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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOve Murberg Henriksen <sorayasilvermoon@hotmail.com>2012-05-07 02:19:13 +0400
committerOve Murberg Henriksen <sorayasilvermoon@hotmail.com>2012-05-07 02:19:13 +0400
commit6c86b70145ee46b647061f4b6455c3e82268df36 (patch)
tree629630f3cc6b6f44ffd5072da5dd81e57fd9861b
parent2ebebc563e2722ee08ffc0fb9204522964538df1 (diff)
parent5fb53b6b301c5ed03cdb3f800bb4af9395369a8f (diff)
svn merge ^/trunk/blender -r46000:46100
some conflicts. had to backup my code, accept with "tc" and introduce my own code again. Hope I didnt leave anything out.
-rw-r--r--CMakeLists.txt2
-rw-r--r--build_files/buildbot/master.cfg2
-rw-r--r--build_files/buildbot/master_unpack.py3
-rw-r--r--build_files/buildbot/slave_compile.py2
-rw-r--r--build_files/buildbot/slave_pack.py2
-rw-r--r--build_files/scons/tools/btools.py8
-rw-r--r--extern/libmv/CMakeLists.txt2
-rw-r--r--extern/libmv/ChangeLog19
-rw-r--r--extern/libmv/files.txt2
-rw-r--r--extern/libmv/libmv-capi.cpp79
-rw-r--r--extern/libmv/libmv-capi.h3
-rw-r--r--intern/audaspace/intern/AUD_C-API.cpp42
-rw-r--r--intern/audaspace/intern/AUD_C-API.h15
-rw-r--r--intern/audaspace/intern/AUD_FileWriter.cpp36
-rw-r--r--intern/audaspace/intern/AUD_FileWriter.h10
-rw-r--r--intern/audaspace/intern/AUD_Reference.h18
-rw-r--r--intern/audaspace/intern/AUD_ReferenceHandler.cpp21
-rw-r--r--intern/container/CTR_Map.h2
-rw-r--r--intern/cycles/blender/addon/properties.py8
-rw-r--r--intern/cycles/blender/addon/ui.py23
-rw-r--r--intern/cycles/blender/blender_session.cpp7
-rw-r--r--intern/cycles/blender/blender_sync.cpp6
-rw-r--r--intern/cycles/blender/blender_sync.h5
-rw-r--r--intern/cycles/bvh/CMakeLists.txt4
-rw-r--r--intern/cycles/bvh/bvh.cpp4
-rw-r--r--intern/cycles/bvh/bvh_build.cpp636
-rw-r--r--intern/cycles/bvh/bvh_build.h110
-rw-r--r--intern/cycles/bvh/bvh_node.cpp22
-rw-r--r--intern/cycles/bvh/bvh_node.h18
-rw-r--r--intern/cycles/bvh/bvh_params.h91
-rw-r--r--intern/cycles/bvh/bvh_sort.cpp16
-rw-r--r--intern/cycles/bvh/bvh_sort.h2
-rw-r--r--intern/cycles/device/device.cpp9
-rw-r--r--intern/cycles/device/device.h4
-rw-r--r--intern/cycles/device/device_cpu.cpp63
-rw-r--r--intern/cycles/device/device_multi.cpp7
-rw-r--r--intern/cycles/kernel/kernel_accumulate.h9
-rw-r--r--intern/cycles/kernel/kernel_path.h33
-rw-r--r--intern/cycles/kernel/kernel_types.h4
-rw-r--r--intern/cycles/kernel/svm/svm_tex_coord.h27
-rw-r--r--intern/cycles/kernel/svm/svm_types.h1
-rw-r--r--intern/cycles/render/integrator.cpp4
-rw-r--r--intern/cycles/render/integrator.h1
-rw-r--r--intern/cycles/render/mesh.cpp7
-rw-r--r--intern/cycles/render/nodes.cpp7
-rw-r--r--intern/cycles/render/object.cpp1
-rw-r--r--intern/cycles/render/session.cpp5
-rw-r--r--intern/cycles/subd/subd_patch.cpp12
-rw-r--r--intern/cycles/util/CMakeLists.txt2
-rw-r--r--intern/cycles/util/util_boundbox.h86
-rw-r--r--intern/cycles/util/util_math.h485
-rw-r--r--intern/cycles/util/util_thread.h127
-rw-r--r--intern/cycles/util/util_transform.cpp23
-rw-r--r--intern/cycles/util/util_types.h268
-rw-r--r--intern/ghost/GHOST_Rect.h4
-rw-r--r--intern/ghost/intern/GHOST_NDOFManager.cpp2
-rw-r--r--intern/guardedalloc/intern/mallocn.c80
-rw-r--r--intern/mikktspace/mikktspace.c406
-rw-r--r--intern/smoke/extern/smoke_API.h7
-rw-r--r--intern/smoke/intern/FLUID_3D.cpp228
-rw-r--r--intern/smoke/intern/FLUID_3D.h17
-rw-r--r--intern/smoke/intern/OBSTACLE.h6
-rw-r--r--intern/smoke/intern/WTURBULENCE.cpp9
-rw-r--r--intern/smoke/intern/smoke_API.cpp53
-rw-r--r--intern/utfconv/utf_winfunc.c12
-rw-r--r--release/plugins/sequence/blur.c50
-rw-r--r--release/plugins/texture/clouds2.c4
-rw-r--r--release/plugins/texture/tiles.c22
-rw-r--r--release/scripts/modules/addon_utils.py7
-rw-r--r--release/scripts/startup/bl_operators/uvcalc_lightmap.py23
-rw-r--r--release/scripts/startup/bl_ui/properties_paint_common.py8
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_common.py28
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_smoke.py9
-rw-r--r--release/scripts/startup/bl_ui/space_clip.py10
-rw-r--r--release/scripts/startup/bl_ui/space_sequencer.py5
-rw-r--r--release/scripts/startup/bl_ui/space_text.py1
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py8
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py1
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py4
-rw-r--r--release/scripts/templates/operator_modal_timer.py2
-rw-r--r--source/blender/avi/AVI_avi.h36
-rw-r--r--source/blender/avi/intern/avi.c46
-rw-r--r--source/blender/avi/intern/avirgb.c4
-rw-r--r--source/blender/avi/intern/codecs.c20
-rw-r--r--source/blender/avi/intern/endian.c6
-rw-r--r--source/blender/avi/intern/options.c2
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c2
-rw-r--r--source/blender/blenfont/intern/blf_lang.c5
-rw-r--r--source/blender/blenkernel/BKE_blender.h4
-rw-r--r--source/blender/blenkernel/BKE_brush.h1
-rw-r--r--source/blender/blenkernel/BKE_cloth.h8
-rw-r--r--source/blender/blenkernel/BKE_curve.h135
-rw-r--r--source/blender/blenkernel/BKE_deform.h4
-rw-r--r--source/blender/blenkernel/BKE_font.h2
-rw-r--r--source/blender/blenkernel/BKE_lattice.h2
-rw-r--r--source/blender/blenkernel/BKE_library.h2
-rw-r--r--source/blender/blenkernel/BKE_mball.h147
-rw-r--r--source/blender/blenkernel/BKE_mesh.h2
-rw-r--r--source/blender/blenkernel/BKE_movieclip.h6
-rw-r--r--source/blender/blenkernel/BKE_node.h2
-rw-r--r--source/blender/blenkernel/BKE_ocean.h4
-rw-r--r--source/blender/blenkernel/BKE_softbody.h6
-rw-r--r--source/blender/blenkernel/BKE_text.h3
-rw-r--r--source/blender/blenkernel/depsgraph_private.h8
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c2
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c49
-rw-r--r--source/blender/blenkernel/intern/action.c20
-rw-r--r--source/blender/blenkernel/intern/anim.c20
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c52
-rw-r--r--source/blender/blenkernel/intern/armature.c97
-rw-r--r--source/blender/blenkernel/intern/blender.c4
-rw-r--r--source/blender/blenkernel/intern/bmfont.c4
-rw-r--r--source/blender/blenkernel/intern/boids.c30
-rw-r--r--source/blender/blenkernel/intern/brush.c10
-rw-r--r--source/blender/blenkernel/intern/bvhutils.c28
-rw-r--r--source/blender/blenkernel/intern/camera.c2
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c96
-rw-r--r--source/blender/blenkernel/intern/cloth.c242
-rw-r--r--source/blender/blenkernel/intern/collision.c343
-rw-r--r--source/blender/blenkernel/intern/colortools.c21
-rw-r--r--source/blender/blenkernel/intern/constraint.c73
-rw-r--r--source/blender/blenkernel/intern/context.c2
-rw-r--r--source/blender/blenkernel/intern/curve.c291
-rw-r--r--source/blender/blenkernel/intern/customdata.c19
-rw-r--r--source/blender/blenkernel/intern/deform.c52
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c208
-rw-r--r--source/blender/blenkernel/intern/displist.c73
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c271
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c18
-rw-r--r--source/blender/blenkernel/intern/effect.c25
-rw-r--r--source/blender/blenkernel/intern/fcurve.c65
-rw-r--r--source/blender/blenkernel/intern/fluidsim.c4
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c19
-rw-r--r--source/blender/blenkernel/intern/font.c50
-rw-r--r--source/blender/blenkernel/intern/gpencil.c16
-rw-r--r--source/blender/blenkernel/intern/group.c2
-rw-r--r--source/blender/blenkernel/intern/idcode.c2
-rw-r--r--source/blender/blenkernel/intern/idprop.c3
-rw-r--r--source/blender/blenkernel/intern/image.c73
-rw-r--r--source/blender/blenkernel/intern/image_gen.c12
-rw-r--r--source/blender/blenkernel/intern/implicit.c347
-rw-r--r--source/blender/blenkernel/intern/ipo.c4
-rw-r--r--source/blender/blenkernel/intern/key.c8
-rw-r--r--source/blender/blenkernel/intern/lattice.c22
-rw-r--r--source/blender/blenkernel/intern/library.c33
-rw-r--r--source/blender/blenkernel/intern/material.c104
-rw-r--r--source/blender/blenkernel/intern/mball.c265
-rw-r--r--source/blender/blenkernel/intern/mesh.c61
-rw-r--r--source/blender/blenkernel/intern/modifier.c2
-rw-r--r--source/blender/blenkernel/intern/modifiers_bmesh.c4
-rw-r--r--source/blender/blenkernel/intern/movieclip.c14
-rw-r--r--source/blender/blenkernel/intern/multires.c16
-rw-r--r--source/blender/blenkernel/intern/navmesh_conversion.c123
-rw-r--r--source/blender/blenkernel/intern/nla.c78
-rw-r--r--source/blender/blenkernel/intern/node.c4
-rw-r--r--source/blender/blenkernel/intern/object.c84
-rw-r--r--source/blender/blenkernel/intern/ocean.c263
-rw-r--r--source/blender/blenkernel/intern/packedFile.c4
-rw-r--r--source/blender/blenkernel/intern/paint.c2
-rw-r--r--source/blender/blenkernel/intern/particle.c338
-rw-r--r--source/blender/blenkernel/intern/particle_system.c248
-rw-r--r--source/blender/blenkernel/intern/pointcache.c70
-rw-r--r--source/blender/blenkernel/intern/property.c10
-rw-r--r--source/blender/blenkernel/intern/report.c2
-rw-r--r--source/blender/blenkernel/intern/sca.c10
-rw-r--r--source/blender/blenkernel/intern/scene.c4
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c146
-rw-r--r--source/blender/blenkernel/intern/sequencer.c35
-rw-r--r--source/blender/blenkernel/intern/shrinkwrap.c87
-rw-r--r--source/blender/blenkernel/intern/sketch.c129
-rw-r--r--source/blender/blenkernel/intern/smoke.c1542
-rw-r--r--source/blender/blenkernel/intern/softbody.c1223
-rw-r--r--source/blender/blenkernel/intern/sound.c104
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c12
-rw-r--r--source/blender/blenkernel/intern/text.c158
-rw-r--r--source/blender/blenkernel/intern/texture.c12
-rw-r--r--source/blender/blenkernel/intern/tracking.c33
-rw-r--r--source/blender/blenkernel/intern/unit.c2
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c30
-rw-r--r--source/blender/blenkernel/intern/writeframeserver.c2
-rw-r--r--source/blender/blenlib/BLI_array.h14
-rw-r--r--source/blender/blenlib/BLI_editVert.h191
-rw-r--r--source/blender/blenlib/BLI_fileops_types.h2
-rw-r--r--source/blender/blenlib/BLI_ghash.h5
-rw-r--r--source/blender/blenlib/BLI_math_geom.h8
-rw-r--r--source/blender/blenlib/BLI_math_vector.h3
-rw-r--r--source/blender/blenlib/BLI_path_util.h2
-rw-r--r--source/blender/blenlib/BLI_utildefines.h40
-rw-r--r--source/blender/blenlib/CMakeLists.txt7
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c321
-rw-r--r--source/blender/blenlib/intern/BLI_kdtree.c24
-rw-r--r--source/blender/blenlib/intern/DLRB_tree.c14
-rw-r--r--source/blender/blenlib/intern/bpath.c4
-rw-r--r--source/blender/blenlib/intern/dynlib.c2
-rw-r--r--source/blender/blenlib/intern/fileops.c10
-rw-r--r--source/blender/blenlib/intern/freetypefont.c47
-rw-r--r--source/blender/blenlib/intern/graph.c399
-rw-r--r--source/blender/blenlib/intern/jitter.c6
-rw-r--r--source/blender/blenlib/intern/listbase.c12
-rw-r--r--source/blender/blenlib/intern/math_matrix.c4
-rw-r--r--source/blender/blenlib/intern/math_rotation.c20
-rw-r--r--source/blender/blenlib/intern/math_vector.c19
-rw-r--r--source/blender/blenlib/intern/noise.c2
-rw-r--r--source/blender/blenlib/intern/path_util.c22
-rw-r--r--source/blender/blenlib/intern/pbvh.c10
-rw-r--r--source/blender/blenlib/intern/storage.c40
-rw-r--r--source/blender/blenlib/intern/string.c6
-rw-r--r--source/blender/blenlib/intern/string_utf8.c34
-rw-r--r--source/blender/blenlib/intern/threads.c2
-rw-r--r--source/blender/blenlib/intern/winstuff.c44
-rw-r--r--source/blender/blenloader/intern/readblenentry.c3
-rw-r--r--source/blender/blenloader/intern/readfile.c262
-rw-r--r--source/blender/blenloader/intern/writefile.c38
-rw-r--r--source/blender/blenpluginapi/iff.h10
-rw-r--r--source/blender/blenpluginapi/intern/pluginapi.c62
-rw-r--r--source/blender/bmesh/CMakeLists.txt2
-rw-r--r--source/blender/bmesh/intern/bmesh_construct.c4
-rw-r--r--source/blender/bmesh/intern/bmesh_core.c27
-rw-r--r--source/blender/bmesh/intern/bmesh_error.h1
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators.c44
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_conv.c4
-rw-r--r--source/blender/bmesh/intern/bmesh_mods.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_opdefines.c51
-rw-r--r--source/blender/bmesh/intern/bmesh_operators_private.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.c22
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.h1
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers.c3
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers_impl.c4
-rw-r--r--source/blender/bmesh/operators/bmo_bevel.c12
-rw-r--r--source/blender/bmesh/operators/bmo_connect.c12
-rw-r--r--source/blender/bmesh/operators/bmo_create.c12
-rw-r--r--source/blender/bmesh/operators/bmo_dupe.c4
-rw-r--r--source/blender/bmesh/operators/bmo_extrude.c6
-rw-r--r--source/blender/bmesh/operators/bmo_inset.c19
-rw-r--r--source/blender/bmesh/operators/bmo_join_triangles.c2
-rw-r--r--source/blender/bmesh/operators/bmo_mirror.c2
-rw-r--r--source/blender/bmesh/operators/bmo_removedoubles.c10
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide.c18
-rw-r--r--source/blender/bmesh/operators/bmo_triangulate.c4
-rw-r--r--source/blender/bmesh/operators/bmo_utils.c10
-rw-r--r--source/blender/collada/AnimationExporter.cpp144
-rw-r--r--source/blender/collada/AnimationExporter.h10
-rw-r--r--source/blender/collada/AnimationImporter.cpp122
-rw-r--r--source/blender/collada/AnimationImporter.h40
-rw-r--r--source/blender/collada/ArmatureExporter.cpp40
-rw-r--r--source/blender/collada/ArmatureImporter.cpp29
-rw-r--r--source/blender/collada/ArmatureImporter.h2
-rw-r--r--source/blender/collada/CameraExporter.cpp25
-rw-r--r--source/blender/collada/DocumentExporter.cpp2
-rw-r--r--source/blender/collada/DocumentImporter.cpp23
-rw-r--r--source/blender/collada/EffectExporter.cpp37
-rw-r--r--source/blender/collada/ErrorHandler.cpp22
-rw-r--r--source/blender/collada/ErrorHandler.h2
-rw-r--r--source/blender/collada/ExtraHandler.h2
-rw-r--r--source/blender/collada/ExtraTags.h2
-rw-r--r--source/blender/collada/GeometryExporter.cpp6
-rw-r--r--source/blender/collada/GeometryExporter.h9
-rw-r--r--source/blender/collada/ImageExporter.cpp5
-rw-r--r--source/blender/collada/LightExporter.cpp21
-rw-r--r--source/blender/collada/MaterialExporter.cpp5
-rw-r--r--source/blender/collada/MaterialExporter.h2
-rw-r--r--source/blender/collada/MeshImporter.cpp8
-rw-r--r--source/blender/collada/SceneExporter.cpp11
-rw-r--r--source/blender/collada/TransformReader.cpp2
-rw-r--r--source/blender/collada/TransformWriter.cpp13
-rw-r--r--source/blender/collada/collada_internal.cpp39
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c52
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c8
-rw-r--r--source/blender/editors/animation/anim_deps.c2
-rw-r--r--source/blender/editors/animation/anim_draw.c12
-rw-r--r--source/blender/editors/animation/anim_filter.c59
-rw-r--r--source/blender/editors/animation/anim_ipo_utils.c2
-rw-r--r--source/blender/editors/animation/anim_markers.c10
-rw-r--r--source/blender/editors/animation/drivers.c22
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c8
-rw-r--r--source/blender/editors/animation/keyframes_draw.c8
-rw-r--r--source/blender/editors/animation/keyframes_general.c12
-rw-r--r--source/blender/editors/animation/keyframing.c31
-rw-r--r--source/blender/editors/animation/keyingsets.c30
-rw-r--r--source/blender/editors/armature/armature_intern.h1
-rw-r--r--source/blender/editors/armature/armature_ops.c3
-rw-r--r--source/blender/editors/armature/editarmature.c269
-rw-r--r--source/blender/editors/armature/editarmature_generate.c48
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c836
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c750
-rw-r--r--source/blender/editors/armature/meshlaplacian.c18
-rw-r--r--source/blender/editors/armature/poseSlide.c10
-rw-r--r--source/blender/editors/armature/poseUtils.c16
-rw-r--r--source/blender/editors/armature/poselib.c24
-rw-r--r--source/blender/editors/armature/poseobject.c117
-rw-r--r--source/blender/editors/armature/reeb.c822
-rw-r--r--source/blender/editors/curve/editcurve.c290
-rw-r--r--source/blender/editors/curve/editfont.c29
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c6
-rw-r--r--source/blender/editors/gpencil/editaction_gpencil.c28
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c12
-rw-r--r--source/blender/editors/gpencil/gpencil_ops.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c4
-rw-r--r--source/blender/editors/include/ED_anim_api.h2
-rw-r--r--source/blender/editors/include/ED_clip.h5
-rw-r--r--source/blender/editors/include/ED_curve.h2
-rw-r--r--source/blender/editors/include/ED_mesh.h8
-rw-r--r--source/blender/editors/include/ED_screen.h1
-rw-r--r--source/blender/editors/include/ED_uvedit.h5
-rw-r--r--source/blender/editors/include/ED_view3d.h2
-rw-r--r--source/blender/editors/interface/interface.c2
-rw-r--r--source/blender/editors/interface/interface_handlers.c10
-rw-r--r--source/blender/editors/interface/interface_layout.c18
-rw-r--r--source/blender/editors/interface/interface_templates.c8
-rw-r--r--source/blender/editors/interface/interface_utils.c2
-rw-r--r--source/blender/editors/interface/interface_widgets.c12
-rw-r--r--source/blender/editors/interface/resources.c3
-rw-r--r--source/blender/editors/mesh/editface.c8
-rw-r--r--source/blender/editors/mesh/editmesh_bvh.c18
-rw-r--r--source/blender/editors/mesh/editmesh_bvh.h5
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c2
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c4
-rw-r--r--source/blender/editors/mesh/editmesh_rip.c13
-rw-r--r--source/blender/editors/mesh/editmesh_select.c6
-rw-r--r--source/blender/editors/mesh/editmesh_slide.c17
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c204
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c2
-rw-r--r--source/blender/editors/mesh/mesh_intern.h5
-rw-r--r--source/blender/editors/mesh/mesh_navmesh.c2
-rw-r--r--source/blender/editors/mesh/mesh_ops.c3
-rw-r--r--source/blender/editors/mesh/meshtools.c36
-rw-r--r--source/blender/editors/metaball/mball_edit.c4
-rw-r--r--source/blender/editors/object/object_add.c685
-rw-r--r--source/blender/editors/object/object_bake.c826
-rw-r--r--source/blender/editors/object/object_constraint.c465
-rw-r--r--source/blender/editors/object/object_edit.c730
-rw-r--r--source/blender/editors/object/object_group.c90
-rw-r--r--source/blender/editors/object/object_hook.c321
-rw-r--r--source/blender/editors/object/object_intern.h2
-rw-r--r--source/blender/editors/object/object_lattice.c198
-rw-r--r--source/blender/editors/object/object_modifier.c427
-rw-r--r--source/blender/editors/object/object_ops.c42
-rw-r--r--source/blender/editors/object/object_relations.c839
-rw-r--r--source/blender/editors/object/object_select.c321
-rw-r--r--source/blender/editors/object/object_shapekey.c170
-rw-r--r--source/blender/editors/object/object_transform.c287
-rw-r--r--source/blender/editors/object/object_vgroup.c907
-rw-r--r--source/blender/editors/physics/dynamicpaint_ops.c3
-rw-r--r--source/blender/editors/physics/particle_edit.c238
-rw-r--r--source/blender/editors/physics/particle_object.c34
-rw-r--r--source/blender/editors/physics/physics_fluid.c73
-rw-r--r--source/blender/editors/render/render_opengl.c4
-rw-r--r--source/blender/editors/render/render_shading.c6
-rw-r--r--source/blender/editors/screen/area.c120
-rw-r--r--source/blender/editors/screen/glutil.c65
-rw-r--r--source/blender/editors/screen/screen_edit.c4
-rw-r--r--source/blender/editors/screen/screen_ops.c16
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c3
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c11
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c2
-rw-r--r--source/blender/editors/sound/sound_ops.c19
-rw-r--r--source/blender/editors/space_action/action_edit.c38
-rw-r--r--source/blender/editors/space_action/action_select.c14
-rw-r--r--source/blender/editors/space_action/space_action.c14
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c2
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c4
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c12
-rw-r--r--source/blender/editors/space_clip/clip_buttons.c6
-rw-r--r--source/blender/editors/space_clip/clip_draw.c5
-rw-r--r--source/blender/editors/space_clip/clip_editor.c57
-rw-r--r--source/blender/editors/space_clip/clip_graph_draw.c58
-rw-r--r--source/blender/editors/space_clip/clip_graph_ops.c10
-rw-r--r--source/blender/editors/space_clip/clip_intern.h5
-rw-r--r--source/blender/editors/space_clip/clip_ops.c6
-rw-r--r--source/blender/editors/space_clip/clip_toolbar.c8
-rw-r--r--source/blender/editors/space_clip/clip_utils.c60
-rw-r--r--source/blender/editors/space_clip/space_clip.c221
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c82
-rw-r--r--source/blender/editors/space_file/file_draw.c22
-rw-r--r--source/blender/editors/space_file/file_intern.h2
-rw-r--r--source/blender/editors/space_file/file_ops.c13
-rw-r--r--source/blender/editors/space_file/file_panels.c2
-rw-r--r--source/blender/editors/space_file/filelist.c22
-rw-r--r--source/blender/editors/space_file/filesel.c3
-rw-r--r--source/blender/editors/space_file/fsmenu.c25
-rw-r--r--source/blender/editors/space_file/space_file.c20
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c2
-rw-r--r--source/blender/editors/space_graph/graph_draw.c10
-rw-r--r--source/blender/editors/space_graph/graph_edit.c52
-rw-r--r--source/blender/editors/space_graph/graph_select.c14
-rw-r--r--source/blender/editors/space_graph/graph_utils.c8
-rw-r--r--source/blender/editors/space_graph/space_graph.c101
-rw-r--r--source/blender/editors/space_image/image_draw.c61
-rw-r--r--source/blender/editors/space_image/image_ops.c7
-rw-r--r--source/blender/editors/space_image/space_image.c2
-rw-r--r--source/blender/editors/space_info/info_stats.c2
-rw-r--r--source/blender/editors/space_logic/logic_buttons.c5
-rw-r--r--source/blender/editors/space_logic/logic_ops.c2
-rw-r--r--source/blender/editors/space_logic/logic_window.c254
-rw-r--r--source/blender/editors/space_logic/space_logic.c4
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c2
-rw-r--r--source/blender/editors/space_nla/nla_channels.c8
-rw-r--r--source/blender/editors/space_nla/nla_draw.c4
-rw-r--r--source/blender/editors/space_nla/nla_edit.c50
-rw-r--r--source/blender/editors/space_nla/nla_ops.c6
-rw-r--r--source/blender/editors/space_nla/nla_select.c10
-rw-r--r--source/blender/editors/space_nla/space_nla.c20
-rw-r--r--source/blender/editors/space_node/drawnode.c68
-rw-r--r--source/blender/editors/space_node/node_draw.c32
-rw-r--r--source/blender/editors/space_node/node_edit.c6
-rw-r--r--source/blender/editors/space_node/node_select.c2
-rw-r--r--source/blender/editors/space_node/node_templates.c13
-rw-r--r--source/blender/editors/space_node/space_node.c6
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c52
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c8
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c6
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c16
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c18
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c16
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c7
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c14
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c21
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c24
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c1
-rw-r--r--source/blender/editors/space_text/space_text.c4
-rw-r--r--source/blender/editors/space_text/text_draw.c3
-rw-r--r--source/blender/editors/space_text/text_intern.h1
-rw-r--r--source/blender/editors/space_text/text_ops.c30
-rw-r--r--source/blender/editors/space_text/text_python.c14
-rw-r--r--source/blender/editors/space_time/space_time.c11
-rw-r--r--source/blender/editors/space_userpref/space_userpref.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c19
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c1
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c9
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c206
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c14
-rw-r--r--source/blender/editors/transform/transform.c343
-rw-r--r--source/blender/editors/transform/transform.h2
-rw-r--r--source/blender/editors/transform/transform_constraints.c13
-rw-r--r--source/blender/editors/transform/transform_conversions.c296
-rw-r--r--source/blender/editors/transform/transform_generics.c136
-rw-r--r--source/blender/editors/transform/transform_input.c6
-rw-r--r--source/blender/editors/transform/transform_manipulator.c26
-rw-r--r--source/blender/editors/transform/transform_ops.c55
-rw-r--r--source/blender/editors/transform/transform_orientations.c20
-rw-r--r--source/blender/editors/transform/transform_snap.c266
-rw-r--r--source/blender/editors/util/crazyspace.c69
-rw-r--r--source/blender/editors/util/numinput.c3
-rw-r--r--source/blender/editors/util/undo.c15
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c34
-rw-r--r--source/blender/editors/uvedit/uvedit_intern.h18
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c302
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c2
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c44
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c8
-rw-r--r--source/blender/gpu/intern/gpu_draw.c8
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c18
-rw-r--r--source/blender/gpu/intern/gpu_material.c103
-rw-r--r--source/blender/gpu/intern/gpu_shader_material.glsl5
-rw-r--r--source/blender/gpu/intern/gpu_shader_material.glsl.c2913
-rw-r--r--source/blender/ikplugin/intern/iksolver_plugin.c6
-rw-r--r--source/blender/ikplugin/intern/itasc_plugin.cpp86
-rw-r--r--source/blender/imbuf/intern/anim_movie.c18
-rw-r--r--source/blender/imbuf/intern/bmp.c60
-rw-r--r--source/blender/imbuf/intern/dds/ColorBlock.cpp24
-rw-r--r--source/blender/imbuf/intern/dds/DirectDrawSurface.cpp8
-rw-r--r--source/blender/imbuf/intern/dds/PixelFormat.h16
-rw-r--r--source/blender/imbuf/intern/filter.c44
-rw-r--r--source/blender/imbuf/intern/imageprocess.c16
-rw-r--r--source/blender/imbuf/intern/indexer.c6
-rw-r--r--source/blender/imbuf/intern/indexer_dv.c4
-rw-r--r--source/blender/imbuf/intern/iris.c64
-rw-r--r--source/blender/imbuf/intern/jp2.c26
-rw-r--r--source/blender/imbuf/intern/jpeg.c10
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp49
-rw-r--r--source/blender/imbuf/intern/png.c12
-rw-r--r--source/blender/imbuf/intern/radiance_hdr.c7
-rw-r--r--source/blender/imbuf/intern/readimage.c2
-rw-r--r--source/blender/imbuf/intern/rectop.c8
-rw-r--r--source/blender/imbuf/intern/scaling.c90
-rw-r--r--source/blender/imbuf/intern/targa.c68
-rw-r--r--source/blender/imbuf/intern/thumbs.c20
-rw-r--r--source/blender/imbuf/intern/util.c15
-rw-r--r--source/blender/makesdna/DNA_brush_types.h3
-rw-r--r--source/blender/makesdna/DNA_listBase.h2
-rw-r--r--source/blender/makesdna/DNA_meshdata_types.h2
-rw-r--r--source/blender/makesdna/DNA_node_types.h4
-rw-r--r--source/blender/makesdna/DNA_object_fluidsim.h12
-rw-r--r--source/blender/makesdna/DNA_object_force.h2
-rw-r--r--source/blender/makesdna/DNA_object_types.h8
-rw-r--r--source/blender/makesdna/DNA_scene_types.h18
-rw-r--r--source/blender/makesdna/DNA_sequence_types.h2
-rw-r--r--source/blender/makesdna/DNA_smoke_types.h12
-rw-r--r--source/blender/makesdna/DNA_space_types.h1
-rw-r--r--source/blender/makesdna/DNA_tracking_types.h11
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h6
-rw-r--r--source/blender/makesdna/intern/dna_genfile.c14
-rw-r--r--source/blender/makesdna/intern/makesdna.c17
-rw-r--r--source/blender/makesrna/intern/makesrna.c8
-rw-r--r--source/blender/makesrna/intern/rna_access.c15
-rw-r--r--source/blender/makesrna/intern/rna_action.c8
-rw-r--r--source/blender/makesrna/intern/rna_actuator.c18
-rw-r--r--source/blender/makesrna/intern/rna_boid.c2
-rw-r--r--source/blender/makesrna/intern/rna_brush.c13
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c4
-rw-r--r--source/blender/makesrna/intern/rna_curve.c62
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c6
-rw-r--r--source/blender/makesrna/intern/rna_fluidsim.c2
-rw-r--r--source/blender/makesrna/intern/rna_image.c18
-rw-r--r--source/blender/makesrna/intern/rna_lamp.c6
-rw-r--r--source/blender/makesrna/intern/rna_main.c5
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c10
-rw-r--r--source/blender/makesrna/intern/rna_material.c6
-rw-r--r--source/blender/makesrna/intern/rna_meta.c4
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c4
-rw-r--r--source/blender/makesrna/intern/rna_movieclip.c6
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c57
-rw-r--r--source/blender/makesrna/intern/rna_object.c8
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c14
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c4
-rw-r--r--source/blender/makesrna/intern/rna_particle.c2
-rw-r--r--source/blender/makesrna/intern/rna_pose.c28
-rw-r--r--source/blender/makesrna/intern/rna_property.c6
-rw-r--r--source/blender/makesrna/intern/rna_scene.c33
-rw-r--r--source/blender/makesrna/intern/rna_sensor.c2
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c28
-rw-r--r--source/blender/makesrna/intern/rna_smoke.c14
-rw-r--r--source/blender/makesrna/intern/rna_space.c8
-rw-r--r--source/blender/makesrna/intern/rna_texture.c22
-rw-r--r--source/blender/makesrna/intern/rna_texture_api.c6
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c6
-rw-r--r--source/blender/makesrna/intern/rna_ui.c2
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c28
-rw-r--r--source/blender/makesrna/intern/rna_wm.c12
-rw-r--r--source/blender/modifiers/intern/MOD_boolean.c2
-rw-r--r--source/blender/modifiers/intern/MOD_boolean_util.c12
-rw-r--r--source/blender/modifiers/intern/MOD_cast.c14
-rw-r--r--source/blender/modifiers/intern/MOD_collision.c24
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c2
-rw-r--r--source/blender/modifiers/intern/MOD_explode.c77
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim_util.c54
-rw-r--r--source/blender/modifiers/intern/MOD_hook.c2
-rw-r--r--source/blender/modifiers/intern/MOD_mask.c43
-rw-r--r--source/blender/modifiers/intern/MOD_particleinstance.c16
-rw-r--r--source/blender/modifiers/intern/MOD_remesh.c6
-rw-r--r--source/blender/modifiers/intern/MOD_screw.c2
-rw-r--r--source/blender/modifiers/intern/MOD_simpledeform.c9
-rw-r--r--source/blender/modifiers/intern/MOD_util.c4
-rw-r--r--source/blender/modifiers/intern/MOD_uvproject.c4
-rw-r--r--source/blender/modifiers/intern/MOD_warp.c8
-rw-r--r--source/blender/modifiers/intern/MOD_wave.c4
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.c6
-rw-r--r--source/blender/nodes/composite/node_composite_util.c29
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bilateralblur.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_channelMatte.c28
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_chromaMatte.c118
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorMatte.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorSpill.c20
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorbalance.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_diffMatte.c97
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_directionalblur.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_distanceMatte.c161
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c30
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_filter.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_gamma.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_glare.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_hueSatVal.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_image.c7
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_levels.c34
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_lummaMatte.c10
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_math.c3
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_movieclip.c62
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_moviedistortion.c50
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_rotate.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c24
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_stabilize2d.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_texture.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_tonemap.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_transform.c38
-rw-r--r--source/blender/nodes/intern/node_common.c2
-rw-r--r--source/blender/nodes/intern/node_socket.c14
-rw-r--r--source/blender/nodes/shader/node_shader_util.c6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_math.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_coord.c3
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_texture.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vectMath.c6
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_bricks.c15
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_image.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_math.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_mixRgb.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_output.c14
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_texture.c8
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.c1
-rw-r--r--source/blender/python/intern/bpy_rna.c24
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c2
-rw-r--r--source/blender/quicktime/apple/quicktime_export.c50
-rw-r--r--source/blender/quicktime/apple/quicktime_import.c56
-rw-r--r--source/blender/render/extern/include/RE_pipeline.h2
-rw-r--r--source/blender/render/intern/include/render_types.h4
-rw-r--r--source/blender/render/intern/include/sunsky.h2
-rw-r--r--source/blender/render/intern/raytrace/bvh.h165
-rw-r--r--source/blender/render/intern/raytrace/rayobject.cpp78
-rw-r--r--source/blender/render/intern/raytrace/rayobject_blibvh.cpp7
-rw-r--r--source/blender/render/intern/raytrace/rayobject_hint.h2
-rw-r--r--source/blender/render/intern/raytrace/rayobject_instance.cpp18
-rw-r--r--source/blender/render/intern/raytrace/rayobject_octree.cpp176
-rw-r--r--source/blender/render/intern/raytrace/rayobject_qbvh.cpp21
-rw-r--r--source/blender/render/intern/raytrace/rayobject_rtbuild.cpp75
-rw-r--r--source/blender/render/intern/raytrace/rayobject_svbvh.cpp34
-rw-r--r--source/blender/render/intern/raytrace/rayobject_vbvh.cpp32
-rw-r--r--source/blender/render/intern/raytrace/reorganize.h202
-rw-r--r--source/blender/render/intern/raytrace/svbvh.h89
-rw-r--r--source/blender/render/intern/raytrace/vbvh.h37
-rw-r--r--source/blender/render/intern/source/convertblender.c199
-rw-r--r--source/blender/render/intern/source/envmap.c6
-rw-r--r--source/blender/render/intern/source/imagetexture.c8
-rw-r--r--source/blender/render/intern/source/initrender.c4
-rw-r--r--source/blender/render/intern/source/occlusion.c4
-rw-r--r--source/blender/render/intern/source/pipeline.c18
-rw-r--r--source/blender/render/intern/source/pixelshading.c4
-rw-r--r--source/blender/render/intern/source/pointdensity.c4
-rw-r--r--source/blender/render/intern/source/rayshade.c148
-rw-r--r--source/blender/render/intern/source/render_result.c1
-rw-r--r--source/blender/render/intern/source/render_texture.c52
-rw-r--r--source/blender/render/intern/source/rendercore.c8
-rw-r--r--source/blender/render/intern/source/renderdatabase.c54
-rw-r--r--source/blender/render/intern/source/shadbuf.c36
-rw-r--r--source/blender/render/intern/source/shadeoutput.c21
-rw-r--r--source/blender/render/intern/source/sss.c2
-rw-r--r--source/blender/render/intern/source/strand.c2
-rw-r--r--source/blender/render/intern/source/sunsky.c24
-rw-r--r--source/blender/render/intern/source/volume_precache.c51
-rw-r--r--source/blender/render/intern/source/volumetric.c15
-rw-r--r--source/blender/render/intern/source/voxeldata.c25
-rw-r--r--source/blender/render/intern/source/zbuf.c78
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c7
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c2
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c2
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c24
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c28
-rw-r--r--source/gameengine/BlenderRoutines/CMakeLists.txt2
-rw-r--r--source/gameengine/BlenderRoutines/SConscript3
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp4
-rw-r--r--source/gameengine/Converter/CMakeLists.txt1
-rw-r--r--source/gameengine/Converter/SConscript3
-rw-r--r--source/gameengine/Ketsji/BL_Shader.h44
-rw-r--r--source/gameengine/Ketsji/CMakeLists.txt1
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.h10
-rw-r--r--source/gameengine/Ketsji/KX_BulletPhysicsController.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_FontObject.h8
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp22
-rw-r--r--source/gameengine/Ketsji/KX_PyMath.h2
-rw-r--r--source/gameengine/Ketsji/SConscript3
-rw-r--r--source/gameengine/Rasterizer/RAS_ICanvas.h10
-rw-r--r--source/gameengine/VideoTexture/ImageRender.cpp4
660 files changed, 18101 insertions, 18261 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6a9ca35cd05..16de9a4055e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -827,7 +827,7 @@ elseif(WIN32)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /MT /Zi" CACHE STRING "MSVC MT flags " FORCE)
# most msvc warnings are C & C++
- set(_WARNINGS "/W3 /wd4018 /wd4244 /wd4305 /wd4800 /wd4181 /wd4065 /wd4267 /we4013")
+ set(_WARNINGS "/W3 /wd4018 /wd4244 /wd4305 /wd4800 /wd4181 /wd4065 /wd4267 /we4013 /wd4200")
set(C_WARNINGS "${_WARNINGS}")
set(CXX_WARNINGS "${_WARNINGS}")
unset(_WARNINGS)
diff --git a/build_files/buildbot/master.cfg b/build_files/buildbot/master.cfg
index 23751f7dcd4..066c133d335 100644
--- a/build_files/buildbot/master.cfg
+++ b/build_files/buildbot/master.cfg
@@ -117,6 +117,8 @@ add_builder(c, 'salad_linux_x86_64_scons', '', generic_builder, 'soc-2011-salad'
add_builder(c, 'win32_scons', 'windows', generic_builder)
add_builder(c, 'salad_win32_scons', 'windows', generic_builder, 'soc-2011-salad')
add_builder(c, 'win64_scons', 'win64', generic_builder)
+add_builder(c, 'mingw_win64_scons', 'mingw64', generic_builder)
+add_builder(c, 'mingw_win32_scons', 'mingw32', generic_builder)
#add_builder(c, 'freebsd_i386_cmake', '', generic_builder)
#add_builder(c, 'freebsd_x86_64_cmake', '', generic_builder)
diff --git a/build_files/buildbot/master_unpack.py b/build_files/buildbot/master_unpack.py
index 3df22ad8745..f67bd294496 100644
--- a/build_files/buildbot/master_unpack.py
+++ b/build_files/buildbot/master_unpack.py
@@ -48,7 +48,8 @@ def get_platform(filename):
tokens = filename.split("-")
platforms = ('osx', 'mac', 'bsd',
'win', 'linux', 'source',
- 'solaris')
+ 'solaris',
+ 'mingw')
platform_tokens = []
found = False
diff --git a/build_files/buildbot/slave_compile.py b/build_files/buildbot/slave_compile.py
index 209253296be..eafdf0868cd 100644
--- a/build_files/buildbot/slave_compile.py
+++ b/build_files/buildbot/slave_compile.py
@@ -117,6 +117,8 @@ else:
scons_options.append('BF_BITNESS=' + bitness)
scons_options.append('WITH_BF_CYCLES_CUDA_BINARIES=True')
scons_options.append('BF_CYCLES_CUDA_NVCC=nvcc.exe')
+ if builder.find('mingw') != -1:
+ scons_options.append('BF_TOOLSET=mingw')
retcode = subprocess.call(['python', 'scons/scons.py'] + scons_options)
sys.exit(retcode)
diff --git a/build_files/buildbot/slave_pack.py b/build_files/buildbot/slave_pack.py
index cb02e619c1d..73c633d0c29 100644
--- a/build_files/buildbot/slave_pack.py
+++ b/build_files/buildbot/slave_pack.py
@@ -81,6 +81,8 @@ if builder.find('scons') != -1:
scons_options.append('BF_BITNESS=' + bitness)
scons_options.append('WITH_BF_CYCLES_CUDA_BINARIES=True')
scons_options.append('BF_CYCLES_CUDA_NVCC=nvcc.exe')
+ if builder.find('mingw') != -1:
+ scons_options.append('BF_TOOLSET=mingw')
retcode = subprocess.call(['python', 'scons/scons.py'] + scons_options)
sys.exit(retcode)
diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py
index efc80fcd3c5..65593d559ed 100644
--- a/build_files/scons/tools/btools.py
+++ b/build_files/scons/tools/btools.py
@@ -622,7 +622,13 @@ def buildslave(target=None, source=None, env=None):
else:
extension = '.tar.bz2'
- platform = env['OURPLATFORM'].split('-')[0]
+ if env['OURPLATFORM'] == 'win32-mingw':
+ platform = 'mingw32'
+ elif env['OURPLATFORM'] == 'win64-mingw':
+ platform = 'mingw64'
+ else:
+ platform = env['OURPLATFORM'].split('-')[0]
+
if platform == 'linux':
import platform
diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt
index 02723b64b62..6be813883ec 100644
--- a/extern/libmv/CMakeLists.txt
+++ b/extern/libmv/CMakeLists.txt
@@ -69,6 +69,7 @@ set(SRC
libmv/simple_pipeline/detect.cc
libmv/simple_pipeline/initialize_reconstruction.cc
libmv/simple_pipeline/intersect.cc
+ libmv/simple_pipeline/modal_solver.cc
libmv/simple_pipeline/pipeline.cc
libmv/simple_pipeline/reconstruction.cc
libmv/simple_pipeline/resect.cc
@@ -126,6 +127,7 @@ set(SRC
libmv/simple_pipeline/detect.h
libmv/simple_pipeline/initialize_reconstruction.h
libmv/simple_pipeline/intersect.h
+ libmv/simple_pipeline/modal_solver.h
libmv/simple_pipeline/pipeline.h
libmv/simple_pipeline/reconstruction.h
libmv/simple_pipeline/resect.h
diff --git a/extern/libmv/ChangeLog b/extern/libmv/ChangeLog
index 33068bddf90..7248e4c9cd9 100644
--- a/extern/libmv/ChangeLog
+++ b/extern/libmv/ChangeLog
@@ -1,3 +1,16 @@
+commit a44312a7beb2963b8e3bf8015c516d2eff40cc3d
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date: Thu Apr 12 13:56:02 2012 +0600
+
+ Added solver for modal camera motion, currently supports only tripod solving
+
+ This solver is intended to deal with such camera motions as tripod and panning,
+ where it's impossible to reconstruct exact position of markers in 3d view.
+
+ It projects markers onto sphere and uses rigid registration of rotation to
+ find rotation angles which makes bundles from previous and current frame be
+ as closest as it's possible.
+
commit fa3842e472e3b9c789e47bf6d8f592aa40a84f16
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Thu Apr 12 12:32:48 2012 +0600
@@ -520,9 +533,3 @@ Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
Date: Fri Aug 19 16:04:37 2011 +0200
MSVC compatibility: heap allocate pattern, explicit float cast.
-
-commit 702658d2f8616964a6eeb3743fd85e97ac7ff09d
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date: Fri Aug 19 14:59:24 2011 +0200
-
- Expose regularization parameters (areaPenalty and conditionPenalty) in API.
diff --git a/extern/libmv/files.txt b/extern/libmv/files.txt
index 1e564d3a2f2..85d09ce05b8 100644
--- a/extern/libmv/files.txt
+++ b/extern/libmv/files.txt
@@ -42,6 +42,8 @@ libmv/simple_pipeline/initialize_reconstruction.cc
libmv/simple_pipeline/initialize_reconstruction.h
libmv/simple_pipeline/intersect.cc
libmv/simple_pipeline/intersect.h
+libmv/simple_pipeline/modal_solver.cc
+libmv/simple_pipeline/modal_solver.h
libmv/simple_pipeline/pipeline.cc
libmv/simple_pipeline/pipeline.h
libmv/simple_pipeline/reconstruction.cc
diff --git a/extern/libmv/libmv-capi.cpp b/extern/libmv/libmv-capi.cpp
index e4708e5907d..6c20d76eeac 100644
--- a/extern/libmv/libmv-capi.cpp
+++ b/extern/libmv/libmv-capi.cpp
@@ -54,6 +54,7 @@
#include "libmv/simple_pipeline/pipeline.h"
#include "libmv/simple_pipeline/camera_intrinsics.h"
#include "libmv/simple_pipeline/rigid_registration.h"
+#include "libmv/simple_pipeline/modal_solver.h"
#include <stdlib.h>
#include <assert.h>
@@ -384,6 +385,31 @@ int libmv_refineParametersAreValid(int parameters) {
LIBMV_REFINE_RADIAL_DISTORTION_K1));
}
+void libmv_solveRefineIntrinsics(libmv::Tracks *tracks, libmv::CameraIntrinsics *intrinsics,
+ libmv::EuclideanReconstruction *reconstruction, int refine_intrinsics,
+ reconstruct_progress_update_cb progress_update_callback, void *callback_customdata)
+{
+ /* only a few combinations are supported but trust the caller */
+ int libmv_refine_flags = 0;
+
+ if (refine_intrinsics & LIBMV_REFINE_FOCAL_LENGTH) {
+ libmv_refine_flags |= libmv::BUNDLE_FOCAL_LENGTH;
+ }
+ if (refine_intrinsics & LIBMV_REFINE_PRINCIPAL_POINT) {
+ libmv_refine_flags |= libmv::BUNDLE_PRINCIPAL_POINT;
+ }
+ if (refine_intrinsics & LIBMV_REFINE_RADIAL_DISTORTION_K1) {
+ libmv_refine_flags |= libmv::BUNDLE_RADIAL_K1;
+ }
+ if (refine_intrinsics & LIBMV_REFINE_RADIAL_DISTORTION_K2) {
+ libmv_refine_flags |= libmv::BUNDLE_RADIAL_K2;
+ }
+
+ progress_update_callback(callback_customdata, 1.0, "Refining solution");
+
+ libmv::EuclideanBundleCommonIntrinsics(*(libmv::Tracks *)tracks, libmv_refine_flags,
+ reconstruction, intrinsics);
+}
libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks *tracks, int keyframe1, int keyframe2,
int refine_intrinsics, double focal_length, double principal_x, double principal_y, double k1, double k2, double k3,
@@ -423,26 +449,45 @@ libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks *tracks, int keyfra
libmv::EuclideanCompleteReconstruction(normalized_tracks, reconstruction, &update_callback);
if (refine_intrinsics) {
- /* only a few combinations are supported but trust the caller */
- int libmv_refine_flags = 0;
- if (refine_intrinsics & LIBMV_REFINE_FOCAL_LENGTH) {
- libmv_refine_flags |= libmv::BUNDLE_FOCAL_LENGTH;
- }
- if (refine_intrinsics & LIBMV_REFINE_PRINCIPAL_POINT) {
- libmv_refine_flags |= libmv::BUNDLE_PRINCIPAL_POINT;
- }
- if (refine_intrinsics & LIBMV_REFINE_RADIAL_DISTORTION_K1) {
- libmv_refine_flags |= libmv::BUNDLE_RADIAL_K1;
- }
- if (refine_intrinsics & LIBMV_REFINE_RADIAL_DISTORTION_K2) {
- libmv_refine_flags |= libmv::BUNDLE_RADIAL_K2;
- }
+ libmv_solveRefineIntrinsics((libmv::Tracks *)tracks, intrinsics, reconstruction,
+ refine_intrinsics, progress_update_callback, callback_customdata);
+ }
- progress_update_callback(callback_customdata, 1.0, "Refining solution");
- libmv::EuclideanBundleCommonIntrinsics(*(libmv::Tracks *)tracks, libmv_refine_flags,
- reconstruction, intrinsics);
+ progress_update_callback(callback_customdata, 1.0, "Finishing solution");
+ libmv_reconstruction->tracks = *(libmv::Tracks *)tracks;
+ libmv_reconstruction->error = libmv::EuclideanReprojectionError(*(libmv::Tracks *)tracks, *reconstruction, *intrinsics);
+
+ return (libmv_Reconstruction *)libmv_reconstruction;
+}
+
+struct libmv_Reconstruction *libmv_solveModal(struct libmv_Tracks *tracks, double focal_length,
+ double principal_x, double principal_y, double k1, double k2, double k3,
+ reconstruct_progress_update_cb progress_update_callback, void *callback_customdata)
+{
+ /* Invert the camera intrinsics. */
+ libmv::vector<libmv::Marker> markers = ((libmv::Tracks*)tracks)->AllMarkers();
+ libmv_Reconstruction *libmv_reconstruction = new libmv_Reconstruction();
+ libmv::EuclideanReconstruction *reconstruction = &libmv_reconstruction->reconstruction;
+ libmv::CameraIntrinsics *intrinsics = &libmv_reconstruction->intrinsics;
+
+ ReconstructUpdateCallback update_callback =
+ ReconstructUpdateCallback(progress_update_callback, callback_customdata);
+
+ intrinsics->SetFocalLength(focal_length, focal_length);
+ intrinsics->SetPrincipalPoint(principal_x, principal_y);
+ intrinsics->SetRadialDistortion(k1, k2, k3);
+
+ for (int i = 0; i < markers.size(); ++i) {
+ intrinsics->InvertIntrinsics(markers[i].x,
+ markers[i].y,
+ &(markers[i].x),
+ &(markers[i].y));
}
+ libmv::Tracks normalized_tracks(markers);
+
+ libmv::ModalSolver(normalized_tracks, reconstruction, &update_callback);
+
progress_update_callback(callback_customdata, 1.0, "Finishing solution");
libmv_reconstruction->tracks = *(libmv::Tracks *)tracks;
libmv_reconstruction->error = libmv::EuclideanReprojectionError(*(libmv::Tracks *)tracks, *reconstruction, *intrinsics);
diff --git a/extern/libmv/libmv-capi.h b/extern/libmv/libmv-capi.h
index 01019832374..bccc4706832 100644
--- a/extern/libmv/libmv-capi.h
+++ b/extern/libmv/libmv-capi.h
@@ -68,6 +68,9 @@ int libmv_refineParametersAreValid(int parameters);
struct libmv_Reconstruction *libmv_solveReconstruction(struct libmv_Tracks *tracks, int keyframe1, int keyframe2,
int refine_intrinsics, double focal_length, double principal_x, double principal_y, double k1, double k2, double k3,
reconstruct_progress_update_cb progress_update_callback, void *callback_customdata);
+struct libmv_Reconstruction *libmv_solveModal(struct libmv_Tracks *tracks, double focal_length,
+ double principal_x, double principal_y, double k1, double k2, double k3,
+ reconstruct_progress_update_cb progress_update_callback, void *callback_customdata);
int libmv_reporojectionPointForTrack(struct libmv_Reconstruction *libmv_reconstruction, int track, double pos[3]);
double libmv_reporojectionErrorForTrack(struct libmv_Reconstruction *libmv_reconstruction, int track);
double libmv_reporojectionErrorForImage(struct libmv_Reconstruction *libmv_reconstruction, int image);
diff --git a/intern/audaspace/intern/AUD_C-API.cpp b/intern/audaspace/intern/AUD_C-API.cpp
index 9100a277124..50b47650696 100644
--- a/intern/audaspace/intern/AUD_C-API.cpp
+++ b/intern/audaspace/intern/AUD_C-API.cpp
@@ -41,6 +41,7 @@
#include <cstdlib>
#include <cstring>
#include <cmath>
+#include <sstream>
#include "AUD_NULLDevice.h"
#include "AUD_I3DDevice.h"
@@ -1236,6 +1237,47 @@ const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned int lengt
}
}
+const char* AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate)
+{
+ try
+ {
+ AUD_SequencerFactory* f = dynamic_cast<AUD_SequencerFactory*>(sound->get());
+
+ f->setSpecs(specs.specs);
+
+ std::vector<AUD_Reference<AUD_IWriter> > writers;
+
+ int channels = specs.channels;
+ specs.channels = AUD_CHANNELS_MONO;
+
+ for(int i = 0; i < channels; i++)
+ {
+ std::stringstream stream;
+ std::string fn = filename;
+ size_t index = fn.find_last_of('.');
+ size_t index_slash = fn.find_last_of('/');
+ size_t index_backslash = fn.find_last_of('\\');
+ if((index == std::string::npos) ||
+ ((index < index_slash) && (index_slash != std::string::npos)) ||
+ ((index < index_backslash) && (index_backslash != std::string::npos)))
+ stream << filename << "_" << (i + 1);
+ else
+ stream << fn.substr(0, index) << "_" << (i + 1) << fn.substr(index);
+ writers.push_back(AUD_FileWriter::createWriter(stream.str(), specs, format, codec, bitrate));
+ }
+
+ AUD_Reference<AUD_IReader> reader = f->createQualityReader();
+ reader->seek(start);
+ AUD_FileWriter::writeReader(reader, writers, length, buffersize);
+
+ return NULL;
+ }
+ catch(AUD_Exception& e)
+ {
+ return e.str;
+ }
+}
+
AUD_Device* AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound* sequencer, float volume, float start)
{
try
diff --git a/intern/audaspace/intern/AUD_C-API.h b/intern/audaspace/intern/AUD_C-API.h
index 8388af2170d..a52a1fa8369 100644
--- a/intern/audaspace/intern/AUD_C-API.h
+++ b/intern/audaspace/intern/AUD_C-API.h
@@ -710,6 +710,21 @@ extern void* AUD_getSet(void* set);
extern const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate);
/**
+ * Mixes a sound down into multiple files.
+ * \param sound The sound scene to mix down.
+ * \param start The start frame.
+ * \param length The count of frames to write.
+ * \param buffersize How many samples should be written at once.
+ * \param filename The file to write to, the channel number and an underscore are added at the beginning.
+ * \param specs The file's audio specification.
+ * \param format The file's container format.
+ * \param codec The codec used for encoding the audio data.
+ * \param bitrate The bitrate for encoding.
+ * \return An error message or NULL in case of success.
+ */
+extern const char* AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate);
+
+/**
* Opens a read device and prepares it for mixdown of the sound scene.
* \param specs Output audio specifications.
* \param sequencer The sound scene to mix down.
diff --git a/intern/audaspace/intern/AUD_FileWriter.cpp b/intern/audaspace/intern/AUD_FileWriter.cpp
index df76b667e3f..f74021acad1 100644
--- a/intern/audaspace/intern/AUD_FileWriter.cpp
+++ b/intern/audaspace/intern/AUD_FileWriter.cpp
@@ -93,3 +93,39 @@ void AUD_FileWriter::writeReader(AUD_Reference<AUD_IReader> reader, AUD_Referenc
writer->write(len, buf);
}
}
+
+void AUD_FileWriter::writeReader(AUD_Reference<AUD_IReader> reader, std::vector<AUD_Reference<AUD_IWriter> >& writers, unsigned int length, unsigned int buffersize)
+{
+ AUD_Buffer buffer(buffersize * AUD_SAMPLE_SIZE(reader->getSpecs()));
+ AUD_Buffer buffer2(buffersize * sizeof(sample_t));
+ sample_t* buf = buffer.getBuffer();
+ sample_t* buf2 = buffer2.getBuffer();
+
+ int len;
+ bool eos = false;
+ int channels = reader->getSpecs().channels;
+
+ for(unsigned int pos = 0; ((pos < length) || (length <= 0)) && !eos; pos += len)
+ {
+ len = buffersize;
+ if((len > length - pos) && (length > 0))
+ len = length - pos;
+ reader->read(len, eos, buf);
+
+ for(int channel = 0; channel < channels; channel++)
+ {
+ for(int i = 0; i < len; i++)
+ {
+ // clamping!
+ if(buf[i * channels + channel] > 1)
+ buf2[i] = 1;
+ else if(buf[i * channels + channel] < -1)
+ buf2[i] = -1;
+ else
+ buf2[i] = buf[i * channels + channel];
+ }
+
+ writers[channel]->write(len, buf2);
+ }
+ }
+}
diff --git a/intern/audaspace/intern/AUD_FileWriter.h b/intern/audaspace/intern/AUD_FileWriter.h
index c9ee2b1ee12..385aba5ef45 100644
--- a/intern/audaspace/intern/AUD_FileWriter.h
+++ b/intern/audaspace/intern/AUD_FileWriter.h
@@ -31,6 +31,7 @@
#define __AUD_FILEWRITER_H__
#include <string>
+#include <vector>
#include "AUD_Reference.h"
@@ -68,6 +69,15 @@ public:
* \param buffersize How many samples should be transfered at once.
*/
static void writeReader(AUD_Reference<AUD_IReader> reader, AUD_Reference<AUD_IWriter> writer, unsigned int length, unsigned int buffersize);
+
+ /**
+ * Writes a reader to several writers.
+ * \param reader The reader to read from.
+ * \param writers The writers to write to.
+ * \param length How many samples should be transfered.
+ * \param buffersize How many samples should be transfered at once.
+ */
+ static void writeReader(AUD_Reference<AUD_IReader> reader, std::vector<AUD_Reference<AUD_IWriter> >& writers, unsigned int length, unsigned int buffersize);
};
#endif //__AUD_FILEWRITER_H__
diff --git a/intern/audaspace/intern/AUD_Reference.h b/intern/audaspace/intern/AUD_Reference.h
index 2e07417154b..0c9f02c0155 100644
--- a/intern/audaspace/intern/AUD_Reference.h
+++ b/intern/audaspace/intern/AUD_Reference.h
@@ -31,6 +31,7 @@
#include <map>
#include <cstddef>
+#include <pthread.h>
// #define MEM_DEBUG
@@ -49,8 +50,13 @@ private:
* Saves the reference counts.
*/
static std::map<void*, unsigned int> m_references;
+ static pthread_mutex_t m_mutex;
+ static bool m_mutex_initialised;
public:
+
+ static pthread_mutex_t* getMutex();
+
/**
* Reference increment.
* \param reference The reference.
@@ -108,6 +114,7 @@ public:
template <class U>
AUD_Reference(U* reference)
{
+ pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
m_original = reference;
m_reference = dynamic_cast<T*>(reference);
AUD_ReferenceHandler::incref(m_original);
@@ -115,6 +122,7 @@ public:
if(m_reference != NULL)
std::cerr << "+" << typeid(*m_reference).name() << std::endl;
#endif
+ pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
}
AUD_Reference()
@@ -129,6 +137,7 @@ public:
*/
AUD_Reference(const AUD_Reference& ref)
{
+ pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
m_original = ref.m_original;
m_reference = ref.m_reference;
AUD_ReferenceHandler::incref(m_original);
@@ -136,11 +145,13 @@ public:
if(m_reference != NULL)
std::cerr << "+" << typeid(*m_reference).name() << std::endl;
#endif
+ pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
}
template <class U>
explicit AUD_Reference(const AUD_Reference<U>& ref)
{
+ pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
m_original = ref.get();
m_reference = dynamic_cast<T*>(ref.get());
AUD_ReferenceHandler::incref(m_original);
@@ -148,6 +159,7 @@ public:
if(m_reference != NULL)
std::cerr << "+" << typeid(*m_reference).name() << std::endl;
#endif
+ pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
}
/**
@@ -156,12 +168,14 @@ public:
*/
~AUD_Reference()
{
+ pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
#ifdef MEM_DEBUG
if(m_reference != NULL)
std::cerr << "-" << typeid(*m_reference).name() << std::endl;
#endif
if(AUD_ReferenceHandler::decref(m_original))
delete m_reference;
+ pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
}
/**
@@ -173,6 +187,8 @@ public:
if(&ref == this)
return *this;
+ pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
+
#ifdef MEM_DEBUG
if(m_reference != NULL)
std::cerr << "-" << typeid(*m_reference).name() << std::endl;
@@ -188,6 +204,8 @@ public:
std::cerr << "+" << typeid(*m_reference).name() << std::endl;
#endif
+ pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
+
return *this;
}
diff --git a/intern/audaspace/intern/AUD_ReferenceHandler.cpp b/intern/audaspace/intern/AUD_ReferenceHandler.cpp
index 24f645df761..3e9f6707262 100644
--- a/intern/audaspace/intern/AUD_ReferenceHandler.cpp
+++ b/intern/audaspace/intern/AUD_ReferenceHandler.cpp
@@ -29,3 +29,24 @@
#include "AUD_Reference.h"
std::map<void*, unsigned int> AUD_ReferenceHandler::m_references;
+pthread_mutex_t AUD_ReferenceHandler::m_mutex;
+bool AUD_ReferenceHandler::m_mutex_initialised = false;
+
+pthread_mutex_t *AUD_ReferenceHandler::getMutex()
+{
+ if(!m_mutex_initialised)
+ {
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+
+ pthread_mutex_init(&m_mutex, &attr);
+
+ pthread_mutexattr_destroy(&attr);
+
+ m_mutex_initialised = true;
+ }
+
+ return &m_mutex;
+}
+
diff --git a/intern/container/CTR_Map.h b/intern/container/CTR_Map.h
index 8b6d84337c2..9557821d642 100644
--- a/intern/container/CTR_Map.h
+++ b/intern/container/CTR_Map.h
@@ -63,7 +63,7 @@ public:
for (int i = 0; i < m_num_buckets; ++i) {
m_buckets[i] = 0;
- for(Entry *entry = map.m_buckets[i]; entry; entry=entry->m_next)
+ for (Entry *entry = map.m_buckets[i]; entry; entry=entry->m_next)
insert(entry->m_key, entry->m_value);
}
}
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index cb99ea3b499..35f97bf629f 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -85,10 +85,10 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
description="Leave out caustics, resulting in a darker image with less noise",
default=False,
)
- cls.blur_caustics = FloatProperty(
- name="Blur Caustics",
- description="Blur caustics to reduce noise",
- min=0.0, max=1.0,
+ cls.blur_glossy = FloatProperty(
+ name="Filter Glossy",
+ description="Adaptively blur glossy shaders after blurry bounces, to reduce noise at the cost of accuracy",
+ min=0.0, max=10.0,
default=0.0,
)
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 624d00b377d..0ed08589327 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -87,11 +87,11 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
sub.prop(cscene, "diffuse_bounces", text="Diffuse")
sub.prop(cscene, "glossy_bounces", text="Glossy")
sub.prop(cscene, "transmission_bounces", text="Transmission")
- sub.prop(cscene, "no_caustics")
- #row = col.row()
- #row.prop(cscene, "blur_caustics")
- #row.active = not cscene.no_caustics
+ col.separator()
+
+ col.prop(cscene, "no_caustics")
+ col.prop(cscene, "blur_glossy")
class CyclesRender_PT_film(CyclesButtonsPanel, Panel):
@@ -178,10 +178,7 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
col = split.column()
col.prop(scene, "layers", text="Scene")
- col.label(text="Material:")
- col.prop(rl, "material_override", text="")
-
- col.prop(rl, "use_sky", "Use Environment")
+ col.prop(rl, "layers_exclude", text="Exclude")
col = split.column()
col.prop(rl, "layers", text="Layer")
@@ -191,6 +188,16 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
split = layout.split()
col = split.column()
+ col.label(text="Material:")
+ col.prop(rl, "material_override", text="")
+
+ col = split.column()
+ col.prop(rl, "samples")
+ col.prop(rl, "use_sky", "Use Environment")
+
+ split = layout.split()
+
+ col = split.column()
col.label(text="Passes:")
col.prop(rl, "use_pass_combined")
col.prop(rl, "use_pass_z")
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index dc6c69e2904..5ece7aa26e2 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -218,12 +218,13 @@ void BlenderSession::render()
scene->film->passes = passes;
scene->film->tag_update(scene);
- /* update session */
- session->reset(buffer_params, session_params.samples);
-
/* update scene */
sync->sync_data(b_v3d, b_iter->name().c_str());
+ /* update session */
+ int samples = sync->get_layer_samples();
+ session->reset(buffer_params, (samples == 0)? session_params.samples: samples);
+
/* render */
session->start();
session->wait();
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index 5a286298774..41cd200d003 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -153,6 +153,8 @@ void BlenderSync::sync_integrator()
integrator->transparent_shadows = get_boolean(cscene, "use_transparent_shadows");
integrator->no_caustics = get_boolean(cscene, "no_caustics");
+ integrator->filter_glossy = get_float(cscene, "blur_glossy");
+
integrator->seed = get_int(cscene, "seed");
integrator->layer_flag = render_layer.layer;
@@ -208,6 +210,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
render_layer.holdout_layer = 0;
render_layer.material_override = PointerRNA_NULL;
render_layer.use_background = true;
+ render_layer.samples = 0;
return;
}
}
@@ -220,12 +223,13 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
for(r.layers.begin(b_rlay); b_rlay != r.layers.end(); ++b_rlay) {
if((!layer && first_layer) || (layer && b_rlay->name() == layer)) {
render_layer.name = b_rlay->name();
- render_layer.scene_layer = get_layer(b_scene.layers());
+ render_layer.scene_layer = get_layer(b_scene.layers()) & ~get_layer(b_rlay->layers_exclude());
render_layer.layer = get_layer(b_rlay->layers());
render_layer.holdout_layer = get_layer(b_rlay->layers_zmask());
render_layer.layer |= render_layer.holdout_layer;
render_layer.material_override = b_rlay->material_override();
render_layer.use_background = b_rlay->use_sky();
+ render_layer.samples = b_rlay->samples();
}
first_layer = false;
diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h
index d2550a1ffd7..ab8e4bd8d00 100644
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@ -57,6 +57,7 @@ public:
void sync_data(BL::SpaceView3D b_v3d, const char *layer = 0);
void sync_camera(BL::Object b_override, int width, int height);
void sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height);
+ int get_layer_samples() { return render_layer.samples; }
/* get parameters */
static SceneParams get_scene_params(BL::Scene b_scene, bool background);
@@ -108,7 +109,8 @@ private:
RenderLayerInfo()
: scene_layer(0), layer(0), holdout_layer(0),
material_override(PointerRNA_NULL),
- use_background(true)
+ use_background(true),
+ samples(0)
{}
string name;
@@ -117,6 +119,7 @@ private:
uint holdout_layer;
BL::Material material_override;
bool use_background;
+ int samples;
} render_layer;
};
diff --git a/intern/cycles/bvh/CMakeLists.txt b/intern/cycles/bvh/CMakeLists.txt
index decc576fe51..131a7a1f750 100644
--- a/intern/cycles/bvh/CMakeLists.txt
+++ b/intern/cycles/bvh/CMakeLists.txt
@@ -10,17 +10,21 @@ set(INC
set(SRC
bvh.cpp
+ bvh_binning.cpp
bvh_build.cpp
bvh_node.cpp
bvh_sort.cpp
+ bvh_split.cpp
)
set(SRC_HEADERS
bvh.h
+ bvh_binning.h
bvh_build.h
bvh_node.h
bvh_params.h
bvh_sort.h
+ bvh_split.h
)
include_directories(${INC})
diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp
index c9bfa964332..15695dddf45 100644
--- a/intern/cycles/bvh/bvh.cpp
+++ b/intern/cycles/bvh/bvh.cpp
@@ -530,7 +530,7 @@ void RegularBVH::refit_nodes()
{
assert(!params.top_level);
- BoundBox bbox;
+ BoundBox bbox = BoundBox::empty;
uint visibility = 0;
refit_node(0, (pack.is_leaf[0])? true: false, bbox, visibility);
}
@@ -572,7 +572,7 @@ void RegularBVH::refit_node(int idx, bool leaf, BoundBox& bbox, uint& visibility
}
else {
/* refit inner node, set bbox from children */
- BoundBox bbox0, bbox1;
+ BoundBox bbox0 = BoundBox::empty, bbox1 = BoundBox::empty;
uint visibility0 = 0, visibility1 = 0;
refit_node((c0 < 0)? -c0-1: c0, (c0 < 0), bbox0, visibility0);
diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp
index 38674c2c561..c5b4f1d01ae 100644
--- a/intern/cycles/bvh/bvh_build.cpp
+++ b/intern/cycles/bvh/bvh_build.cpp
@@ -15,22 +15,36 @@
* limitations under the License.
*/
+#include "bvh_binning.h"
#include "bvh_build.h"
#include "bvh_node.h"
#include "bvh_params.h"
-#include "bvh_sort.h"
+#include "bvh_split.h"
#include "mesh.h"
#include "object.h"
#include "scene.h"
-#include "util_algorithm.h"
+#include "util_debug.h"
#include "util_foreach.h"
#include "util_progress.h"
#include "util_time.h"
CCL_NAMESPACE_BEGIN
+/* BVH Build Task */
+
+class BVHBuildTask : public Task {
+public:
+ BVHBuildTask(InnerNode *node_, int child_, BVHObjectBinning& range_, int level_)
+ : node(node_), child(child_), level(level_), range(range_) {}
+
+ InnerNode *node;
+ int child;
+ int level;
+ BVHObjectBinning range;
+};
+
/* Constructor / Destructor */
BVHBuild::BVHBuild(const vector<Object*>& objects_,
@@ -41,10 +55,10 @@ BVHBuild::BVHBuild(const vector<Object*>& objects_,
prim_object(prim_object_),
params(params_),
progress(progress_),
- progress_start_time(0.0)
+ progress_start_time(0.0),
+ task_pool(function_bind(&BVHBuild::thread_build_node, this, _1, _2))
{
spatial_min_overlap = 0.0f;
- progress_num_duplicates = 0;
}
BVHBuild::~BVHBuild()
@@ -53,57 +67,63 @@ BVHBuild::~BVHBuild()
/* Adding References */
-void BVHBuild::add_reference_mesh(NodeSpec& root, Mesh *mesh, int i)
+void BVHBuild::add_reference_mesh(BoundBox& root, BoundBox& center, Mesh *mesh, int i)
{
for(uint j = 0; j < mesh->triangles.size(); j++) {
Mesh::Triangle t = mesh->triangles[j];
- Reference ref;
+ BoundBox bounds = BoundBox::empty;
for(int k = 0; k < 3; k++) {
float3 pt = mesh->verts[t.v[k]];
- ref.bounds.grow(pt);
+ bounds.grow(pt);
}
- if(ref.bounds.valid()) {
- ref.prim_index = j;
- ref.prim_object = i;
-
- references.push_back(ref);
- root.bounds.grow(ref.bounds);
+ if(bounds.valid()) {
+ references.push_back(BVHReference(bounds, j, i));
+ root.grow(bounds);
+ center.grow(bounds.center2());
}
}
}
-void BVHBuild::add_reference_object(NodeSpec& root, Object *ob, int i)
+void BVHBuild::add_reference_object(BoundBox& root, BoundBox& center, Object *ob, int i)
{
- Reference ref;
-
- ref.prim_index = -1;
- ref.prim_object = i;
- ref.bounds = ob->bounds;
-
- references.push_back(ref);
- root.bounds.grow(ref.bounds);
+ references.push_back(BVHReference(ob->bounds, -1, i));
+ root.grow(ob->bounds);
+ center.grow(ob->bounds.center2());
}
-void BVHBuild::add_references(NodeSpec& root)
+void BVHBuild::add_references(BVHRange& root)
{
- /* init root spec */
- root.num = 0;
- root.bounds = BoundBox();
+ /* reserve space for references */
+ size_t num_alloc_references = 0;
+
+ foreach(Object *ob, objects) {
+ if(params.top_level) {
+ if(ob->mesh->transform_applied)
+ num_alloc_references += ob->mesh->triangles.size();
+ else
+ num_alloc_references++;
+ }
+ else
+ num_alloc_references += ob->mesh->triangles.size();
+ }
+
+ references.reserve(num_alloc_references);
- /* add objects */
+ /* add references from objects */
+ BoundBox bounds = BoundBox::empty, center = BoundBox::empty;
int i = 0;
foreach(Object *ob, objects) {
if(params.top_level) {
if(ob->mesh->transform_applied)
- add_reference_mesh(root, ob->mesh, i);
+ add_reference_mesh(bounds, center, ob->mesh, i);
else
- add_reference_object(root, ob, i);
+ add_reference_object(bounds, center, ob, i);
}
else
- add_reference_mesh(root, ob->mesh, i);
+ add_reference_mesh(bounds, center, ob->mesh, i);
i++;
@@ -111,129 +131,213 @@ void BVHBuild::add_references(NodeSpec& root)
}
/* happens mostly on empty meshes */
- if(!root.bounds.valid())
- root.bounds.grow(make_float3(0.0f, 0.0f, 0.0f));
+ if(!bounds.valid())
+ bounds.grow(make_float3(0.0f, 0.0f, 0.0f));
- root.num = references.size();
+ root = BVHRange(bounds, center, 0, references.size());
}
/* Build */
BVHNode* BVHBuild::run()
{
- NodeSpec root;
+ BVHRange root;
/* add references */
add_references(root);
- if(progress.get_cancel()) return NULL;
+ if(progress.get_cancel())
+ return NULL;
/* init spatial splits */
if(params.top_level) /* todo: get rid of this */
params.use_spatial_split = false;
- spatial_min_overlap = root.bounds.area() * params.spatial_split_alpha;
+ spatial_min_overlap = root.bounds().safe_area() * params.spatial_split_alpha;
spatial_right_bounds.clear();
- spatial_right_bounds.resize(max(root.num, (int)BVHParams::NUM_SPATIAL_BINS) - 1);
+ spatial_right_bounds.resize(max(root.size(), (int)BVHParams::NUM_SPATIAL_BINS) - 1);
/* init progress updates */
- progress_num_duplicates = 0;
progress_start_time = time_dt();
+ progress_count = 0;
+ progress_total = references.size();
+ progress_original_total = progress_total;
+
+ prim_index.resize(references.size());
+ prim_object.resize(references.size());
/* build recursively */
- return build_node(root, 0, 0.0f, 1.0f);
+ BVHNode *rootnode;
+
+ if(params.use_spatial_split) {
+ /* singlethreaded spatial split build */
+ rootnode = build_node(root, 0);
+ }
+ else {
+ /* multithreaded binning build */
+ BVHObjectBinning rootbin(root, &references[0]);
+ rootnode = build_node(rootbin, 0);
+ task_pool.wait();
+ }
+
+ /* delete if we cancelled */
+ if(rootnode) {
+ if(progress.get_cancel()) {
+ rootnode->deleteSubtree();
+ rootnode = NULL;
+ }
+ else if(!params.use_spatial_split) {
+ /*rotate(rootnode, 4, 5);*/
+ rootnode->update_visibility();
+ }
+ }
+
+ return rootnode;
}
-void BVHBuild::progress_update(float progress_start, float progress_end)
+void BVHBuild::progress_update()
{
if(time_dt() - progress_start_time < 0.25f)
return;
+
+ double progress_start = (double)progress_count/(double)progress_total;
+ double duplicates = (double)(progress_total - progress_original_total)/(double)progress_total;
- float duplicates = (float)progress_num_duplicates/(float)references.size();
string msg = string_printf("Building BVH %.0f%%, duplicates %.0f%%",
progress_start*100.0f, duplicates*100.0f);
progress.set_substatus(msg);
- progress_start_time = time_dt();
+ progress_start_time = time_dt();
}
-BVHNode* BVHBuild::build_node(const NodeSpec& spec, int level, float progress_start, float progress_end)
+void BVHBuild::thread_build_node(Task *task_, int thread_id)
{
- /* progress update */
- progress_update(progress_start, progress_end);
- if(progress.get_cancel()) return NULL;
+ if(progress.get_cancel())
+ return;
- /* small enough or too deep => create leaf. */
- if(spec.num <= params.min_leaf_size || level >= BVHParams::MAX_DEPTH)
- return create_leaf_node(spec);
-
- /* find split candidates. */
- float area = spec.bounds.area();
- float leafSAH = area * params.triangle_cost(spec.num);
- float nodeSAH = area * params.node_cost(2);
- ObjectSplit object = find_object_split(spec, nodeSAH);
- SpatialSplit spatial;
-
- if(params.use_spatial_split && level < BVHParams::MAX_SPATIAL_DEPTH) {
- BoundBox overlap = object.left_bounds;
- overlap.intersect(object.right_bounds);
-
- if(overlap.area() >= spatial_min_overlap)
- spatial = find_spatial_split(spec, nodeSAH);
- }
+ /* build nodes */
+ BVHBuildTask *task = (BVHBuildTask*)task_;
+ BVHNode *node = build_node(task->range, task->level);
+
+ /* set child in inner node */
+ task->node->children[task->child] = node;
- /* leaf SAH is the lowest => create leaf. */
- float minSAH = min(min(leafSAH, object.sah), spatial.sah);
+ /* update progress */
+ if(task->range.size() < THREAD_TASK_SIZE) {
+ /*rotate(node, INT_MAX, 5);*/
- if(minSAH == leafSAH && spec.num <= params.max_leaf_size)
- return create_leaf_node(spec);
+ thread_scoped_lock lock(build_mutex);
- /* perform split. */
- NodeSpec left, right;
+ progress_count += task->range.size();
+ progress_update();
+ }
+}
+
+/* multithreaded binning builder */
+BVHNode* BVHBuild::build_node(const BVHObjectBinning& range, int level)
+{
+ size_t size = range.size();
+ float leafSAH = params.sah_triangle_cost * range.leafSAH;
+ float splitSAH = params.sah_node_cost * range.bounds().half_area() + params.sah_triangle_cost * range.splitSAH;
- if(params.use_spatial_split && minSAH == spatial.sah)
- do_spatial_split(left, right, spec, spatial);
- if(!left.num || !right.num)
- do_object_split(left, right, spec, object);
+ /* make leaf node when threshold reached or SAH tells us */
+ if(params.small_enough_for_leaf(size, level) || (size <= params.max_leaf_size && leafSAH < splitSAH))
+ return create_leaf_node(range);
+
+ /* perform split */
+ BVHObjectBinning left, right;
+ range.split(&references[0], left, right);
/* create inner node. */
- progress_num_duplicates += left.num + right.num - spec.num;
+ InnerNode *inner;
- float progress_mid = lerp(progress_start, progress_end, (float)right.num / (float)(left.num + right.num));
+ if(range.size() < THREAD_TASK_SIZE) {
+ /* local build */
+ BVHNode *leftnode = build_node(left, level + 1);
+ BVHNode *rightnode = build_node(right, level + 1);
- BVHNode* rightNode = build_node(right, level + 1, progress_start, progress_mid);
- if(progress.get_cancel()) {
- if(rightNode) rightNode->deleteSubtree();
- return NULL;
+ inner = new InnerNode(range.bounds(), leftnode, rightnode);
}
+ else {
+ /* threaded build */
+ inner = new InnerNode(range.bounds());
+
+ task_pool.push(new BVHBuildTask(inner, 0, left, level + 1), true);
+ task_pool.push(new BVHBuildTask(inner, 1, right, level + 1), true);
+ }
+
+ return inner;
+}
- BVHNode* leftNode = build_node(left, level + 1, progress_mid, progress_end);
- if(progress.get_cancel()) {
- if(leftNode) leftNode->deleteSubtree();
+/* single threaded spatial split builder */
+BVHNode* BVHBuild::build_node(const BVHRange& range, int level)
+{
+ /* progress update */
+ progress_update();
+ if(progress.get_cancel())
return NULL;
+
+ /* small enough or too deep => create leaf. */
+ if(params.small_enough_for_leaf(range.size(), level)) {
+ progress_count += range.size();
+ return create_leaf_node(range);
+ }
+
+ /* splitting test */
+ BVHMixedSplit split(this, range, level);
+
+ if(split.no_split) {
+ progress_count += range.size();
+ return create_leaf_node(range);
}
+
+ /* do split */
+ BVHRange left, right;
+ split.split(this, left, right, range);
+
+ progress_total += left.size() + right.size() - range.size();
+ size_t total = progress_total;
+
+ /* leaft node */
+ BVHNode *leftnode = build_node(left, level + 1);
+
+ /* right node (modify start for splits) */
+ right.set_start(right.start() + progress_total - total);
+ BVHNode *rightnode = build_node(right, level + 1);
- return new InnerNode(spec.bounds, leftNode, rightNode);
+ /* inner node */
+ return new InnerNode(range.bounds(), leftnode, rightnode);
}
-BVHNode *BVHBuild::create_object_leaf_nodes(const Reference *ref, int num)
+/* Create Nodes */
+
+BVHNode *BVHBuild::create_object_leaf_nodes(const BVHReference *ref, int start, int num)
{
if(num == 0) {
- BoundBox bounds;
+ BoundBox bounds = BoundBox::empty;
return new LeafNode(bounds, 0, 0, 0);
}
else if(num == 1) {
- prim_index.push_back(ref[0].prim_index);
- prim_object.push_back(ref[0].prim_object);
- uint visibility = objects[ref[0].prim_object]->visibility;
- return new LeafNode(ref[0].bounds, visibility, prim_index.size()-1, prim_index.size());
+ if(start == prim_index.size()) {
+ assert(params.use_spatial_split);
+
+ prim_index.push_back(ref->prim_index());
+ prim_object.push_back(ref->prim_object());
+ }
+ else {
+ prim_index[start] = ref->prim_index();
+ prim_object[start] = ref->prim_object();
+ }
+
+ uint visibility = objects[ref->prim_object()]->visibility;
+ return new LeafNode(ref->bounds(), visibility, start, start+1);
}
else {
int mid = num/2;
- BVHNode *leaf0 = create_object_leaf_nodes(ref, mid);
- BVHNode *leaf1 = create_object_leaf_nodes(ref+mid, num-mid);
+ BVHNode *leaf0 = create_object_leaf_nodes(ref, start, mid);
+ BVHNode *leaf1 = create_object_leaf_nodes(ref+mid, start+mid, num-mid);
- BoundBox bounds;
+ BoundBox bounds = BoundBox::empty;
bounds.grow(leaf0->m_bounds);
bounds.grow(leaf1->m_bounds);
@@ -241,310 +345,136 @@ BVHNode *BVHBuild::create_object_leaf_nodes(const Reference *ref, int num)
}
}
-BVHNode* BVHBuild::create_leaf_node(const NodeSpec& spec)
+BVHNode* BVHBuild::create_leaf_node(const BVHRange& range)
{
vector<int>& p_index = prim_index;
vector<int>& p_object = prim_object;
- BoundBox bounds;
- int num = 0;
+ BoundBox bounds = BoundBox::empty;
+ int num = 0, ob_num = 0;
uint visibility = 0;
- for(int i = 0; i < spec.num; i++) {
- if(references.back().prim_index != -1) {
- p_index.push_back(references.back().prim_index);
- p_object.push_back(references.back().prim_object);
- bounds.grow(references.back().bounds);
- visibility |= objects[references.back().prim_object]->visibility;
- references.pop_back();
+ for(int i = 0; i < range.size(); i++) {
+ BVHReference& ref = references[range.start() + i];
+
+ if(ref.prim_index() != -1) {
+ if(range.start() + num == prim_index.size()) {
+ assert(params.use_spatial_split);
+
+ p_index.push_back(ref.prim_index());
+ p_object.push_back(ref.prim_object());
+ }
+ else {
+ p_index[range.start() + num] = ref.prim_index();
+ p_object[range.start() + num] = ref.prim_object();
+ }
+
+ bounds.grow(ref.bounds());
+ visibility |= objects[ref.prim_object()]->visibility;
num++;
}
+ else {
+ if(ob_num < i)
+ references[range.start() + ob_num] = ref;
+ ob_num++;
+ }
}
BVHNode *leaf = NULL;
if(num > 0) {
- leaf = new LeafNode(bounds, visibility, p_index.size() - num, p_index.size());
+ leaf = new LeafNode(bounds, visibility, range.start(), range.start() + num);
- if(num == spec.num)
+ if(num == range.size())
return leaf;
}
/* while there may be multiple triangles in a leaf, for object primitives
- * we want them to be the only one, so we */
- int ob_num = spec.num - num;
- const Reference *ref = (ob_num)? &references.back() - (ob_num - 1): NULL;
- BVHNode *oleaf = create_object_leaf_nodes(ref, ob_num);
- for(int i = 0; i < ob_num; i++)
- references.pop_back();
+ * we want there to be the only one, so we keep splitting */
+ const BVHReference *ref = (ob_num)? &references[range.start()]: NULL;
+ BVHNode *oleaf = create_object_leaf_nodes(ref, range.start() + num, ob_num);
if(leaf)
- return new InnerNode(spec.bounds, leaf, oleaf);
+ return new InnerNode(range.bounds(), leaf, oleaf);
else
return oleaf;
}
-/* Object Split */
+/* Tree Rotations */
-BVHBuild::ObjectSplit BVHBuild::find_object_split(const NodeSpec& spec, float nodeSAH)
+void BVHBuild::rotate(BVHNode *node, int max_depth, int iterations)
{
- ObjectSplit split;
- const Reference *ref_ptr = &references[references.size() - spec.num];
-
- for(int dim = 0; dim < 3; dim++) {
- /* sort references */
- bvh_reference_sort(references.size() - spec.num, references.size(), &references[0], dim);
-
- /* sweep right to left and determine bounds. */
- BoundBox right_bounds;
-
- for(int i = spec.num - 1; i > 0; i--) {
- right_bounds.grow(ref_ptr[i].bounds);
- spatial_right_bounds[i - 1] = right_bounds;
- }
-
- /* sweep left to right and select lowest SAH. */
- BoundBox left_bounds;
-
- for(int i = 1; i < spec.num; i++) {
- left_bounds.grow(ref_ptr[i - 1].bounds);
- right_bounds = spatial_right_bounds[i - 1];
-
- float sah = nodeSAH +
- left_bounds.area() * params.triangle_cost(i) +
- right_bounds.area() * params.triangle_cost(spec.num - i);
-
- if(sah < split.sah) {
- split.sah = sah;
- split.dim = dim;
- split.num_left = i;
- split.left_bounds = left_bounds;
- split.right_bounds = right_bounds;
- }
- }
- }
-
- return split;
+ /* in tested scenes, this resulted in slightly slower raytracing, so disabled
+ * it for now. could be implementation bug, or depend on the scene */
+ if(node)
+ for(int i = 0; i < iterations; i++)
+ rotate(node, max_depth);
}
-void BVHBuild::do_object_split(NodeSpec& left, NodeSpec& right, const NodeSpec& spec, const ObjectSplit& split)
+void BVHBuild::rotate(BVHNode *node, int max_depth)
{
- /* sort references according to split */
- int start = references.size() - spec.num;
- int end = references.size(); /* todo: is this right? */
-
- bvh_reference_sort(start, end, &references[0], split.dim);
-
- /* split node specs */
- left.num = split.num_left;
- left.bounds = split.left_bounds;
- right.num = spec.num - split.num_left;
- right.bounds = split.right_bounds;
-}
-
-/* Spatial Split */
-
-BVHBuild::SpatialSplit BVHBuild::find_spatial_split(const NodeSpec& spec, float nodeSAH)
-{
- /* initialize bins. */
- float3 origin = spec.bounds.min;
- float3 binSize = (spec.bounds.max - origin) * (1.0f / (float)BVHParams::NUM_SPATIAL_BINS);
- float3 invBinSize = 1.0f / binSize;
-
- for(int dim = 0; dim < 3; dim++) {
- for(int i = 0; i < BVHParams::NUM_SPATIAL_BINS; i++) {
- SpatialBin& bin = spatial_bins[dim][i];
-
- bin.bounds = BoundBox();
- bin.enter = 0;
- bin.exit = 0;
- }
- }
-
- /* chop references into bins. */
- for(unsigned int refIdx = references.size() - spec.num; refIdx < references.size(); refIdx++) {
- const Reference& ref = references[refIdx];
- float3 firstBinf = (ref.bounds.min - origin) * invBinSize;
- float3 lastBinf = (ref.bounds.max - origin) * invBinSize;
- int3 firstBin = make_int3((int)firstBinf.x, (int)firstBinf.y, (int)firstBinf.z);
- int3 lastBin = make_int3((int)lastBinf.x, (int)lastBinf.y, (int)lastBinf.z);
+ /* nothing to rotate if we reached a leaf node. */
+ if(node->is_leaf() || max_depth < 0)
+ return;
+
+ InnerNode *parent = (InnerNode*)node;
- firstBin = clamp(firstBin, 0, BVHParams::NUM_SPATIAL_BINS - 1);
- lastBin = clamp(lastBin, firstBin, BVHParams::NUM_SPATIAL_BINS - 1);
+ /* rotate all children first */
+ for(size_t c = 0; c < 2; c++)
+ rotate(parent->children[c], max_depth-1);
- for(int dim = 0; dim < 3; dim++) {
- Reference currRef = ref;
+ /* compute current area of all children */
+ BoundBox bounds0 = parent->children[0]->m_bounds;
+ BoundBox bounds1 = parent->children[1]->m_bounds;
- for(int i = firstBin[dim]; i < lastBin[dim]; i++) {
- Reference leftRef, rightRef;
+ float area0 = bounds0.half_area();
+ float area1 = bounds1.half_area();
+ float4 child_area = make_float4(area0, area1, 0.0f, 0.0f);
- split_reference(leftRef, rightRef, currRef, dim, origin[dim] + binSize[dim] * (float)(i + 1));
- spatial_bins[dim][i].bounds.grow(leftRef.bounds);
- currRef = rightRef;
- }
+ /* find best rotation. we pick a target child of a first child, and swap
+ * this with an other child. we perform the best such swap. */
+ float best_cost = FLT_MAX;
+ int best_child = -1, bets_target = -1, best_other = -1;
- spatial_bins[dim][lastBin[dim]].bounds.grow(currRef.bounds);
- spatial_bins[dim][firstBin[dim]].enter++;
- spatial_bins[dim][lastBin[dim]].exit++;
- }
- }
+ for(size_t c = 0; c < 2; c++) {
+ /* ignore leaf nodes as we cannot descent into */
+ if(parent->children[c]->is_leaf())
+ continue;
- /* select best split plane. */
- SpatialSplit split;
+ InnerNode *child = (InnerNode*)parent->children[c];
+ BoundBox& other = (c == 0)? bounds1: bounds0;
- for(int dim = 0; dim < 3; dim++) {
- /* sweep right to left and determine bounds. */
- BoundBox right_bounds;
+ /* transpose child bounds */
+ BoundBox target0 = child->children[0]->m_bounds;
+ BoundBox target1 = child->children[1]->m_bounds;
- for(int i = BVHParams::NUM_SPATIAL_BINS - 1; i > 0; i--) {
- right_bounds.grow(spatial_bins[dim][i].bounds);
- spatial_right_bounds[i - 1] = right_bounds;
- }
+ /* compute cost for both possible swaps */
+ float cost0 = merge(other, target1).half_area() - child_area[c];
+ float cost1 = merge(target0, other).half_area() - child_area[c];
- /* sweep left to right and select lowest SAH. */
- BoundBox left_bounds;
- int leftNum = 0;
- int rightNum = spec.num;
+ if(min(cost0,cost1) < best_cost) {
+ best_child = (int)c;
+ best_other = (int)(1-c);
- for(int i = 1; i < BVHParams::NUM_SPATIAL_BINS; i++) {
- left_bounds.grow(spatial_bins[dim][i - 1].bounds);
- leftNum += spatial_bins[dim][i - 1].enter;
- rightNum -= spatial_bins[dim][i - 1].exit;
-
- float sah = nodeSAH +
- left_bounds.area() * params.triangle_cost(leftNum) +
- spatial_right_bounds[i - 1].area() * params.triangle_cost(rightNum);
-
- if(sah < split.sah) {
- split.sah = sah;
- split.dim = dim;
- split.pos = origin[dim] + binSize[dim] * (float)i;
+ if(cost0 < cost1) {
+ best_cost = cost0;
+ bets_target = 0;
+ }
+ else {
+ best_cost = cost0;
+ bets_target = 1;
}
}
}
- return split;
-}
-
-void BVHBuild::do_spatial_split(NodeSpec& left, NodeSpec& right, const NodeSpec& spec, const SpatialSplit& split)
-{
- /* Categorize references and compute bounds.
- *
- * Left-hand side: [left_start, left_end[
- * Uncategorized/split: [left_end, right_start[
- * Right-hand side: [right_start, refs.size()[ */
-
- vector<Reference>& refs = references;
- int left_start = refs.size() - spec.num;
- int left_end = left_start;
- int right_start = refs.size();
-
- left.bounds = right.bounds = BoundBox();
-
- for(int i = left_end; i < right_start; i++) {
- if(refs[i].bounds.max[split.dim] <= split.pos) {
- /* entirely on the left-hand side */
- left.bounds.grow(refs[i].bounds);
- swap(refs[i], refs[left_end++]);
- }
- else if(refs[i].bounds.min[split.dim] >= split.pos) {
- /* entirely on the right-hand side */
- right.bounds.grow(refs[i].bounds);
- swap(refs[i--], refs[--right_start]);
- }
- }
-
- /* duplicate or unsplit references intersecting both sides. */
- while(left_end < right_start) {
- /* split reference. */
- Reference lref, rref;
-
- split_reference(lref, rref, refs[left_end], split.dim, split.pos);
-
- /* compute SAH for duplicate/unsplit candidates. */
- BoundBox lub = left.bounds; // Unsplit to left: new left-hand bounds.
- BoundBox rub = right.bounds; // Unsplit to right: new right-hand bounds.
- BoundBox ldb = left.bounds; // Duplicate: new left-hand bounds.
- BoundBox rdb = right.bounds; // Duplicate: new right-hand bounds.
-
- lub.grow(refs[left_end].bounds);
- rub.grow(refs[left_end].bounds);
- ldb.grow(lref.bounds);
- rdb.grow(rref.bounds);
-
- float lac = params.triangle_cost(left_end - left_start);
- float rac = params.triangle_cost(refs.size() - right_start);
- float lbc = params.triangle_cost(left_end - left_start + 1);
- float rbc = params.triangle_cost(refs.size() - right_start + 1);
-
- float unsplitLeftSAH = lub.area() * lbc + right.bounds.area() * rac;
- float unsplitRightSAH = left.bounds.area() * lac + rub.area() * rbc;
- float duplicateSAH = ldb.area() * lbc + rdb.area() * rbc;
- float minSAH = min(min(unsplitLeftSAH, unsplitRightSAH), duplicateSAH);
-
- if(minSAH == unsplitLeftSAH) {
- /* unsplit to left */
- left.bounds = lub;
- left_end++;
- }
- else if(minSAH == unsplitRightSAH) {
- /* unsplit to right */
- right.bounds = rub;
- swap(refs[left_end], refs[--right_start]);
- }
- else {
- /* duplicate */
- left.bounds = ldb;
- right.bounds = rdb;
- refs[left_end++] = lref;
- refs.push_back(rref);
- }
- }
-
- left.num = left_end - left_start;
- right.num = refs.size() - right_start;
-}
+ /* if we did not find a swap that improves the SAH then do nothing */
+ if(best_cost >= 0)
+ return;
-void BVHBuild::split_reference(Reference& left, Reference& right, const Reference& ref, int dim, float pos)
-{
- /* initialize references. */
- left.prim_index = right.prim_index = ref.prim_index;
- left.prim_object = right.prim_object = ref.prim_object;
- left.bounds = right.bounds = BoundBox();
-
- /* loop over vertices/edges. */
- Object *ob = objects[ref.prim_object];
- const Mesh *mesh = ob->mesh;
- const int *inds = mesh->triangles[ref.prim_index].v;
- const float3 *verts = &mesh->verts[0];
- const float3* v1 = &verts[inds[2]];
-
- for(int i = 0; i < 3; i++) {
- const float3* v0 = v1;
- int vindex = inds[i];
- v1 = &verts[vindex];
- float v0p = (*v0)[dim];
- float v1p = (*v1)[dim];
-
- /* insert vertex to the boxes it belongs to. */
- if(v0p <= pos)
- left.bounds.grow(*v0);
-
- if(v0p >= pos)
- right.bounds.grow(*v0);
-
- /* edge intersects the plane => insert intersection to both boxes. */
- if((v0p < pos && v1p > pos) || (v0p > pos && v1p < pos)) {
- float3 t = lerp(*v0, *v1, clamp((pos - v0p) / (v1p - v0p), 0.0f, 1.0f));
- left.bounds.grow(t);
- right.bounds.grow(t);
- }
- }
+ /* perform the best found tree rotation */
+ InnerNode *child = (InnerNode*)parent->children[best_child];
- /* intersect with original bounds. */
- left.bounds.max[dim] = pos;
- right.bounds.min[dim] = pos;
- left.bounds.intersect(ref.bounds);
- right.bounds.intersect(ref.bounds);
+ swap(parent->children[best_other], child->children[bets_target]);
+ child->m_bounds = merge(child->children[0]->m_bounds, child->children[1]->m_bounds);
}
CCL_NAMESPACE_END
diff --git a/intern/cycles/bvh/bvh_build.h b/intern/cycles/bvh/bvh_build.h
index 1fa1951d7f2..84e14632b4b 100644
--- a/intern/cycles/bvh/bvh_build.h
+++ b/intern/cycles/bvh/bvh_build.h
@@ -21,8 +21,10 @@
#include <float.h>
#include "bvh.h"
+#include "bvh_binning.h"
#include "util_boundbox.h"
+#include "util_task.h"
#include "util_vector.h"
CCL_NAMESPACE_BEGIN
@@ -37,28 +39,7 @@ class Progress;
class BVHBuild
{
public:
- struct Reference
- {
- int prim_index;
- int prim_object;
- BoundBox bounds;
-
- Reference()
- {
- }
- };
-
- struct NodeSpec
- {
- int num;
- BoundBox bounds;
-
- NodeSpec()
- {
- num = 0;
- }
- };
-
+ /* Constructor/Destructor */
BVHBuild(
const vector<Object*>& objects,
vector<int>& prim_index,
@@ -70,63 +51,37 @@ public:
BVHNode *run();
protected:
+ friend class BVHMixedSplit;
+ friend class BVHObjectSplit;
+ friend class BVHSpatialSplit;
+
/* adding references */
- void add_reference_mesh(NodeSpec& root, Mesh *mesh, int i);
- void add_reference_object(NodeSpec& root, Object *ob, int i);
- void add_references(NodeSpec& root);
+ void add_reference_mesh(BoundBox& root, BoundBox& center, Mesh *mesh, int i);
+ void add_reference_object(BoundBox& root, BoundBox& center, Object *ob, int i);
+ void add_references(BVHRange& root);
/* building */
- BVHNode *build_node(const NodeSpec& spec, int level, float progress_start, float progress_end);
- BVHNode *create_leaf_node(const NodeSpec& spec);
- BVHNode *create_object_leaf_nodes(const Reference *ref, int num);
-
- void progress_update(float progress_start, float progress_end);
-
- /* object splits */
- struct ObjectSplit
- {
- float sah;
- int dim;
- int num_left;
- BoundBox left_bounds;
- BoundBox right_bounds;
-
- ObjectSplit()
- : sah(FLT_MAX), dim(0), num_left(0)
- {
- }
- };
-
- ObjectSplit find_object_split(const NodeSpec& spec, float nodeSAH);
- void do_object_split(NodeSpec& left, NodeSpec& right, const NodeSpec& spec, const ObjectSplit& split);
-
- /* spatial splits */
- struct SpatialSplit
- {
- float sah;
- int dim;
- float pos;
-
- SpatialSplit()
- : sah(FLT_MAX), dim(0), pos(0.0f)
- {
- }
- };
-
- struct SpatialBin
- {
- BoundBox bounds;
- int enter;
- int exit;
- };
-
- SpatialSplit find_spatial_split(const NodeSpec& spec, float nodeSAH);
- void do_spatial_split(NodeSpec& left, NodeSpec& right, const NodeSpec& spec, const SpatialSplit& split);
- void split_reference(Reference& left, Reference& right, const Reference& ref, int dim, float pos);
+ BVHNode *build_node(const BVHRange& range, int level);
+ BVHNode *build_node(const BVHObjectBinning& range, int level);
+ BVHNode *create_leaf_node(const BVHRange& range);
+ BVHNode *create_object_leaf_nodes(const BVHReference *ref, int start, int num);
+
+ /* threads */
+ enum { THREAD_TASK_SIZE = 4096 };
+ void thread_build_node(Task *task_, int thread_id);
+ thread_mutex build_mutex;
+
+ /* progress */
+ void progress_update();
+
+ /* tree rotations */
+ void rotate(BVHNode *node, int max_depth);
+ void rotate(BVHNode *node, int max_depth, int iterations);
/* objects and primitive references */
vector<Object*> objects;
- vector<Reference> references;
+ vector<BVHReference> references;
+ int num_original_references;
/* output primitive indexes and objects */
vector<int>& prim_index;
@@ -138,12 +93,17 @@ protected:
/* progress reporting */
Progress& progress;
double progress_start_time;
- int progress_num_duplicates;
+ size_t progress_count;
+ size_t progress_total;
+ size_t progress_original_total;
/* spatial splitting */
float spatial_min_overlap;
vector<BoundBox> spatial_right_bounds;
- SpatialBin spatial_bins[3][BVHParams::NUM_SPATIAL_BINS];
+ BVHSpatialBin spatial_bins[3][BVHParams::NUM_SPATIAL_BINS];
+
+ /* threads */
+ TaskPool task_pool;
};
CCL_NAMESPACE_END
diff --git a/intern/cycles/bvh/bvh_node.cpp b/intern/cycles/bvh/bvh_node.cpp
index 63683bae4a3..4edfb4b70a4 100644
--- a/intern/cycles/bvh/bvh_node.cpp
+++ b/intern/cycles/bvh/bvh_node.cpp
@@ -24,6 +24,8 @@
CCL_NAMESPACE_BEGIN
+/* BVH Node */
+
int BVHNode::getSubtreeSize(BVH_STAT stat) const
{
int cnt = 0;
@@ -59,7 +61,8 @@ int BVHNode::getSubtreeSize(BVH_STAT stat) const
void BVHNode::deleteSubtree()
{
for(int i=0;i<num_children();i++)
- get_child(i)->deleteSubtree();
+ if(get_child(i))
+ get_child(i)->deleteSubtree();
delete this;
}
@@ -70,12 +73,27 @@ float BVHNode::computeSubtreeSAHCost(const BVHParams& p, float probability) cons
for(int i=0;i<num_children();i++) {
BVHNode *child = get_child(i);
- SAH += child->computeSubtreeSAHCost(p, probability * child->m_bounds.area()/m_bounds.area());
+ SAH += child->computeSubtreeSAHCost(p, probability * child->m_bounds.safe_area()/m_bounds.safe_area());
}
return SAH;
}
+uint BVHNode::update_visibility()
+{
+ if(!is_leaf() && m_visibility == 0) {
+ InnerNode *inner = (InnerNode*)this;
+ BVHNode *child0 = inner->children[0];
+ BVHNode *child1 = inner->children[1];
+
+ m_visibility = child0->update_visibility()|child1->update_visibility();
+ }
+
+ return m_visibility;
+}
+
+/* Inner Node */
+
void InnerNode::print(int depth) const
{
for(int i = 0; i < depth; i++)
diff --git a/intern/cycles/bvh/bvh_node.h b/intern/cycles/bvh/bvh_node.h
index 5e0a17a1193..5c00f7b7a38 100644
--- a/intern/cycles/bvh/bvh_node.h
+++ b/intern/cycles/bvh/bvh_node.h
@@ -49,8 +49,6 @@ public:
virtual int num_triangles() const { return 0; }
virtual void print(int depth = 0) const = 0;
- float getArea() const { return m_bounds.area(); }
-
BoundBox m_bounds;
uint m_visibility;
@@ -58,6 +56,8 @@ public:
int getSubtreeSize(BVH_STAT stat=BVH_STAT_NODE_COUNT) const;
float computeSubtreeSAHCost(const BVHParams& p, float probability = 1.0f) const;
void deleteSubtree();
+
+ uint update_visibility();
};
class InnerNode : public BVHNode
@@ -66,9 +66,21 @@ public:
InnerNode(const BoundBox& bounds, BVHNode* child0, BVHNode* child1)
{
m_bounds = bounds;
- m_visibility = child0->m_visibility|child1->m_visibility;
children[0] = child0;
children[1] = child1;
+
+ if(child0 && child1)
+ m_visibility = child0->m_visibility|child1->m_visibility;
+ else
+ m_visibility = 0; /* happens on build cancel */
+ }
+
+ InnerNode(const BoundBox& bounds)
+ {
+ m_bounds = bounds;
+ m_visibility = 0;
+ children[0] = NULL;
+ children[1] = NULL;
}
bool is_leaf() const { return false; }
diff --git a/intern/cycles/bvh/bvh_params.h b/intern/cycles/bvh/bvh_params.h
index 38093438500..0cf5e905fea 100644
--- a/intern/cycles/bvh/bvh_params.h
+++ b/intern/cycles/bvh/bvh_params.h
@@ -18,6 +18,8 @@
#ifndef __BVH_PARAMS_H__
#define __BVH_PARAMS_H__
+#include "util_boundbox.h"
+
CCL_NAMESPACE_BEGIN
/* BVH Parameters */
@@ -73,14 +75,97 @@ public:
}
/* SAH costs */
- float cost(int num_nodes, int num_tris) const
+ __forceinline float cost(int num_nodes, int num_tris) const
{ return node_cost(num_nodes) + triangle_cost(num_tris); }
- float triangle_cost(int n) const
+ __forceinline float triangle_cost(int n) const
{ return n*sah_triangle_cost; }
- float node_cost(int n) const
+ __forceinline float node_cost(int n) const
{ return n*sah_node_cost; }
+
+ __forceinline bool small_enough_for_leaf(int size, int level)
+ { return (size <= min_leaf_size || level >= MAX_DEPTH); }
+};
+
+/* BVH Reference
+ *
+ * Reference to a primitive. Primitive index and object are sneakily packed
+ * into BoundBox to reduce memory usage and align nicely */
+
+class BVHReference
+{
+public:
+ __forceinline BVHReference() {}
+
+ __forceinline BVHReference(const BoundBox& bounds_, int prim_index, int prim_object)
+ : rbounds(bounds_)
+ {
+ rbounds.min.w = __int_as_float(prim_index);
+ rbounds.max.w = __int_as_float(prim_object);
+ }
+
+ __forceinline const BoundBox& bounds() const { return rbounds; }
+ __forceinline int prim_index() const { return __float_as_int(rbounds.min.w); }
+ __forceinline int prim_object() const { return __float_as_int(rbounds.max.w); }
+
+protected:
+ BoundBox rbounds;
+};
+
+/* BVH Range
+ *
+ * Build range used during construction, to indicate the bounds and place in
+ * the reference array of a subset of pirmitives Again uses trickery to pack
+ * integers into BoundBox for alignment purposes. */
+
+class BVHRange
+{
+public:
+ __forceinline BVHRange()
+ {
+ rbounds.min.w = __int_as_float(0);
+ rbounds.max.w = __int_as_float(0);
+ }
+
+ __forceinline BVHRange(const BoundBox& bounds_, int start_, int size_)
+ : rbounds(bounds_)
+ {
+ rbounds.min.w = __int_as_float(start_);
+ rbounds.max.w = __int_as_float(size_);
+ }
+
+ __forceinline BVHRange(const BoundBox& bounds_, const BoundBox& cbounds_, int start_, int size_)
+ : rbounds(bounds_), cbounds(cbounds_)
+ {
+ rbounds.min.w = __int_as_float(start_);
+ rbounds.max.w = __int_as_float(size_);
+ }
+
+ __forceinline void set_start(int start_) { rbounds.min.w = __int_as_float(start_); }
+
+ __forceinline const BoundBox& bounds() const { return rbounds; }
+ __forceinline const BoundBox& cent_bounds() const { return cbounds; }
+ __forceinline int start() const { return __float_as_int(rbounds.min.w); }
+ __forceinline int size() const { return __float_as_int(rbounds.max.w); }
+ __forceinline int end() const { return start() + size(); }
+
+protected:
+ BoundBox rbounds;
+ BoundBox cbounds;
+};
+
+/* BVH Spatial Bin */
+
+struct BVHSpatialBin
+{
+ BoundBox bounds;
+ int enter;
+ int exit;
+
+ __forceinline BVHSpatialBin()
+ {
+ }
};
CCL_NAMESPACE_END
diff --git a/intern/cycles/bvh/bvh_sort.cpp b/intern/cycles/bvh/bvh_sort.cpp
index ee4531a4843..bef384be592 100644
--- a/intern/cycles/bvh/bvh_sort.cpp
+++ b/intern/cycles/bvh/bvh_sort.cpp
@@ -32,23 +32,23 @@ public:
dim = dim_;
}
- bool operator()(const BVHBuild::Reference& ra, const BVHBuild::Reference& rb)
+ bool operator()(const BVHReference& ra, const BVHReference& rb)
{
- float ca = ra.bounds.min[dim] + ra.bounds.max[dim];
- float cb = rb.bounds.min[dim] + rb.bounds.max[dim];
+ float ca = ra.bounds().min[dim] + ra.bounds().max[dim];
+ float cb = rb.bounds().min[dim] + rb.bounds().max[dim];
if(ca < cb) return true;
else if(ca > cb) return false;
- else if(ra.prim_object < rb.prim_object) return true;
- else if(ra.prim_object > rb.prim_object) return false;
- else if(ra.prim_index < rb.prim_index) return true;
- else if(ra.prim_index > rb.prim_index) return false;
+ else if(ra.prim_object() < rb.prim_object()) return true;
+ else if(ra.prim_object() > rb.prim_object()) return false;
+ else if(ra.prim_index() < rb.prim_index()) return true;
+ else if(ra.prim_index() > rb.prim_index()) return false;
return false;
}
};
-void bvh_reference_sort(int start, int end, BVHBuild::Reference *data, int dim)
+void bvh_reference_sort(int start, int end, BVHReference *data, int dim)
{
sort(data+start, data+end, BVHReferenceCompare(dim));
}
diff --git a/intern/cycles/bvh/bvh_sort.h b/intern/cycles/bvh/bvh_sort.h
index f0676948146..ba35ba3fae7 100644
--- a/intern/cycles/bvh/bvh_sort.h
+++ b/intern/cycles/bvh/bvh_sort.h
@@ -20,7 +20,7 @@
CCL_NAMESPACE_BEGIN
-void bvh_reference_sort(int start, int end, BVHBuild::Reference *data, int dim);
+void bvh_reference_sort(int start, int end, BVHReference *data, int dim);
CCL_NAMESPACE_END
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index cceec8b8e5c..42dda1180c7 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -58,15 +58,6 @@ void DeviceTask::split_max_size(list<DeviceTask>& tasks, int max_size)
split(tasks, num);
}
-void DeviceTask::split(ThreadQueue<DeviceTask>& queue, int num)
-{
- list<DeviceTask> tasks;
- split(tasks, num);
-
- foreach(DeviceTask& task, tasks)
- queue.push(task);
-}
-
void DeviceTask::split(list<DeviceTask>& tasks, int num)
{
if(type == SHADER) {
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index af2567498d9..87f255e54e7 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -25,6 +25,7 @@
#include "util_list.h"
#include "util_string.h"
+#include "util_task.h"
#include "util_thread.h"
#include "util_types.h"
#include "util_vector.h"
@@ -66,7 +67,7 @@ public:
/* Device Task */
-class DeviceTask {
+class DeviceTask : public Task {
public:
typedef enum { PATH_TRACE, TONEMAP, SHADER } Type;
Type type;
@@ -87,7 +88,6 @@ public:
DeviceTask(Type type = PATH_TRACE);
void split(list<DeviceTask>& tasks, int num);
- void split(ThreadQueue<DeviceTask>& tasks, int num);
void split_max_size(list<DeviceTask>& tasks, int max_size);
};
diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index da977ed8472..ec84047c44f 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -40,35 +40,21 @@ CCL_NAMESPACE_BEGIN
class CPUDevice : public Device
{
public:
- vector<thread*> threads;
- ThreadQueue<DeviceTask> tasks;
+ TaskPool task_pool;
KernelGlobals *kg;
CPUDevice(int threads_num)
+ : task_pool(function_bind(&CPUDevice::thread_run, this, _1, _2))
{
kg = kernel_globals_create();
/* do now to avoid thread issues */
system_cpu_support_optimized();
-
- if(threads_num == 0)
- threads_num = system_cpu_thread_count();
-
- threads.resize(threads_num);
-
- for(size_t i = 0; i < threads.size(); i++)
- threads[i] = new thread(function_bind(&CPUDevice::thread_run, this, i));
}
~CPUDevice()
{
- tasks.stop();
-
- foreach(thread *t, threads) {
- t->join();
- delete t;
- }
-
+ task_pool.stop();
kernel_globals_free(kg);
}
@@ -127,25 +113,21 @@ public:
#endif
}
- void thread_run(int t)
+ void thread_run(Task *task_, int thread_id)
{
- DeviceTask task;
-
- while(tasks.worker_wait_pop(task)) {
- if(task.type == DeviceTask::PATH_TRACE)
- thread_path_trace(task);
- else if(task.type == DeviceTask::TONEMAP)
- thread_tonemap(task);
- else if(task.type == DeviceTask::SHADER)
- thread_shader(task);
-
- tasks.worker_done();
- }
+ DeviceTask *task = (DeviceTask*)task_;
+
+ if(task->type == DeviceTask::PATH_TRACE)
+ thread_path_trace(*task);
+ else if(task->type == DeviceTask::TONEMAP)
+ thread_tonemap(*task);
+ else if(task->type == DeviceTask::SHADER)
+ thread_shader(*task);
}
void thread_path_trace(DeviceTask& task)
{
- if(tasks.worker_cancel())
+ if(task_pool.cancelled())
return;
#ifdef WITH_OSL
@@ -160,7 +142,7 @@ public:
kernel_cpu_optimized_path_trace(kg, (float*)task.buffer, (unsigned int*)task.rng_state,
task.sample, x, y, task.offset, task.stride);
- if(tasks.worker_cancel())
+ if(task_pool.cancelled())
break;
}
}
@@ -172,7 +154,7 @@ public:
kernel_cpu_path_trace(kg, (float*)task.buffer, (unsigned int*)task.rng_state,
task.sample, x, y, task.offset, task.stride);
- if(tasks.worker_cancel())
+ if(task_pool.cancelled())
break;
}
}
@@ -214,7 +196,7 @@ public:
for(int x = task.shader_x; x < task.shader_x + task.shader_w; x++) {
kernel_cpu_optimized_shader(kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x);
- if(tasks.worker_cancel())
+ if(task_pool.cancelled())
break;
}
}
@@ -224,7 +206,7 @@ public:
for(int x = task.shader_x; x < task.shader_x + task.shader_w; x++) {
kernel_cpu_shader(kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x);
- if(tasks.worker_cancel())
+ if(task_pool.cancelled())
break;
}
}
@@ -239,17 +221,22 @@ public:
{
/* split task into smaller ones, more than number of threads for uneven
workloads where some parts of the image render slower than others */
- task.split(tasks, threads.size()*10);
+ list<DeviceTask> tasks;
+
+ task.split(tasks, TaskScheduler::num_threads()*10);
+
+ foreach(DeviceTask& task, tasks)
+ task_pool.push(new DeviceTask(task));
}
void task_wait()
{
- tasks.wait_done();
+ task_pool.wait();
}
void task_cancel()
{
- tasks.cancel();
+ task_pool.cancel();
}
};
diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp
index 1f69f2c53fa..9f7d65e640b 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -257,13 +257,14 @@ public:
void task_add(DeviceTask& task)
{
- ThreadQueue<DeviceTask> tasks;
+ list<DeviceTask> tasks;
task.split(tasks, devices.size());
foreach(SubDevice& sub, devices) {
- DeviceTask subtask;
+ if(!tasks.empty()) {
+ DeviceTask subtask = tasks.front();
+ tasks.pop_front();
- if(tasks.worker_wait_pop(subtask)) {
if(task.buffer) subtask.buffer = sub.ptr_map[task.buffer];
if(task.rng_state) subtask.rng_state = sub.ptr_map[task.rng_state];
if(task.rgba) subtask.rgba = sub.ptr_map[task.rgba];
diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h
index 9a52531eec0..6c3ade1c531 100644
--- a/intern/cycles/kernel/kernel_accumulate.h
+++ b/intern/cycles/kernel/kernel_accumulate.h
@@ -266,7 +266,7 @@ __device_inline void path_radiance_accum_background(PathRadiance *L, float3 thro
#endif
}
-__device_inline float3 path_radiance_sum(PathRadiance *L)
+__device_inline float3 path_radiance_sum(KernelGlobals *kg, PathRadiance *L)
{
#ifdef __PASSES__
if(L->use_light_pass) {
@@ -283,9 +283,14 @@ __device_inline float3 path_radiance_sum(PathRadiance *L)
L->indirect_glossy *= L->indirect;
L->indirect_transmission *= L->indirect;
- return L->emission + L->background
+ float3 L_sum = L->emission
+ L->direct_diffuse + L->direct_glossy + L->direct_transmission
+ L->indirect_diffuse + L->indirect_glossy + L->indirect_transmission;
+
+ if(!kernel_data.background.transparent)
+ L_sum += L->background;
+
+ return L_sum;
}
else
return L->emission;
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index ff12e85375c..8ebac177277 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -223,6 +223,7 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R
path_radiance_init(&L, kernel_data.film.use_light_pass);
+ float min_ray_pdf = FLT_MAX;
float ray_pdf = 0.0f;
PathState state;
int rng_offset = PRNG_BASE_NUM;
@@ -239,13 +240,17 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R
/* eval background shader if nothing hit */
if(kernel_data.background.transparent && (state.flag & PATH_RAY_CAMERA)) {
L_transparent += average(throughput);
+
+#ifdef __PASSES__
+ if(!(kernel_data.film.pass_flag & PASS_BACKGROUND))
+#endif
+ break;
}
+
#ifdef __BACKGROUND__
- else {
- /* sample background shader */
- float3 L_background = indirect_background(kg, &ray, state.flag, ray_pdf);
- path_radiance_accum_background(&L, throughput, L_background, state.bounce);
- }
+ /* sample background shader */
+ float3 L_background = indirect_background(kg, &ray, state.flag, ray_pdf);
+ path_radiance_accum_background(&L, throughput, L_background, state.bounce);
#endif
break;
@@ -259,6 +264,18 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R
kernel_write_data_passes(kg, buffer, &L, &sd, sample, state.flag, throughput);
+ /* blurring of bsdf after bounces, for rays that have a small likelihood
+ of following this particular path (diffuse, rough glossy) */
+ if(kernel_data.integrator.filter_glossy != FLT_MAX) {
+ float blur_pdf = kernel_data.integrator.filter_glossy*min_ray_pdf;
+
+ if(blur_pdf < 1.0f) {
+ float blur_roughness = sqrtf(1.0f - blur_pdf)*0.5f;
+ shader_bsdf_blur(kg, &sd, blur_roughness);
+ }
+ }
+
+ /* holdout */
#ifdef __HOLDOUT__
if((sd.flag & SD_HOLDOUT) && (state.flag & PATH_RAY_CAMERA)) {
float3 holdout_weight = shader_holdout_eval(kg, &sd);
@@ -378,8 +395,10 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R
path_radiance_bsdf_bounce(&L, &throughput, &bsdf_eval, bsdf_pdf, state.bounce, label);
/* set labels */
- if(!(label & LABEL_TRANSPARENT))
+ if(!(label & LABEL_TRANSPARENT)) {
ray_pdf = bsdf_pdf;
+ min_ray_pdf = fminf(bsdf_pdf, min_ray_pdf);
+ }
/* update path state */
path_state_next(kg, &state, label);
@@ -394,7 +413,7 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R
#endif
}
- float3 L_sum = path_radiance_sum(&L);
+ float3 L_sum = path_radiance_sum(kg, &L);
#ifdef __CLAMP_SAMPLE__
path_radiance_clamp(&L, &L_sum, kernel_data.integrator.sample_clamp);
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 391dcd12dad..102a2bb036d 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -516,6 +516,7 @@ typedef struct KernelIntegrator {
/* caustics */
int no_caustics;
+ float filter_glossy;
/* seed */
int seed;
@@ -525,9 +526,6 @@ typedef struct KernelIntegrator {
/* clamp */
float sample_clamp;
-
- /* padding */
- int pad;
} KernelIntegrator;
typedef struct KernelBVH {
diff --git a/intern/cycles/kernel/svm/svm_tex_coord.h b/intern/cycles/kernel/svm/svm_tex_coord.h
index f494b6d66e1..98f8734aed2 100644
--- a/intern/cycles/kernel/svm/svm_tex_coord.h
+++ b/intern/cycles/kernel/svm/svm_tex_coord.h
@@ -40,6 +40,15 @@ __device void svm_node_tex_coord(KernelGlobals *kg, ShaderData *sd, float *stack
data = sd->P;
break;
}
+ case NODE_TEXCO_NORMAL: {
+ if(sd->object != ~0) {
+ Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_INVERSE_TRANSFORM);
+ data = transform_direction(&tfm, sd->N);
+ }
+ else
+ data = sd->N;
+ break;
+ }
case NODE_TEXCO_CAMERA: {
Transform tfm = kernel_data.cam.worldtocamera;
@@ -85,6 +94,15 @@ __device void svm_node_tex_coord_bump_dx(KernelGlobals *kg, ShaderData *sd, floa
data = sd->P + sd->dP.dx;
break;
}
+ case NODE_TEXCO_NORMAL: {
+ if(sd->object != ~0) {
+ Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_INVERSE_TRANSFORM);
+ data = transform_direction(&tfm, sd->N);
+ }
+ else
+ data = sd->N;
+ break;
+ }
case NODE_TEXCO_CAMERA: {
Transform tfm = kernel_data.cam.worldtocamera;
@@ -133,6 +151,15 @@ __device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, ShaderData *sd, floa
data = sd->P + sd->dP.dy;
break;
}
+ case NODE_TEXCO_NORMAL: {
+ if(sd->object != ~0) {
+ Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_INVERSE_TRANSFORM);
+ data = normalize(transform_direction(&tfm, sd->N));
+ }
+ else
+ data = sd->N;
+ break;
+ }
case NODE_TEXCO_CAMERA: {
Transform tfm = kernel_data.cam.worldtocamera;
diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h
index 68eb39bdd29..fa7c211b5f9 100644
--- a/intern/cycles/kernel/svm/svm_types.h
+++ b/intern/cycles/kernel/svm/svm_types.h
@@ -119,6 +119,7 @@ typedef enum NodeLightPath {
} NodeLightPath;
typedef enum NodeTexCoord {
+ NODE_TEXCO_NORMAL,
NODE_TEXCO_OBJECT,
NODE_TEXCO_CAMERA,
NODE_TEXCO_WINDOW,
diff --git a/intern/cycles/render/integrator.cpp b/intern/cycles/render/integrator.cpp
index 6e6d30f3879..c1f066df10c 100644
--- a/intern/cycles/render/integrator.cpp
+++ b/intern/cycles/render/integrator.cpp
@@ -41,6 +41,7 @@ Integrator::Integrator()
transparent_shadows = false;
no_caustics = false;
+ filter_glossy = 0.0f;
seed = 0;
layer_flag = ~0;
sample_clamp = 0.0f;
@@ -81,6 +82,8 @@ void Integrator::device_update(Device *device, DeviceScene *dscene)
kintegrator->transparent_shadows = transparent_shadows;
kintegrator->no_caustics = no_caustics;
+ kintegrator->filter_glossy = (filter_glossy == 0.0f)? FLT_MAX: 1.0f/filter_glossy;
+
kintegrator->seed = hash_int(seed);
kintegrator->layer_flag = layer_flag << PATH_RAY_LAYER_SHIFT;
@@ -119,6 +122,7 @@ bool Integrator::modified(const Integrator& integrator)
transparent_probalistic == integrator.transparent_probalistic &&
transparent_shadows == integrator.transparent_shadows &&
no_caustics == integrator.no_caustics &&
+ filter_glossy == integrator.filter_glossy &&
layer_flag == integrator.layer_flag &&
seed == integrator.seed &&
sample_clamp == integrator.sample_clamp);
diff --git a/intern/cycles/render/integrator.h b/intern/cycles/render/integrator.h
index abbbaca894c..0817fcaa457 100644
--- a/intern/cycles/render/integrator.h
+++ b/intern/cycles/render/integrator.h
@@ -41,6 +41,7 @@ public:
bool transparent_shadows;
bool no_caustics;
+ float filter_glossy;
int seed;
int layer_flag;
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index a7eb365f983..0ce16e65621 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -43,6 +43,7 @@ Mesh::Mesh()
transform_applied = false;
transform_negative_scaled = false;
displacement_method = DISPLACE_BUMP;
+ bounds = BoundBox::empty;
bvh = NULL;
@@ -96,7 +97,7 @@ void Mesh::add_triangle(int v0, int v1, int v2, int shader_, bool smooth_)
void Mesh::compute_bounds()
{
- BoundBox bnds;
+ BoundBox bnds = BoundBox::empty;
size_t verts_size = verts.size();
for(size_t i = 0; i < verts_size; i++)
@@ -697,6 +698,8 @@ void MeshManager::device_update(Device *device, DeviceScene *dscene, Scene *scen
progress.set_status(msg, "Building BVH");
mesh->compute_bvh(&scene->params, progress);
+
+ i++;
}
if(progress.get_cancel()) return;
@@ -704,8 +707,6 @@ void MeshManager::device_update(Device *device, DeviceScene *dscene, Scene *scen
mesh->need_update = false;
mesh->need_update_rebuild = false;
}
-
- i++;
}
foreach(Shader *shader, scene->shaders)
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index db696993737..d71438ebae1 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -1503,6 +1503,7 @@ TextureCoordinateNode::TextureCoordinateNode()
{
add_input("Normal", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL, true);
add_output("Generated", SHADER_SOCKET_POINT);
+ add_output("Normal", SHADER_SOCKET_NORMAL);
add_output("UV", SHADER_SOCKET_POINT);
add_output("Object", SHADER_SOCKET_POINT);
add_output("Camera", SHADER_SOCKET_POINT);
@@ -1551,6 +1552,12 @@ void TextureCoordinateNode::compile(SVMCompiler& compiler)
}
}
+ out = output("Normal");
+ if(!out->links.empty()) {
+ compiler.stack_assign(out);
+ compiler.add_node(texco_node, NODE_TEXCO_NORMAL, out->stack_offset);
+ }
+
out = output("UV");
if(!out->links.empty()) {
int attr = compiler.attribute(Attribute::STD_UV);
diff --git a/intern/cycles/render/object.cpp b/intern/cycles/render/object.cpp
index 5f7a5810c09..28645d856a8 100644
--- a/intern/cycles/render/object.cpp
+++ b/intern/cycles/render/object.cpp
@@ -37,6 +37,7 @@ Object::Object()
tfm = transform_identity();
visibility = ~0;
pass_id = 0;
+ bounds = BoundBox::empty;
}
Object::~Object()
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index 676f42be790..34a0c0ff877 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -27,6 +27,7 @@
#include "util_foreach.h"
#include "util_function.h"
+#include "util_task.h"
#include "util_time.h"
CCL_NAMESPACE_BEGIN
@@ -37,6 +38,8 @@ Session::Session(const SessionParams& params_)
{
device_use_gl = ((params.device.type != DEVICE_CPU) && !params.background);
+ TaskScheduler::init(params.threads);
+
device = Device::create(params.device, params.background, params.threads);
buffers = new RenderBuffers(device);
display = new DisplayBuffer(device);
@@ -88,6 +91,8 @@ Session::~Session()
delete display;
delete scene;
delete device;
+
+ TaskScheduler::exit();
}
void Session::start()
diff --git a/intern/cycles/subd/subd_patch.cpp b/intern/cycles/subd/subd_patch.cpp
index ff477296c7e..f6acc358959 100644
--- a/intern/cycles/subd/subd_patch.cpp
+++ b/intern/cycles/subd/subd_patch.cpp
@@ -93,7 +93,7 @@ void LinearQuadPatch::eval(float3 *P, float3 *dPdu, float3 *dPdv, float u, float
BoundBox LinearQuadPatch::bound()
{
- BoundBox bbox;
+ BoundBox bbox = BoundBox::empty;
for(int i = 0; i < 4; i++)
bbox.grow(hull[i]);
@@ -115,7 +115,7 @@ void LinearTrianglePatch::eval(float3 *P, float3 *dPdu, float3 *dPdv, float u, f
BoundBox LinearTrianglePatch::bound()
{
- BoundBox bbox;
+ BoundBox bbox = BoundBox::empty;
for(int i = 0; i < 3; i++)
bbox.grow(hull[i]);
@@ -132,7 +132,7 @@ void BicubicPatch::eval(float3 *P, float3 *dPdu, float3 *dPdv, float u, float v)
BoundBox BicubicPatch::bound()
{
- BoundBox bbox;
+ BoundBox bbox = BoundBox::empty;
for(int i = 0; i < 16; i++)
bbox.grow(hull[i]);
@@ -152,7 +152,7 @@ void BicubicTangentPatch::eval(float3 *P, float3 *dPdu, float3 *dPdv, float u, f
BoundBox BicubicTangentPatch::bound()
{
- BoundBox bbox;
+ BoundBox bbox = BoundBox::empty;
for(int i = 0; i < 16; i++)
bbox.grow(hull[i]);
@@ -205,7 +205,7 @@ void GregoryQuadPatch::eval(float3 *P, float3 *dPdu, float3 *dPdv, float u, floa
BoundBox GregoryQuadPatch::bound()
{
- BoundBox bbox;
+ BoundBox bbox = BoundBox::empty;
for(int i = 0; i < 20; i++)
bbox.grow(hull[i]);
@@ -276,7 +276,7 @@ void GregoryTrianglePatch::eval(float3 *P, float3 *dPdu, float3 *dPdv, float u,
BoundBox GregoryTrianglePatch::bound()
{
- BoundBox bbox;
+ BoundBox bbox = BoundBox::empty;
for(int i = 0; i < 20; i++)
bbox.grow(hull[i]);
diff --git a/intern/cycles/util/CMakeLists.txt b/intern/cycles/util/CMakeLists.txt
index 9182ee4cbe1..87bd84b4e0f 100644
--- a/intern/cycles/util/CMakeLists.txt
+++ b/intern/cycles/util/CMakeLists.txt
@@ -15,6 +15,7 @@ set(SRC
util_path.cpp
util_string.cpp
util_system.cpp
+ util_task.cpp
util_time.cpp
util_transform.cpp
)
@@ -50,6 +51,7 @@ set(SRC_HEADERS
util_set.h
util_string.h
util_system.h
+ util_task.h
util_thread.h
util_time.h
util_transform.h
diff --git a/intern/cycles/util/util_boundbox.h b/intern/cycles/util/util_boundbox.h
index bb1df0b220f..9511b48e103 100644
--- a/intern/cycles/util/util_boundbox.h
+++ b/intern/cycles/util/util_boundbox.h
@@ -23,6 +23,7 @@
#include <float.h>
#include "util_math.h"
+#include "util_string.h"
#include "util_transform.h"
#include "util_types.h"
@@ -35,45 +36,81 @@ class BoundBox
public:
float3 min, max;
- BoundBox(void)
+ __forceinline BoundBox()
{
- min = make_float3(FLT_MAX, FLT_MAX, FLT_MAX);
- max = make_float3(-FLT_MAX, -FLT_MAX, -FLT_MAX);
}
- BoundBox(const float3& min_, const float3& max_)
+ __forceinline BoundBox(const float3& pt)
+ : min(pt), max(pt)
+ {
+ }
+
+ __forceinline BoundBox(const float3& min_, const float3& max_)
: min(min_), max(max_)
{
}
- void grow(const float3& pt)
+ static struct empty_t {} empty;
+
+ __forceinline BoundBox(empty_t)
+ : min(make_float3(FLT_MAX, FLT_MAX, FLT_MAX)), max(make_float3(-FLT_MAX, -FLT_MAX, -FLT_MAX))
+ {
+ }
+
+ __forceinline void grow(const float3& pt)
{
min = ccl::min(min, pt);
max = ccl::max(max, pt);
}
- void grow(const BoundBox& bbox)
+ __forceinline void grow(const BoundBox& bbox)
{
grow(bbox.min);
grow(bbox.max);
}
- void intersect(const BoundBox& bbox)
+ __forceinline void intersect(const BoundBox& bbox)
{
min = ccl::max(min, bbox.min);
max = ccl::min(max, bbox.max);
}
- float area(void) const
+ /* todo: avoid using this */
+ __forceinline float safe_area() const
{
- if(!valid())
+ if(!((min.x <= max.x) && (min.y <= max.y) && (min.z <= max.z)))
return 0.0f;
+ return area();
+ }
+
+ __forceinline float area() const
+ {
+ return half_area()*2.0f;
+ }
+
+ __forceinline float half_area() const
+ {
float3 d = max - min;
- return dot(d, d)*2.0f;
+ return (d.x*d.z + d.y*d.z + d.x*d.y);
+ }
+
+ __forceinline float3 center() const
+ {
+ return 0.5f*(min + max);
}
- bool valid(void) const
+ __forceinline float3 center2() const
+ {
+ return min + max;
+ }
+
+ __forceinline float3 size() const
+ {
+ return max - min;
+ }
+
+ __forceinline bool valid() const
{
return (min.x <= max.x) && (min.y <= max.y) && (min.z <= max.z) &&
(isfinite(min.x) && isfinite(min.y) && isfinite(min.z)) &&
@@ -82,7 +119,7 @@ public:
BoundBox transformed(const Transform *tfm)
{
- BoundBox result;
+ BoundBox result = BoundBox::empty;
for(int i = 0; i < 8; i++) {
float3 p;
@@ -98,6 +135,31 @@ public:
}
};
+__forceinline BoundBox merge(const BoundBox& bbox, const float3& pt)
+{
+ return BoundBox(min(bbox.min, pt), max(bbox.max, pt));
+}
+
+__forceinline BoundBox merge(const BoundBox& a, const BoundBox& b)
+{
+ return BoundBox(min(a.min, b.min), max(a.max, b.max));
+}
+
+__forceinline BoundBox merge(const BoundBox& a, const BoundBox& b, const BoundBox& c, const BoundBox& d)
+{
+ return merge(merge(a, b), merge(c, d));
+}
+
+__forceinline BoundBox intersect(const BoundBox& a, const BoundBox& b)
+{
+ return BoundBox(max(a.min, b.min), min(a.max, b.max));
+}
+
+__forceinline BoundBox intersect(const BoundBox& a, const BoundBox& b, const BoundBox& c)
+{
+ return intersect(a, intersect(b, c));
+}
+
CCL_NAMESPACE_END
#endif /* __UTIL_BOUNDBOX_H__ */
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h
index 019dede07fa..53c1302b4a1 100644
--- a/intern/cycles/util/util_math.h
+++ b/intern/cycles/util/util_math.h
@@ -182,93 +182,74 @@ __device_inline float average(const float2 a)
__device_inline float2 operator-(const float2 a)
{
- float2 r = {-a.x, -a.y};
- return r;
+ return make_float2(-a.x, -a.y);
}
__device_inline float2 operator*(const float2 a, const float2 b)
{
- float2 r = {a.x*b.x, a.y*b.y};
- return r;
+ return make_float2(a.x*b.x, a.y*b.y);
}
__device_inline float2 operator*(const float2 a, float f)
{
- float2 r = {a.x*f, a.y*f};
- return r;
+ return make_float2(a.x*f, a.y*f);
}
__device_inline float2 operator*(float f, const float2 a)
{
- float2 r = {a.x*f, a.y*f};
- return r;
+ return make_float2(a.x*f, a.y*f);
}
__device_inline float2 operator/(float f, const float2 a)
{
- float2 r = {f/a.x, f/a.y};
- return r;
+ return make_float2(f/a.x, f/a.y);
}
__device_inline float2 operator/(const float2 a, float f)
{
float invf = 1.0f/f;
- float2 r = {a.x*invf, a.y*invf};
- return r;
+ return make_float2(a.x*invf, a.y*invf);
}
__device_inline float2 operator/(const float2 a, const float2 b)
{
- float2 r = {a.x/b.x, a.y/b.y};
- return r;
+ return make_float2(a.x/b.x, a.y/b.y);
}
__device_inline float2 operator+(const float2 a, const float2 b)
{
- float2 r = {a.x+b.x, a.y+b.y};
- return r;
+ return make_float2(a.x+b.x, a.y+b.y);
}
__device_inline float2 operator-(const float2 a, const float2 b)
{
- float2 r = {a.x-b.x, a.y-b.y};
- return r;
+ return make_float2(a.x-b.x, a.y-b.y);
}
__device_inline float2 operator+=(float2& a, const float2 b)
{
- a.x += b.x;
- a.y += b.y;
- return a;
+ return a = a + b;
}
__device_inline float2 operator*=(float2& a, const float2 b)
{
- a.x *= b.x;
- a.y *= b.y;
- return a;
+ return a = a * b;
}
__device_inline float2 operator*=(float2& a, float f)
{
- a.x *= f;
- a.y *= f;
- return a;
+ return a = a * f;
}
__device_inline float2 operator/=(float2& a, const float2 b)
{
- a.x /= b.x;
- a.y /= b.y;
- return a;
+ return a = a / b;
}
__device_inline float2 operator/=(float2& a, float f)
{
float invf = 1.0f/f;
- a.x *= invf;
- a.y *= invf;
- return a;
+ return a = a * invf;
}
@@ -314,14 +295,12 @@ __device_inline bool operator!=(const float2 a, const float2 b)
__device_inline float2 min(float2 a, float2 b)
{
- float2 r = {min(a.x, b.x), min(a.y, b.y)};
- return r;
+ return make_float2(min(a.x, b.x), min(a.y, b.y));
}
__device_inline float2 max(float2 a, float2 b)
{
- float2 r = {max(a.x, b.x), max(a.y, b.y)};
- return r;
+ return make_float2(max(a.x, b.x), max(a.y, b.y));
}
__device_inline float2 clamp(float2 a, float2 mn, float2 mx)
@@ -361,112 +340,78 @@ __device_inline float2 interp(float2 a, float2 b, float t)
/* Float3 Vector */
-__device_inline bool is_zero(const float3 a)
-{
- return (a.x == 0.0f && a.y == 0.0f && a.z == 0.0f);
-}
-
-__device_inline float average(const float3 a)
-{
- return (a.x + a.y + a.z)*(1.0f/3.0f);
-}
-
#ifndef __KERNEL_OPENCL__
__device_inline float3 operator-(const float3 a)
{
- float3 r = make_float3(-a.x, -a.y, -a.z);
- return r;
+ return make_float3(-a.x, -a.y, -a.z);
}
__device_inline float3 operator*(const float3 a, const float3 b)
{
- float3 r = make_float3(a.x*b.x, a.y*b.y, a.z*b.z);
- return r;
+ return make_float3(a.x*b.x, a.y*b.y, a.z*b.z);
}
__device_inline float3 operator*(const float3 a, float f)
{
- float3 r = make_float3(a.x*f, a.y*f, a.z*f);
- return r;
+ return make_float3(a.x*f, a.y*f, a.z*f);
}
__device_inline float3 operator*(float f, const float3 a)
{
- float3 r = make_float3(a.x*f, a.y*f, a.z*f);
- return r;
+ return make_float3(a.x*f, a.y*f, a.z*f);
}
__device_inline float3 operator/(float f, const float3 a)
{
- float3 r = make_float3(f/a.x, f/a.y, f/a.z);
- return r;
+ return make_float3(f/a.x, f/a.y, f/a.z);
}
__device_inline float3 operator/(const float3 a, float f)
{
float invf = 1.0f/f;
- float3 r = make_float3(a.x*invf, a.y*invf, a.z*invf);
- return r;
+ return make_float3(a.x*invf, a.y*invf, a.z*invf);
}
__device_inline float3 operator/(const float3 a, const float3 b)
{
- float3 r = make_float3(a.x/b.x, a.y/b.y, a.z/b.z);
- return r;
+ return make_float3(a.x/b.x, a.y/b.y, a.z/b.z);
}
__device_inline float3 operator+(const float3 a, const float3 b)
{
- float3 r = make_float3(a.x+b.x, a.y+b.y, a.z+b.z);
- return r;
+ return make_float3(a.x+b.x, a.y+b.y, a.z+b.z);
}
__device_inline float3 operator-(const float3 a, const float3 b)
{
- float3 r = make_float3(a.x-b.x, a.y-b.y, a.z-b.z);
- return r;
+ return make_float3(a.x-b.x, a.y-b.y, a.z-b.z);
}
__device_inline float3 operator+=(float3& a, const float3 b)
{
- a.x += b.x;
- a.y += b.y;
- a.z += b.z;
- return a;
+ return a = a + b;
}
__device_inline float3 operator*=(float3& a, const float3 b)
{
- a.x *= b.x;
- a.y *= b.y;
- a.z *= b.z;
- return a;
+ return a = a * b;
}
__device_inline float3 operator*=(float3& a, float f)
{
- a.x *= f;
- a.y *= f;
- a.z *= f;
- return a;
+ return a = a * f;
}
__device_inline float3 operator/=(float3& a, const float3 b)
{
- a.x /= b.x;
- a.y /= b.y;
- a.z /= b.z;
- return a;
+ return a = a / b;
}
__device_inline float3 operator/=(float3& a, float f)
{
float invf = 1.0f/f;
- a.x *= invf;
- a.y *= invf;
- a.z *= invf;
- return a;
+ return a = a * invf;
}
__device_inline float dot(const float3 a, const float3 b)
@@ -506,7 +451,11 @@ __device_inline float3 normalize_len(const float3 a, float *t)
__device_inline bool operator==(const float3 a, const float3 b)
{
+#ifdef __KERNEL_SSE__
+ return (_mm_movemask_ps(_mm_cmpeq_ps(a.m128, b.m128)) & 7) == 7;
+#else
return (a.x == b.x && a.y == b.y && a.z == b.z);
+#endif
}
__device_inline bool operator!=(const float3 a, const float3 b)
@@ -516,14 +465,20 @@ __device_inline bool operator!=(const float3 a, const float3 b)
__device_inline float3 min(float3 a, float3 b)
{
- float3 r = make_float3(min(a.x, b.x), min(a.y, b.y), min(a.z, b.z));
- return r;
+#ifdef __KERNEL_SSE__
+ return _mm_min_ps(a.m128, b.m128);
+#else
+ return make_float3(min(a.x, b.x), min(a.y, b.y), min(a.z, b.z));
+#endif
}
__device_inline float3 max(float3 a, float3 b)
{
- float3 r = make_float3(max(a.x, b.x), max(a.y, b.y), max(a.z, b.z));
- return r;
+#ifdef __KERNEL_SSE__
+ return _mm_max_ps(a.m128, b.m128);
+#else
+ return make_float3(max(a.x, b.x), max(a.y, b.y), max(a.z, b.z));
+#endif
}
__device_inline float3 clamp(float3 a, float3 mn, float3 mx)
@@ -533,7 +488,12 @@ __device_inline float3 clamp(float3 a, float3 mn, float3 mx)
__device_inline float3 fabs(float3 a)
{
+#ifdef __KERNEL_SSE__
+ __m128 mask = _mm_castsi128_ps(_mm_set1_epi32(0x7fffffff));
+ return _mm_and_ps(a.m128, mask);
+#else
return make_float3(fabsf(a.x), fabsf(a.y), fabsf(a.z));
+#endif
}
#endif
@@ -555,6 +515,16 @@ __device_inline void print_float3(const char *label, const float3& a)
printf("%s: %.8f %.8f %.8f\n", label, a.x, a.y, a.z);
}
+__device_inline float3 rcp(const float3& a)
+{
+#ifdef __KERNEL_SSE__
+ float4 r = _mm_rcp_ps(a.m128);
+ return _mm_sub_ps(_mm_add_ps(r, r), _mm_mul_ps(_mm_mul_ps(r, r), a));
+#else
+ return make_float3(1.0f/a.x, 1.0f/a.y, 1.0f/a.z);
+#endif
+}
+
#endif
__device_inline float3 interp(float3 a, float3 b, float t)
@@ -562,122 +532,257 @@ __device_inline float3 interp(float3 a, float3 b, float t)
return a + t*(b - a);
}
+__device_inline bool is_zero(const float3 a)
+{
+#ifdef __KERNEL_SSE__
+ return a == make_float3(0.0f);
+#else
+ return (a.x == 0.0f && a.y == 0.0f && a.z == 0.0f);
+#endif
+}
+
+__device_inline float reduce_add(const float3 a)
+{
+#ifdef __KERNEL_SSE__
+ return (a.x + a.y + a.z);
+#else
+ return (a.x + a.y + a.z);
+#endif
+}
+
+__device_inline float average(const float3 a)
+{
+ return reduce_add(a)*(1.0f/3.0f);
+}
+
/* Float4 Vector */
-#ifndef __KERNEL_OPENCL__
+#ifdef __KERNEL_SSE__
-__device_inline bool is_zero(const float4& a)
+template<size_t index_0, size_t index_1, size_t index_2, size_t index_3> __forceinline const float4 shuffle(const float4& b)
{
- return (a.x == 0.0f && a.y == 0.0f && a.z == 0.0f && a.w == 0.0f);
+ return _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(b), _MM_SHUFFLE(index_3, index_2, index_1, index_0)));
}
-__device_inline float average(const float4& a)
+template<> __forceinline const float4 shuffle<0, 0, 2, 2>(const float4& b)
{
- return (a.x + a.y + a.z + a.w)*(1.0f/4.0f);
+ return _mm_moveldup_ps(b);
}
+template<> __forceinline const float4 shuffle<1, 1, 3, 3>(const float4& b)
+{
+ return _mm_movehdup_ps(b);
+}
+
+template<> __forceinline const float4 shuffle<0, 1, 0, 1>(const float4& b)
+{
+ return _mm_castpd_ps(_mm_movedup_pd(_mm_castps_pd(b)));
+}
+
+#endif
+
+#ifndef __KERNEL_OPENCL__
+
__device_inline float4 operator-(const float4& a)
{
- float4 r = {-a.x, -a.y, -a.z, -a.w};
- return r;
+#ifdef __KERNEL_SSE__
+ __m128 mask = _mm_castsi128_ps(_mm_set1_epi32(0x80000000));
+ return _mm_xor_ps(a.m128, mask);
+#else
+ return make_float4(-a.x, -a.y, -a.z, -a.w);
+#endif
}
__device_inline float4 operator*(const float4& a, const float4& b)
{
- float4 r = {a.x*b.x, a.y*b.y, a.z*b.z, a.w*b.w};
- return r;
+#ifdef __KERNEL_SSE__
+ return _mm_mul_ps(a.m128, b.m128);
+#else
+ return make_float4(a.x*b.x, a.y*b.y, a.z*b.z, a.w*b.w);
+#endif
}
__device_inline float4 operator*(const float4& a, float f)
{
- float4 r = {a.x*f, a.y*f, a.z*f, a.w*f};
- return r;
+#ifdef __KERNEL_SSE__
+ return a * make_float4(f);
+#else
+ return make_float4(a.x*f, a.y*f, a.z*f, a.w*f);
+#endif
}
__device_inline float4 operator*(float f, const float4& a)
{
- float4 r = {a.x*f, a.y*f, a.z*f, a.w*f};
- return r;
+ return a * f;
+}
+
+__device_inline float4 rcp(const float4& a)
+{
+#ifdef __KERNEL_SSE__
+ float4 r = _mm_rcp_ps(a.m128);
+ return _mm_sub_ps(_mm_add_ps(r, r), _mm_mul_ps(_mm_mul_ps(r, r), a));
+#else
+ return make_float4(1.0f/a.x, 1.0f/a.y, 1.0f/a.z, 1.0f/a.w);
+#endif
}
__device_inline float4 operator/(const float4& a, float f)
{
- float invf = 1.0f/f;
- float4 r = {a.x*invf, a.y*invf, a.z*invf, a.w*invf};
- return r;
+ return a * (1.0f/f);
}
__device_inline float4 operator/(const float4& a, const float4& b)
{
- float4 r = {a.x/b.x, a.y/b.y, a.z/b.z, a.w/b.w};
- return r;
+#ifdef __KERNEL_SSE__
+ return a * rcp(b);
+#else
+ return make_float4(a.x/b.x, a.y/b.y, a.z/b.z, a.w/b.w);
+#endif
+
}
__device_inline float4 operator+(const float4& a, const float4& b)
{
- float4 r = {a.x+b.x, a.y+b.y, a.z+b.z, a.w+b.w};
- return r;
+#ifdef __KERNEL_SSE__
+ return _mm_add_ps(a.m128, b.m128);
+#else
+ return make_float4(a.x+b.x, a.y+b.y, a.z+b.z, a.w+b.w);
+#endif
}
__device_inline float4 operator-(const float4& a, const float4& b)
{
- float4 r = {a.x-b.x, a.y-b.y, a.z-b.z, a.w-b.w};
- return r;
+#ifdef __KERNEL_SSE__
+ return _mm_sub_ps(a.m128, b.m128);
+#else
+ return make_float4(a.x-b.x, a.y-b.y, a.z-b.z, a.w-b.w);
+#endif
}
__device_inline float4 operator+=(float4& a, const float4& b)
{
- a.x += b.x;
- a.y += b.y;
- a.z += b.z;
- a.w += b.w;
- return a;
+ return a = a + b;
}
__device_inline float4 operator*=(float4& a, const float4& b)
{
- a.x *= b.x;
- a.y *= b.y;
- a.z *= b.z;
- a.w *= b.w;
- return a;
+ return a = a * b;
}
__device_inline float4 operator/=(float4& a, float f)
{
- float invf = 1.0f/f;
- a.x *= invf;
- a.y *= invf;
- a.z *= invf;
- a.w *= invf;
- return a;
+ return a = a / f;
}
-__device_inline float dot(const float4& a, const float4& b)
+__device_inline int4 operator<(const float4& a, const float4& b)
{
- return a.x*b.x + a.y*b.y + a.z*b.z + a.w*b.w;
+#ifdef __KERNEL_SSE__
+ return _mm_cvtps_epi32(_mm_cmplt_ps(a.m128, b.m128)); /* todo: avoid cvt */
+#else
+ return make_int4(a.x < b.x, a.y < b.y, a.z < b.z, a.w < b.w);
+#endif
+}
+
+__device_inline int4 operator>=(float4 a, float4 b)
+{
+#ifdef __KERNEL_SSE__
+ return _mm_cvtps_epi32(_mm_cmpge_ps(a.m128, b.m128)); /* todo: avoid cvt */
+#else
+ return make_int4(a.x >= b.x, a.y >= b.y, a.z >= b.z, a.w >= b.w);
+#endif
+}
+
+__device_inline int4 operator<=(const float4& a, const float4& b)
+{
+#ifdef __KERNEL_SSE__
+ return _mm_cvtps_epi32(_mm_cmple_ps(a.m128, b.m128)); /* todo: avoid cvt */
+#else
+ return make_int4(a.x <= b.x, a.y <= b.y, a.z <= b.z, a.w <= b.w);
+#endif
+}
+
+__device_inline bool operator==(const float4 a, const float4 b)
+{
+#ifdef __KERNEL_SSE__
+ return (_mm_movemask_ps(_mm_cmpeq_ps(a.m128, b.m128)) & 15) == 15;
+#else
+ return (a.x == b.x && a.y == b.y && a.z == b.z && a.w == b.w);
+#endif
}
__device_inline float4 cross(const float4& a, const float4& b)
{
- float4 r = {a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x, 0.0f};
- return r;
+#ifdef __KERNEL_SSE__
+ return (shuffle<1,2,0,0>(a)*shuffle<2,0,1,0>(b)) - (shuffle<2,0,1,0>(a)*shuffle<1,2,0,0>(b));
+#else
+ return make_float4(a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x, 0.0f);
+#endif
}
__device_inline float4 min(float4 a, float4 b)
{
+#ifdef __KERNEL_SSE__
+ return _mm_min_ps(a.m128, b.m128);
+#else
return make_float4(min(a.x, b.x), min(a.y, b.y), min(a.z, b.z), min(a.w, b.w));
+#endif
}
__device_inline float4 max(float4 a, float4 b)
{
+#ifdef __KERNEL_SSE__
+ return _mm_max_ps(a.m128, b.m128);
+#else
return make_float4(max(a.x, b.x), max(a.y, b.y), max(a.z, b.z), max(a.w, b.w));
+#endif
}
#endif
#ifndef __KERNEL_GPU__
+__device_inline float4 select(const int4& mask, const float4& a, const float4& b)
+{
+#ifdef __KERNEL_SSE__
+ /* blendv is sse4, and apparently broken on vs2008 */
+ return _mm_or_ps(_mm_and_ps(_mm_cvtepi32_ps(mask), a), _mm_andnot_ps(_mm_cvtepi32_ps(mask), b)); /* todo: avoid cvt */
+#else
+ return make_float4((mask.x)? a.x: b.x, (mask.y)? a.y: b.y, (mask.z)? a.z: b.z, (mask.w)? a.w: b.w);
+#endif
+}
+
+__device_inline float4 reduce_min(const float4& a)
+{
+#ifdef __KERNEL_SSE__
+ float4 h = min(shuffle<1,0,3,2>(a), a);
+ return min(shuffle<2,3,0,1>(h), h);
+#else
+ return make_float4(min(min(a.x, a.y), min(a.z, a.w)));
+#endif
+}
+
+__device_inline float4 reduce_max(const float4& a)
+{
+#ifdef __KERNEL_SSE__
+ float4 h = max(shuffle<1,0,3,2>(a), a);
+ return max(shuffle<2,3,0,1>(h), h);
+#else
+ return make_float4(max(max(a.x, a.y), max(a.z, a.w)));
+#endif
+}
+
+#if 0
+__device_inline float4 reduce_add(const float4& a)
+{
+#ifdef __KERNEL_SSE__
+ float4 h = shuffle<1,0,3,2>(a) + a;
+ return shuffle<2,3,0,1>(h) + h;
+#else
+ return make_float4((a.x + a.y) + (a.z + a.w));
+#endif
+}
+#endif
+
__device_inline void print_float4(const char *label, const float4& a)
{
printf("%s: %.8f %.8f %.8f %.8f\n", label, a.x, a.y, a.z, a.w);
@@ -685,26 +790,77 @@ __device_inline void print_float4(const char *label, const float4& a)
#endif
+#ifndef __KERNEL_OPENCL__
+
+__device_inline bool is_zero(const float4& a)
+{
+#ifdef __KERNEL_SSE__
+ return a == make_float4(0.0f);
+#else
+ return (a.x == 0.0f && a.y == 0.0f && a.z == 0.0f && a.w == 0.0f);
+#endif
+}
+
+__device_inline float reduce_add(const float4& a)
+{
+#ifdef __KERNEL_SSE__
+ float4 h = shuffle<1,0,3,2>(a) + a;
+ return _mm_cvtss_f32(shuffle<2,3,0,1>(h) + h); /* todo: efficiency? */
+#else
+ return ((a.x + a.y) + (a.z + a.w));
+#endif
+}
+
+__device_inline float average(const float4& a)
+{
+ return reduce_add(a) * 0.25f;
+}
+
+__device_inline float dot(const float4& a, const float4& b)
+{
+ return reduce_add(a * b);
+}
+
+#endif
+
/* Int3 */
#ifndef __KERNEL_OPENCL__
+__device_inline int3 min(int3 a, int3 b)
+{
+#ifdef __KERNEL_SSE__
+ return _mm_min_epi32(a.m128, b.m128);
+#else
+ return make_int3(min(a.x, b.x), min(a.y, b.y), min(a.z, b.z));
+#endif
+}
+
__device_inline int3 max(int3 a, int3 b)
{
- int3 r = {max(a.x, b.x), max(a.y, b.y), max(a.z, b.z)};
- return r;
+#ifdef __KERNEL_SSE__
+ return _mm_max_epi32(a.m128, b.m128);
+#else
+ return make_int3(max(a.x, b.x), max(a.y, b.y), max(a.z, b.z));
+#endif
}
__device_inline int3 clamp(const int3& a, int mn, int mx)
{
- int3 r = {clamp(a.x, mn, mx), clamp(a.y, mn, mx), clamp(a.z, mn, mx)};
- return r;
+#ifdef __KERNEL_SSE__
+ return min(max(a, make_int3(mn)), make_int3(mx));
+#else
+ return make_int3(clamp(a.x, mn, mx), clamp(a.y, mn, mx), clamp(a.z, mn, mx));
+#endif
}
__device_inline int3 clamp(const int3& a, int3& mn, int mx)
{
- int3 r = {clamp(a.x, mn.x, mx), clamp(a.y, mn.y, mx), clamp(a.z, mn.z, mx)};
- return r;
+#ifdef __KERNEL_SSE__
+ return min(max(a, mn), make_int3(mx));
+#else
+ return make_int3(clamp(a.x, mn.x, mx), clamp(a.y, mn.y, mx), clamp(a.z, mn.z, mx));
+#endif
}
#endif
@@ -720,16 +876,63 @@ __device_inline void print_int3(const char *label, const int3& a)
/* Int4 */
-#ifndef __KERNEL_OPENCL__
+#ifndef __KERNEL_GPU__
-__device_inline int4 operator>=(float4 a, float4 b)
+__device_inline int4 operator+(const int4& a, const int4& b)
{
- return make_int4(a.x >= b.x, a.y >= b.y, a.z >= b.z, a.w >= b.w);
+#ifdef __KERNEL_SSE__
+ return _mm_add_epi32(a.m128, b.m128);
+#else
+ return make_int4(a.x+b.x, a.y+b.y, a.z+b.z, a.w+b.w);
+#endif
+}
+
+__device_inline int4 operator+=(int4& a, const int4& b)
+{
+ return a = a + b;
}
+__device_inline int4 operator>>(const int4& a, int i)
+{
+#ifdef __KERNEL_SSE__
+ return _mm_srai_epi32(a.m128, i);
+#else
+ return make_int4(a.x >> i, a.y >> i, a.z >> i, a.w >> i);
#endif
+}
-#ifndef __KERNEL_GPU__
+__device_inline int4 min(int4 a, int4 b)
+{
+#ifdef __KERNEL_SSE__
+ return _mm_min_epi32(a.m128, b.m128);
+#else
+ return make_int4(min(a.x, b.x), min(a.y, b.y), min(a.z, b.z), min(a.w, b.w));
+#endif
+}
+
+__device_inline int4 max(int4 a, int4 b)
+{
+#ifdef __KERNEL_SSE__
+ return _mm_max_epi32(a.m128, b.m128);
+#else
+ return make_int4(max(a.x, b.x), max(a.y, b.y), max(a.z, b.z), max(a.w, b.w));
+#endif
+}
+
+__device_inline int4 clamp(const int4& a, const int4& mn, const int4& mx)
+{
+ return min(max(a, mn), mx);
+}
+
+__device_inline int4 select(const int4& mask, const int4& a, const int4& b)
+{
+#ifdef __KERNEL_SSE__
+ __m128 m = _mm_cvtepi32_ps(mask);
+ return _mm_castps_si128(_mm_or_ps(_mm_and_ps(m, _mm_castsi128_ps(a)), _mm_andnot_ps(m, _mm_castsi128_ps(b)))); /* todo: avoid cvt */
+#else
+ return make_int4((mask.x)? a.x: b.x, (mask.y)? a.y: b.y, (mask.z)? a.z: b.z, (mask.w)? a.w: b.w);
+#endif
+}
__device_inline void print_int4(const char *label, const int4& a)
{
diff --git a/intern/cycles/util/util_thread.h b/intern/cycles/util/util_thread.h
index 6836be203f5..3d15b342fe5 100644
--- a/intern/cycles/util/util_thread.h
+++ b/intern/cycles/util/util_thread.h
@@ -69,133 +69,6 @@ protected:
bool joined;
};
-/* Thread Safe Queue to pass tasks from one thread to another. Tasks should be
- * pushed into the queue, while the worker thread waits to pop the next task
- * off the queue. Once all tasks are into the queue, calling stop() will stop
- * the worker threads from waiting for more tasks once all tasks are done. */
-
-template<typename T> class ThreadQueue
-{
-public:
- ThreadQueue()
- {
- tot = 0;
- tot_done = 0;
- do_stop = false;
- do_cancel = false;
- }
-
- /* Main thread functions */
-
- /* push a task to be executed */
- void push(const T& value)
- {
- thread_scoped_lock lock(queue_mutex);
- queue.push(value);
- tot++;
- lock.unlock();
-
- queue_cond.notify_one();
- }
-
- /* wait until all tasks are done */
- void wait_done()
- {
- thread_scoped_lock lock(done_mutex);
-
- while(tot_done != tot)
- done_cond.wait(lock);
- }
-
- /* stop all worker threads */
- void stop()
- {
- clear();
- do_stop = true;
- queue_cond.notify_all();
- }
-
- /* cancel all tasks, but keep worker threads running */
- void cancel()
- {
- clear();
- do_cancel = true;
- wait_done();
- do_cancel = false;
- }
-
- /* Worker thread functions
- *
- * while(queue.worker_wait_pop(task)) {
- * for(..) {
- * ... do work ...
- *
- * if(queue.worker_cancel())
- * break;
- * }
- *
- * queue.worker_done();
- * }
- */
-
- bool worker_wait_pop(T& value)
- {
- thread_scoped_lock lock(queue_mutex);
-
- while(queue.empty() && !do_stop)
- queue_cond.wait(lock);
-
- if(queue.empty())
- return false;
-
- value = queue.front();
- queue.pop();
-
- return true;
- }
-
- void worker_done()
- {
- thread_scoped_lock lock(done_mutex);
- tot_done++;
- lock.unlock();
-
- assert(tot_done <= tot);
-
- done_cond.notify_all();
- }
-
- bool worker_cancel()
- {
- return do_cancel;
- }
-
-protected:
- void clear()
- {
- thread_scoped_lock lock(queue_mutex);
-
- while(!queue.empty()) {
- thread_scoped_lock done_lock(done_mutex);
- tot_done++;
- done_lock.unlock();
-
- queue.pop();
- }
-
- done_cond.notify_all();
- }
-
- std::queue<T> queue;
- thread_mutex queue_mutex;
- thread_mutex done_mutex;
- thread_condition_variable queue_cond;
- thread_condition_variable done_cond;
- volatile bool do_stop;
- volatile bool do_cancel;
- volatile int tot, tot_done;
-};
-
/* Thread Local Storage
*
* Boost implementation is a bit slow, and Mac OS X __thread is not supported
diff --git a/intern/cycles/util/util_transform.cpp b/intern/cycles/util/util_transform.cpp
index 61bc36ae888..0fd26825911 100644
--- a/intern/cycles/util/util_transform.cpp
+++ b/intern/cycles/util/util_transform.cpp
@@ -129,23 +129,26 @@ static bool transform_matrix4_gj_inverse(float R[][4], float M[][4])
Transform transform_inverse(const Transform& tfm)
{
- union { Transform T; float M[4][4]; } R, M;
-
- R.T = transform_identity();
- M.T = tfm;
+ Transform tfmR = transform_identity();
+ float M[4][4], R[4][4];
- if(!transform_matrix4_gj_inverse(R.M, M.M)) {
+ memcpy(R, &tfmR, sizeof(R));
+ memcpy(M, &tfm, sizeof(M));
+
+ if(!transform_matrix4_gj_inverse(R, M)) {
/* matrix is degenerate (e.g. 0 scale on some axis), ideally we should
never be in this situation, but try to invert it anyway with tweak */
- M.M[0][0] += 1e-8f;
- M.M[1][1] += 1e-8f;
- M.M[2][2] += 1e-8f;
+ M[0][0] += 1e-8f;
+ M[1][1] += 1e-8f;
+ M[2][2] += 1e-8f;
- if(!transform_matrix4_gj_inverse(R.M, M.M))
+ if(!transform_matrix4_gj_inverse(R, M))
return transform_identity();
}
- return R.T;
+ memcpy(&tfmR, R, sizeof(R));
+
+ return tfmR;
}
CCL_NAMESPACE_END
diff --git a/intern/cycles/util/util_types.h b/intern/cycles/util/util_types.h
index efdda98571a..0451d877c45 100644
--- a/intern/cycles/util/util_types.h
+++ b/intern/cycles/util/util_types.h
@@ -36,23 +36,37 @@
#define __shared
#define __constant
-#ifdef __GNUC__
-#define __device_inline static inline __attribute__((always_inline))
-#else
+#if defined(_WIN32) && !defined(FREE_WINDOWS)
#define __device_inline static __forceinline
+#define __align(...) __declspec(align(__VA_ARGS__))
+#else
+#define __device_inline static inline __attribute__((always_inline))
+#define __forceinline inline __attribute__((always_inline))
+#define __align(...) __attribute__((aligned(__VA_ARGS__)))
+#endif
+
#endif
+/* Bitness */
+
+#if defined(__ppc64__) || defined(__PPC64__) || defined(__x86_64__) || defined(__ia64__) || defined(_M_X64)
+#define __KERNEL_64_BIT__
#endif
/* SIMD Types */
-/* not needed yet, will be for qbvh
-#ifndef __KERNEL_GPU__
+/* not enabled, globally applying it just gives slowdown,
+ * but useful for testing. */
+//#define __KERNEL_SSE__
+#ifdef __KERNEL_SSE__
-#include <emmintrin.h>
-#include <xmmintrin.h>
+#include <xmmintrin.h> /* SSE 1 */
+#include <emmintrin.h> /* SSE 2 */
+#include <pmmintrin.h> /* SSE 3 */
+#include <tmmintrin.h> /* SSE 3 */
+#include <smmintrin.h> /* SSE 4 */
-#endif*/
+#endif
#ifndef _WIN32
#ifndef __KERNEL_GPU__
@@ -97,6 +111,12 @@ typedef unsigned int uint32_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;
+#ifdef __KERNEL_64_BIT__
+typedef int64_t ssize_t;
+#else
+typedef int32_t ssize_t;
+#endif
+
#endif
/* Generic Memory Pointer */
@@ -108,89 +128,137 @@ typedef uint64_t device_ptr;
struct uchar2 {
uchar x, y;
- uchar operator[](int i) const { return *(&x + i); }
- uchar& operator[](int i) { return *(&x + i); }
+ __forceinline uchar operator[](int i) const { return *(&x + i); }
+ __forceinline uchar& operator[](int i) { return *(&x + i); }
};
struct uchar3 {
uchar x, y, z;
- uchar operator[](int i) const { return *(&x + i); }
- uchar& operator[](int i) { return *(&x + i); }
+ __forceinline uchar operator[](int i) const { return *(&x + i); }
+ __forceinline uchar& operator[](int i) { return *(&x + i); }
};
struct uchar4 {
uchar x, y, z, w;
- uchar operator[](int i) const { return *(&x + i); }
- uchar& operator[](int i) { return *(&x + i); }
+ __forceinline uchar operator[](int i) const { return *(&x + i); }
+ __forceinline uchar& operator[](int i) { return *(&x + i); }
};
struct int2 {
int x, y;
- int operator[](int i) const { return *(&x + i); }
- int& operator[](int i) { return *(&x + i); }
+ __forceinline int operator[](int i) const { return *(&x + i); }
+ __forceinline int& operator[](int i) { return *(&x + i); }
};
+#ifdef __KERNEL_SSE__
+struct __align(16) int3 {
+ union {
+ __m128i m128;
+ struct { int x, y, z, w; };
+ };
+
+ __forceinline int3() {}
+ __forceinline int3(const __m128i a) : m128(a) {}
+ __forceinline operator const __m128i&(void) const { return m128; }
+ __forceinline operator __m128i&(void) { return m128; }
+#else
struct int3 {
- int x, y, z;
+ int x, y, z, w;
+#endif
- int operator[](int i) const { return *(&x + i); }
- int& operator[](int i) { return *(&x + i); }
+ __forceinline int operator[](int i) const { return *(&x + i); }
+ __forceinline int& operator[](int i) { return *(&x + i); }
};
+#ifdef __KERNEL_SSE__
+struct __align(16) int4 {
+ union {
+ __m128i m128;
+ struct { int x, y, z, w; };
+ };
+
+ __forceinline int4() {}
+ __forceinline int4(const __m128i a) : m128(a) {}
+ __forceinline operator const __m128i&(void) const { return m128; }
+ __forceinline operator __m128i&(void) { return m128; }
+#else
struct int4 {
int x, y, z, w;
+#endif
- int operator[](int i) const { return *(&x + i); }
- int& operator[](int i) { return *(&x + i); }
+ __forceinline int operator[](int i) const { return *(&x + i); }
+ __forceinline int& operator[](int i) { return *(&x + i); }
};
struct uint2 {
uint x, y;
- uint operator[](int i) const { return *(&x + i); }
- uint& operator[](int i) { return *(&x + i); }
+ __forceinline uint operator[](uint i) const { return *(&x + i); }
+ __forceinline uint& operator[](uint i) { return *(&x + i); }
};
struct uint3 {
uint x, y, z;
- uint operator[](int i) const { return *(&x + i); }
- uint& operator[](int i) { return *(&x + i); }
+ __forceinline uint operator[](uint i) const { return *(&x + i); }
+ __forceinline uint& operator[](uint i) { return *(&x + i); }
};
struct uint4 {
uint x, y, z, w;
- uint operator[](int i) const { return *(&x + i); }
- uint& operator[](int i) { return *(&x + i); }
+ __forceinline uint operator[](uint i) const { return *(&x + i); }
+ __forceinline uint& operator[](uint i) { return *(&x + i); }
};
struct float2 {
float x, y;
- float operator[](int i) const { return *(&x + i); }
- float& operator[](int i) { return *(&x + i); }
+ __forceinline float operator[](int i) const { return *(&x + i); }
+ __forceinline float& operator[](int i) { return *(&x + i); }
};
+#ifdef __KERNEL_SSE__
+struct __align(16) float3 {
+ union {
+ __m128 m128;
+ struct { float x, y, z, w; };
+ };
+
+ __forceinline float3() {}
+ __forceinline float3(const __m128 a) : m128(a) {}
+ __forceinline operator const __m128&(void) const { return m128; }
+ __forceinline operator __m128&(void) { return m128; }
+#else
struct float3 {
- float x, y, z;
-
-#ifdef WITH_OPENCL
- float w;
+ float x, y, z, w;
#endif
- float operator[](int i) const { return *(&x + i); }
- float& operator[](int i) { return *(&x + i); }
+ __forceinline float operator[](int i) const { return *(&x + i); }
+ __forceinline float& operator[](int i) { return *(&x + i); }
};
+#ifdef __KERNEL_SSE__
+struct __align(16) float4 {
+ union {
+ __m128 m128;
+ struct { float x, y, z, w; };
+ };
+
+ __forceinline float4() {}
+ __forceinline float4(const __m128 a) : m128(a) {}
+ __forceinline operator const __m128&(void) const { return m128; }
+ __forceinline operator __m128&(void) { return m128; }
+#else
struct float4 {
float x, y, z, w;
+#endif
- float operator[](int i) const { return *(&x + i); }
- float& operator[](int i) { return *(&x + i); }
+ __forceinline float operator[](int i) const { return *(&x + i); }
+ __forceinline float& operator[](int i) { return *(&x + i); }
};
#endif
@@ -201,87 +269,179 @@ struct float4 {
*
* OpenCL does not support C++ class, so we use these instead. */
-__device uchar2 make_uchar2(uchar x, uchar y)
+__device_inline uchar2 make_uchar2(uchar x, uchar y)
{
uchar2 a = {x, y};
return a;
}
-__device uchar3 make_uchar3(uchar x, uchar y, uchar z)
+__device_inline uchar3 make_uchar3(uchar x, uchar y, uchar z)
{
uchar3 a = {x, y, z};
return a;
}
-__device uchar4 make_uchar4(uchar x, uchar y, uchar z, uchar w)
+__device_inline uchar4 make_uchar4(uchar x, uchar y, uchar z, uchar w)
{
uchar4 a = {x, y, z, w};
return a;
}
-__device int2 make_int2(int x, int y)
+__device_inline int2 make_int2(int x, int y)
{
int2 a = {x, y};
return a;
}
-__device int3 make_int3(int x, int y, int z)
+__device_inline int3 make_int3(int x, int y, int z)
{
- int3 a = {x, y, z};
+#ifdef __KERNEL_SSE__
+ int3 a;
+ a.m128 = _mm_set_epi32(0, z, y, x);
+#else
+ int3 a = {x, y, z, 0};
+#endif
+
return a;
}
-__device int4 make_int4(int x, int y, int z, int w)
+__device_inline int4 make_int4(int x, int y, int z, int w)
{
+#ifdef __KERNEL_SSE__
+ int4 a;
+ a.m128 = _mm_set_epi32(w, z, y, x);
+#else
int4 a = {x, y, z, w};
+#endif
+
return a;
}
-__device uint2 make_uint2(uint x, uint y)
+__device_inline uint2 make_uint2(uint x, uint y)
{
uint2 a = {x, y};
return a;
}
-__device uint3 make_uint3(uint x, uint y, uint z)
+__device_inline uint3 make_uint3(uint x, uint y, uint z)
{
uint3 a = {x, y, z};
return a;
}
-__device uint4 make_uint4(uint x, uint y, uint z, uint w)
+__device_inline uint4 make_uint4(uint x, uint y, uint z, uint w)
{
uint4 a = {x, y, z, w};
return a;
}
-__device float2 make_float2(float x, float y)
+__device_inline float2 make_float2(float x, float y)
{
float2 a = {x, y};
return a;
}
-__device float3 make_float3(float x, float y, float z)
+__device_inline float3 make_float3(float x, float y, float z)
{
-#ifdef WITH_OPENCL
- float3 a = {x, y, z, 0.0f};
+#ifdef __KERNEL_SSE__
+ float3 a;
+ a.m128 = _mm_set_ps(0.0f, z, y, x);
#else
- float3 a = {x, y, z};
+ float3 a = {x, y, z, 0.0f};
#endif
+
return a;
}
-__device float4 make_float4(float x, float y, float z, float w)
+__device_inline float4 make_float4(float x, float y, float z, float w)
{
+#ifdef __KERNEL_SSE__
+ float4 a;
+ a.m128 = _mm_set_ps(w, z, y, x);
+#else
float4 a = {x, y, z, w};
+#endif
+
return a;
}
-__device int align_up(int offset, int alignment)
+__device_inline int align_up(int offset, int alignment)
{
return (offset + alignment - 1) & ~(alignment - 1);
}
+__device_inline int3 make_int3(int i)
+{
+#ifdef __KERNEL_SSE__
+ int3 a;
+ a.m128 = _mm_set1_epi32(i);
+#else
+ int3 a = {i, i, i, i};
+#endif
+
+ return a;
+}
+
+__device_inline int4 make_int4(int i)
+{
+#ifdef __KERNEL_SSE__
+ int4 a;
+ a.m128 = _mm_set1_epi32(i);
+#else
+ int4 a = {i, i, i, i};
+#endif
+
+ return a;
+}
+
+__device_inline float3 make_float3(float f)
+{
+#ifdef __KERNEL_SSE__
+ float3 a;
+ a.m128 = _mm_set1_ps(f);
+#else
+ float3 a = {f, f, f, f};
+#endif
+
+ return a;
+}
+
+__device_inline float4 make_float4(float f)
+{
+#ifdef __KERNEL_SSE__
+ float4 a;
+ a.m128 = _mm_set1_ps(f);
+#else
+ float4 a = {f, f, f, f};
+#endif
+
+ return a;
+}
+
+__device_inline float4 make_float4(const int4& i)
+{
+#ifdef __KERNEL_SSE__
+ float4 a;
+ a.m128 = _mm_cvtepi32_ps(i.m128);
+#else
+ float4 a = {(float)i.x, (float)i.y, (float)i.z, (float)i.w};
+#endif
+
+ return a;
+}
+
+__device_inline int4 make_int4(const float3& f)
+{
+#ifdef __KERNEL_SSE__
+ int4 a;
+ a.m128 = _mm_cvtps_epi32(f.m128);
+#else
+ int4 a = {(int)f.x, (int)f.y, (int)f.z, (int)f.w};
+#endif
+
+ return a;
+}
+
#endif
CCL_NAMESPACE_END
diff --git a/intern/ghost/GHOST_Rect.h b/intern/ghost/GHOST_Rect.h
index bcbcaded364..30d9d16b701 100644
--- a/intern/ghost/GHOST_Rect.h
+++ b/intern/ghost/GHOST_Rect.h
@@ -241,8 +241,10 @@ inline void GHOST_Rect::wrapPoint(GHOST_TInt32 &x, GHOST_TInt32 &y, GHOST_TInt32
GHOST_TInt32 h= getHeight();
/* highly unlikely but avoid eternal loop */
- if(w-ofs*2 <= 0 || h-ofs*2 <= 0)
+ if (w-ofs*2 <= 0 || h-ofs*2 <= 0) {
return;
+ }
+
while(x-ofs < m_l) x+= w-(ofs*2);
while(y-ofs < m_t) y+= h-(ofs*2);
while(x+ofs > m_r) x-= w-(ofs*2);
diff --git a/intern/ghost/intern/GHOST_NDOFManager.cpp b/intern/ghost/intern/GHOST_NDOFManager.cpp
index 694394afcde..e5f523ca8ef 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManager.cpp
@@ -286,7 +286,7 @@ bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short produ
}
if (m_buttonMask == 0)
- m_buttonMask = ~(-1 << m_buttonCount);
+ m_buttonMask = (int) ~(UINT_MAX << m_buttonCount);
#ifdef DEBUG_NDOF_BUTTONS
printf("ndof: %d buttons -> hex:%X\n", m_buttonCount, m_buttonMask);
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index 2a6a0df0ff4..bb3a1c66ddc 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -243,7 +243,7 @@ void *MEM_dupallocN(void *vmemh)
MemHead *memh= vmemh;
memh--;
- if(memh->mmap)
+ if (memh->mmap)
newp= MEM_mapallocN(memh->len, "dupli_mapalloc");
else
newp= MEM_mallocN(memh->len, "dupli_alloc");
@@ -265,8 +265,8 @@ void *MEM_reallocN(void *vmemh, size_t len)
memh--;
newp= MEM_mallocN(len, memh->name);
- if(newp) {
- if(len < memh->len)
+ if (newp) {
+ if (len < memh->len)
memcpy(newp, vmemh, len);
else
memcpy(newp, vmemh, memh->len);
@@ -311,14 +311,14 @@ void *MEM_mallocN(size_t len, const char *str)
memh= (MemHead *)malloc(len+sizeof(MemHead)+sizeof(MemTail));
- if(memh) {
+ if (memh) {
make_memhead_header(memh, len, str);
mem_unlock_thread();
- if(malloc_debug_memset && len)
+ if (malloc_debug_memset && len)
memset(memh+1, 255, len);
#ifdef DEBUG_MEMCOUNTER
- if(_mallocn_count==DEBUG_MEMCOUNTER_ERROR_VAL)
+ if (_mallocn_count==DEBUG_MEMCOUNTER_ERROR_VAL)
memcount_raise(__func__);
memh->_count= _mallocn_count++;
#endif
@@ -339,11 +339,11 @@ void *MEM_callocN(size_t len, const char *str)
memh= (MemHead *)calloc(len+sizeof(MemHead)+sizeof(MemTail),1);
- if(memh) {
+ if (memh) {
make_memhead_header(memh, len, str);
mem_unlock_thread();
#ifdef DEBUG_MEMCOUNTER
- if(_mallocn_count==DEBUG_MEMCOUNTER_ERROR_VAL)
+ if (_mallocn_count==DEBUG_MEMCOUNTER_ERROR_VAL)
memcount_raise(__func__);
memh->_count= _mallocn_count++;
#endif
@@ -366,14 +366,14 @@ void *MEM_mapallocN(size_t len, const char *str)
memh= mmap(NULL, len+sizeof(MemHead)+sizeof(MemTail),
PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANON, -1, 0);
- if(memh!=(MemHead *)-1) {
+ if (memh!=(MemHead *)-1) {
make_memhead_header(memh, len, str);
memh->mmap= 1;
mmap_in_use += len;
peak_mem = mmap_in_use > peak_mem ? mmap_in_use : peak_mem;
mem_unlock_thread();
#ifdef DEBUG_MEMCOUNTER
- if(_mallocn_count==DEBUG_MEMCOUNTER_ERROR_VAL)
+ if (_mallocn_count==DEBUG_MEMCOUNTER_ERROR_VAL)
memcount_raise(__func__);
memh->_count= _mallocn_count++;
#endif
@@ -406,9 +406,9 @@ static int compare_len(const void *p1, const void *p2)
const MemPrintBlock *pb1= (const MemPrintBlock*)p1;
const MemPrintBlock *pb2= (const MemPrintBlock*)p2;
- if(pb1->len < pb2->len)
+ if (pb1->len < pb2->len)
return 1;
- else if(pb1->len == pb2->len)
+ else if (pb1->len == pb2->len)
return 0;
else
return -1;
@@ -431,7 +431,7 @@ void MEM_printmemlist_stats(void)
membl = membase->first;
if (membl) membl = MEMNEXT(membl);
- while(membl) {
+ while (membl) {
pb->name= membl->name;
pb->len= membl->len;
pb->items= 1;
@@ -439,18 +439,18 @@ void MEM_printmemlist_stats(void)
totpb++;
pb++;
- if(membl->next)
+ if (membl->next)
membl= MEMNEXT(membl->next);
else break;
}
/* sort by name and add together blocks with the same name */
qsort(printblock, totpb, sizeof(MemPrintBlock), compare_name);
- for(a=0, b=0; a<totpb; a++) {
- if(a == b) {
+ for (a = 0, b=0; a<totpb; a++) {
+ if (a == b) {
continue;
}
- else if(strcmp(printblock[a].name, printblock[b].name) == 0) {
+ else if (strcmp(printblock[a].name, printblock[b].name) == 0) {
printblock[b].len += printblock[a].len;
printblock[b].items++;
}
@@ -465,7 +465,7 @@ void MEM_printmemlist_stats(void)
qsort(printblock, totpb, sizeof(MemPrintBlock), compare_len);
printf("\ntotal memory len: %.3f MB\n", (double)mem_in_use/(double)(1024*1024));
printf(" ITEMS TOTAL-MiB AVERAGE-KiB TYPE\n");
- for(a=0, pb=printblock; a<totpb; a++, pb++)
+ for (a = 0, pb=printblock; a<totpb; a++, pb++)
printf("%6d (%8.3f %8.3f) %s\n", pb->items, (double)pb->len/(double)(1024*1024), (double)pb->len/1024.0/(double)pb->items, pb->name);
free(printblock);
@@ -491,7 +491,7 @@ static void MEM_printmemlist_internal( int pydict )
print_error("# membase_debug.py\n");
print_error("membase = [\\\n");
}
- while(membl) {
+ while (membl) {
if (pydict) {
fprintf(stderr, "{'len':" SIZET_FORMAT ", 'name':'''%s''', 'pointer':'%p'},\\\n", SIZET_ARG(membl->len), membl->name, (void *)(membl+1));
} else {
@@ -501,7 +501,7 @@ static void MEM_printmemlist_internal( int pydict )
print_error("%s len: " SIZET_FORMAT " %p\n", membl->name, SIZET_ARG(membl->len), membl+1);
#endif
}
- if(membl->next)
+ if (membl->next)
membl= MEMNEXT(membl->next);
else break;
}
@@ -536,9 +536,9 @@ void MEM_callbackmemlist(void (*func)(void*)) {
membl = membase->first;
if (membl) membl = MEMNEXT(membl);
- while(membl) {
+ while (membl) {
func(membl+1);
- if(membl->next)
+ if (membl->next)
membl= MEMNEXT(membl->next);
else break;
}
@@ -554,13 +554,13 @@ short MEM_testN(void *vmemh) {
membl = membase->first;
if (membl) membl = MEMNEXT(membl);
- while(membl) {
+ while (membl) {
if (vmemh == membl+1) {
mem_unlock_thread();
return 1;
}
- if(membl->next)
+ if (membl->next)
membl= MEMNEXT(membl->next);
else break;
}
@@ -585,13 +585,13 @@ short MEM_freeN(void *vmemh) /* anders compileertie niet meer */
MemHead *memh= vmemh;
const char *name;
- if (memh == NULL){
+ if (memh == NULL) {
MemorY_ErroR("free","attempt to free NULL pointer");
/* print_error(err_stream, "%d\n", (memh+4000)->tag1); */
return(-1);
}
- if(sizeof(intptr_t)==8) {
+ if (sizeof(intptr_t)==8) {
if (((intptr_t) memh) & 0x7) {
MemorY_ErroR("free","attempt to free illegal pointer");
return(-1);
@@ -605,7 +605,7 @@ short MEM_freeN(void *vmemh) /* anders compileertie niet meer */
}
memh--;
- if(memh->tag1 == MEMFREE && memh->tag2 == MEMFREE) {
+ if (memh->tag1 == MEMFREE && memh->tag2 == MEMFREE) {
MemorY_ErroR(memh->name,"double free");
return(-1);
}
@@ -613,7 +613,7 @@ short MEM_freeN(void *vmemh) /* anders compileertie niet meer */
mem_lock_thread();
if ((memh->tag1 == MEMTAG1) && (memh->tag2 == MEMTAG2) && ((memh->len & 0x3) == 0)) {
memt = (MemTail *)(((char *) memh) + sizeof(MemHead) + memh->len);
- if (memt->tag3 == MEMTAG3){
+ if (memt->tag3 == MEMTAG3) {
memh->tag1 = MEMFREE;
memh->tag2 = MEMFREE;
@@ -628,7 +628,7 @@ short MEM_freeN(void *vmemh) /* anders compileertie niet meer */
error = 2;
MemorY_ErroR(memh->name,"end corrupt");
name = check_memlist(memh);
- if (name != NULL){
+ if (name != NULL) {
if (name != memh->name) MemorY_ErroR(name,"is also corrupt");
}
} else{
@@ -694,13 +694,13 @@ static void rem_memblock(MemHead *memh)
totblock--;
mem_in_use -= memh->len;
- if(memh->mmap) {
+ if (memh->mmap) {
mmap_in_use -= memh->len;
if (munmap(memh, memh->len + sizeof(MemHead) + sizeof(MemTail)))
printf("Couldn't unmap memory %s\n", memh->name);
}
else {
- if(malloc_debug_memset && memh->len)
+ if (malloc_debug_memset && memh->len)
memset(memh+1, 255, memh->len);
free(memh);
}
@@ -723,7 +723,7 @@ static const char *check_memlist(MemHead *memh)
forw = membase->first;
if (forw) forw = MEMNEXT(forw);
forwok = NULL;
- while(forw){
+ while (forw) {
if (forw->tag1 != MEMTAG1 || forw->tag2 != MEMTAG2) break;
forwok = forw;
if (forw->next) forw = MEMNEXT(forw->next);
@@ -733,7 +733,7 @@ static const char *check_memlist(MemHead *memh)
back = (MemHead *) membase->last;
if (back) back = MEMNEXT(back);
backok = NULL;
- while(back){
+ while (back) {
if (back->tag1 != MEMTAG1 || back->tag2 != MEMTAG2) break;
backok = back;
if (back->prev) back = MEMNEXT(back->prev);
@@ -742,13 +742,13 @@ static const char *check_memlist(MemHead *memh)
if (forw != back) return ("MORE THAN 1 MEMORYBLOCK CORRUPT");
- if (forw == NULL && back == NULL){
+ if (forw == NULL && back == NULL) {
/* geen foute headers gevonden dan maar op zoek naar memblock*/
forw = membase->first;
if (forw) forw = MEMNEXT(forw);
forwok = NULL;
- while(forw){
+ while (forw) {
if (forw == memh) break;
if (forw->tag1 != MEMTAG1 || forw->tag2 != MEMTAG2) break;
forwok = forw;
@@ -760,7 +760,7 @@ static const char *check_memlist(MemHead *memh)
back = (MemHead *) membase->last;
if (back) back = MEMNEXT(back);
backok = NULL;
- while(back){
+ while (back) {
if (back == memh) break;
if (back->tag1 != MEMTAG1 || back->tag2 != MEMTAG2) break;
backok = back;
@@ -772,10 +772,10 @@ static const char *check_memlist(MemHead *memh)
if (forwok) name = forwok->nextname;
else name = "No name found";
- if (forw == memh){
+ if (forw == memh) {
/* voor alle zekerheid wordt dit block maar uit de lijst gehaald */
- if (forwok){
- if (backok){
+ if (forwok) {
+ if (backok) {
forwok->next = (MemHead *)&backok->next;
backok->prev = (MemHead *)&forwok->next;
forwok->nextname = backok->name;
@@ -785,7 +785,7 @@ static const char *check_memlist(MemHead *memh)
/* membase->last = (struct Link *) &forwok->next; */
}
} else{
- if (backok){
+ if (backok) {
backok->prev = NULL;
membase->first = &backok->next;
} else{
diff --git a/intern/mikktspace/mikktspace.c b/intern/mikktspace/mikktspace.c
index 2036e601bcb..24c77c439a7 100644
--- a/intern/mikktspace/mikktspace.c
+++ b/intern/mikktspace/mikktspace.c
@@ -193,7 +193,7 @@ static STSpace AvgTSpace(const STSpace * pTS0, const STSpace * pTS1)
// this if is important. Due to floating point precision
// averaging when ts0==ts1 will cause a slight difference
// which results in tangent space splits later on
- if(pTS0->fMagS==pTS1->fMagS && pTS0->fMagT==pTS1->fMagT &&
+ if (pTS0->fMagS==pTS1->fMagS && pTS0->fMagT==pTS1->fMagT &&
veq(pTS0->vOs,pTS1->vOs) && veq(pTS0->vOt, pTS1->vOt))
{
ts_res.fMagS = pTS0->fMagS;
@@ -207,8 +207,8 @@ static STSpace AvgTSpace(const STSpace * pTS0, const STSpace * pTS1)
ts_res.fMagT = 0.5f*(pTS0->fMagT+pTS1->fMagT);
ts_res.vOs = vadd(pTS0->vOs,pTS1->vOs);
ts_res.vOt = vadd(pTS0->vOt,pTS1->vOt);
- if( VNotZero(ts_res.vOs) ) ts_res.vOs = Normalize(ts_res.vOs);
- if( VNotZero(ts_res.vOt) ) ts_res.vOt = Normalize(ts_res.vOt);
+ if ( VNotZero(ts_res.vOs) ) ts_res.vOs = Normalize(ts_res.vOs);
+ if ( VNotZero(ts_res.vOt) ) ts_res.vOt = Normalize(ts_res.vOt);
}
return ts_res;
@@ -246,7 +246,7 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre
const float fThresCos = (float) cos((fAngularThreshold*(float)M_PI)/180.0f);
// verify all call-backs have been set
- if( pContext->m_pInterface->m_getNumFaces==NULL ||
+ if ( pContext->m_pInterface->m_getNumFaces==NULL ||
pContext->m_pInterface->m_getNumVerticesOfFace==NULL ||
pContext->m_pInterface->m_getPosition==NULL ||
pContext->m_pInterface->m_getNormal==NULL ||
@@ -254,21 +254,21 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre
return TFALSE;
// count triangles on supported faces
- for(f=0; f<iNrFaces; f++)
+ for (f=0; f<iNrFaces; f++)
{
const int verts = pContext->m_pInterface->m_getNumVerticesOfFace(pContext, f);
- if(verts==3) ++iNrTrianglesIn;
+ if (verts==3) ++iNrTrianglesIn;
else if(verts==4) iNrTrianglesIn += 2;
}
- if(iNrTrianglesIn<=0) return TFALSE;
+ if (iNrTrianglesIn<=0) return TFALSE;
// allocate memory for an index list
piTriListIn = (int *) malloc(sizeof(int)*3*iNrTrianglesIn);
pTriInfos = (STriInfo *) malloc(sizeof(STriInfo)*iNrTrianglesIn);
- if(piTriListIn==NULL || pTriInfos==NULL)
+ if (piTriListIn==NULL || pTriInfos==NULL)
{
- if(piTriListIn!=NULL) free(piTriListIn);
- if(pTriInfos!=NULL) free(pTriInfos);
+ if (piTriListIn!=NULL) free(piTriListIn);
+ if (pTriInfos!=NULL) free(pTriInfos);
return TFALSE;
}
@@ -283,7 +283,7 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre
// Mark all degenerate triangles
iTotTris = iNrTrianglesIn;
iDegenTriangles = 0;
- for(t=0; t<iTotTris; t++)
+ for (t=0; t<iTotTris; t++)
{
const int i0 = piTriListIn[t*3+0];
const int i1 = piTriListIn[t*3+1];
@@ -291,7 +291,7 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre
const SVec3 p0 = GetPosition(pContext, i0);
const SVec3 p1 = GetPosition(pContext, i1);
const SVec3 p2 = GetPosition(pContext, i2);
- if(veq(p0,p1) || veq(p0,p2) || veq(p1,p2)) // degenerate
+ if (veq(p0,p1) || veq(p0,p2) || veq(p1,p2)) // degenerate
{
pTriInfos[t].iFlag |= MARK_DEGENERATE;
++iDegenTriangles;
@@ -317,10 +317,10 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre
iNrMaxGroups = iNrTrianglesIn*3;
pGroups = (SGroup *) malloc(sizeof(SGroup)*iNrMaxGroups);
piGroupTrianglesBuffer = (int *) malloc(sizeof(int)*iNrTrianglesIn*3);
- if(pGroups==NULL || piGroupTrianglesBuffer==NULL)
+ if (pGroups==NULL || piGroupTrianglesBuffer==NULL)
{
- if(pGroups!=NULL) free(pGroups);
- if(piGroupTrianglesBuffer!=NULL) free(piGroupTrianglesBuffer);
+ if (pGroups!=NULL) free(pGroups);
+ if (piGroupTrianglesBuffer!=NULL) free(piGroupTrianglesBuffer);
free(piTriListIn);
free(pTriInfos);
return TFALSE;
@@ -333,7 +333,7 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre
//
psTspace = (STSpace *) malloc(sizeof(STSpace)*iNrTSPaces);
- if(psTspace==NULL)
+ if (psTspace==NULL)
{
free(piTriListIn);
free(pTriInfos);
@@ -342,7 +342,7 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre
return TFALSE;
}
memset(psTspace, 0, sizeof(STSpace)*iNrTSPaces);
- for(t=0; t<iNrTSPaces; t++)
+ for (t=0; t<iNrTSPaces; t++)
{
psTspace[t].vOs.x=1.0f; psTspace[t].vOs.y=0.0f; psTspace[t].vOs.z=0.0f; psTspace[t].fMagS = 1.0f;
psTspace[t].vOt.x=0.0f; psTspace[t].vOt.y=1.0f; psTspace[t].vOt.z=0.0f; psTspace[t].fMagT = 1.0f;
@@ -359,7 +359,7 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre
free(pGroups);
free(piGroupTrianglesBuffer);
- if(!bRes) // if an allocation in GenerateTSpaces() failed
+ if (!bRes) // if an allocation in GenerateTSpaces() failed
{
// clean up and return false
free(pTriInfos); free(piTriListIn); free(psTspace);
@@ -376,10 +376,10 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre
free(pTriInfos); free(piTriListIn);
index = 0;
- for(f=0; f<iNrFaces; f++)
+ for (f=0; f<iNrFaces; f++)
{
const int verts = pContext->m_pInterface->m_getNumVerticesOfFace(pContext, f);
- if(verts!=3 && verts!=4) continue;
+ if (verts!=3 && verts!=4) continue;
// I've decided to let degenerate triangles and group-with-anythings
@@ -390,28 +390,28 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre
// (this is already the case for good triangles but not for
// degenerate ones and those with bGroupWithAnything==true)
bool bOrient = psTspace[index].bOrient;
- if(psTspace[index].iCounter == 0) // tspace was not derived from a group
+ if (psTspace[index].iCounter == 0) // tspace was not derived from a group
{
// look for a space created in GenerateTSpaces() by iCounter>0
bool bNotFound = true;
int i=1;
- while(i<verts && bNotFound)
+ while (i<verts && bNotFound)
{
- if(psTspace[index+i].iCounter > 0) bNotFound=false;
+ if (psTspace[index+i].iCounter > 0) bNotFound=false;
else ++i;
}
- if(!bNotFound) bOrient = psTspace[index+i].bOrient;
+ if (!bNotFound) bOrient = psTspace[index+i].bOrient;
}*/
// set data
- for(i=0; i<verts; i++)
+ for (i=0; i<verts; i++)
{
const STSpace * pTSpace = &psTspace[index];
float tang[] = {pTSpace->vOs.x, pTSpace->vOs.y, pTSpace->vOs.z};
float bitang[] = {pTSpace->vOt.x, pTSpace->vOt.y, pTSpace->vOt.z};
- if(pContext->m_pInterface->m_setTSpace!=NULL)
+ if (pContext->m_pInterface->m_setTSpace!=NULL)
pContext->m_pInterface->m_setTSpace(pContext, tang, bitang, pTSpace->fMagS, pTSpace->fMagT, pTSpace->bOrient, f, i);
- if(pContext->m_pInterface->m_setTSpaceBasic!=NULL)
+ if (pContext->m_pInterface->m_setTSpaceBasic!=NULL)
pContext->m_pInterface->m_setTSpaceBasic(pContext, tang, pTSpace->bOrient==TTRUE ? 1.0f : (-1.0f), f, i);
++index;
@@ -464,23 +464,23 @@ static void GenerateSharedVerticesIndexList(int piTriList_in_and_out[], const SM
int iMaxCount=0;
SVec3 vMin = GetPosition(pContext, 0), vMax = vMin, vDim;
float fMin, fMax;
- for(i=1; i<(iNrTrianglesIn*3); i++)
+ for (i=1; i<(iNrTrianglesIn*3); i++)
{
const int index = piTriList_in_and_out[i];
const SVec3 vP = GetPosition(pContext, index);
- if(vMin.x > vP.x) vMin.x = vP.x;
+ if (vMin.x > vP.x) vMin.x = vP.x;
else if(vMax.x < vP.x) vMax.x = vP.x;
- if(vMin.y > vP.y) vMin.y = vP.y;
+ if (vMin.y > vP.y) vMin.y = vP.y;
else if(vMax.y < vP.y) vMax.y = vP.y;
- if(vMin.z > vP.z) vMin.z = vP.z;
+ if (vMin.z > vP.z) vMin.z = vP.z;
else if(vMax.z < vP.z) vMax.z = vP.z;
}
vDim = vsub(vMax,vMin);
iChannel = 0;
fMin = vMin.x; fMax=vMax.x;
- if(vDim.y>vDim.x && vDim.y>vDim.z)
+ if (vDim.y>vDim.x && vDim.y>vDim.z)
{
iChannel=1;
fMin = vMin.y, fMax=vMax.y;
@@ -497,12 +497,12 @@ static void GenerateSharedVerticesIndexList(int piTriList_in_and_out[], const SM
piHashOffsets = (int *) malloc(sizeof(int)*g_iCells);
piHashCount2 = (int *) malloc(sizeof(int)*g_iCells);
- if(piHashTable==NULL || piHashCount==NULL || piHashOffsets==NULL || piHashCount2==NULL)
+ if (piHashTable==NULL || piHashCount==NULL || piHashOffsets==NULL || piHashCount2==NULL)
{
- if(piHashTable!=NULL) free(piHashTable);
- if(piHashCount!=NULL) free(piHashCount);
- if(piHashOffsets!=NULL) free(piHashOffsets);
- if(piHashCount2!=NULL) free(piHashCount2);
+ if (piHashTable!=NULL) free(piHashTable);
+ if (piHashCount!=NULL) free(piHashCount);
+ if (piHashOffsets!=NULL) free(piHashOffsets);
+ if (piHashCount2!=NULL) free(piHashCount2);
GenerateSharedVerticesIndexListSlow(piTriList_in_and_out, pContext, iNrTrianglesIn);
return;
}
@@ -510,7 +510,7 @@ static void GenerateSharedVerticesIndexList(int piTriList_in_and_out[], const SM
memset(piHashCount2, 0, sizeof(int)*g_iCells);
// count amount of elements in each cell unit
- for(i=0; i<(iNrTrianglesIn*3); i++)
+ for (i=0; i<(iNrTrianglesIn*3); i++)
{
const int index = piTriList_in_and_out[i];
const SVec3 vP = GetPosition(pContext, index);
@@ -521,11 +521,11 @@ static void GenerateSharedVerticesIndexList(int piTriList_in_and_out[], const SM
// evaluate start index of each cell.
piHashOffsets[0]=0;
- for(k=1; k<g_iCells; k++)
+ for (k=1; k<g_iCells; k++)
piHashOffsets[k]=piHashOffsets[k-1]+piHashCount[k-1];
// insert vertices
- for(i=0; i<(iNrTrianglesIn*3); i++)
+ for (i=0; i<(iNrTrianglesIn*3); i++)
{
const int index = piTriList_in_and_out[i];
const SVec3 vP = GetPosition(pContext, index);
@@ -538,29 +538,29 @@ static void GenerateSharedVerticesIndexList(int piTriList_in_and_out[], const SM
pTable[piHashCount2[iCell]] = i; // vertex i has been inserted.
++piHashCount2[iCell];
}
- for(k=0; k<g_iCells; k++)
+ for (k=0; k<g_iCells; k++)
assert(piHashCount2[k] == piHashCount[k]); // verify the count
free(piHashCount2);
// find maximum amount of entries in any hash entry
iMaxCount = piHashCount[0];
- for(k=1; k<g_iCells; k++)
- if(iMaxCount<piHashCount[k])
+ for (k=1; k<g_iCells; k++)
+ if (iMaxCount<piHashCount[k])
iMaxCount=piHashCount[k];
pTmpVert = (STmpVert *) malloc(sizeof(STmpVert)*iMaxCount);
// complete the merge
- for(k=0; k<g_iCells; k++)
+ for (k=0; k<g_iCells; k++)
{
// extract table of cell k and amount of entries in it
int * pTable = &piHashTable[piHashOffsets[k]];
const int iEntries = piHashCount[k];
- if(iEntries < 2) continue;
+ if (iEntries < 2) continue;
- if(pTmpVert!=NULL)
+ if (pTmpVert!=NULL)
{
- for(e=0; e<iEntries; e++)
+ for (e=0; e<iEntries; e++)
{
int i = pTable[e];
const SVec3 vP = GetPosition(pContext, piTriList_in_and_out[i]);
@@ -573,7 +573,7 @@ static void GenerateSharedVerticesIndexList(int piTriList_in_and_out[], const SM
MergeVertsSlow(piTriList_in_and_out, pContext, pTable, iEntries);
}
- if(pTmpVert!=NULL) { free(pTmpVert); }
+ if (pTmpVert!=NULL) { free(pTmpVert); }
free(piHashTable);
free(piHashCount);
free(piHashOffsets);
@@ -585,11 +585,11 @@ static void MergeVertsFast(int piTriList_in_and_out[], STmpVert pTmpVert[], cons
int c=0, l=0, channel=0;
float fvMin[3], fvMax[3];
float dx=0, dy=0, dz=0, fSep=0;
- for(c=0; c<3; c++)
+ for (c=0; c<3; c++)
{ fvMin[c]=pTmpVert[iL_in].vert[c]; fvMax[c]=fvMin[c]; }
- for(l=(iL_in+1); l<=iR_in; l++)
- for(c=0; c<3; c++)
- if(fvMin[c]>pTmpVert[l].vert[c]) fvMin[c]=pTmpVert[l].vert[c];
+ for (l=(iL_in+1); l<=iR_in; l++)
+ for (c=0; c<3; c++)
+ if (fvMin[c]>pTmpVert[l].vert[c]) fvMin[c]=pTmpVert[l].vert[c];
else if(fvMax[c]<pTmpVert[l].vert[c]) fvMax[c]=pTmpVert[l].vert[c];
dx = fvMax[0]-fvMin[0];
@@ -597,17 +597,17 @@ static void MergeVertsFast(int piTriList_in_and_out[], STmpVert pTmpVert[], cons
dz = fvMax[2]-fvMin[2];
channel = 0;
- if(dy>dx && dy>dz) channel=1;
+ if (dy>dx && dy>dz) channel=1;
else if(dz>dx) channel=2;
fSep = 0.5f*(fvMax[channel]+fvMin[channel]);
// terminate recursion when the separation/average value
// is no longer strictly between fMin and fMax values.
- if(fSep>=fvMax[channel] || fSep<=fvMin[channel])
+ if (fSep>=fvMax[channel] || fSep<=fvMin[channel])
{
// complete the weld
- for(l=iL_in; l<=iR_in; l++)
+ for (l=iL_in; l<=iR_in; l++)
{
int i = pTmpVert[l].index;
const int index = piTriList_in_and_out[i];
@@ -617,7 +617,7 @@ static void MergeVertsFast(int piTriList_in_and_out[], STmpVert pTmpVert[], cons
tbool bNotFound = TTRUE;
int l2=iL_in, i2rec=-1;
- while(l2<l && bNotFound)
+ while (l2<l && bNotFound)
{
const int i2 = pTmpVert[l2].index;
const int index2 = piTriList_in_and_out[i2];
@@ -627,7 +627,7 @@ static void MergeVertsFast(int piTriList_in_and_out[], STmpVert pTmpVert[], cons
i2rec=i2;
//if(vP==vP2 && vN==vN2 && vT==vT2)
- if(vP.x==vP2.x && vP.y==vP2.y && vP.z==vP2.z &&
+ if (vP.x==vP2.x && vP.y==vP2.y && vP.z==vP2.z &&
vN.x==vN2.x && vN.y==vN2.y && vN.z==vN2.z &&
vT.x==vT2.x && vT.y==vT2.y && vT.z==vT2.z)
bNotFound = TFALSE;
@@ -636,7 +636,7 @@ static void MergeVertsFast(int piTriList_in_and_out[], STmpVert pTmpVert[], cons
}
// merge if previously found
- if(!bNotFound)
+ if (!bNotFound)
piTriList_in_and_out[i] = piTriList_in_and_out[i2rec];
}
}
@@ -646,24 +646,24 @@ static void MergeVertsFast(int piTriList_in_and_out[], STmpVert pTmpVert[], cons
assert((iR_in-iL_in)>0); // at least 2 entries
// separate (by fSep) all points between iL_in and iR_in in pTmpVert[]
- while(iL < iR)
+ while (iL < iR)
{
tbool bReadyLeftSwap = TFALSE, bReadyRightSwap = TFALSE;
- while((!bReadyLeftSwap) && iL<iR)
+ while ((!bReadyLeftSwap) && iL<iR)
{
assert(iL>=iL_in && iL<=iR_in);
bReadyLeftSwap = !(pTmpVert[iL].vert[channel]<fSep);
- if(!bReadyLeftSwap) ++iL;
+ if (!bReadyLeftSwap) ++iL;
}
- while((!bReadyRightSwap) && iL<iR)
+ while ((!bReadyRightSwap) && iL<iR)
{
assert(iR>=iL_in && iR<=iR_in);
bReadyRightSwap = pTmpVert[iR].vert[channel]<fSep;
- if(!bReadyRightSwap) --iR;
+ if (!bReadyRightSwap) --iR;
}
assert( (iL<iR) || !(bReadyLeftSwap && bReadyRightSwap) );
- if(bReadyLeftSwap && bReadyRightSwap)
+ if (bReadyLeftSwap && bReadyRightSwap)
{
const STmpVert sTmp = pTmpVert[iL];
assert(iL<iR);
@@ -674,17 +674,17 @@ static void MergeVertsFast(int piTriList_in_and_out[], STmpVert pTmpVert[], cons
}
assert(iL==(iR+1) || (iL==iR));
- if(iL==iR)
+ if (iL==iR)
{
const tbool bReadyRightSwap = pTmpVert[iR].vert[channel]<fSep;
- if(bReadyRightSwap) ++iL;
+ if (bReadyRightSwap) ++iL;
else --iR;
}
// only need to weld when there is more than 1 instance of the (x,y,z)
- if(iL_in < iR)
+ if (iL_in < iR)
MergeVertsFast(piTriList_in_and_out, pTmpVert, pContext, iL_in, iR); // weld all left of fSep
- if(iL < iR_in)
+ if (iL < iR_in)
MergeVertsFast(piTriList_in_and_out, pTmpVert, pContext, iL, iR_in); // weld all right of (or equal to) fSep
}
}
@@ -693,7 +693,7 @@ static void MergeVertsSlow(int piTriList_in_and_out[], const SMikkTSpaceContext
{
// this can be optimized further using a tree structure or more hashing.
int e=0;
- for(e=0; e<iEntries; e++)
+ for (e=0; e<iEntries; e++)
{
int i = pTable[e];
const int index = piTriList_in_and_out[i];
@@ -703,7 +703,7 @@ static void MergeVertsSlow(int piTriList_in_and_out[], const SMikkTSpaceContext
tbool bNotFound = TTRUE;
int e2=0, i2rec=-1;
- while(e2<e && bNotFound)
+ while (e2<e && bNotFound)
{
const int i2 = pTable[e2];
const int index2 = piTriList_in_and_out[i2];
@@ -712,14 +712,14 @@ static void MergeVertsSlow(int piTriList_in_and_out[], const SMikkTSpaceContext
const SVec3 vT2 = GetTexCoord(pContext, index2);
i2rec = i2;
- if(veq(vP,vP2) && veq(vN,vN2) && veq(vT,vT2))
+ if (veq(vP,vP2) && veq(vN,vN2) && veq(vT,vT2))
bNotFound = TFALSE;
else
++e2;
}
// merge if previously found
- if(!bNotFound)
+ if (!bNotFound)
piTriList_in_and_out[i] = piTriList_in_and_out[i2rec];
}
}
@@ -727,9 +727,9 @@ static void MergeVertsSlow(int piTriList_in_and_out[], const SMikkTSpaceContext
static void GenerateSharedVerticesIndexListSlow(int piTriList_in_and_out[], const SMikkTSpaceContext * pContext, const int iNrTrianglesIn)
{
int iNumUniqueVerts = 0, t=0, i=0;
- for(t=0; t<iNrTrianglesIn; t++)
+ for (t=0; t<iNrTrianglesIn; t++)
{
- for(i=0; i<3; i++)
+ for (i=0; i<3; i++)
{
const int offs = t*3 + i;
const int index = piTriList_in_and_out[offs];
@@ -740,27 +740,27 @@ static void GenerateSharedVerticesIndexListSlow(int piTriList_in_and_out[], cons
tbool bFound = TFALSE;
int t2=0, index2rec=-1;
- while(!bFound && t2<=t)
+ while (!bFound && t2<=t)
{
int j=0;
- while(!bFound && j<3)
+ while (!bFound && j<3)
{
const int index2 = piTriList_in_and_out[t2*3 + j];
const SVec3 vP2 = GetPosition(pContext, index2);
const SVec3 vN2 = GetNormal(pContext, index2);
const SVec3 vT2 = GetTexCoord(pContext, index2);
- if(veq(vP,vP2) && veq(vN,vN2) && veq(vT,vT2))
+ if (veq(vP,vP2) && veq(vN,vN2) && veq(vT,vT2))
bFound = TTRUE;
else
++j;
}
- if(!bFound) ++t2;
+ if (!bFound) ++t2;
}
assert(bFound);
// if we found our own
- if(index2rec == index) { ++iNumUniqueVerts; }
+ if (index2rec == index) { ++iNumUniqueVerts; }
piTriList_in_and_out[offs] = index2rec;
}
@@ -771,15 +771,15 @@ static int GenerateInitialVerticesIndexList(STriInfo pTriInfos[], int piTriList_
{
int iTSpacesOffs = 0, f=0, t=0;
int iDstTriIndex = 0;
- for(f=0; f<pContext->m_pInterface->m_getNumFaces(pContext); f++)
+ for (f=0; f<pContext->m_pInterface->m_getNumFaces(pContext); f++)
{
const int verts = pContext->m_pInterface->m_getNumVerticesOfFace(pContext, f);
- if(verts!=3 && verts!=4) continue;
+ if (verts!=3 && verts!=4) continue;
pTriInfos[iDstTriIndex].iOrgFaceNumber = f;
pTriInfos[iDstTriIndex].iTSpacesOffs = iTSpacesOffs;
- if(verts==3)
+ if (verts==3)
{
unsigned char * pVerts = pTriInfos[iDstTriIndex].vert_num;
pVerts[0]=0; pVerts[1]=1; pVerts[2]=2;
@@ -810,7 +810,7 @@ static int GenerateInitialVerticesIndexList(STriInfo pTriInfos[], int piTriList_
const float distSQ_02 = LengthSquared(vsub(T2,T0));
const float distSQ_13 = LengthSquared(vsub(T3,T1));
tbool bQuadDiagIs_02;
- if(distSQ_02<distSQ_13)
+ if (distSQ_02<distSQ_13)
bQuadDiagIs_02 = TTRUE;
else if(distSQ_13<distSQ_02)
bQuadDiagIs_02 = TFALSE;
@@ -826,7 +826,7 @@ static int GenerateInitialVerticesIndexList(STriInfo pTriInfos[], int piTriList_
bQuadDiagIs_02 = distSQ_13<distSQ_02 ? TFALSE : TTRUE;
}
- if(bQuadDiagIs_02)
+ if (bQuadDiagIs_02)
{
{
unsigned char * pVerts_A = pTriInfos[iDstTriIndex].vert_num;
@@ -871,7 +871,7 @@ static int GenerateInitialVerticesIndexList(STriInfo pTriInfos[], int piTriList_
assert(iDstTriIndex<=iNrTrianglesIn);
}
- for(t=0; t<iNrTrianglesIn; t++)
+ for (t=0; t<iNrTrianglesIn; t++)
pTriInfos[t].iFlag = 0;
// return total amount of tspaces
@@ -946,8 +946,8 @@ static void InitTriInfo(STriInfo pTriInfos[], const int piTriListIn[], const SMi
// pTriInfos[f].iFlag is cleared in GenerateInitialVerticesIndexList() which is called before this function.
// generate neighbor info list
- for(f=0; f<iNrTrianglesIn; f++)
- for(i=0; i<3; i++)
+ for (f=0; f<iNrTrianglesIn; f++)
+ for (i=0; i<3; i++)
{
pTriInfos[f].FaceNeighbors[i] = -1;
pTriInfos[f].AssignedGroup[i] = NULL;
@@ -962,7 +962,7 @@ static void InitTriInfo(STriInfo pTriInfos[], const int piTriListIn[], const SMi
}
// evaluate first order derivatives
- for(f=0; f<iNrTrianglesIn; f++)
+ for (f=0; f<iNrTrianglesIn; f++)
{
// initial values
const SVec3 v1 = GetPosition(pContext, piTriListIn[f*3+0]);
@@ -986,47 +986,47 @@ static void InitTriInfo(STriInfo pTriInfos[], const int piTriListIn[], const SMi
pTriInfos[f].iFlag |= (fSignedAreaSTx2>0 ? ORIENT_PRESERVING : 0);
- if( NotZero(fSignedAreaSTx2) )
+ if ( NotZero(fSignedAreaSTx2) )
{
const float fAbsArea = fabsf(fSignedAreaSTx2);
const float fLenOs = Length(vOs);
const float fLenOt = Length(vOt);
const float fS = (pTriInfos[f].iFlag&ORIENT_PRESERVING)==0 ? (-1.0f) : 1.0f;
- if( NotZero(fLenOs) ) pTriInfos[f].vOs = vscale(fS/fLenOs, vOs);
- if( NotZero(fLenOt) ) pTriInfos[f].vOt = vscale(fS/fLenOt, vOt);
+ if ( NotZero(fLenOs) ) pTriInfos[f].vOs = vscale(fS/fLenOs, vOs);
+ if ( NotZero(fLenOt) ) pTriInfos[f].vOt = vscale(fS/fLenOt, vOt);
// evaluate magnitudes prior to normalization of vOs and vOt
pTriInfos[f].fMagS = fLenOs / fAbsArea;
pTriInfos[f].fMagT = fLenOt / fAbsArea;
// if this is a good triangle
- if( NotZero(pTriInfos[f].fMagS) && NotZero(pTriInfos[f].fMagT))
+ if ( NotZero(pTriInfos[f].fMagS) && NotZero(pTriInfos[f].fMagT))
pTriInfos[f].iFlag &= (~GROUP_WITH_ANY);
}
}
// force otherwise healthy quads to a fixed orientation
- while(t<(iNrTrianglesIn-1))
+ while (t<(iNrTrianglesIn-1))
{
const int iFO_a = pTriInfos[t].iOrgFaceNumber;
const int iFO_b = pTriInfos[t+1].iOrgFaceNumber;
- if(iFO_a==iFO_b) // this is a quad
+ if (iFO_a==iFO_b) // this is a quad
{
const tbool bIsDeg_a = (pTriInfos[t].iFlag&MARK_DEGENERATE)!=0 ? TTRUE : TFALSE;
const tbool bIsDeg_b = (pTriInfos[t+1].iFlag&MARK_DEGENERATE)!=0 ? TTRUE : TFALSE;
// bad triangles should already have been removed by
// DegenPrologue(), but just in case check bIsDeg_a and bIsDeg_a are false
- if((bIsDeg_a||bIsDeg_b)==TFALSE)
+ if ((bIsDeg_a||bIsDeg_b)==TFALSE)
{
const tbool bOrientA = (pTriInfos[t].iFlag&ORIENT_PRESERVING)!=0 ? TTRUE : TFALSE;
const tbool bOrientB = (pTriInfos[t+1].iFlag&ORIENT_PRESERVING)!=0 ? TTRUE : TFALSE;
// if this happens the quad has extremely bad mapping!!
- if(bOrientA!=bOrientB)
+ if (bOrientA!=bOrientB)
{
//printf("found quad with bad mapping\n");
tbool bChooseOrientFirstTri = TFALSE;
- if((pTriInfos[t+1].iFlag&GROUP_WITH_ANY)!=0) bChooseOrientFirstTri = TTRUE;
+ if ((pTriInfos[t+1].iFlag&GROUP_WITH_ANY)!=0) bChooseOrientFirstTri = TTRUE;
else if( CalcTexArea(pContext, &piTriListIn[t*3+0]) >= CalcTexArea(pContext, &piTriListIn[(t+1)*3+0]) )
bChooseOrientFirstTri = TTRUE;
@@ -1048,7 +1048,7 @@ static void InitTriInfo(STriInfo pTriInfos[], const int piTriListIn[], const SMi
// match up edge pairs
{
SEdge * pEdges = (SEdge *) malloc(sizeof(SEdge)*iNrTrianglesIn*3);
- if(pEdges==NULL)
+ if (pEdges==NULL)
BuildNeighborsSlow(pTriInfos, piTriListIn, iNrTrianglesIn);
else
{
@@ -1070,12 +1070,12 @@ static int Build4RuleGroups(STriInfo pTriInfos[], SGroup pGroups[], int piGroupT
const int iNrMaxGroups = iNrTrianglesIn*3;
int iNrActiveGroups = 0;
int iOffset = 0, f=0, i=0;
- for(f=0; f<iNrTrianglesIn; f++)
+ for (f=0; f<iNrTrianglesIn; f++)
{
- for(i=0; i<3; i++)
+ for (i=0; i<3; i++)
{
// if not assigned to a group
- if((pTriInfos[f].iFlag&GROUP_WITH_ANY)==0 && pTriInfos[f].AssignedGroup[i]==NULL)
+ if ((pTriInfos[f].iFlag&GROUP_WITH_ANY)==0 && pTriInfos[f].AssignedGroup[i]==NULL)
{
tbool bOrPre;
int neigh_indexL, neigh_indexR;
@@ -1092,7 +1092,7 @@ static int Build4RuleGroups(STriInfo pTriInfos[], SGroup pGroups[], int piGroupT
bOrPre = (pTriInfos[f].iFlag&ORIENT_PRESERVING)!=0 ? TTRUE : TFALSE;
neigh_indexL = pTriInfos[f].FaceNeighbors[i];
neigh_indexR = pTriInfos[f].FaceNeighbors[i>0?(i-1):2];
- if(neigh_indexL>=0) // neighbor
+ if (neigh_indexL>=0) // neighbor
{
const tbool bAnswer =
AssignRecur(piTriListIn, pTriInfos, neigh_indexL,
@@ -1102,7 +1102,7 @@ static int Build4RuleGroups(STriInfo pTriInfos[], SGroup pGroups[], int piGroupT
const tbool bDiff = bOrPre!=bOrPre2 ? TTRUE : TFALSE;
assert(bAnswer || bDiff);
}
- if(neigh_indexR>=0) // neighbor
+ if (neigh_indexR>=0) // neighbor
{
const tbool bAnswer =
AssignRecur(piTriListIn, pTriInfos, neigh_indexR,
@@ -1141,20 +1141,20 @@ static tbool AssignRecur(const int piTriListIn[], STriInfo psTriInfos[],
const int iVertRep = pGroup->iVertexRepresentitive;
const int * pVerts = &piTriListIn[3*iMyTriIndex+0];
int i=-1;
- if(pVerts[0]==iVertRep) i=0;
+ if (pVerts[0]==iVertRep) i=0;
else if(pVerts[1]==iVertRep) i=1;
else if(pVerts[2]==iVertRep) i=2;
assert(i>=0 && i<3);
// early out
- if(pMyTriInfo->AssignedGroup[i] == pGroup) return TTRUE;
+ if (pMyTriInfo->AssignedGroup[i] == pGroup) return TTRUE;
else if(pMyTriInfo->AssignedGroup[i]!=NULL) return TFALSE;
- if((pMyTriInfo->iFlag&GROUP_WITH_ANY)!=0)
+ if ((pMyTriInfo->iFlag&GROUP_WITH_ANY)!=0)
{
// first to group with a group-with-anything triangle
// determines it's orientation.
// This is the only existing order dependency in the code!!
- if( pMyTriInfo->AssignedGroup[0] == NULL &&
+ if ( pMyTriInfo->AssignedGroup[0] == NULL &&
pMyTriInfo->AssignedGroup[1] == NULL &&
pMyTriInfo->AssignedGroup[2] == NULL )
{
@@ -1164,7 +1164,7 @@ static tbool AssignRecur(const int piTriListIn[], STriInfo psTriInfos[],
}
{
const tbool bOrient = (pMyTriInfo->iFlag&ORIENT_PRESERVING)!=0 ? TTRUE : TFALSE;
- if(bOrient != pGroup->bOrientPreservering) return TFALSE;
+ if (bOrient != pGroup->bOrientPreservering) return TFALSE;
}
AddTriToGroup(pGroup, iMyTriIndex);
@@ -1173,9 +1173,9 @@ static tbool AssignRecur(const int piTriListIn[], STriInfo psTriInfos[],
{
const int neigh_indexL = pMyTriInfo->FaceNeighbors[i];
const int neigh_indexR = pMyTriInfo->FaceNeighbors[i>0?(i-1):2];
- if(neigh_indexL>=0)
+ if (neigh_indexL>=0)
AssignRecur(piTriListIn, psTriInfos, neigh_indexL, pGroup);
- if(neigh_indexR>=0)
+ if (neigh_indexR>=0)
AssignRecur(piTriListIn, psTriInfos, neigh_indexR, pGroup);
}
@@ -1199,39 +1199,39 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con
SSubGroup * pUniSubGroups = NULL;
int * pTmpMembers = NULL;
int iMaxNrFaces=0, iUniqueTspaces=0, g=0, i=0;
- for(g=0; g<iNrActiveGroups; g++)
- if(iMaxNrFaces < pGroups[g].iNrFaces)
+ for (g=0; g<iNrActiveGroups; g++)
+ if (iMaxNrFaces < pGroups[g].iNrFaces)
iMaxNrFaces = pGroups[g].iNrFaces;
- if(iMaxNrFaces == 0) return TTRUE;
+ if (iMaxNrFaces == 0) return TTRUE;
// make initial allocations
pSubGroupTspace = (STSpace *) malloc(sizeof(STSpace)*iMaxNrFaces);
pUniSubGroups = (SSubGroup *) malloc(sizeof(SSubGroup)*iMaxNrFaces);
pTmpMembers = (int *) malloc(sizeof(int)*iMaxNrFaces);
- if(pSubGroupTspace==NULL || pUniSubGroups==NULL || pTmpMembers==NULL)
+ if (pSubGroupTspace==NULL || pUniSubGroups==NULL || pTmpMembers==NULL)
{
- if(pSubGroupTspace!=NULL) free(pSubGroupTspace);
- if(pUniSubGroups!=NULL) free(pUniSubGroups);
- if(pTmpMembers!=NULL) free(pTmpMembers);
+ if (pSubGroupTspace!=NULL) free(pSubGroupTspace);
+ if (pUniSubGroups!=NULL) free(pUniSubGroups);
+ if (pTmpMembers!=NULL) free(pTmpMembers);
return TFALSE;
}
iUniqueTspaces = 0;
- for(g=0; g<iNrActiveGroups; g++)
+ for (g=0; g<iNrActiveGroups; g++)
{
const SGroup * pGroup = &pGroups[g];
int iUniqueSubGroups = 0, s=0;
- for(i=0; i<pGroup->iNrFaces; i++) // triangles
+ for (i=0; i<pGroup->iNrFaces; i++) // triangles
{
const int f = pGroup->pFaceIndices[i]; // triangle number
int index=-1, iVertIndex=-1, iOF_1=-1, iMembers=0, j=0, l=0;
SSubGroup tmp_group;
tbool bFound;
SVec3 n, vOs, vOt;
- if(pTriInfos[f].AssignedGroup[0]==pGroup) index=0;
+ if (pTriInfos[f].AssignedGroup[0]==pGroup) index=0;
else if(pTriInfos[f].AssignedGroup[1]==pGroup) index=1;
else if(pTriInfos[f].AssignedGroup[2]==pGroup) index=2;
assert(index>=0 && index<3);
@@ -1245,14 +1245,14 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con
// project
vOs = vsub(pTriInfos[f].vOs, vscale(vdot(n,pTriInfos[f].vOs), n));
vOt = vsub(pTriInfos[f].vOt, vscale(vdot(n,pTriInfos[f].vOt), n));
- if( VNotZero(vOs) ) vOs = Normalize(vOs);
- if( VNotZero(vOt) ) vOt = Normalize(vOt);
+ if ( VNotZero(vOs) ) vOs = Normalize(vOs);
+ if ( VNotZero(vOt) ) vOt = Normalize(vOt);
// original face number
iOF_1 = pTriInfos[f].iOrgFaceNumber;
iMembers = 0;
- for(j=0; j<pGroup->iNrFaces; j++)
+ for (j=0; j<pGroup->iNrFaces; j++)
{
const int t = pGroup->pFaceIndices[j]; // triangle number
const int iOF_2 = pTriInfos[t].iOrgFaceNumber;
@@ -1260,8 +1260,8 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con
// project
SVec3 vOs2 = vsub(pTriInfos[t].vOs, vscale(vdot(n,pTriInfos[t].vOs), n));
SVec3 vOt2 = vsub(pTriInfos[t].vOt, vscale(vdot(n,pTriInfos[t].vOt), n));
- if( VNotZero(vOs2) ) vOs2 = Normalize(vOs2);
- if( VNotZero(vOt2) ) vOt2 = Normalize(vOt2);
+ if ( VNotZero(vOs2) ) vOs2 = Normalize(vOs2);
+ if ( VNotZero(vOt2) ) vOt2 = Normalize(vOt2);
{
const tbool bAny = ( (pTriInfos[f].iFlag | pTriInfos[t].iFlag) & GROUP_WITH_ANY )!=0 ? TTRUE : TFALSE;
@@ -1272,7 +1272,7 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con
const float fCosT = vdot(vOt,vOt2);
assert(f!=t || bSameOrgFace); // sanity check
- if(bAny || bSameOrgFace || (fCosS>fThresCos && fCosT>fThresCos))
+ if (bAny || bSameOrgFace || (fCosS>fThresCos && fCosT>fThresCos))
pTmpMembers[iMembers++] = t;
}
}
@@ -1280,7 +1280,7 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con
// sort pTmpMembers
tmp_group.iNrFaces = iMembers;
tmp_group.pTriMembers = pTmpMembers;
- if(iMembers>1)
+ if (iMembers>1)
{
unsigned int uSeed = INTERNAL_RND_SORT_SEED; // could replace with a random seed?
QuickSort(pTmpMembers, 0, iMembers-1, uSeed);
@@ -1289,10 +1289,10 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con
// look for an existing match
bFound = TFALSE;
l=0;
- while(l<iUniqueSubGroups && !bFound)
+ while (l<iUniqueSubGroups && !bFound)
{
bFound = CompareSubGroups(&tmp_group, &pUniSubGroups[l]);
- if(!bFound) ++l;
+ if (!bFound) ++l;
}
// assign tangent space index
@@ -1300,15 +1300,15 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con
//piTempTangIndices[f*3+index] = iUniqueTspaces+l;
// if no match was found we allocate a new subgroup
- if(!bFound)
+ if (!bFound)
{
// insert new subgroup
int * pIndices = (int *) malloc(sizeof(int)*iMembers);
- if(pIndices==NULL)
+ if (pIndices==NULL)
{
// clean up and return false
int s=0;
- for(s=0; s<iUniqueSubGroups; s++)
+ for (s=0; s<iUniqueSubGroups; s++)
free(pUniSubGroups[s].pTriMembers);
free(pUniSubGroups);
free(pTmpMembers);
@@ -1330,7 +1330,7 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con
STSpace * pTS_out = &psTspace[iOffs+iVert];
assert(pTS_out->iCounter<2);
assert(((pTriInfos[f].iFlag&ORIENT_PRESERVING)!=0) == pGroup->bOrientPreservering);
- if(pTS_out->iCounter==1)
+ if (pTS_out->iCounter==1)
{
*pTS_out = AvgTSpace(pTS_out, &pSubGroupTspace[l]);
pTS_out->iCounter = 2; // update counter
@@ -1347,7 +1347,7 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con
}
// clean up and offset iUniqueTspaces
- for(s=0; s<iUniqueSubGroups; s++)
+ for (s=0; s<iUniqueSubGroups; s++)
free(pUniSubGroups[s].pTriMembers);
iUniqueTspaces += iUniqueSubGroups;
}
@@ -1370,17 +1370,17 @@ static STSpace EvalTspace(int face_indices[], const int iFaces, const int piTriL
res.vOt.x=0.0f; res.vOt.y=0.0f; res.vOt.z=0.0f;
res.fMagS = 0; res.fMagT = 0;
- for(face=0; face<iFaces; face++)
+ for (face=0; face<iFaces; face++)
{
const int f = face_indices[face];
// only valid triangles get to add their contribution
- if( (pTriInfos[f].iFlag&GROUP_WITH_ANY)==0 )
+ if ( (pTriInfos[f].iFlag&GROUP_WITH_ANY)==0 )
{
SVec3 n, vOs, vOt, p0, p1, p2, v1, v2;
float fCos, fAngle, fMagS, fMagT;
int i=-1, index=-1, i0=-1, i1=-1, i2=-1;
- if(piTriListIn[3*f+0]==iVertexRepresentitive) i=0;
+ if (piTriListIn[3*f+0]==iVertexRepresentitive) i=0;
else if(piTriListIn[3*f+1]==iVertexRepresentitive) i=1;
else if(piTriListIn[3*f+2]==iVertexRepresentitive) i=2;
assert(i>=0 && i<3);
@@ -1390,8 +1390,8 @@ static STSpace EvalTspace(int face_indices[], const int iFaces, const int piTriL
n = GetNormal(pContext, index);
vOs = vsub(pTriInfos[f].vOs, vscale(vdot(n,pTriInfos[f].vOs), n));
vOt = vsub(pTriInfos[f].vOt, vscale(vdot(n,pTriInfos[f].vOt), n));
- if( VNotZero(vOs) ) vOs = Normalize(vOs);
- if( VNotZero(vOt) ) vOt = Normalize(vOt);
+ if ( VNotZero(vOs) ) vOs = Normalize(vOs);
+ if ( VNotZero(vOt) ) vOt = Normalize(vOt);
i2 = piTriListIn[3*f + (i<2?(i+1):0)];
i1 = piTriListIn[3*f + i];
@@ -1423,9 +1423,9 @@ static STSpace EvalTspace(int face_indices[], const int iFaces, const int piTriL
}
// normalize
- if( VNotZero(res.vOs) ) res.vOs = Normalize(res.vOs);
- if( VNotZero(res.vOt) ) res.vOt = Normalize(res.vOt);
- if(fAngleSum>0)
+ if ( VNotZero(res.vOs) ) res.vOs = Normalize(res.vOs);
+ if ( VNotZero(res.vOt) ) res.vOt = Normalize(res.vOt);
+ if (fAngleSum>0)
{
res.fMagS /= fAngleSum;
res.fMagT /= fAngleSum;
@@ -1438,11 +1438,11 @@ static tbool CompareSubGroups(const SSubGroup * pg1, const SSubGroup * pg2)
{
tbool bStillSame=TTRUE;
int i=0;
- if(pg1->iNrFaces!=pg2->iNrFaces) return TFALSE;
- while(i<pg1->iNrFaces && bStillSame)
+ if (pg1->iNrFaces!=pg2->iNrFaces) return TFALSE;
+ while (i<pg1->iNrFaces && bStillSame)
{
bStillSame = pg1->pTriMembers[i]==pg2->pTriMembers[i] ? TTRUE : TFALSE;
- if(bStillSame) ++i;
+ if (bStillSame) ++i;
}
return bStillSame;
}
@@ -1467,12 +1467,12 @@ static void QuickSort(int* pSortBuffer, int iLeft, int iRight, unsigned int uSee
do
{
- while(pSortBuffer[iL] < iMid)
+ while (pSortBuffer[iL] < iMid)
++iL;
- while(pSortBuffer[iR] > iMid)
+ while (pSortBuffer[iR] > iMid)
--iR;
- if(iL <= iR)
+ if (iL <= iR)
{
iTmp = pSortBuffer[iL];
pSortBuffer[iL] = pSortBuffer[iR];
@@ -1480,11 +1480,11 @@ static void QuickSort(int* pSortBuffer, int iLeft, int iRight, unsigned int uSee
++iL; --iR;
}
}
- while(iL <= iR);
+ while (iL <= iR);
- if(iLeft < iR)
+ if (iLeft < iR)
QuickSort(pSortBuffer, iLeft, iR, uSeed);
- if(iL < iRight)
+ if (iL < iRight)
QuickSort(pSortBuffer, iL, iRight, uSeed);
}
@@ -1499,8 +1499,8 @@ static void BuildNeighborsFast(STriInfo pTriInfos[], SEdge * pEdges, const int p
// build array of edges
unsigned int uSeed = INTERNAL_RND_SORT_SEED; // could replace with a random seed?
int iEntries=0, iCurStartIndex=-1, f=0, i=0;
- for(f=0; f<iNrTrianglesIn; f++)
- for(i=0; i<3; i++)
+ for (f=0; f<iNrTrianglesIn; f++)
+ for (i=0; i<3; i++)
{
const int i0 = piTriListIn[f*3+i];
const int i1 = piTriListIn[f*3+(i<2?(i+1):0)];
@@ -1517,9 +1517,9 @@ static void BuildNeighborsFast(STriInfo pTriInfos[], SEdge * pEdges, const int p
// with i0 as msb in the quicksort call above.
iEntries = iNrTrianglesIn*3;
iCurStartIndex = 0;
- for(i=1; i<iEntries; i++)
+ for (i=1; i<iEntries; i++)
{
- if(pEdges[iCurStartIndex].i0 != pEdges[i].i0)
+ if (pEdges[iCurStartIndex].i0 != pEdges[i].i0)
{
const int iL = iCurStartIndex;
const int iR = i-1;
@@ -1533,9 +1533,9 @@ static void BuildNeighborsFast(STriInfo pTriInfos[], SEdge * pEdges, const int p
// this step is to remain compliant with BuildNeighborsSlow() when
// more than 2 triangles use the same edge (such as a butterfly topology).
iCurStartIndex = 0;
- for(i=1; i<iEntries; i++)
+ for (i=1; i<iEntries; i++)
{
- if(pEdges[iCurStartIndex].i0 != pEdges[i].i0 || pEdges[iCurStartIndex].i1 != pEdges[i].i1)
+ if (pEdges[iCurStartIndex].i0 != pEdges[i].i0 || pEdges[iCurStartIndex].i1 != pEdges[i].i1)
{
const int iL = iCurStartIndex;
const int iR = i-1;
@@ -1546,7 +1546,7 @@ static void BuildNeighborsFast(STriInfo pTriInfos[], SEdge * pEdges, const int p
}
// pair up, adjacent triangles
- for(i=0; i<iEntries; i++)
+ for (i=0; i<iEntries; i++)
{
const int i0=pEdges[i].i0;
const int i1=pEdges[i].i1;
@@ -1558,12 +1558,12 @@ static void BuildNeighborsFast(STriInfo pTriInfos[], SEdge * pEdges, const int p
GetEdge(&i0_A, &i1_A, &edgenum_A, &piTriListIn[f*3], i0, i1); // resolve index ordering and edge_num
bUnassigned_A = pTriInfos[f].FaceNeighbors[edgenum_A] == -1 ? TTRUE : TFALSE;
- if(bUnassigned_A)
+ if (bUnassigned_A)
{
// get true index ordering
int j=i+1, t;
tbool bNotFound = TTRUE;
- while(j<iEntries && i0==pEdges[j].i0 && i1==pEdges[j].i1 && bNotFound)
+ while (j<iEntries && i0==pEdges[j].i0 && i1==pEdges[j].i1 && bNotFound)
{
tbool bUnassigned_B;
int i0_B, i1_B;
@@ -1572,13 +1572,13 @@ static void BuildNeighborsFast(STriInfo pTriInfos[], SEdge * pEdges, const int p
GetEdge(&i1_B, &i0_B, &edgenum_B, &piTriListIn[t*3], pEdges[j].i0, pEdges[j].i1); // resolve index ordering and edge_num
//assert(!(i0_A==i1_B && i1_A==i0_B));
bUnassigned_B = pTriInfos[t].FaceNeighbors[edgenum_B]==-1 ? TTRUE : TFALSE;
- if(i0_A==i0_B && i1_A==i1_B && bUnassigned_B)
+ if (i0_A==i0_B && i1_A==i1_B && bUnassigned_B)
bNotFound = TFALSE;
else
++j;
}
- if(!bNotFound)
+ if (!bNotFound)
{
int t = pEdges[j].f;
pTriInfos[f].FaceNeighbors[edgenum_A] = t;
@@ -1592,12 +1592,12 @@ static void BuildNeighborsFast(STriInfo pTriInfos[], SEdge * pEdges, const int p
static void BuildNeighborsSlow(STriInfo pTriInfos[], const int piTriListIn[], const int iNrTrianglesIn)
{
int f=0, i=0;
- for(f=0; f<iNrTrianglesIn; f++)
+ for (f=0; f<iNrTrianglesIn; f++)
{
- for(i=0; i<3; i++)
+ for (i=0; i<3; i++)
{
// if unassigned
- if(pTriInfos[f].FaceNeighbors[i] == -1)
+ if (pTriInfos[f].FaceNeighbors[i] == -1)
{
const int i0_A = piTriListIn[f*3+i];
const int i1_A = piTriListIn[f*3+(i<2?(i+1):0)];
@@ -1605,29 +1605,29 @@ static void BuildNeighborsSlow(STriInfo pTriInfos[], const int piTriListIn[], co
// search for a neighbor
tbool bFound = TFALSE;
int t=0, j=0;
- while(!bFound && t<iNrTrianglesIn)
+ while (!bFound && t<iNrTrianglesIn)
{
- if(t!=f)
+ if (t!=f)
{
j=0;
- while(!bFound && j<3)
+ while (!bFound && j<3)
{
// in rev order
const int i1_B = piTriListIn[t*3+j];
const int i0_B = piTriListIn[t*3+(j<2?(j+1):0)];
//assert(!(i0_A==i1_B && i1_A==i0_B));
- if(i0_A==i0_B && i1_A==i1_B)
+ if (i0_A==i0_B && i1_A==i1_B)
bFound = TTRUE;
else
++j;
}
}
- if(!bFound) ++t;
+ if (!bFound) ++t;
}
// assign neighbors
- if(bFound)
+ if (bFound)
{
pTriInfos[f].FaceNeighbors[i] = t;
//assert(pTriInfos[t].FaceNeighbors[j]==-1);
@@ -1646,10 +1646,10 @@ static void QuickSortEdges(SEdge * pSortBuffer, int iLeft, int iRight, const int
// early out
SEdge sTmp;
const int iElems = iRight-iLeft+1;
- if(iElems<2) return;
+ if (iElems<2) return;
else if(iElems==2)
{
- if(pSortBuffer[iLeft].array[channel] > pSortBuffer[iRight].array[channel])
+ if (pSortBuffer[iLeft].array[channel] > pSortBuffer[iRight].array[channel])
{
sTmp = pSortBuffer[iLeft];
pSortBuffer[iLeft] = pSortBuffer[iRight];
@@ -1673,12 +1673,12 @@ static void QuickSortEdges(SEdge * pSortBuffer, int iLeft, int iRight, const int
do
{
- while(pSortBuffer[iL].array[channel] < iMid)
+ while (pSortBuffer[iL].array[channel] < iMid)
++iL;
- while(pSortBuffer[iR].array[channel] > iMid)
+ while (pSortBuffer[iR].array[channel] > iMid)
--iR;
- if(iL <= iR)
+ if (iL <= iR)
{
sTmp = pSortBuffer[iL];
pSortBuffer[iL] = pSortBuffer[iR];
@@ -1686,11 +1686,11 @@ static void QuickSortEdges(SEdge * pSortBuffer, int iLeft, int iRight, const int
++iL; --iR;
}
}
- while(iL <= iR);
+ while (iL <= iR);
- if(iLeft < iR)
+ if (iLeft < iR)
QuickSortEdges(pSortBuffer, iLeft, iR, channel, uSeed);
- if(iL < iRight)
+ if (iL < iRight)
QuickSortEdges(pSortBuffer, iL, iRight, channel, uSeed);
}
@@ -1700,10 +1700,10 @@ static void GetEdge(int * i0_out, int * i1_out, int * edgenum_out, const int ind
*edgenum_out = -1;
// test if first index is on the edge
- if(indices[0]==i0_in || indices[0]==i1_in)
+ if (indices[0]==i0_in || indices[0]==i1_in)
{
// test if second index is on the edge
- if(indices[1]==i0_in || indices[1]==i1_in)
+ if (indices[1]==i0_in || indices[1]==i1_in)
{
edgenum_out[0]=0; // first edge
i0_out[0]=indices[0];
@@ -1736,15 +1736,15 @@ static void DegenPrologue(STriInfo pTriInfos[], int piTriList_out[], const int i
// locate quads with only one good triangle
int t=0;
- while(t<(iTotTris-1))
+ while (t<(iTotTris-1))
{
const int iFO_a = pTriInfos[t].iOrgFaceNumber;
const int iFO_b = pTriInfos[t+1].iOrgFaceNumber;
- if(iFO_a==iFO_b) // this is a quad
+ if (iFO_a==iFO_b) // this is a quad
{
const tbool bIsDeg_a = (pTriInfos[t].iFlag&MARK_DEGENERATE)!=0 ? TTRUE : TFALSE;
const tbool bIsDeg_b = (pTriInfos[t+1].iFlag&MARK_DEGENERATE)!=0 ? TTRUE : TFALSE;
- if((bIsDeg_a^bIsDeg_b)!=0)
+ if ((bIsDeg_a^bIsDeg_b)!=0)
{
pTriInfos[t].iFlag |= QUAD_ONE_DEGEN_TRI;
pTriInfos[t+1].iFlag |= QUAD_ONE_DEGEN_TRI;
@@ -1760,12 +1760,12 @@ static void DegenPrologue(STriInfo pTriInfos[], int piTriList_out[], const int i
iNextGoodTriangleSearchIndex = 1;
t=0;
bStillFindingGoodOnes = TTRUE;
- while(t<iNrTrianglesIn && bStillFindingGoodOnes)
+ while (t<iNrTrianglesIn && bStillFindingGoodOnes)
{
const tbool bIsGood = (pTriInfos[t].iFlag&MARK_DEGENERATE)==0 ? TTRUE : TFALSE;
- if(bIsGood)
+ if (bIsGood)
{
- if(iNextGoodTriangleSearchIndex < (t+2))
+ if (iNextGoodTriangleSearchIndex < (t+2))
iNextGoodTriangleSearchIndex = t+2;
}
else
@@ -1773,10 +1773,10 @@ static void DegenPrologue(STriInfo pTriInfos[], int piTriList_out[], const int i
int t0, t1;
// search for the first good triangle.
tbool bJustADegenerate = TTRUE;
- while(bJustADegenerate && iNextGoodTriangleSearchIndex<iTotTris)
+ while (bJustADegenerate && iNextGoodTriangleSearchIndex<iTotTris)
{
const tbool bIsGood = (pTriInfos[iNextGoodTriangleSearchIndex].iFlag&MARK_DEGENERATE)==0 ? TTRUE : TFALSE;
- if(bIsGood) bJustADegenerate=TFALSE;
+ if (bIsGood) bJustADegenerate=TFALSE;
else ++iNextGoodTriangleSearchIndex;
}
@@ -1786,10 +1786,10 @@ static void DegenPrologue(STriInfo pTriInfos[], int piTriList_out[], const int i
assert(iNextGoodTriangleSearchIndex > (t+1));
// swap triangle t0 and t1
- if(!bJustADegenerate)
+ if (!bJustADegenerate)
{
int i=0;
- for(i=0; i<3; i++)
+ for (i=0; i<3; i++)
{
const int index = piTriList_out[t0*3+i];
piTriList_out[t0*3+i] = piTriList_out[t1*3+i];
@@ -1805,7 +1805,7 @@ static void DegenPrologue(STriInfo pTriInfos[], int piTriList_out[], const int i
bStillFindingGoodOnes = TFALSE; // this is not supposed to happen
}
- if(bStillFindingGoodOnes) ++t;
+ if (bStillFindingGoodOnes) ++t;
}
assert(bStillFindingGoodOnes); // code will still work.
@@ -1817,28 +1817,28 @@ static void DegenEpilogue(STSpace psTspace[], STriInfo pTriInfos[], int piTriLis
int t=0, i=0;
// deal with degenerate triangles
// punishment for degenerate triangles is O(N^2)
- for(t=iNrTrianglesIn; t<iTotTris; t++)
+ for (t=iNrTrianglesIn; t<iTotTris; t++)
{
// degenerate triangles on a quad with one good triangle are skipped
// here but processed in the next loop
const tbool bSkip = (pTriInfos[t].iFlag&QUAD_ONE_DEGEN_TRI)!=0 ? TTRUE : TFALSE;
- if(!bSkip)
+ if (!bSkip)
{
- for(i=0; i<3; i++)
+ for (i=0; i<3; i++)
{
const int index1 = piTriListIn[t*3+i];
// search through the good triangles
tbool bNotFound = TTRUE;
int j=0;
- while(bNotFound && j<(3*iNrTrianglesIn))
+ while (bNotFound && j<(3*iNrTrianglesIn))
{
const int index2 = piTriListIn[j];
- if(index1==index2) bNotFound=TFALSE;
+ if (index1==index2) bNotFound=TFALSE;
else ++j;
}
- if(!bNotFound)
+ if (!bNotFound)
{
const int iTri = j/3;
const int iVert = j%3;
@@ -1855,11 +1855,11 @@ static void DegenEpilogue(STSpace psTspace[], STriInfo pTriInfos[], int piTriLis
}
// deal with degenerate quads with one good triangle
- for(t=0; t<iNrTrianglesIn; t++)
+ for (t=0; t<iNrTrianglesIn; t++)
{
// this triangle belongs to a quad where the
// other triangle is degenerate
- if( (pTriInfos[t].iFlag&QUAD_ONE_DEGEN_TRI)!=0 )
+ if ( (pTriInfos[t].iFlag&QUAD_ONE_DEGEN_TRI)!=0 )
{
SVec3 vDstP;
int iOrgF=-1, i=0;
@@ -1867,7 +1867,7 @@ static void DegenEpilogue(STSpace psTspace[], STriInfo pTriInfos[], int piTriLis
unsigned char * pV = pTriInfos[t].vert_num;
int iFlag = (1<<pV[0]) | (1<<pV[1]) | (1<<pV[2]);
int iMissingIndex = 0;
- if((iFlag&2)==0) iMissingIndex=1;
+ if ((iFlag&2)==0) iMissingIndex=1;
else if((iFlag&4)==0) iMissingIndex=2;
else if((iFlag&8)==0) iMissingIndex=3;
@@ -1875,11 +1875,11 @@ static void DegenEpilogue(STSpace psTspace[], STriInfo pTriInfos[], int piTriLis
vDstP = GetPosition(pContext, MakeIndex(iOrgF, iMissingIndex));
bNotFound = TTRUE;
i=0;
- while(bNotFound && i<3)
+ while (bNotFound && i<3)
{
const int iVert = pV[i];
const SVec3 vSrcP = GetPosition(pContext, MakeIndex(iOrgF, iVert));
- if(veq(vSrcP, vDstP)==TTRUE)
+ if (veq(vSrcP, vDstP)==TTRUE)
{
const int iOffs = pTriInfos[t].iTSpacesOffs;
psTspace[iOffs+iMissingIndex] = psTspace[iOffs+iVert];
diff --git a/intern/smoke/extern/smoke_API.h b/intern/smoke/extern/smoke_API.h
index 9d5dfd98823..a0eb1bf38e0 100644
--- a/intern/smoke/extern/smoke_API.h
+++ b/intern/smoke/extern/smoke_API.h
@@ -41,11 +41,11 @@ struct FLUID_3D;
void smoke_export(struct FLUID_3D *fluid, float *dt, float *dx, float **dens, float **densold, float **heat, float **heatold, float **vx, float **vy, float **vz, float **vxold, float **vyold, float **vzold, unsigned char **obstacles);
// low res
-struct FLUID_3D *smoke_init(int *res, float *p0);
+struct FLUID_3D *smoke_init(int *res, float *p0, float dtdef);
void smoke_free(struct FLUID_3D *fluid);
void smoke_initBlenderRNA(struct FLUID_3D *fluid, float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli);
-void smoke_step(struct FLUID_3D *fluid, size_t framenr, float fps);
+void smoke_step(struct FLUID_3D *fluid, float dtSubdiv);
float *smoke_get_density(struct FLUID_3D *fluid);
float *smoke_get_heat(struct FLUID_3D *fluid);
@@ -53,6 +53,9 @@ float *smoke_get_velocity_x(struct FLUID_3D *fluid);
float *smoke_get_velocity_y(struct FLUID_3D *fluid);
float *smoke_get_velocity_z(struct FLUID_3D *fluid);
+/* Moving obstacle velocity provided by blender */
+void smoke_get_ob_velocity(struct FLUID_3D *fluid, float **x, float **y, float **z);
+
float *smoke_get_force_x(struct FLUID_3D *fluid);
float *smoke_get_force_y(struct FLUID_3D *fluid);
float *smoke_get_force_z(struct FLUID_3D *fluid);
diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp
index 9f036cc6d2f..04971f898e9 100644
--- a/intern/smoke/intern/FLUID_3D.cpp
+++ b/intern/smoke/intern/FLUID_3D.cpp
@@ -34,6 +34,8 @@
#include "SPHERE.h"
#include <zlib.h>
+#include "float.h"
+
#if PARALLEL==1
#include <omp.h>
#endif // PARALLEL
@@ -42,11 +44,11 @@
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
-FLUID_3D::FLUID_3D(int *res, float *p0) :
+FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
_xRes(res[0]), _yRes(res[1]), _zRes(res[2]), _res(0.0f)
{
// set simulation consts
- _dt = DT_DEFAULT; // just in case. set in step from a RNA factor
+ _dt = dtdef; // just in case. set in step from a RNA factor
// start point of array
_p0[0] = p0[0];
@@ -81,6 +83,9 @@ FLUID_3D::FLUID_3D(int *res, float *p0) :
_xVelocity = new float[_totalCells];
_yVelocity = new float[_totalCells];
_zVelocity = new float[_totalCells];
+ _xVelocityOb = new float[_totalCells];
+ _yVelocityOb = new float[_totalCells];
+ _zVelocityOb = new float[_totalCells];
_xVelocityOld = new float[_totalCells];
_yVelocityOld = new float[_totalCells];
_zVelocityOld = new float[_totalCells];
@@ -111,6 +116,9 @@ FLUID_3D::FLUID_3D(int *res, float *p0) :
_xVelocity[x] = 0.0f;
_yVelocity[x] = 0.0f;
_zVelocity[x] = 0.0f;
+ _xVelocityOb[x] = 0.0f;
+ _yVelocityOb[x] = 0.0f;
+ _zVelocityOb[x] = 0.0f;
_xVelocityOld[x] = 0.0f;
_yVelocityOld[x] = 0.0f;
_zVelocityOld[x] = 0.0f;
@@ -131,9 +139,15 @@ FLUID_3D::FLUID_3D(int *res, float *p0) :
_colloPrev = 1; // default value
+ setBorderObstacles(); // walls
+
+}
+void FLUID_3D::setBorderObstacles()
+{
+
// set side obstacles
- int index;
+ unsigned int index;
for (int y = 0; y < _yRes; y++)
for (int x = 0; x < _xRes; x++)
{
@@ -169,7 +183,6 @@ FLUID_3D::FLUID_3D(int *res, float *p0) :
index += _xRes - 1;
if(_domainBcRight==1) _obstacles[index] = 1;
}
-
}
FLUID_3D::~FLUID_3D()
@@ -177,6 +190,9 @@ FLUID_3D::~FLUID_3D()
if (_xVelocity) delete[] _xVelocity;
if (_yVelocity) delete[] _yVelocity;
if (_zVelocity) delete[] _zVelocity;
+ if (_xVelocityOb) delete[] _xVelocityOb;
+ if (_yVelocityOb) delete[] _yVelocityOb;
+ if (_zVelocityOb) delete[] _zVelocityOb;
if (_xVelocityOld) delete[] _xVelocityOld;
if (_yVelocityOld) delete[] _yVelocityOld;
if (_zVelocityOld) delete[] _zVelocityOld;
@@ -214,10 +230,18 @@ void FLUID_3D::initBlenderRNA(float *alpha, float *beta, float *dt_factor, float
//////////////////////////////////////////////////////////////////////
void FLUID_3D::step(float dt)
{
+#if 0
// If border rules have been changed
if (_colloPrev != *_borderColli) {
+ printf("Border collisions changed\n");
+
+ // DG TODO: Need to check that no animated obstacle flags are overwritten
setBorderCollisions();
}
+#endif
+
+ // DG: TODO for the moment redo border for every timestep since it's been deleted every time by moving obstacles
+ setBorderCollisions();
// set delta time by dt_factor
@@ -786,6 +810,7 @@ void FLUID_3D::project()
memset(_pressure, 0, sizeof(float)*_totalCells);
memset(_divergence, 0, sizeof(float)*_totalCells);
+ // set velocity and pressure inside of obstacles to zero
setObstacleBoundaries(_pressure, 0, _zRes);
// copy out the boundaries
@@ -798,12 +823,49 @@ void FLUID_3D::project()
if(_domainBcTop == 0) setNeumannZ(_zVelocity, _res, 0, _zRes);
else setZeroZ(_zVelocity, _res, 0, _zRes);
+ /*
+ {
+ float maxx = 0, maxy = 0, maxz = 0;
+ for(unsigned int i = 0; i < _xRes * _yRes * _zRes; i++)
+ {
+ if(_xVelocity[i] > maxx)
+ maxx = _xVelocity[i];
+ if(_yVelocity[i] > maxy)
+ maxy = _yVelocity[i];
+ if(_zVelocity[i] > maxz)
+ maxz = _zVelocity[i];
+ }
+ printf("Max velx: %f, vely: %f, velz: %f\n", maxx, maxy, maxz);
+ }
+ */
+
+ /*
+ {
+ float maxvalue = 0;
+ for(unsigned int i = 0; i < _xRes * _yRes * _zRes; i++)
+ {
+ if(_heat[i] > maxvalue)
+ maxvalue = _heat[i];
+
+ }
+ printf("Max heat: %f\n", maxvalue);
+ }
+ */
+
// calculate divergence
index = _slabSize + _xRes + 1;
for (z = 1; z < _zRes - 1; z++, index += 2 * _xRes)
for (y = 1; y < _yRes - 1; y++, index += 2)
for (x = 1; x < _xRes - 1; x++, index++)
{
+
+ if(_obstacles[index])
+ {
+ _divergence[index] = 0.0f;
+ continue;
+ }
+
+
float xright = _xVelocity[index + 1];
float xleft = _xVelocity[index - 1];
float yup = _yVelocity[index + _xRes];
@@ -811,26 +873,82 @@ void FLUID_3D::project()
float ztop = _zVelocity[index + _slabSize];
float zbottom = _zVelocity[index - _slabSize];
- if(_obstacles[index+1]) xright = - _xVelocity[index];
+ if(_obstacles[index+1]) xright = - _xVelocity[index]; // DG: +=
if(_obstacles[index-1]) xleft = - _xVelocity[index];
if(_obstacles[index+_xRes]) yup = - _yVelocity[index];
if(_obstacles[index-_xRes]) ydown = - _yVelocity[index];
if(_obstacles[index+_slabSize]) ztop = - _zVelocity[index];
if(_obstacles[index-_slabSize]) zbottom = - _zVelocity[index];
+ if(_obstacles[index+1] & 8) xright += _xVelocityOb[index + 1];
+ if(_obstacles[index-1] & 8) xleft += _xVelocityOb[index - 1];
+ if(_obstacles[index+_xRes] & 8) yup += _yVelocityOb[index + _xRes];
+ if(_obstacles[index-_xRes] & 8) ydown += _yVelocityOb[index - _xRes];
+ if(_obstacles[index+_slabSize] & 8) ztop += _zVelocityOb[index + _slabSize];
+ if(_obstacles[index-_slabSize] & 8) zbottom += _zVelocityOb[index - _slabSize];
+
_divergence[index] = -_dx * 0.5f * (
xright - xleft +
yup - ydown +
ztop - zbottom );
- // DG: commenting this helps CG to get a better start, 10-20% speed improvement
- // _pressure[index] = 0.0f;
+ // Pressure is zero anyway since now a local array is used
+ _pressure[index] = 0.0f;
}
+
+
+ /*
+ {
+ float maxvalue = 0;
+ for(unsigned int i = 0; i < _xRes * _yRes * _zRes; i++)
+ {
+ if(_divergence[i] > maxvalue)
+ maxvalue = _divergence[i];
+
+ }
+ printf("Max divergence: %f\n", maxvalue);
+ }
+ */
+
copyBorderAll(_pressure, 0, _zRes);
+ /*
+ {
+ float maxvalue = 0;
+ for(unsigned int i = 0; i < _xRes * _yRes * _zRes; i++)
+ {
+ if(_pressure[i] > maxvalue)
+ maxvalue = _pressure[i];
+ }
+ printf("Max pressure BEFORE: %f\n", maxvalue);
+ }
+ */
+
// solve Poisson equation
solvePressurePre(_pressure, _divergence, _obstacles);
+ {
+ float maxvalue = 0;
+ for(unsigned int i = 0; i < _xRes * _yRes * _zRes; i++)
+ {
+ if(_pressure[i] > maxvalue)
+ maxvalue = _pressure[i];
+
+ /* HACK: Animated collision object sometimes result in a non converging solvePressurePre() */
+ if(_pressure[i] > _dx * _dt)
+ _pressure[i] = _dx * _dt;
+ else if(_pressure[i] < -_dx * _dt)
+ _pressure[i] = -_dx * _dt;
+
+ // if(_obstacle[i] && _pressure[i] != 0.0)
+ // printf("BAD PRESSURE i\n");
+
+ // if(_pressure[i]>1)
+ // printf("index: %d\n", i);
+ }
+ // printf("Max pressure: %f, dx: %f\n", maxvalue, _dx);
+ }
+
setObstaclePressure(_pressure, 0, _zRes);
// project out solution
@@ -848,12 +966,74 @@ void FLUID_3D::project()
}
}
+ setObstacleVelocity(0, _zRes);
+
if (_pressure) delete[] _pressure;
if (_divergence) delete[] _divergence;
}
+//////////////////////////////////////////////////////////////////////
+// calculate the obstacle velocity at boundary
+//////////////////////////////////////////////////////////////////////
+void FLUID_3D::setObstacleVelocity(int zBegin, int zEnd)
+{
+
+ // completely TODO <-- who wrote this and what is here TODO? DG
+ const size_t index_ = _slabSize + _xRes + 1;
+
+ //int vIndex=_slabSize + _xRes + 1;
+
+ int bb=0;
+ int bt=0;
+
+ if (zBegin == 0) {bb = 1;}
+ if (zEnd == _zRes) {bt = 1;}
+ // tag remaining obstacle blocks
+ for (int z = zBegin + bb; z < zEnd - bt; z++)
+ {
+ size_t index = index_ +(z-1)*_slabSize;
+
+ for (int y = 1; y < _yRes - 1; y++, index += 2)
+ {
+ for (int x = 1; x < _xRes - 1; x++, index++)
+ {
+ if (!_obstacles[index])
+ {
+ // if(_obstacles[index+1]) xright = - _xVelocityOb[index];
+ if((_obstacles[index - 1] & 8) && abs(_xVelocityOb[index - 1]) > FLT_EPSILON )
+ {
+ // printf("velocity x!\n");
+ _xVelocity[index] = _xVelocityOb[index - 1];
+ _xVelocity[index - 1] = _xVelocityOb[index - 1];
+ }
+ // if(_obstacles[index+_xRes]) yup = - _yVelocityOb[index];
+ if((_obstacles[index - _xRes] & 8) && abs(_yVelocityOb[index - _xRes]) > FLT_EPSILON)
+ {
+ // printf("velocity y!\n");
+ _yVelocity[index] = _yVelocityOb[index - _xRes];
+ _yVelocity[index - _xRes] = _yVelocityOb[index - _xRes];
+ }
+ // if(_obstacles[index+_slabSize]) ztop = - _zVelocityOb[index];
+ if((_obstacles[index - _slabSize] & 8) && abs(_zVelocityOb[index - _slabSize]) > FLT_EPSILON)
+ {
+ // printf("velocity z!\n");
+ _zVelocity[index] = _zVelocityOb[index - _slabSize];
+ _zVelocity[index - _slabSize] = _zVelocityOb[index - _slabSize];
+ }
+ }
+ else
+ {
+ _density[index] = 0;
+ }
+ //vIndex++;
+ } // x loop
+ //vIndex += 2;
+ } // y loop
+ //vIndex += 2 * _xRes;
+ } // z loop
+}
//////////////////////////////////////////////////////////////////////
// diffuse heat
@@ -892,7 +1072,7 @@ void FLUID_3D::addObstacle(OBSTACLE* obstacle)
void FLUID_3D::setObstaclePressure(float *_pressure, int zBegin, int zEnd)
{
- // compleately TODO
+ // completely TODO <-- who wrote this and what is here TODO? DG
const size_t index_ = _slabSize + _xRes + 1;
@@ -914,7 +1094,7 @@ void FLUID_3D::setObstaclePressure(float *_pressure, int zBegin, int zEnd)
for (int x = 1; x < _xRes - 1; x++, index++)
{
// could do cascade of ifs, but they are a pain
- if (_obstacles[index])
+ if (_obstacles[index] /* && !(_obstacles[index] & 8) DG TODO TEST THIS CONDITION */)
{
const int top = _obstacles[index + _slabSize];
const int bottom= _obstacles[index - _slabSize];
@@ -928,9 +1108,11 @@ void FLUID_3D::setObstaclePressure(float *_pressure, int zBegin, int zEnd)
// const bool fully = (up && down);
//const bool fullx = (left && right);
+ /*
_xVelocity[index] =
_yVelocity[index] =
_zVelocity[index] = 0.0f;
+ */
_pressure[index] = 0.0f;
// average pressure neighbors
@@ -1253,7 +1435,35 @@ void FLUID_3D::advectMacCormackEnd2(int zBegin, int zEnd)
setZeroBorder(_density, res, zBegin, zEnd);
setZeroBorder(_heat, res, zBegin, zEnd);
+#if 0
+ {
+ const size_t index_ = _slabSize + _xRes + 1;
+ int bb=0;
+ int bt=0;
+
+ if (zBegin == 0) {bb = 1;}
+ if (zEnd == _zRes) {bt = 1;}
+
+ for (int z = zBegin + bb; z < zEnd - bt; z++)
+ {
+ size_t index = index_ +(z-1)*_slabSize;
+ for (int y = 1; y < _yRes - 1; y++, index += 2)
+ {
+ for (int x = 1; x < _xRes - 1; x++, index++)
+ {
+ // clean custom velocities from moving obstacles again
+ if (_obstacles[index])
+ {
+ _xVelocity[index] =
+ _yVelocity[index] =
+ _zVelocity[index] = 0.0f;
+ }
+ }
+ }
+ }
+ }
+#endif
/*int begin=zBegin * _slabSize;
int end=begin + (zEnd - zBegin) * _slabSize;
diff --git a/intern/smoke/intern/FLUID_3D.h b/intern/smoke/intern/FLUID_3D.h
index c9e18926fb2..5704cba3ed4 100644
--- a/intern/smoke/intern/FLUID_3D.h
+++ b/intern/smoke/intern/FLUID_3D.h
@@ -39,9 +39,6 @@
// #include "WTURBULENCE.h"
#include "VEC3.h"
-// timestep default value for nice appearance
-#define DT_DEFAULT 0.1f;
-
using namespace std;
using namespace BasicVector;
class WTURBULENCE;
@@ -49,7 +46,7 @@ class WTURBULENCE;
class FLUID_3D
{
public:
- FLUID_3D(int *res, /* int amplify, */ float *p0);
+ FLUID_3D(int *res, /* int amplify, */ float *p0, float dtdef);
FLUID_3D() {};
virtual ~FLUID_3D();
@@ -72,7 +69,7 @@ class FLUID_3D
int yRes() const { return _yRes; };
int zRes() const { return _zRes; };
- public:
+ public:
// dimensions
int _xRes, _yRes, _zRes, _maxRes;
Vec3Int _res;
@@ -89,6 +86,8 @@ class FLUID_3D
void artificialDampingSL(int zBegin, int zEnd);
void artificialDampingExactSL(int pos);
+ void setBorderObstacles();
+
// fields
float* _density;
float* _densityOld;
@@ -97,13 +96,17 @@ class FLUID_3D
float* _xVelocity;
float* _yVelocity;
float* _zVelocity;
+ float* _xVelocityOb;
+ float* _yVelocityOb;
+ float* _zVelocityOb;
float* _xVelocityOld;
float* _yVelocityOld;
float* _zVelocityOld;
float* _xForce;
float* _yForce;
float* _zForce;
- unsigned char* _obstacles;
+ unsigned char* _obstacles; /* only used (usefull) for static obstacles like domain boundaries */
+ unsigned char* _obstaclesAnim;
// Required for proper threading:
float* _xVelocityTemp;
@@ -137,6 +140,8 @@ class FLUID_3D
// have to recalibrate borders if nothing has changed
void setBorderCollisions();
+ void setObstacleVelocity(int zBegin, int zEnd);
+
// WTURBULENCE object, if active
// WTURBULENCE* _wTurbulence;
diff --git a/intern/smoke/intern/OBSTACLE.h b/intern/smoke/intern/OBSTACLE.h
index 61d47b727f0..da8ec6be024 100644
--- a/intern/smoke/intern/OBSTACLE.h
+++ b/intern/smoke/intern/OBSTACLE.h
@@ -27,9 +27,11 @@
#define OBSTACLE_H
enum OBSTACLE_FLAGS {
- EMPTY = 0,
+ EMPTY = 0,
+ /* 1 is used to flag an object cell */
MARCHED = 2,
- RETIRED = 4
+ RETIRED = 4,
+ ANIMATED = 8,
};
class OBSTACLE
diff --git a/intern/smoke/intern/WTURBULENCE.cpp b/intern/smoke/intern/WTURBULENCE.cpp
index cd18cf7b344..83bec466c9f 100644
--- a/intern/smoke/intern/WTURBULENCE.cpp
+++ b/intern/smoke/intern/WTURBULENCE.cpp
@@ -431,8 +431,11 @@ void WTURBULENCE::decomposeEnergy(float *_energy, float *_highFreqEnergy)
// compute velocity from energies and march into obstacles
// for wavelet decomposition
//////////////////////////////////////////////////////////////////////
-void WTURBULENCE::computeEnergy(float *_energy, float* xvel, float* yvel, float* zvel, unsigned char *obstacles)
+void WTURBULENCE::computeEnergy(float *_energy, float* xvel, float* yvel, float* zvel, unsigned char *origObstacles)
{
+ unsigned char *obstacles = new unsigned char[_totalCellsSm];
+ memcpy(obstacles, origObstacles, sizeof(unsigned char) * _totalCellsSm);
+
// compute everywhere
for (int x = 0; x < _totalCellsSm; x++)
_energy[x] = 0.5f * (xvel[x] * xvel[x] + yvel[x] * yvel[x] + zvel[x] * zvel[x]);
@@ -506,7 +509,9 @@ void WTURBULENCE::computeEnergy(float *_energy, float* xvel, float* yvel, float*
for (int y = 1; y < _yResSm - 1; y++, index += 2)
for (int x = 1; x < _xResSm - 1; x++, index++)
if (obstacles[index])
- obstacles[index] = 1;
+ obstacles[index] = 1; // DG TODO ? animated obstacle flag?
+
+ free(obstacles);
}
//////////////////////////////////////////////////////////////////////////////////////////
diff --git a/intern/smoke/intern/smoke_API.cpp b/intern/smoke/intern/smoke_API.cpp
index a2f3c21bbbf..78f7d35360a 100644
--- a/intern/smoke/intern/smoke_API.cpp
+++ b/intern/smoke/intern/smoke_API.cpp
@@ -19,6 +19,7 @@
* All rights reserved.
*
* Contributor(s): Daniel Genrich
+ * Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -36,10 +37,10 @@
#include <math.h>
// y in smoke is z in blender
-extern "C" FLUID_3D *smoke_init(int *res, float *p0)
+extern "C" FLUID_3D *smoke_init(int *res, float *p0, float dtdef)
{
// smoke lib uses y as top-bottom/vertical axis where blender uses z
- FLUID_3D *fluid = new FLUID_3D(res, p0);
+ FLUID_3D *fluid = new FLUID_3D(res, p0, dtdef);
// printf("xres: %d, yres: %d, zres: %d\n", res[0], res[1], res[2]);
@@ -78,41 +79,9 @@ extern "C" size_t smoke_get_index2d(int x, int max_x, int y /*, int max_y, int z
return x + y * max_x;
}
-extern "C" void smoke_step(FLUID_3D *fluid, size_t framenr, float fps)
+extern "C" void smoke_step(FLUID_3D *fluid, float dtSubdiv)
{
- /* stability values copied from wturbulence.cpp */
- const int maxSubSteps = 25;
- const float maxVel = 0.5f; /* TODO: maybe 0.5 is still too high, please confirm! -dg */
-
- float dt = DT_DEFAULT;
- float maxVelMag = 0.0f;
- int totalSubsteps;
- int substep = 0;
- float dtSubdiv;
-
- /* get max velocity and lower the dt value if it is too high */
- size_t size= fluid->_xRes * fluid->_yRes * fluid->_zRes;
-
- for(size_t i = 0; i < size; i++)
- {
- float vtemp = (fluid->_xVelocity[i]*fluid->_xVelocity[i]+fluid->_yVelocity[i]*fluid->_yVelocity[i]+fluid->_zVelocity[i]*fluid->_zVelocity[i]);
- if(vtemp > maxVelMag)
- maxVelMag = vtemp;
- }
-
- /* adapt timestep for different framerates, dt = 0.1 is at 25fps */
- dt *= (25.0f / fps);
-
- maxVelMag = sqrt(maxVelMag) * dt * (*(fluid->_dtFactor));
- totalSubsteps = (int)((maxVelMag / maxVel) + 1.0f); /* always round up */
- totalSubsteps = (totalSubsteps < 1) ? 1 : totalSubsteps;
- totalSubsteps = (totalSubsteps > maxSubSteps) ? maxSubSteps : totalSubsteps;
- dtSubdiv = (float)dt / (float)totalSubsteps;
-
- // printf("totalSubsteps: %d, maxVelMag: %f, dt: %f\n", totalSubsteps, maxVelMag, dt);
-
- for(substep = 0; substep < totalSubsteps; substep++)
- fluid->step(dtSubdiv);
+ fluid->step(dtSubdiv);
}
extern "C" void smoke_turbulence_step(WTURBULENCE *wt, FLUID_3D *fluid)
@@ -307,6 +276,18 @@ extern "C" unsigned char *smoke_get_obstacle(FLUID_3D *fluid)
return fluid->_obstacles;
}
+extern "C" void smoke_get_ob_velocity(struct FLUID_3D *fluid, float **x, float **y, float **z)
+{
+ *x = fluid->_xVelocityOb;
+ *y = fluid->_yVelocityOb;
+ *z = fluid->_zVelocityOb;
+}
+
+extern "C" unsigned char *smoke_get_obstacle_anim(FLUID_3D *fluid)
+{
+ return fluid->_obstaclesAnim;
+}
+
extern "C" void smoke_turbulence_set_noise(WTURBULENCE *wt, int type)
{
wt->setNoise(type);
diff --git a/intern/utfconv/utf_winfunc.c b/intern/utfconv/utf_winfunc.c
index 2e200ea3ad3..68d1d6bb403 100644
--- a/intern/utfconv/utf_winfunc.c
+++ b/intern/utfconv/utf_winfunc.c
@@ -39,7 +39,7 @@ FILE * ufopen(const char * filename, const char * mode)
UTF16_ENCODE(filename);
UTF16_ENCODE (mode);
- if(filename_16 && mode_16) {
+ if (filename_16 && mode_16) {
f = _wfopen(filename_16, mode_16);
}
@@ -81,7 +81,7 @@ int urename(const char *oldname, const char *newname )
UTF16_ENCODE(oldname);
UTF16_ENCODE (newname);
- if(oldname_16 && newname_16) r = _wrename(oldname_16, newname_16);
+ if (oldname_16 && newname_16) r = _wrename(oldname_16, newname_16);
UTF16_UN_ENCODE(newname);
UTF16_UN_ENCODE(oldname);
@@ -94,7 +94,7 @@ int umkdir(const char *pathname)
BOOL r = 0;
UTF16_ENCODE(pathname);
- if(pathname_16) r = CreateDirectoryW(pathname_16, NULL);
+ if (pathname_16) r = CreateDirectoryW(pathname_16, NULL);
UTF16_UN_ENCODE(pathname);
@@ -123,10 +123,10 @@ int uput_getenv(const char *varname, char * value, size_t buffsize)
{
int r = 0;
wchar_t * str;
- if(!buffsize) return r;
+ if (!buffsize) return r;
UTF16_ENCODE(varname);
- if(varname_16) {
+ if (varname_16) {
str = _wgetenv(varname_16);
conv_utf_16_to_8(str, value, buffsize);
r = 1;
@@ -143,7 +143,7 @@ int uputenv(const char *name, const char *value)
int r = -1;
UTF16_ENCODE(name);
UTF16_ENCODE(value);
- if(name_16 && value_16) {
+ if (name_16 && value_16) {
r = (SetEnvironmentVariableW(name_16,value_16)!= 0) ? 0 : -1;
}
UTF16_UN_ENCODE(value);
diff --git a/release/plugins/sequence/blur.c b/release/plugins/sequence/blur.c
index e95c243b558..b59d7fbd005 100644
--- a/release/plugins/sequence/blur.c
+++ b/release/plugins/sequence/blur.c
@@ -106,20 +106,20 @@ void blurbuf(struct ImBuf *ibuf, int nr, Cast *cast)
x4= ibuf->x/4;
/* This doesn't seem to work... paprmh */
- if(cast->gamma != 1.0) gamwarp(tbuf, cast->gamma);
+ if (cast->gamma != 1.0) gamwarp(tbuf, cast->gamma);
/* reduce */
- for(i=0; i<nr; i++) {
+ for (i=0; i<nr; i++) {
ttbuf = onehalf(tbuf);
if (ttbuf) {
freeImBuf(tbuf);
tbuf = ttbuf;
}
- if(tbuf->x<4 || tbuf->y<4) break;
+ if (tbuf->x<4 || tbuf->y<4) break;
}
/* enlarge */
- for(i=0; i<nr; i++) {
+ for (i=0; i<nr; i++) {
ttbuf = double_x(tbuf);
if (ttbuf) {
freeImBuf(tbuf);
@@ -130,18 +130,18 @@ void blurbuf(struct ImBuf *ibuf, int nr, Cast *cast)
freeImBuf(tbuf);
tbuf = ttbuf;
}
- if(tbuf->x > x4) {
+ if (tbuf->x > x4) {
scaleImBuf(tbuf, ibuf->x, ibuf->y);
break;
}
}
/* this doesn't seem to work...paprmh*/
- if(cast->gamma != 1.0) gamwarp(tbuf, 1.0 / cast->gamma);
+ if (cast->gamma != 1.0) gamwarp(tbuf, 1.0 / cast->gamma);
- if(ibuf->rect)memcpy(ibuf->rect, tbuf->rect, 4*ibuf->x*ibuf->y);
+ if (ibuf->rect)memcpy(ibuf->rect, tbuf->rect, 4*ibuf->x*ibuf->y);
- if(ibuf->rect_float)
+ if (ibuf->rect_float)
memcpy(ibuf->rect_float, tbuf->rect_float, 4*ibuf->x*ibuf->y*sizeof(float));
freeImBuf(tbuf);
@@ -161,13 +161,13 @@ void doblur(struct ImBuf *mbuf, float fac, Cast *cast)
/* which buffers ? */
- if(fac>7.0) fac= 7.0;
- if(fac<=1.0) return;
+ if (fac>7.0) fac= 7.0;
+ if (fac<=1.0) return;
pfac= 2.0;
pbuf= dupImBuf(mbuf);
n= 1;
- while(pfac < fac) {
+ while (pfac < fac) {
blurbuf(pbuf, n, cast);
blurbuf(pbuf, n, cast);
@@ -185,10 +185,10 @@ void doblur(struct ImBuf *mbuf, float fac, Cast *cast)
fac= (fac-pfac)/(ifac-pfac);
n= mbuf->x*mbuf->y;
- if(cast->show) fac=cast->show-1;
+ if (cast->show) fac=cast->show-1;
- if(mbuf->rect_float){
- if(fac>=1) {
+ if (mbuf->rect_float){
+ if (fac>=1) {
memcpy(mbuf->rect_float, ibuf->rect_float, 4*n*sizeof(float));
}
else if(fac<=0) {
@@ -200,7 +200,7 @@ void doblur(struct ImBuf *mbuf, float fac, Cast *cast)
irectf= (float *)ibuf->rect_float;
prectf= (float *)pbuf->rect_float;
mrectf= (float *)mbuf->rect_float;
- while(n--) {
+ while (n--) {
mrectf[0]= irectf[0]*fac+ prectf[0]*infac;
mrectf[1]= irectf[1]*fac+ prectf[1]*infac;
mrectf[2]= irectf[2]*fac+ prectf[2]*infac;
@@ -213,10 +213,10 @@ void doblur(struct ImBuf *mbuf, float fac, Cast *cast)
}
else if(mbuf->rect){
b1= (int)fac*255.0;
- if(b1>255) b1= 255;
+ if (b1>255) b1= 255;
b2= 255-b1;
- if(b1==255) {
+ if (b1==255) {
memcpy(mbuf->rect, ibuf->rect, 4*n);
}
else if(b1==0) {
@@ -226,7 +226,7 @@ void doblur(struct ImBuf *mbuf, float fac, Cast *cast)
irect= (char *)ibuf->rect;
prect= (char *)pbuf->rect;
mrect= (char *)mbuf->rect;
- while(n--) {
+ while (n--) {
mrect[0]= (irect[0]*b1+ prect[0]*b2)>>8;
mrect[1]= (irect[1]*b1+ prect[1]*b2)>>8;
mrect[2]= (irect[2]*b1+ prect[2]*b2)>>8;
@@ -247,7 +247,7 @@ void plugin_seq_doit(Cast *cast, float facf0, float facf1, int x, int y, ImBuf *
{
float bfacf0, bfacf1;
- if(cast->use_ipo==0) {
+ if (cast->use_ipo==0) {
bfacf0= bfacf1= cast->blur+1.0;
}
else {
@@ -255,8 +255,8 @@ void plugin_seq_doit(Cast *cast, float facf0, float facf1, int x, int y, ImBuf *
bfacf1 = (facf1 * 6.0) + 1.0;
}
- if(out->rect) memcpy(out->rect, ibuf1->rect, 4*out->x*out->y);
- if(out->rect_float) memcpy(out->rect_float, ibuf1->rect_float, 4*out->x*out->y*sizeof(float));
+ if (out->rect) memcpy(out->rect, ibuf1->rect, 4*out->x*out->y);
+ if (out->rect_float) memcpy(out->rect_float, ibuf1->rect_float, 4*out->x*out->y*sizeof(float));
/****************I can't get this field code to work... works ok without...paprmh****************/
@@ -269,13 +269,13 @@ void plugin_seq_doit(Cast *cast, float facf0, float facf1, int x, int y, ImBuf *
doblur(out, bfacf0, cast); /*fieldA*/
-/* if(out->rect)out->rect += out->x * out->y;
- if(out->rect_float)out->rect_float += out->x * out->y;
+/* if (out->rect)out->rect += out->x * out->y;
+ if (out->rect_float)out->rect_float += out->x * out->y;
doblur(out, bfacf1, cast);*/ /*fieldB*/
-/* if(out->rect)out->rect -= out->x * out->y;
- if(out->rect_float)out->rect_float -= out->x * out->y;
+/* if (out->rect)out->rect -= out->x * out->y;
+ if (out->rect_float)out->rect_float -= out->x * out->y;
out->flags |= IB_fields;
interlace(out);*/
diff --git a/release/plugins/texture/clouds2.c b/release/plugins/texture/clouds2.c
index fc20f5769ef..8561d11dc3b 100644
--- a/release/plugins/texture/clouds2.c
+++ b/release/plugins/texture/clouds2.c
@@ -150,7 +150,7 @@ int plugin_tex_doit(int stype, Cast *cast, float *texvec, float *dxt, float *dyt
/* always return this value */
result[0] = CLAMP (val+cast->offset, 0.0, 1.0) * pow (fabs(sqrt(tv[0]*tv[0]+tv[1]*tv[1]+tv[2]*tv[2])), cast->falloff);
- if(stype==1) {
+ if (stype==1) {
/*
* this is r, g, b, a:
*/
@@ -161,7 +161,7 @@ int plugin_tex_doit(int stype, Cast *cast, float *texvec, float *dxt, float *dyt
res |= TEX_RGB;
}
- if(stype==2) {
+ if (stype==2) {
/*
* This value is the displacement of the actual normal in
* the Material calculation.
diff --git a/release/plugins/texture/tiles.c b/release/plugins/texture/tiles.c
index 151f64b6dab..11e1ed8f8af 100644
--- a/release/plugins/texture/tiles.c
+++ b/release/plugins/texture/tiles.c
@@ -124,7 +124,7 @@ float sample_wave(float freq, float coord, float pixsize)
float fac, frac, retval;
int part1, part2;
- if(pixsize > freq) return 0.5;
+ if (pixsize > freq) return 0.5;
pixsize/= freq;
@@ -132,19 +132,19 @@ float sample_wave(float freq, float coord, float pixsize)
part1= ffloor(fac);
frac= fac - part1;
- if(part1 & 1) retval= 0.0;
- else retval= 1.0;
+ if (part1 & 1) retval= 0.0;
+ else retval = 1.0;
- if(pixsize != 0.0) {
+ if (pixsize != 0.0) {
/* is coord+pixsize another value? */
part2= ffloor(fac + pixsize);
- if(part1==part2) return retval;
+ if (part1==part2) return retval;
/* antialias */
- if(retval==1.0) retval= (1.0-frac)/pixsize;
- else retval= 1.0-(1.0-frac)/pixsize;
+ if (retval == 1.0) retval= (1.0 - frac) / pixsize;
+ else retval= 1.0 - (1.0 - frac) / pixsize;
}
return retval;
}
@@ -153,23 +153,23 @@ int plugin_tex_doit(int stype, Cast *cast, float *texvec, float *dxt, float *dyt
{
float xwave, ywave;
- if(stype==1) {
+ if (stype==1) {
texvec[0]+= hnoise(cast->noise, texvec[0], texvec[1], texvec[2]);
texvec[1]+= hnoise(cast->noise, texvec[1], texvec[2], texvec[0]);
}
- if(dxt && dyt) {
+ if (dxt && dyt) {
xwave= sample_wave(cast->size, texvec[0], fabs(dxt[0]) + fabs(dyt[0]) );
ywave= sample_wave(cast->size, texvec[1], fabs(dxt[1]) + fabs(dyt[1]) );
- if(xwave > ywave) result[0]= xwave-ywave;
+ if (xwave > ywave) result[0]= xwave-ywave;
else result[0]= ywave-xwave;
}
else {
xwave= sample_wave(cast->size, texvec[0], 0.0 );
ywave= sample_wave(cast->size, texvec[1], 0.0 );
- if(xwave > ywave) result[0]= xwave-ywave;
+ if (xwave > ywave) result[0]= xwave-ywave;
else result[0]= ywave-xwave;
}
diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py
index 588c10eea54..695bb8cb6b6 100644
--- a/release/scripts/modules/addon_utils.py
+++ b/release/scripts/modules/addon_utils.py
@@ -212,10 +212,13 @@ def check(module_name):
loaded_state = False
+ if mod and getattr(mod, "__addon_persistent__", False):
+ loaded_default = True
+
return loaded_default, loaded_state
-def enable(module_name, default_set=True):
+def enable(module_name, default_set=True, persistent=False):
"""
Enables an addon by name.
@@ -283,6 +286,7 @@ def enable(module_name, default_set=True):
ext.module = module_name
mod.__addon_enabled__ = True
+ mod.__addon_persistent__ = persistent
if _bpy.app.debug_python:
print("\taddon_utils.enable", mod.__name__)
@@ -305,6 +309,7 @@ def disable(module_name, default_set=True):
# the addon in the user prefs.
if mod:
mod.__addon_enabled__ = False
+ mod.__addon_persistent = False
try:
mod.unregister()
diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
index 3bd0d6fa4cc..b184c81d6a7 100644
--- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py
+++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
@@ -157,18 +157,17 @@ class prettyface(object):
angles_co.sort()
I = [i for a, i in angles_co]
- #~ fuv = f.uv
uv_layer = f.id_data.uv_layers.active.data
- fuv = [uv_layer[i].uv for i in f.loops] # XXX25
+ fuv = [uv_layer[i].uv for i in f.loop_indices]
if self.rot:
- fuv[I[2]] = p1
- fuv[I[1]] = p2
- fuv[I[0]] = p3
+ fuv[I[2]][:] = p1
+ fuv[I[1]][:] = p2
+ fuv[I[0]][:] = p3
else:
- fuv[I[2]] = p1
- fuv[I[0]] = p2
- fuv[I[1]] = p3
+ fuv[I[2]][:] = p1
+ fuv[I[0]][:] = p2
+ fuv[I[1]][:] = p3
f, lens, lensord = uv[0]
@@ -179,10 +178,10 @@ class prettyface(object):
set_uv(f, (x2, y2), (x2, y1 + margin_h), (x1 + margin_w, y2))
else: # 1 QUAD
- uv[1][0], uv[1][1] = x1, y1
- uv[2][0], uv[2][1] = x1, y2
- uv[3][0], uv[3][1] = x2, y2
- uv[0][0], uv[0][1] = x2, y1
+ uv[1][:] = x1, y1
+ uv[2][:] = x1, y2
+ uv[3][:] = x2, y2
+ uv[0][:] = x2, y1
def __hash__(self):
# None unique hash
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 25ea85a9a6a..94df1ed6cf5 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -47,6 +47,8 @@ class UnifiedPaintPanel():
parent.label(text="Unified Settings:")
parent.prop(ups, "use_unified_size", text="Size")
parent.prop(ups, "use_unified_strength", text="Strength")
+ if context.weight_paint_object:
+ parent.prop(ups, "use_unified_weight", text="Weight")
@staticmethod
def prop_unified_size(parent, context, brush, prop_name, icon='NONE', text="", slider=False):
@@ -59,3 +61,9 @@ class UnifiedPaintPanel():
ups = context.tool_settings.unified_paint_settings
ptr = ups if ups.use_unified_strength else brush
parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider)
+
+ @staticmethod
+ def prop_unified_weight(parent, context, brush, prop_name, icon='NONE', text="", slider=False):
+ ups = context.tool_settings.unified_paint_settings
+ ptr = ups if ups.use_unified_weight else brush
+ parent.prop(ptr, prop_name, icon=icon, text=text, slider=slider)
diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py
index f623d9a37eb..4db056e77a2 100644
--- a/release/scripts/startup/bl_ui/properties_physics_common.py
+++ b/release/scripts/startup/bl_ui/properties_physics_common.py
@@ -94,18 +94,25 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
if cachetype in {'PSYS', 'HAIR', 'SMOKE'}:
row.prop(cache, "use_external")
- if cache.use_external:
- split = layout.split(percentage=0.80)
- split.prop(cache, "name", text="File Name")
- split.prop(cache, "index", text="")
-
- row = layout.row()
- row.label(text="File Path:")
- row.prop(cache, "use_library_path", "Use Lib Path")
+ if cachetype == 'SMOKE':
+ row.prop(cache, "use_library_path", "Use Lib Path")
- layout.prop(cache, "filepath", text="")
+ if cache.use_external:
+ split = layout.split(percentage=0.35)
+ col = split.column()
+ col.label(text="File Name:")
+ if cache.use_external:
+ col.label(text="File Path:")
- layout.label(text=cache.info)
+ col = split.column()
+ sub = col.split(percentage=0.70, align=True)
+ sub.prop(cache, "name", text="")
+ sub.prop(cache, "index", text="")
+ col.prop(cache, "filepath", text="")
+
+ cache_info = cache.info
+ if cache_info:
+ layout.label(text=cache_info)
else:
if cachetype in {'SMOKE', 'DYNAMIC_PAINT'}:
if not bpy.data.is_saved:
@@ -117,6 +124,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
else:
layout.prop(cache, "name", text="Cache Name")
+ if not cache.use_external or cachetype == 'SMOKE':
row = layout.row(align=True)
if cachetype not in {'PSYS', 'DYNAMIC_PAINT'}:
diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index 9f760f2f024..d3ab616a793 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -100,6 +100,15 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel):
sub.prop(flow, "use_absolute")
sub.prop(flow, "density")
sub.prop(flow, "temperature")
+
+ elif md.smoke_type == 'COLLISION':
+ coll = md.coll_settings
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(coll, "collision_type")
+
class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, Panel):
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index 5cbe03bba1a..5c67b932d03 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -227,12 +227,16 @@ class CLIP_PT_tools_solve(Panel):
else "Object Motion")
col.operator("clip.clear_solution")
+ col = layout.column()
+ col.prop(settings, "use_tripod_solver")
+
col = layout.column(align=True)
+ col.active = not settings.use_tripod_solver
col.prop(settings, "keyframe_a")
col.prop(settings, "keyframe_b")
col = layout.column(align=True)
- col.active = tracking_object.is_camera
+ col.active = tracking_object.is_camera and not settings.use_tripod_solver
col.label(text="Refine:")
col.prop(settings, "refine_intrinsics", text="")
@@ -825,6 +829,10 @@ class CLIP_MT_view(Menu):
def draw(self, context):
layout = self.layout
+ sc = context.space_data
+
+ layout.prop(sc, "show_seconds")
+ layout.separator()
layout.operator("clip.properties", icon='MENU_PANEL')
layout.operator("clip.tools", icon='MENU_PANEL')
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index aae950519a4..43d675c1417 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -220,7 +220,6 @@ class SEQUENCER_MT_add_effect(Menu):
layout.operator("sequencer.effect_strip_add", text="Gamma Cross").type = 'GAMMA_CROSS'
layout.operator("sequencer.effect_strip_add", text="Multiply").type = 'MULTIPLY'
layout.operator("sequencer.effect_strip_add", text="Over Drop").type = 'OVER_DROP'
- layout.operator("sequencer.effect_strip_add", text="Plugin").type = 'PLUGIN'
layout.operator("sequencer.effect_strip_add", text="Wipe").type = 'WIPE'
layout.operator("sequencer.effect_strip_add", text="Glow").type = 'GLOW'
layout.operator("sequencer.effect_strip_add", text="Transform").type = 'TRANSFORM'
@@ -488,7 +487,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
col = layout.column(align=True)
if strip.type == 'SPEED':
col.prop(strip, "multiply_speed")
- elif strip.type in {'CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE'}:
+ elif strip.type in {'CROSS', 'GAMMA_CROSS', 'WIPE'}:
col.prop(strip, "use_default_fade", "Default fade")
if not strip.use_default_fade:
col.prop(strip, "effect_fader", text="Effect fader")
@@ -553,7 +552,6 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'MOVIECLIP', 'META',
'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
- 'PLUGIN',
'WIPE', 'GLOW', 'TRANSFORM',
'MULTICAM', 'SPEED', 'ADJUSTMENT'}
@@ -716,7 +714,6 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'MOVIECLIP', 'META',
'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
- 'PLUGIN',
'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
'MULTICAM', 'SPEED', 'ADJUSTMENT'}
diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py
index 7249e9522ff..a40e08c2e5c 100644
--- a/release/scripts/startup/bl_ui/space_text.py
+++ b/release/scripts/startup/bl_ui/space_text.py
@@ -273,6 +273,7 @@ class TEXT_MT_edit(Menu):
layout.operator("text.cut")
layout.operator("text.copy")
layout.operator("text.paste")
+ layout.operator("text.duplicate_line")
layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 7010c4f07cf..113c370e687 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -637,10 +637,6 @@ class USERPREF_PT_theme(Panel):
col.label(text="Tooltip:")
ui_items_general(col, ui)
- ui = theme.user_interface.wcol_tooltip
- col.label(text="Tooltip:")
- ui_items_general(col, ui)
-
ui = theme.user_interface.wcol_menu_item
col.label(text="Menu Item:")
ui_items_general(col, ui)
@@ -785,8 +781,6 @@ class USERPREF_PT_file(Panel):
sub = col1.column()
sub.label(text="Fonts:")
sub.label(text="Textures:")
- sub.label(text="Texture Plugins:")
- sub.label(text="Sequence Plugins:")
sub.label(text="Render Output:")
sub.label(text="Scripts:")
sub.label(text="Sounds:")
@@ -797,8 +791,6 @@ class USERPREF_PT_file(Panel):
sub = col1.column()
sub.prop(paths, "font_directory", text="")
sub.prop(paths, "texture_directory", text="")
- sub.prop(paths, "texture_plugin_directory", text="")
- sub.prop(paths, "sequence_plugin_directory", text="")
sub.prop(paths, "render_output_directory", text="")
sub.prop(paths, "script_directory", text="")
sub.prop(paths, "sound_directory", text="")
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 9cf52056875..ff9484e6baf 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -1767,6 +1767,7 @@ class VIEW3D_MT_edit_mesh_faces(Menu):
layout.operator("mesh.inset")
layout.operator("mesh.bevel")
layout.operator("mesh.solidify")
+ layout.operator("mesh.wireframe")
layout.operator("mesh.sort_faces")
layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index c494590d005..503229f5593 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -652,13 +652,15 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
# Weight Paint Mode #
elif context.weight_paint_object and brush:
- layout.prop(toolsettings, "vertex_group_weight", text="Weight", slider=True)
layout.prop(toolsettings, "use_auto_normalize", text="Auto Normalize")
layout.prop(toolsettings, "use_multipaint", text="Multi-Paint")
col = layout.column()
row = col.row(align=True)
+ self.prop_unified_weight(row, context, brush, "weight", slider=True, text="Weight")
+
+ row = col.row(align=True)
self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
self.prop_unified_size(row, context, brush, "use_pressure_size")
diff --git a/release/scripts/templates/operator_modal_timer.py b/release/scripts/templates/operator_modal_timer.py
index ec47390da81..ebbf6395df5 100644
--- a/release/scripts/templates/operator_modal_timer.py
+++ b/release/scripts/templates/operator_modal_timer.py
@@ -14,7 +14,7 @@ class ModalTimerOperator(bpy.types.Operator):
if event.type == 'TIMER':
# change theme color, silly!
- color = context.user_preferences.themes[0].view_3d.back
+ color = context.user_preferences.themes[0].view_3d.space.back
color.s = 1.0
color.h += 0.01
diff --git a/source/blender/avi/AVI_avi.h b/source/blender/avi/AVI_avi.h
index a579bf7dfec..5f4bdf88879 100644
--- a/source/blender/avi/AVI_avi.h
+++ b/source/blender/avi/AVI_avi.h
@@ -235,28 +235,28 @@ typedef enum {
/**
* Test whether this is an avi-format.
*/
-int AVI_is_avi (const char *name);
+int AVI_is_avi(const char *name);
/**
* Open a compressed file, decompress it into memory.
*/
-AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...);
+AviError AVI_open_compress(char *name, AviMovie *movie, int streams, ...);
/**
* Finalize a compressed output stream.
*/
-AviError AVI_close_compress (AviMovie *movie);
+AviError AVI_close_compress(AviMovie *movie);
/**
* Choose a compression option for \<movie\>. Possible options are
* AVI_OPTION_TYPE_MAIN, AVI_OPTION_TYPE_STRH, AVI_OPTION_TYPE_STRF
*/
-AviError AVI_set_compress_option (AviMovie *movie,
- int option_type,
- int stream,
- AviOption option,
- void *opt_data);
+AviError AVI_set_compress_option(AviMovie *movie,
+ int option_type,
+ int stream,
+ AviOption option,
+ void *opt_data);
/* Hmmm... there should be some explanantion about what these mean */
/**
* Compression option, for use in avi_set_compress_option
@@ -275,35 +275,35 @@ AviError AVI_set_compress_option (AviMovie *movie,
* Direct the streams \<avist_type\> to \<movie\>. Redirect \<stream_num\>
* streams.
*/
-int AVI_get_stream (AviMovie *movie, int avist_type, int stream_num);
+int AVI_get_stream(AviMovie *movie, int avist_type, int stream_num);
/**
* Open a movie stream from file.
*/
-AviError AVI_open_movie (const char *name, AviMovie *movie);
+AviError AVI_open_movie(const char *name, AviMovie *movie);
/**
* Read a frame from a movie stream.
*/
-void *AVI_read_frame (AviMovie *movie,
- AviFormat format,
- int frame,
- int stream);
+void *AVI_read_frame(AviMovie *movie,
+ AviFormat format,
+ int frame,
+ int stream);
/**
* Close an open movie stream.
*/
-AviError AVI_close (AviMovie *movie);
+AviError AVI_close(AviMovie *movie);
/**
* Write frames to a movie stream.
*/
-AviError AVI_write_frame (AviMovie *movie, int frame_num, ...);
+AviError AVI_write_frame(AviMovie *movie, int frame_num, ...);
/**
* Unused but still external
*/
-AviError AVI_print_error (AviError error);
-void AVI_set_debug (int mode);
+AviError AVI_print_error(AviError error);
+void AVI_set_debug(int mode);
#endif /* __AVI_AVI_H__ */
diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c
index 2011ced96d9..3a64a8aa8ac 100644
--- a/source/blender/avi/intern/avi.c
+++ b/source/blender/avi/intern/avi.c
@@ -58,8 +58,8 @@ static char DEBUG_FCC[4];
#define DEBUG_PRINT(x) if (AVI_DEBUG) { printf("AVI DEBUG: " x); } (void)0
/* local functions */
-char *fcc_to_char (unsigned int fcc);
-char *tcc_to_char (unsigned int tcc);
+char *fcc_to_char(unsigned int fcc);
+char *tcc_to_char(unsigned int tcc);
@@ -89,7 +89,7 @@ unsigned int GET_TCC (FILE *fp)
return FCC (tmp);
}
-char *fcc_to_char (unsigned int fcc)
+char *fcc_to_char(unsigned int fcc)
{
DEBUG_FCC[0]= (fcc)&127;
DEBUG_FCC[1]= (fcc>>8)&127;
@@ -99,7 +99,7 @@ char *fcc_to_char (unsigned int fcc)
return DEBUG_FCC;
}
-char *tcc_to_char (unsigned int tcc)
+char *tcc_to_char(unsigned int tcc)
{
DEBUG_FCC[0]= (tcc)&127;
DEBUG_FCC[1]= (tcc>>8)&127;
@@ -109,7 +109,7 @@ char *tcc_to_char (unsigned int tcc)
return DEBUG_FCC;
}
-int AVI_get_stream (AviMovie *movie, int avist_type, int stream_num)
+int AVI_get_stream(AviMovie *movie, int avist_type, int stream_num)
{
int cur_stream;
@@ -157,7 +157,7 @@ static int fcc_is_data (int fcc)
return 1;
}
-AviError AVI_print_error (AviError in_error)
+AviError AVI_print_error(AviError in_error)
{
int error;
@@ -200,12 +200,12 @@ AviError AVI_print_error (AviError in_error)
return in_error;
}
#if 0
-void AVI_set_debug (int mode)
+void AVI_set_debug(int mode)
{
AVI_DEBUG= mode;
}
-int AVI_is_avi (char *name)
+int AVI_is_avi(char *name)
{
FILE *fp;
int ret;
@@ -228,7 +228,7 @@ int AVI_is_avi (char *name)
}
#endif
-int AVI_is_avi (const char *name)
+int AVI_is_avi(const char *name)
{
int temp, fcca, j;
AviMovie movie= {NULL};
@@ -425,7 +425,7 @@ int AVI_is_avi (const char *name)
}
-AviError AVI_open_movie (const char *name, AviMovie *movie)
+AviError AVI_open_movie(const char *name, AviMovie *movie)
{
int temp, fcca, size, j;
@@ -442,7 +442,9 @@ AviError AVI_open_movie (const char *name, AviMovie *movie)
if (GET_FCC (movie->fp) != FCC("RIFF") ||
!(movie->size = GET_FCC (movie->fp)))
+ {
return AVI_ERROR_FORMAT;
+ }
movie->header = (AviMainHeader *) MEM_mallocN (sizeof (AviMainHeader), "movieheader");
@@ -636,7 +638,7 @@ AviError AVI_open_movie (const char *name, AviMovie *movie)
return AVI_ERROR_FORMAT;
}
- movie->entries = (AviIndexEntry *) MEM_mallocN (movie->index_entries * sizeof(AviIndexEntry),"movieentries");
+ movie->entries = (AviIndexEntry *) MEM_mallocN (movie->index_entries * sizeof(AviIndexEntry), "movieentries");
for (temp=0; temp < movie->index_entries; temp++) {
movie->entries[temp].ChunkId = GET_FCC (movie->fp);
@@ -699,7 +701,7 @@ void *AVI_read_frame (AviMovie *movie, AviFormat format, int frame, int stream)
fseek (movie->fp, movie->read_offset + movie->entries[i-1].Offset, SEEK_SET);
temp = GET_FCC(movie->fp);
- buffer = MEM_mallocN (temp,"readbuffer");
+ buffer = MEM_mallocN (temp, "readbuffer");
if (fread (buffer, 1, temp, movie->fp) != temp) {
MEM_freeN(buffer);
@@ -712,7 +714,7 @@ void *AVI_read_frame (AviMovie *movie, AviFormat format, int frame, int stream)
return buffer;
}
-AviError AVI_close (AviMovie *movie)
+AviError AVI_close(AviMovie *movie)
{
int i;
@@ -735,7 +737,7 @@ AviError AVI_close (AviMovie *movie)
return AVI_ERROR_NONE;
}
-AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...)
+AviError AVI_open_compress(char *name, AviMovie *movie, int streams, ...)
{
va_list ap;
AviList list;
@@ -753,14 +755,14 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...)
if (movie->fp == NULL)
return AVI_ERROR_OPEN;
- movie->offset_table = (int64_t *) MEM_mallocN ((1+streams*2) * sizeof (int64_t),"offsettable");
+ movie->offset_table = (int64_t *) MEM_mallocN ((1+streams*2) * sizeof (int64_t), "offsettable");
for (i=0; i < 1 + streams*2; i++)
movie->offset_table[i] = -1L;
movie->entries = NULL;
- movie->header = (AviMainHeader *) MEM_mallocN (sizeof(AviMainHeader),"movieheader");
+ movie->header = (AviMainHeader *) MEM_mallocN (sizeof(AviMainHeader), "movieheader");
movie->header->fcc = FCC("avih");
movie->header->size = 56;
@@ -779,7 +781,7 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...)
movie->header->Reserved[2] = 0;
movie->header->Reserved[3] = 0;
- movie->streams = (AviStreamRec *) MEM_mallocN (sizeof(AviStreamRec) * movie->header->Streams,"moviestreams");
+ movie->streams = (AviStreamRec *) MEM_mallocN (sizeof(AviStreamRec) * movie->header->Streams, "moviestreams");
va_start (ap, streams);
@@ -816,7 +818,7 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...)
#if 0
if (movie->streams[i].format == AVI_FORMAT_MJPEG) {
movie->streams[i].sf = MEM_mallocN (sizeof(AviBitmapInfoHeader)
- + sizeof(AviMJPEGUnknown),"moviestreamformatL");
+ + sizeof(AviMJPEGUnknown), "moviestreamformatL");
movie->streams[i].sf_size = sizeof(AviBitmapInfoHeader) + sizeof(AviMJPEGUnknown);
}
else {
@@ -931,7 +933,7 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...)
return AVI_ERROR_NONE;
}
-AviError AVI_write_frame (AviMovie *movie, int frame_num, ...)
+AviError AVI_write_frame(AviMovie *movie, int frame_num, ...)
{
AviList list;
AviChunk chunk;
@@ -950,7 +952,7 @@ AviError AVI_write_frame (AviMovie *movie, int frame_num, ...)
if (frame_num+1 > movie->index_entries) {
temp = (AviIndexEntry *) MEM_mallocN ((frame_num+1) *
- (movie->header->Streams+1) * sizeof(AviIndexEntry),"newidxentry");
+ (movie->header->Streams+1) * sizeof(AviIndexEntry), "newidxentry");
if (movie->entries != NULL) {
memcpy (temp, movie->entries, movie->index_entries * (movie->header->Streams+1)
* sizeof(AviIndexEntry));
@@ -1039,7 +1041,7 @@ AviError AVI_write_frame (AviMovie *movie, int frame_num, ...)
return AVI_ERROR_NONE;
}
-AviError AVI_close_compress (AviMovie *movie)
+AviError AVI_close_compress(AviMovie *movie)
{
int temp, movi_size, i;
@@ -1060,7 +1062,7 @@ AviError AVI_close_compress (AviMovie *movie)
fseek (movie->fp, movie->movi_offset, SEEK_SET);
- PUT_FCCN((movi_size-(movie->movi_offset+4L)),movie->fp);
+ PUT_FCCN((movi_size-(movie->movi_offset+4L)), movie->fp);
fclose (movie->fp);
diff --git a/source/blender/avi/intern/avirgb.c b/source/blender/avi/intern/avirgb.c
index 8e5806c09cf..e06d0bbfa11 100644
--- a/source/blender/avi/intern/avirgb.c
+++ b/source/blender/avi/intern/avirgb.c
@@ -45,7 +45,7 @@
void *avi_converter_from_avi_rgb (AviMovie *movie, int stream, unsigned char *buffer, int *size)
{
- int x, y,i, rowstride;
+ int x, y, i, rowstride;
unsigned char *buf;
AviBitmapInfoHeader *bi;
short bits= 32;
@@ -127,7 +127,7 @@ void *avi_converter_to_avi_rgb (AviMovie *movie, int stream, unsigned char *buff
*size= movie->header->Height * movie->header->Width * 3;
if (movie->header->Width%2) *size+= movie->header->Height;
- buf = MEM_mallocN (*size,"toavirgbbuf");
+ buf = MEM_mallocN (*size, "toavirgbbuf");
rowstride = movie->header->Width*3;
if (movie->header->Width%2) rowstride++;
diff --git a/source/blender/avi/intern/codecs.c b/source/blender/avi/intern/codecs.c
index 73af7097994..87db5915dc8 100644
--- a/source/blender/avi/intern/codecs.c
+++ b/source/blender/avi/intern/codecs.c
@@ -46,10 +46,12 @@ void *avi_format_convert (AviMovie *movie, int stream, void *buffer, AviFormat f
return buffer;
if (from != AVI_FORMAT_RGB24 &&
- to != AVI_FORMAT_RGB24)
+ to != AVI_FORMAT_RGB24)
+ {
return avi_format_convert(movie, stream,
- avi_format_convert (movie, stream, buffer, from, AVI_FORMAT_RGB24, size),
- AVI_FORMAT_RGB24, to, size);
+ avi_format_convert(movie, stream, buffer, from, AVI_FORMAT_RGB24, size),
+ AVI_FORMAT_RGB24, to, size);
+ }
switch (to) {
case AVI_FORMAT_RGB24:
@@ -83,21 +85,21 @@ void *avi_format_convert (AviMovie *movie, int stream, void *buffer, AviFormat f
return buffer;
}
-int avi_get_data_id (AviFormat format, int stream)
+int avi_get_data_id(AviFormat format, int stream)
{
char fcc[5];
if (avi_get_format_type (format) == FCC("vids"))
- sprintf (fcc,"%2.2ddc",stream);
+ sprintf (fcc, "%2.2ddc", stream);
else if (avi_get_format_type (format) == FCC("auds"))
- sprintf (fcc,"%2.2ddc",stream);
+ sprintf (fcc, "%2.2ddc", stream);
else
return 0;
return FCC(fcc);
}
-int avi_get_format_type (AviFormat format)
+int avi_get_format_type(AviFormat format)
{
switch (format) {
case AVI_FORMAT_RGB24:
@@ -112,7 +114,7 @@ int avi_get_format_type (AviFormat format)
}
}
-int avi_get_format_fcc (AviFormat format)
+int avi_get_format_fcc(AviFormat format)
{
switch (format) {
case AVI_FORMAT_RGB24:
@@ -129,7 +131,7 @@ int avi_get_format_fcc (AviFormat format)
}
}
-int avi_get_format_compression (AviFormat format)
+int avi_get_format_compression(AviFormat format)
{
switch (format) {
case AVI_FORMAT_RGB24:
diff --git a/source/blender/avi/intern/endian.c b/source/blender/avi/intern/endian.c
index adcc7e8750a..41b8202af03 100644
--- a/source/blender/avi/intern/endian.c
+++ b/source/blender/avi/intern/endian.c
@@ -49,7 +49,7 @@
#ifdef __BIG_ENDIAN__
static void invert (int *num)
{
- int new=0,i,j;
+ int new=0, i, j;
for (j=0; j < 4; j++) {
for (i=0; i<8; i++) {
@@ -63,7 +63,7 @@ static void invert (int *num)
static void sinvert (short int *num)
{
short int new=0;
- int i,j;
+ int i, j;
for (j=0; j < 2; j++) {
for (i=0; i<8; i++) {
@@ -169,7 +169,7 @@ static void Iindexe (AviIndexEntry *indexe)
}
#endif /* __BIG_ENDIAN__ */
-void awrite (AviMovie *movie, void *datain, int block, int size, FILE *fp, int type)
+void awrite(AviMovie *movie, void *datain, int block, int size, FILE *fp, int type)
{
#ifdef __BIG_ENDIAN__
void *data;
diff --git a/source/blender/avi/intern/options.c b/source/blender/avi/intern/options.c
index a2fd756ddaa..fb1ed24926e 100644
--- a/source/blender/avi/intern/options.c
+++ b/source/blender/avi/intern/options.c
@@ -44,7 +44,7 @@
/* avi_set_compress_options gets its own file... now don't WE feel important? */
-AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, AviOption option, void *opt_data)
+AviError AVI_set_compress_option(AviMovie *movie, int option_type, int stream, AviOption option, void *opt_data)
{
int i;
int useconds;
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 033efbfc1fc..9309cf15667 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -341,7 +341,7 @@ static void blf_texture5_draw(const float shadow_col[4], float uv[2][2], float x
static void blf_texture3_draw(const float shadow_col[4], float uv[2][2], float x1, float y1, float x2, float y2)
{
float soft[9] = {1/16.0f, 2/16.0f, 1/16.0f,
- 2/16.0f,4/16.0f, 2/16.0f,
+ 2/16.0f, 4/16.0f, 2/16.0f,
1/16.0f, 2/16.0f, 1/16.0f};
float color[4], *fp = soft;
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
index 435ca8776bc..96d3a231ba5 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -106,6 +106,7 @@ static const char *locales[] = {
"serbian (latin)", "sr_RS@latin",
"kyrgyz", "ky_KG",
"turkish", "tr_TR",
+ "hungarian", "hu_HU",
};
void BLF_lang_init(void)
@@ -182,9 +183,9 @@ void BLF_lang_set(const char *str)
char *envStr;
if (U.language == 0)/* use system setting */
- envStr = BLI_sprintfN( "LANG=%s", getenv("LANG") );
+ envStr = BLI_sprintfN("LANG=%s", getenv("LANG"));
else
- envStr = BLI_sprintfN( "LANG=%s", short_locale );
+ envStr = BLI_sprintfN("LANG=%s", short_locale);
gettext_putenv(envStr);
MEM_freeN(envStr);
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 5afe27f7be3..51daac87138 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 263
-#define BLENDER_SUBVERSION 0
+#define BLENDER_SUBVERSION 1
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
@@ -51,7 +51,7 @@ extern "C" {
/* can be left blank, otherwise a,b,c... etc with no quotes */
#define BLENDER_VERSION_CHAR
/* alpha/beta/rc/release, docs use this */
-#define BLENDER_VERSION_CYCLE release
+#define BLENDER_VERSION_CYCLE alpha
extern char versionstr[]; /* from blender.c */
diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h
index 1ff9bc46638..2a62d204e78 100644
--- a/source/blender/blenkernel/BKE_brush.h
+++ b/source/blender/blenkernel/BKE_brush.h
@@ -99,6 +99,7 @@ float brush_unprojected_radius(const struct Scene *scene, struct Brush *brush);
void brush_set_unprojected_radius(struct Scene *scene, struct Brush *brush, float value);
float brush_alpha(const struct Scene *scene, struct Brush *brush);
+float brush_weight(const Scene *scene, struct Brush *brush);
int brush_use_locked_size(const struct Scene *scene, struct Brush *brush);
int brush_use_alpha_pressure(const struct Scene *scene, struct Brush *brush);
diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h
index 623dbd9c7ac..378cc72beb1 100644
--- a/source/blender/blenkernel/BKE_cloth.h
+++ b/source/blender/blenkernel/BKE_cloth.h
@@ -169,10 +169,10 @@ typedef enum
/* Spring types as defined in the paper.*/
typedef enum
{
- CLOTH_SPRING_TYPE_STRUCTURAL = ( 1 << 1 ),
- CLOTH_SPRING_TYPE_SHEAR = ( 1 << 2 ) ,
- CLOTH_SPRING_TYPE_BENDING = ( 1 << 3 ),
- CLOTH_SPRING_TYPE_GOAL = ( 1 << 4 ),
+ CLOTH_SPRING_TYPE_STRUCTURAL = (1 << 1),
+ CLOTH_SPRING_TYPE_SHEAR = (1 << 2),
+ CLOTH_SPRING_TYPE_BENDING = (1 << 3),
+ CLOTH_SPRING_TYPE_GOAL = (1 << 4)
} CLOTH_SPRING_TYPES;
/* SPRING FLAGS */
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index fa3a1a6897a..3b9328ae1aa 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -53,72 +53,83 @@ struct Scene;
#define CU_DO_TILT(cu, nu) (((nu->flag & CU_2D) && (cu->flag & CU_3D)==0) ? 0 : 1)
#define CU_DO_RADIUS(cu, nu) ((CU_DO_TILT(cu, nu) || ((cu)->flag & CU_PATH_RADIUS) || (cu)->bevobj || (cu)->ext1!=0.0f || (cu)->ext2!=0.0f) ? 1:0)
+/* ** Curve ** */
+void BKE_curve_unlink(struct Curve *cu);
+void BKE_curve_free(struct Curve *cu);
+void BKE_curve_editfont_free(struct Curve *cu);
+struct Curve *BKE_curve_add(const char *name, int type);
+struct Curve *BKE_curve_copy(struct Curve *cu);
+void BKE_curve_make_local(struct Curve *cu);
+short BKE_curve_type_get(struct Curve *cu);
+void BKE_curve_type_test(struct Object *ob);
+void BKE_curve_curve_dimension_update(struct Curve *cu);
+void BKE_curve_tex_space_calc(struct Curve *cu);
-void unlink_curve(struct Curve *cu);
-void free_curve_editNurb_keyIndex(struct EditNurb *editnurb);
-void free_curve_editNurb(struct Curve *cu);
-void free_curve(struct Curve *cu);
-void BKE_free_editfont(struct Curve *cu);
-struct Curve *add_curve(const char *name, int type);
-struct Curve *copy_curve(struct Curve *cu);
-void make_local_curve(struct Curve *cu);
-struct ListBase *curve_editnurbs(struct Curve *cu);
-short curve_type(struct Curve *cu);
-void test_curve_type(struct Object *ob);
-void update_curve_dimension(struct Curve *cu );
-void tex_space_curve(struct Curve *cu);
-int count_curveverts(struct ListBase *nurb);
-int count_curveverts_without_handles(struct ListBase *nurb);
-void freeNurb(struct Nurb *nu);
-void freeNurblist(struct ListBase *lb);
-struct Nurb *duplicateNurb(struct Nurb *nu);
-void duplicateNurblist(struct ListBase *lb1, struct ListBase *lb2);
-void test2DNurb(struct Nurb *nu);
-void minmaxNurb(struct Nurb *nu, float *min, float *max);
-
-void nurbs_knot_calc_u(struct Nurb *nu);
-void nurbs_knot_calc_v(struct Nurb *nu);
-
-void makeNurbfaces(struct Nurb *nu, float *coord_array, int rowstride, int resolu, int resolv);
-void makeNurbcurve(struct Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride);
-void forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride);
-float *make_orco_curve(struct Scene *scene, struct Object *ob);
-float *make_orco_surf(struct Object *ob);
-void makebevelcurve(struct Scene *scene, struct Object *ob, struct ListBase *disp, int forRender);
-
-void makeBevelList(struct Object *ob);
-
-void calchandleNurb(struct BezTriple *bezt, struct BezTriple *prev, struct BezTriple *next, int mode);
-void calchandlesNurb(struct Nurb *nu);
-void testhandlesNurb(struct Nurb *nu);
-void autocalchandlesNurb(struct Nurb *nu, int flag);
-void autocalchandlesNurb_all(ListBase *editnurb, int flag);
-void sethandlesNurb(ListBase *editnurb, short code);
-
-void switchdirectionNurb(struct Nurb *nu);
-
-void addNurbPoints(struct Nurb *nu, int number);
-void addNurbPointsBezier(struct Nurb *nu, int number);
-
-float (*curve_getVertexCos(struct Curve *cu, struct ListBase *lb, int *numVerts_r))[3];
-void curve_applyVertexCos(struct Curve *cu, struct ListBase *lb, float (*vertexCos)[3]);
-
-float (*curve_getKeyVertexCos(struct Curve *cu, struct ListBase *lb, float *key))[3];
-void curve_applyKeyVertexTilts(struct Curve *cu, struct ListBase *lb, float *key);
+int BKE_curve_minmax(struct Curve *cu, float min[3], float max[3]);
+int BKE_curve_center_median(struct Curve *cu, float cent[3]);
+int BKE_curve_center_bounds(struct Curve *cu, float cent[3]);
+void BKE_curve_translate(struct Curve *cu, float offset[3], int do_keys);
+void BKE_curve_delete_material_index(struct Curve *cu, int index);
+
+ListBase *BKE_curve_nurbs_get(struct Curve *cu);
+
+float (*BKE_curve_vertexCos_get(struct Curve *cu, struct ListBase *lb, int *numVerts_r))[3];
+void BK_curve_vertexCos_apply(struct Curve *cu, struct ListBase *lb, float (*vertexCos)[3]);
+
+float (*BKE_curve_keyVertexCos_get(struct Curve *cu, struct ListBase *lb, float *key))[3];
+void BKE_curve_keyVertexTilts_apply(struct Curve *cu, struct ListBase *lb, float *key);
+
+void BKE_curve_editNurb_keyIndex_free(struct EditNurb *editnurb);
+void BKE_curve_editNurb_free(struct Curve *cu);
+struct ListBase *BKE_curve_editNurbs_get(struct Curve *cu);
+
+float *BKE_curve_make_orco(struct Scene *scene, struct Object *ob);
+float *BKE_curve_surf_make_orco(struct Object *ob);
+
+void BKE_curve_bevelList_make(struct Object *ob);
+void BKE_curve_bevel_make(struct Scene *scene, struct Object *ob, struct ListBase *disp, int forRender);
+
+void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride);
+
+/* ** Nurbs ** */
+
+int BKE_nurbList_verts_count(struct ListBase *nurb);
+int BKE_nurbList_verts_count_without_handles(struct ListBase *nurb);
+
+void BKE_nurbList_free(struct ListBase *lb);
+void BKE_nurbList_duplicate(struct ListBase *lb1, struct ListBase *lb2);
+void BKE_nurbList_handles_set(struct ListBase *editnurb, short code);
+
+void BKE_nurbList_handles_autocalc(ListBase *editnurb, int flag);
+
+void BKE_nurb_free(struct Nurb *nu);
+struct Nurb *BKE_nurb_duplicate(struct Nurb *nu);
+
+void BKE_nurb_test2D(struct Nurb *nu);
+void BKE_nurb_minmax(struct Nurb *nu, float *min, float *max);
+
+void BKE_nurb_makeFaces(struct Nurb *nu, float *coord_array, int rowstride, int resolu, int resolv);
+void BKE_nurb_makeCurve(struct Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride);
+
+void BKE_nurb_knot_calc_u(struct Nurb *nu);
+void BKE_nurb_knot_calc_v(struct Nurb *nu);
/* nurb checks if they can be drawn, also clamp order func */
-int check_valid_nurb_u(struct Nurb *nu);
-int check_valid_nurb_v(struct Nurb *nu);
+int BKE_nurb_check_valid_u(struct Nurb *nu);
+int BKE_nurb_check_valid_v(struct Nurb *nu);
-int clamp_nurb_order_u(struct Nurb *nu);
-int clamp_nurb_order_v(struct Nurb *nu);
+int BKE_nurb_order_clamp_u(struct Nurb *nu);
+int BKE_nurb_order_clamp_v(struct Nurb *nu);
-ListBase *BKE_curve_nurbs(struct Curve *cu);
+void BKE_nurb_direction_switch(struct Nurb *nu);
-int minmax_curve(struct Curve *cu, float min[3], float max[3]);
-int curve_center_median(struct Curve *cu, float cent[3]);
-int curve_center_bounds(struct Curve *cu, float cent[3]);
-void curve_translate(struct Curve *cu, float offset[3], int do_keys);
-void curve_delete_material_index(struct Curve *cu, int index);
-#endif
+void BKE_nurb_points_add(struct Nurb *nu, int number);
+void BKE_nurb_bezierPoints_add(struct Nurb *nu, int number);
+
+void BKE_nurb_handle_calc(struct BezTriple *bezt, struct BezTriple *prev, struct BezTriple *next, int mode);
+void BKE_nurb_handles_calc(struct Nurb *nu);
+void BKE_nurb_handles_autocalc(struct Nurb *nu, int flag);
+void BKE_nurb_handles_test(struct Nurb *nu);
+
+#endif
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index 17275b6ea7d..b59fc9af37c 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -71,6 +71,10 @@ void defvert_normalize_lock(struct MDeformVert *dvert, const int def_nr_lock);
/* utility function, note that 32 chars is the maximum string length since its only
* used with defgroups currently */
+
+void BKE_deform_split_suffix(const char string[MAX_VGROUP_NAME], char base[MAX_VGROUP_NAME], char ext[MAX_VGROUP_NAME]);
+void BKE_deform_split_prefix(const char string[MAX_VGROUP_NAME], char base[MAX_VGROUP_NAME], char ext[MAX_VGROUP_NAME]);
+
void flip_side_name(char name[64], const char from_name[64], int strip_number);
#endif
diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h
index e94787cfd3c..16e98f25e0c 100644
--- a/source/blender/blenkernel/BKE_font.h
+++ b/source/blender/blenkernel/BKE_font.h
@@ -49,7 +49,7 @@ struct Main;
struct chartrans {
float xof, yof;
float rot;
- short linenr,charnr;
+ short linenr, charnr;
char dobreak;
};
diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h
index 29c78510fd8..a0075c4d6be 100644
--- a/source/blender/blenkernel/BKE_lattice.h
+++ b/source/blender/blenkernel/BKE_lattice.h
@@ -49,7 +49,7 @@ void make_local_lattice(struct Lattice *lt);
void calc_lat_fudu(int flag, int res, float *fu, float *du);
void init_latt_deform(struct Object *oblatt, struct Object *ob);
-void calc_latt_deform(struct Object *, float *co, float weight);
+void calc_latt_deform(struct Object *, float co[3], float weight);
void end_latt_deform(struct Object *);
int object_deform_mball(struct Object *ob, struct ListBase *dispbase);
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index b18d25094dc..be21996428a 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -85,7 +85,7 @@ struct ID *find_id(const char *type, const char *name);
void clear_id_newpoins(void);
void IDnames_to_pupstring(const char **str, const char *title, const char *extraops,
- struct ListBase *lb,struct ID* link, short *nr);
+ struct ListBase *lb, struct ID* link, short *nr);
void IMAnames_to_pupstring(const char **str, const char *title, const char *extraops,
struct ListBase *lb, struct ID *link, short *nr);
diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h
index fafd2a3d30e..018ee7f6c94 100644
--- a/source/blender/blenkernel/BKE_mball.h
+++ b/source/blender/blenkernel/BKE_mball.h
@@ -37,147 +37,30 @@ struct Object;
struct Scene;
struct MetaElem;
-typedef struct point { /* a three-dimensional point */
- float x, y, z; /* its coordinates */
-} MB_POINT;
+void BKE_metaball_unlink(struct MetaBall *mb);
+void BKE_metaball_free(struct MetaBall *mb);
+struct MetaBall *BKE_metaball_add(const char *name);
+struct MetaBall *BKE_metaball_copy(struct MetaBall *mb);
-typedef struct vertex { /* surface vertex */
- MB_POINT position, normal; /* position and surface normal */
-} VERTEX;
+void BKE_metaball_make_local(struct MetaBall *mb);
-typedef struct vertices { /* list of vertices in polygonization */
- int count, max; /* # vertices, max # allowed */
- VERTEX *ptr; /* dynamically allocated */
-} VERTICES;
+void BKE_metaball_cubeTable_free(void);
-typedef struct corner { /* corner of a cube */
- int i, j, k; /* (i, j, k) is index within lattice */
- float x, y, z, value; /* location and function value */
- struct corner *next;
-} CORNER;
+void BKE_metaball_polygonize(struct Scene *scene, struct Object *ob, struct ListBase *dispbase);
+int BKE_metaball_is_basis_for(struct Object *ob1, struct Object *ob2);
+int BKE_metaball_is_basis(struct Object *ob);
+struct Object *BKE_metaball_basis_find(struct Scene *scene, struct Object *ob);
-typedef struct cube { /* partitioning cell (cube) */
- int i, j, k; /* lattice location of cube */
- CORNER *corners[8]; /* eight corners */
-} CUBE;
+void BKE_metaball_tex_space_calc(struct Object *ob);
+float *BKE_metaball_make_orco(struct Object *ob, struct ListBase *dispbase);
-typedef struct cubes { /* linked list of cubes acting as stack */
- CUBE cube; /* a single cube */
- struct cubes *next; /* remaining elements */
-} CUBES;
-
-typedef struct centerlist { /* list of cube locations */
- int i, j, k; /* cube location */
- struct centerlist *next; /* remaining elements */
-} CENTERLIST;
-
-typedef struct edgelist { /* list of edges */
- int i1, j1, k1, i2, j2, k2; /* edge corner ids */
- int vid; /* vertex id */
- struct edgelist *next; /* remaining elements */
-} EDGELIST;
-
-typedef struct intlist { /* list of integers */
- int i; /* an integer */
- struct intlist *next; /* remaining elements */
-} INTLIST;
-
-typedef struct intlists { /* list of list of integers */
- INTLIST *list; /* a list of integers */
- struct intlists *next; /* remaining elements */
-} INTLISTS;
-
-typedef struct process { /* parameters, function, storage */
- /* what happens here? floats, I think. */
- /* float (*function)(void); */ /* implicit surface function */
- float (*function)(float, float, float);
- float size, delta; /* cube size, normal delta */
- int bounds; /* cube range within lattice */
- CUBES *cubes; /* active cubes */
- VERTICES vertices; /* surface vertices */
- CENTERLIST **centers; /* cube center hash table */
- CORNER **corners; /* corner value hash table */
- EDGELIST **edges; /* edge and vertex id hash table */
-} PROCESS;
-
-/* dividing scene using octal tree makes polygonisation faster */
-typedef struct ml_pointer {
- struct ml_pointer *next, *prev;
- struct MetaElem *ml;
-} ml_pointer;
-
-typedef struct octal_node {
- struct octal_node *nodes[8]; /* children of current node */
- struct octal_node *parent; /* parent of current node */
- struct ListBase elems; /* ListBase of MetaElem pointers (ml_pointer) */
- float x_min, y_min, z_min; /* 1st border point */
- float x_max, y_max, z_max; /* 7th border point */
- float x,y,z; /* center of node */
- int pos, neg; /* number of positive and negative MetaElements in the node */
- int count; /* number of MetaElems, which belongs to the node */
-} octal_node;
-
-typedef struct octal_tree {
- struct octal_node *first; /* first node */
- int pos, neg; /* number of positive and negative MetaElements in the scene */
- short depth; /* number of scene subdivision */
-} octal_tree;
-
-struct pgn_elements {
- struct pgn_elements *next, *prev;
- char *data;
-};
-
-octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z, short depth);
-
-void freepolygonize(PROCESS *p);
-void docube(CUBE *cube, PROCESS *p, struct MetaBall *mb);
-void testface(int i, int j, int k, CUBE* old, int bit, int c1, int c2, int c3, int c4, PROCESS *p);
-CORNER *setcorner (PROCESS* p, int i, int j, int k);
-int vertid (CORNER *c1, CORNER *c2, PROCESS *p, struct MetaBall *mb);
-int setcenter(CENTERLIST *table[], int i, int j, int k);
-int otherface (int edge, int face);
-void makecubetable (void);
-void setedge (EDGELIST *table[], int i1, int j1, int k1, int i2, int j2, int k2, int vid);
-int getedge (EDGELIST *table[], int i1, int j1, int k1, int i2, int j2, int k2);
-void addtovertices (VERTICES *vertices, VERTEX v);
-void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v);
-void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2, float (*function)(float, float, float), MB_POINT *p, struct MetaBall *mb, int f);
-void add_cube(PROCESS *mbproc, int i, int j, int k, int count);
-void find_first_points(PROCESS *mbproc, struct MetaBall *mb, int a);
-
-void fill_metaball_octal_node(octal_node *node, struct MetaElem *ml, short i);
-void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y, float size_z, short depth);
-void free_metaball_octal_node(octal_node *node);
-void init_metaball_octal_tree(int depth);
-void polygonize(PROCESS *mbproc, struct MetaBall *mb);
-float init_meta(struct Scene *scene, struct Object *ob);
-
-void unlink_mball(struct MetaBall *mb);
-void free_mball(struct MetaBall *mb);
-struct MetaBall *add_mball(const char *name);
-struct MetaBall *copy_mball(struct MetaBall *mb);
-void make_local_mball(struct MetaBall *mb);
-struct MetaElem *add_metaball_element(struct MetaBall *mb, const int type);
-void tex_space_mball(struct Object *ob);
-float *make_orco_mball(struct Object *ob, struct ListBase *dispbase);
-void copy_mball_properties(struct Scene *scene, struct Object *active_object);
-struct Object *find_basis_mball(struct Scene *scene, struct Object *ob);
-int is_basis_mball(struct Object *ob);
-int is_mball_basis_for(struct Object *ob1, struct Object *ob2);
-void metaball_polygonize(struct Scene *scene, struct Object *ob, struct ListBase *dispbase);
-void calc_mballco(struct MetaElem *ml, float vec[3]);
-float densfunc(struct MetaElem *ball, float x, float y, float z);
-float metaball(float x, float y, float z);
-void accum_mballfaces(int i1, int i2, int i3, int i4);
-void *new_pgn_element(int size);
-int nextcwedge (int edge, int face);
-void BKE_freecubetable(void);
+void BKE_metaball_properties_copy(struct Scene *scene, struct Object *active_object);
int BKE_metaball_minmax(struct MetaBall *mb, float min[3], float max[3]);
int BKE_metaball_center_median(struct MetaBall *mb, float cent[3]);
int BKE_metaball_center_bounds(struct MetaBall *mb, float cent[3]);
void BKE_metaball_translate(struct MetaBall *mb, float offset[3]);
-#endif
+struct MetaElem *BKE_metaball_element_add(struct MetaBall *mb, const int type);
+#endif
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 742e6ef0b89..14cb5d19ddf 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -146,7 +146,7 @@ void copy_dverts(struct MDeformVert *dst, struct MDeformVert *src, int totvert);
void mesh_delete_material_index(struct Mesh *me, short index);
void mesh_set_smooth_flag(struct Object *meshOb, int enableSmooth);
void BKE_mesh_convert_mfaces_to_mpolys(struct Mesh *mesh);
-void mesh_calc_normals_tessface(struct MVert *mverts, int numVerts,struct MFace *mfaces, int numFaces, float (*faceNors_r)[3]);
+void mesh_calc_normals_tessface(struct MVert *mverts, int numVerts, struct MFace *mfaces, int numFaces, float (*faceNors_r)[3]);
/* used for unit testing; compares two meshes, checking only
* differences we care about. should be usable with leaf's
diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h
index d7b2f271a83..29924542494 100644
--- a/source/blender/blenkernel/BKE_movieclip.h
+++ b/source/blender/blenkernel/BKE_movieclip.h
@@ -40,10 +40,10 @@ struct MovieClipUser;
struct MovieTrackingTrack;
struct MovieDistortion;
-void free_movieclip(struct MovieClip *clip);
-void unlink_movieclip(struct Main *bmain, struct MovieClip *clip);
+void BKE_movieclip_free(struct MovieClip *clip);
+void BKE_movieclip_unlink(struct Main *bmain, struct MovieClip *clip);
-struct MovieClip *BKE_add_movieclip_file(const char *name);
+struct MovieClip *BKE_movieclip_file_add(const char *name);
void BKE_movieclip_reload(struct MovieClip *clip);
struct ImBuf *BKE_movieclip_get_ibuf(struct MovieClip *clip, struct MovieClipUser *user);
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index cb161b26ee5..a4eddd0b590 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -123,7 +123,7 @@ typedef struct bNodeTemplate {
* implementing the node behavior.
*/
typedef struct bNodeType {
- void *next,*prev;
+ void *next, *prev;
short needs_free; /* set for allocated types that need to be freed */
int type;
diff --git a/source/blender/blenkernel/BKE_ocean.h b/source/blender/blenkernel/BKE_ocean.h
index 7c0d99b35ea..5f7f7740a9f 100644
--- a/source/blender/blenkernel/BKE_ocean.h
+++ b/source/blender/blenkernel/BKE_ocean.h
@@ -79,8 +79,8 @@ struct Ocean *BKE_add_ocean(void);
void BKE_free_ocean_data(struct Ocean *oc);
void BKE_free_ocean(struct Ocean *oc);
-void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, float l, float A, float w, float damp,
- float alignment, float depth, float time, short do_height_field, short do_chop, short do_normals, short do_jacobian, int seed);
+void BKE_init_ocean(struct Ocean* o, int M, int N, float Lx, float Lz, float V, float l, float A, float w, float damp,
+ float alignment, float depth, float time, short do_height_field, short do_chop, short do_normals, short do_jacobian, int seed);
void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount);
/* sampling the ocean surface */
diff --git a/source/blender/blenkernel/BKE_softbody.h b/source/blender/blenkernel/BKE_softbody.h
index 6714225f513..547fd9e4393 100644
--- a/source/blender/blenkernel/BKE_softbody.h
+++ b/source/blender/blenkernel/BKE_softbody.h
@@ -39,9 +39,9 @@ typedef struct BodyPoint {
float origS[3], origE[3], origT[3], pos[3], vec[3], force[3];
float goal;
float prevpos[3], prevvec[3], prevdx[3], prevdv[3]; /* used for Heun integration */
- float impdv[3],impdx[3];
+ float impdv[3], impdx[3];
int nofsprings; int *springs;
- float choke,choke2,frozen;
+ float choke, choke2, frozen;
float colball;
short loc_flag; //reserved by locale module specific states
//char octantflag;
@@ -68,7 +68,7 @@ extern void sbObjectToSoftbody(struct Object *ob);
/* pass NULL to unlink again */
extern void sbSetInterruptCallBack(int (*f)(void));
-extern void SB_estimate_transform(Object *ob,float lloc[3],float lrot[3][3],float lscale[3][3]);
+extern void SB_estimate_transform(Object *ob, float lloc[3], float lrot[3][3], float lscale[3][3]);
#endif
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h
index 0a94d89a121..b1902c75afb 100644
--- a/source/blender/blenkernel/BKE_text.h
+++ b/source/blender/blenkernel/BKE_text.h
@@ -96,6 +96,7 @@ void txt_unindent (struct Text *text);
void txt_comment (struct Text *text);
void txt_indent (struct Text *text);
void txt_uncomment (struct Text *text);
+void txt_duplicate_line (struct Text *text);
int setcurr_tab_spaces (struct Text *text, int space);
void txt_add_marker (struct Text *text, struct TextLine *line, int start, int end, const unsigned char color[4], int group, int flags);
@@ -169,6 +170,8 @@ int text_check_whitespace(const char ch);
#define UNDO_COMMENT 034
#define UNDO_UNCOMMENT 035
+#define UNDO_DUPLICATE 040
+
/* Marker flags */
#define TMARK_TEMP 0x01 /* Remove on non-editing events, don't save */
#define TMARK_EDITALL 0x02 /* Edit all markers of the same group as one */
diff --git a/source/blender/blenkernel/depsgraph_private.h b/source/blender/blenkernel/depsgraph_private.h
index f27ee2f1a41..c5e2f0900f0 100644
--- a/source/blender/blenkernel/depsgraph_private.h
+++ b/source/blender/blenkernel/depsgraph_private.h
@@ -117,10 +117,10 @@ DagNode * get_top_node_queue(DagNodeQueue *queue);
DagForest *getMainDag(void);
void setMainDag(DagForest *dag);
DagForest * dag_init(void);
-DagNode * dag_find_node (DagForest *forest,void * fob);
-DagNode * dag_add_node (DagForest *forest,void * fob);
-DagNode * dag_get_node (DagForest *forest,void * fob);
-DagNode * dag_get_sub_node (DagForest *forest,void * fob);
+DagNode * dag_find_node (DagForest *forest, void * fob);
+DagNode * dag_add_node (DagForest *forest, void * fob);
+DagNode * dag_get_node (DagForest *forest, void * fob);
+DagNode * dag_get_sub_node (DagForest *forest, void * fob);
void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, const char *name);
void graph_bfs(void);
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index f5718974f9f..53e4a973cd4 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -1272,7 +1272,9 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV
if (f->numVerts != numVerts ||
memcmp(FACE_getVerts(f), ss->tempVerts, sizeof(*ss->tempVerts) * numVerts) ||
memcmp(FACE_getEdges(f), ss->tempEdges, sizeof(*ss->tempEdges) * numVerts))
+ {
topologyChanged = 1;
+ }
}
if (!f || topologyChanged) {
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index c28958d5b0d..74373d28c14 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -322,7 +322,7 @@ int DM_release(DerivedMesh *dm)
{
if (dm->needsFree) {
bvhcache_free(&dm->bvhCache);
- GPU_drawobject_free( dm );
+ GPU_drawobject_free(dm);
CustomData_free(&dm->vertData, dm->numVertData);
CustomData_free(&dm->edgeData, dm->numEdgeData);
CustomData_free(&dm->faceData, dm->numTessFaceData);
@@ -371,7 +371,7 @@ void DM_ensure_tessface(DerivedMesh *dm)
const int numTessFaces = dm->getNumTessFaces(dm);
const int numPolys = dm->getNumPolys(dm);
- if ( (numTessFaces == 0) && (numPolys != 0)) {
+ if ((numTessFaces == 0) && (numPolys != 0)) {
dm->recalcTessellation(dm);
if (dm->getNumTessFaces(dm) != 0) {
@@ -1223,7 +1223,7 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag,
for (i=0; i<dm->numPolyData; i++, mp++) {
ml = mloop + mp->loopstart;
- BLI_array_growitems(wtcol_l, mp->totloop);
+ BLI_array_grow_items(wtcol_l, mp->totloop);
for (j = 0; j < mp->totloop; j++, ml++, totloop++) {
copy_v4_v4_char((char *)&wtcol_l[totloop],
(char *)&wtcol_v[4 * ml->v]);
@@ -2279,8 +2279,10 @@ DerivedMesh *editbmesh_get_derived_cage_and_final(Scene *scene, Object *obedit,
* the data we need, rebuild the derived mesh
*/
if (!em->derivedCage ||
- (em->lastDataMask & dataMask) != dataMask)
+ (em->lastDataMask & dataMask) != dataMask)
+ {
editbmesh_build_data(scene, obedit, em, dataMask);
+ }
*final_r = em->derivedFinal;
return em->derivedCage;
@@ -2292,8 +2294,10 @@ DerivedMesh *editbmesh_get_derived_cage(Scene *scene, Object *obedit, BMEditMesh
* the data we need, rebuild the derived mesh
*/
if (!em->derivedCage ||
- (em->lastDataMask & dataMask) != dataMask)
+ (em->lastDataMask & dataMask) != dataMask)
+ {
editbmesh_build_data(scene, obedit, em, dataMask);
+ }
return em->derivedCage;
}
@@ -2409,7 +2413,7 @@ static void GetTextureCoordinate(const SMikkTSpaceContext * pContext, float fUV[
}
else {
const float *orco= pMesh->orco[(&pMesh->mface[face_num].v1)[vert_index]];
- map_to_sphere( &fUV[0], &fUV[1], orco[0], orco[1], orco[2]);
+ map_to_sphere(&fUV[0], &fUV[1], orco[0], orco[1], orco[2]);
}
}
@@ -2532,11 +2536,11 @@ void DM_add_tangent_layer(DerivedMesh *dm)
if (mf->v4) {
v4= &mvert[mf->v4];
- normal_quad_v3( fno,v4->co, v3->co, v2->co, v1->co);
+ normal_quad_v3(fno, v4->co, v3->co, v2->co, v1->co);
}
else {
v4= NULL;
- normal_tri_v3( fno,v3->co, v2->co, v1->co);
+ normal_tri_v3(fno, v3->co, v2->co, v1->co);
}
if (mtface) {
@@ -2547,11 +2551,11 @@ void DM_add_tangent_layer(DerivedMesh *dm)
}
else {
uv1= uv[0]; uv2= uv[1]; uv3= uv[2]; uv4= uv[3];
- map_to_sphere( &uv[0][0], &uv[0][1],orco[mf->v1][0], orco[mf->v1][1], orco[mf->v1][2]);
- map_to_sphere( &uv[1][0], &uv[1][1],orco[mf->v2][0], orco[mf->v2][1], orco[mf->v2][2]);
- map_to_sphere( &uv[2][0], &uv[2][1],orco[mf->v3][0], orco[mf->v3][1], orco[mf->v3][2]);
+ map_to_sphere(&uv[0][0], &uv[0][1], orco[mf->v1][0], orco[mf->v1][1], orco[mf->v1][2]);
+ map_to_sphere(&uv[1][0], &uv[1][1], orco[mf->v2][0], orco[mf->v2][1], orco[mf->v2][2]);
+ map_to_sphere(&uv[2][0], &uv[2][1], orco[mf->v3][0], orco[mf->v3][1], orco[mf->v3][2]);
if (v4)
- map_to_sphere( &uv[3][0], &uv[3][1],orco[mf->v4][0], orco[mf->v4][1], orco[mf->v4][2]);
+ map_to_sphere(&uv[3][0], &uv[3][1], orco[mf->v4][0], orco[mf->v4][1], orco[mf->v4][2]);
}
tangent_from_uv(uv1, uv2, uv3, v1->co, v2->co, v3->co, fno, tang);
@@ -2574,11 +2578,11 @@ void DM_add_tangent_layer(DerivedMesh *dm)
len= (mf->v4)? 4 : 3;
if (mtface == NULL) {
- map_to_sphere( &uv[0][0], &uv[0][1],orco[mf->v1][0], orco[mf->v1][1], orco[mf->v1][2]);
- map_to_sphere( &uv[1][0], &uv[1][1],orco[mf->v2][0], orco[mf->v2][1], orco[mf->v2][2]);
- map_to_sphere( &uv[2][0], &uv[2][1],orco[mf->v3][0], orco[mf->v3][1], orco[mf->v3][2]);
+ map_to_sphere(&uv[0][0], &uv[0][1], orco[mf->v1][0], orco[mf->v1][1], orco[mf->v1][2]);
+ map_to_sphere(&uv[1][0], &uv[1][1], orco[mf->v2][0], orco[mf->v2][1], orco[mf->v2][2]);
+ map_to_sphere(&uv[2][0], &uv[2][1], orco[mf->v3][0], orco[mf->v3][1], orco[mf->v3][2]);
if (len==4)
- map_to_sphere( &uv[3][0], &uv[3][1],orco[mf->v4][0], orco[mf->v4][1], orco[mf->v4][2]);
+ map_to_sphere(&uv[3][0], &uv[3][1], orco[mf->v4][0], orco[mf->v4][1], orco[mf->v4][2]);
}
mf_vi[0]= mf->v1;
@@ -2612,7 +2616,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
int nr_accumulated = 0;
int f;
- for ( f=0; f < totface; f++ ) {
+ for (f=0; f < totface; f++ ) {
{
float * verts[4], * tex_coords[4];
const int nr_verts = mface[f].v4!=0 ? 4 : 3;
@@ -2628,7 +2632,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
// discard degenerate faces
is_degenerate = 0;
if ( equals_v3v3(verts[0], verts[1]) || equals_v3v3(verts[0], verts[2]) || equals_v3v3(verts[1], verts[2]) ||
- equals_v2v2(tex_coords[0], tex_coords[1]) || equals_v2v2(tex_coords[0], tex_coords[2]) || equals_v2v2(tex_coords[1], tex_coords[2]) )
+ equals_v2v2(tex_coords[0], tex_coords[1]) || equals_v2v2(tex_coords[0], tex_coords[2]) || equals_v2v2(tex_coords[1], tex_coords[2]))
{
is_degenerate = 1;
}
@@ -2636,7 +2640,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
// verify last vertex as well if this is a quad
if (is_degenerate == 0 && nr_verts == 4) {
if (equals_v3v3(verts[3], verts[0]) || equals_v3v3(verts[3], verts[1]) || equals_v3v3(verts[3], verts[2]) ||
- equals_v2v2(tex_coords[3], tex_coords[0]) || equals_v2v2(tex_coords[3], tex_coords[1]) || equals_v2v2(tex_coords[3], tex_coords[2]) )
+ equals_v2v2(tex_coords[3], tex_coords[0]) || equals_v2v2(tex_coords[3], tex_coords[1]) || equals_v2v2(tex_coords[3], tex_coords[2]))
{
is_degenerate = 1;
}
@@ -2701,8 +2705,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
if (nr_tris_to_pile==1 || nr_tris_to_pile==2) {
const int indices[] = {offs+0, offs+1, offs+2, offs+0, offs+2, (offs+3)&0x3 };
int t;
- for ( t=0; t<nr_tris_to_pile; t++ )
- {
+ for (t=0; t<nr_tris_to_pile; t++ ) {
float f2x_area_uv;
float * p0 = verts[indices[t*3+0]];
float * p1 = verts[indices[t*3+1]];
@@ -2933,7 +2936,7 @@ static void navmesh_drawColored(DerivedMesh *dm)
glDisable(GL_LIGHTING);
/* if (GPU_buffer_legacy(dm) ) */ { /* TODO - VBO draw code, not high priority - campbell */
- DEBUG_VBO( "Using legacy code. drawNavMeshColored\n" );
+ DEBUG_VBO("Using legacy code. drawNavMeshColored\n");
//glShadeModel(GL_SMOOTH);
glBegin(glmode = GL_QUADS);
for (a = 0; a < dm->numTessFaceData; a++, mface++) {
@@ -3114,7 +3117,7 @@ static void dm_debug_info_layers(DynStr *dynstr, DerivedMesh *dm, void *(*getEle
CustomData_file_write_info(type, &structname, &structnum);
BLI_dynstr_appendf(dynstr,
" dict(name='%s', struct='%s', type=%d, ptr='%p', elem=%d, length=%d),\n",
- name, structname, type, (void *)pt, size, (int)(MEM_allocN_len(pt) / size));
+ name, structname, type, (void *)pt, size, (int)(MEM_allocN_len(pt) / size));
}
}
}
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 93401a528ab..5a2407ca56b 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -157,7 +157,7 @@ void make_local_action(bAction *act)
/* .................................. */
-void free_action (bAction *act)
+void free_action(bAction *act)
{
/* sanity check */
if (act == NULL)
@@ -235,7 +235,7 @@ bActionGroup *get_active_actiongroup (bAction *act)
}
/* Make the given Action-Group the active one */
-void set_active_action_group (bAction *act, bActionGroup *agrp, short select)
+void set_active_action_group(bAction *act, bActionGroup *agrp, short select)
{
bActionGroup *grp;
@@ -280,7 +280,7 @@ bActionGroup *action_groups_add_new (bAction *act, const char name[])
* - assumes that channel is not linked to anything anymore
* - always adds at the end of the group
*/
-void action_groups_add_channel (bAction *act, bActionGroup *agrp, FCurve *fcurve)
+void action_groups_add_channel(bAction *act, bActionGroup *agrp, FCurve *fcurve)
{
/* sanity checks */
if (ELEM3(NULL, act, agrp, fcurve))
@@ -346,7 +346,7 @@ void action_groups_add_channel (bAction *act, bActionGroup *agrp, FCurve *fcurve
}
/* Remove the given channel from all groups */
-void action_groups_remove_channel (bAction *act, FCurve *fcu)
+void action_groups_remove_channel(bAction *act, FCurve *fcu)
{
/* sanity checks */
if (ELEM(NULL, act, fcu))
@@ -394,7 +394,7 @@ bActionGroup *action_groups_find_named (bAction *act, const char name[])
}
/* Clear all 'temp' flags on all groups */
-void action_groups_clear_tempflags (bAction *act)
+void action_groups_clear_tempflags(bAction *act)
{
bActionGroup *agrp;
@@ -491,7 +491,7 @@ const char *get_ikparam_name(bPose *pose)
return NULL;
}
/* dst should be freed already, makes entire duplicate */
-void copy_pose (bPose **dst, bPose *src, int copycon)
+void copy_pose(bPose **dst, bPose *src, int copycon)
{
bPose *outPose;
bPoseChannel *pchan;
@@ -792,7 +792,7 @@ void framechange_poses_clear_unkeyed(void)
/* ************************** Bone Groups ************************** */
/* Adds a new bone-group */
-void pose_add_group (Object *ob)
+void pose_add_group(Object *ob)
{
bPose *pose= (ob) ? ob->pose : NULL;
bActionGroup *grp;
@@ -809,7 +809,7 @@ void pose_add_group (Object *ob)
}
/* Remove the active bone-group */
-void pose_remove_group (Object *ob)
+void pose_remove_group(Object *ob)
{
bPose *pose= (ob) ? ob->pose : NULL;
bActionGroup *grp = NULL;
@@ -946,7 +946,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
/* Return flags indicating which transforms the given object/posechannel has
* - if 'curves' is provided, a list of links to these curves are also returned
*/
-short action_get_item_transforms (bAction *act, Object *ob, bPoseChannel *pchan, ListBase *curves)
+short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan, ListBase *curves)
{
PointerRNA ptr;
FCurve *fcu;
@@ -1134,7 +1134,7 @@ void copy_pose_result(bPose *to, bPose *from)
/* For the calculation of the effects of an Action at the given frame on an object
* This is currently only used for the Action Constraint
*/
-void what_does_obaction (Object *ob, Object *workob, bPose *pose, bAction *act, char groupname[], float cframe)
+void what_does_obaction(Object *ob, Object *workob, bPose *pose, bAction *act, char groupname[], float cframe)
{
bActionGroup *agrp= action_groups_find_named(act, groupname);
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 1ec9f7d8a10..7afcd828573 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -482,7 +482,7 @@ void calc_curvepath(Object *ob)
if (ob==NULL || ob->type != OB_CURVE) return;
cu= ob->data;
- nurbs= BKE_curve_nurbs(cu);
+ nurbs= BKE_curve_nurbs_get(cu);
nu= nurbs->first;
if (cu->path) free_path(cu->path);
@@ -863,9 +863,9 @@ static void vertex_dupli__mapFunc(void *userData, int index, const float co[3],
vec[0]= -no_s[0]; vec[1]= -no_s[1]; vec[2]= -no_s[2];
}
- vec_to_quat( q2,vec, vdd->ob->trackflag, vdd->ob->upflag);
+ vec_to_quat(q2, vec, vdd->ob->trackflag, vdd->ob->upflag);
- quat_to_mat3( mat,q2);
+ quat_to_mat3(mat, q2);
copy_m4_m4(tmat, obmat);
mul_m4_m4m3(obmat, tmat, mat);
}
@@ -1142,8 +1142,8 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
copy_v3_v3(obmat[3], cent);
/* rotation */
- tri_to_quat( quat,v1, v2, v3);
- quat_to_mat3( mat,quat);
+ tri_to_quat(quat, v1, v2, v3);
+ quat_to_mat3(mat, quat);
/* scale */
if (par->transflag & OB_DUPLIFACES_SCALE) {
@@ -1329,7 +1329,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
else
a = totpart;
- for (pa=psys->particles,counter=0; a<totpart+totchild; a++,pa++,counter++) {
+ for (pa=psys->particles, counter=0; a<totpart+totchild; a++, pa++, counter++) {
if (a<totpart) {
/* handle parent particle */
if (pa->flag & no_draw_flag)
@@ -1350,9 +1350,11 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
/* some hair paths might be non-existent so they can't be used for duplication */
if (hair &&
- ((a < totpart && psys->pathcache[a]->steps < 0) ||
- (a >= totpart && psys->childcache[a-totpart]->steps < 0)))
+ ((a < totpart && psys->pathcache[a]->steps < 0) ||
+ (a >= totpart && psys->childcache[a-totpart]->steps < 0)))
+ {
continue;
+ }
if (part->ren_as==PART_DRAW_GR) {
/* prevent divide by zero below [#28336] */
@@ -1503,7 +1505,7 @@ static Object *find_family_object(Object **obar, char *family, char ch)
ob= G.main->object.first;
while (ob) {
- if ( ob->id.name[flen+2]==ch ) {
+ if (ob->id.name[flen + 2] == ch) {
if ( strncmp(ob->id.name+2, family, flen)==0 ) break;
}
ob= ob->id.next;
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 75b9ae59e26..f3a7ff90373 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -71,7 +71,7 @@
/* Getter/Setter -------------------------------------------- */
/* Check if ID can have AnimData */
-short id_type_can_have_animdata (ID *id)
+short id_type_can_have_animdata(ID *id)
{
/* sanity check */
if (id == NULL)
@@ -152,7 +152,7 @@ AnimData *BKE_id_add_animdata (ID *id)
/* Action Setter --------------------------------------- */
/* Called when user tries to change the active action of an AnimData block (via RNA, Outliner, etc.) */
-short BKE_animdata_set_action (ReportList *reports, ID *id, bAction *act)
+short BKE_animdata_set_action(ReportList *reports, ID *id, bAction *act)
{
AnimData *adt = BKE_animdata_from_id(id);
short ok = 0;
@@ -205,7 +205,7 @@ short BKE_animdata_set_action (ReportList *reports, ID *id, bAction *act)
/* Freeing -------------------------------------------- */
/* Free AnimData used by the nominated ID-block, and clear ID-block's AnimData pointer */
-void BKE_free_animdata (ID *id)
+void BKE_free_animdata(ID *id)
{
/* Only some ID-blocks have this info for now, so we cast the
* types that do to be of type IdAdtTemplate
@@ -274,7 +274,7 @@ AnimData *BKE_copy_animdata (AnimData *adt, const short do_action)
return dadt;
}
-int BKE_copy_animdata_id (ID *id_to, ID *id_from, const short do_action)
+int BKE_copy_animdata_id(ID *id_to, ID *id_from, const short do_action)
{
AnimData *adt;
@@ -344,7 +344,7 @@ void BKE_animdata_make_local(AnimData *adt)
/* When duplicating data (i.e. objects), drivers referring to the original data will
* get updated to point to the duplicated data (if drivers belong to the new data)
*/
-void BKE_relink_animdata (AnimData *adt)
+void BKE_relink_animdata(AnimData *adt)
{
/* sanity check */
if (adt == NULL)
@@ -393,7 +393,7 @@ static short animpath_matches_basepath (const char path[], const char basepath[]
* - This is used when data moves from one datablock to another, causing the
* F-Curves to need to be moved over too
*/
-void action_move_fcurves_by_basepath (bAction *srcAct, bAction *dstAct, const char basepath[])
+void action_move_fcurves_by_basepath(bAction *srcAct, bAction *dstAct, const char basepath[])
{
FCurve *fcu, *fcn=NULL;
@@ -473,7 +473,7 @@ void action_move_fcurves_by_basepath (bAction *srcAct, bAction *dstAct, const ch
* animation data is based off "basepath", creating new AnimData and
* associated data as necessary
*/
-void BKE_animdata_separate_by_basepath (ID *srcID, ID *dstID, ListBase *basepaths)
+void BKE_animdata_separate_by_basepath(ID *srcID, ID *dstID, ListBase *basepaths)
{
AnimData *srcAdt=NULL, *dstAdt=NULL;
LinkData *ld;
@@ -735,7 +735,7 @@ void BKE_animdata_fix_paths_rename(ID *owner_id, AnimData *adt, ID *ref_id, cons
/* Whole Database Ops -------------------------------------------- */
/* apply the given callback function on all data in main database */
-void BKE_animdata_main_cb (Main *mainptr, ID_AnimData_Edit_Callback func, void *user_data)
+void BKE_animdata_main_cb(Main *mainptr, ID_AnimData_Edit_Callback func, void *user_data)
{
ID *id;
@@ -1028,7 +1028,7 @@ KS_Path *BKE_keyingset_add_path (KeyingSet *ks, ID *id, const char group_name[],
}
/* Free the given Keying Set path */
-void BKE_keyingset_free_path (KeyingSet *ks, KS_Path *ksp)
+void BKE_keyingset_free_path(KeyingSet *ks, KS_Path *ksp)
{
/* sanity check */
if (ELEM(NULL, ks, ksp))
@@ -1043,7 +1043,7 @@ void BKE_keyingset_free_path (KeyingSet *ks, KS_Path *ksp)
}
/* Copy all KeyingSets in the given list */
-void BKE_keyingsets_copy (ListBase *newlist, ListBase *list)
+void BKE_keyingsets_copy(ListBase *newlist, ListBase *list)
{
KeyingSet *ksn;
KS_Path *kspn;
@@ -1061,7 +1061,7 @@ void BKE_keyingsets_copy (ListBase *newlist, ListBase *list)
/* Freeing Tools --------------------------- */
/* Free data for KeyingSet but not set itself */
-void BKE_keyingset_free (KeyingSet *ks)
+void BKE_keyingset_free(KeyingSet *ks)
{
KS_Path *ksp, *kspn;
@@ -1077,7 +1077,7 @@ void BKE_keyingset_free (KeyingSet *ks)
}
/* Free all the KeyingSets in the given list */
-void BKE_keyingsets_free (ListBase *list)
+void BKE_keyingsets_free(ListBase *list)
{
KeyingSet *ks, *ksn;
@@ -1250,8 +1250,7 @@ static void animsys_evaluate_fcurves (PointerRNA *ptr, ListBase *list, AnimMappe
FCurve *fcu;
/* calculate then execute each curve */
- for (fcu= list->first; fcu; fcu= fcu->next)
- {
+ for (fcu= list->first; fcu; fcu= fcu->next) {
/* check if this F-Curve doesn't belong to a muted group */
if ((fcu->grp == NULL) || (fcu->grp->flag & AGRP_MUTED)==0) {
/* check if this curve should be skipped */
@@ -1274,8 +1273,7 @@ static void animsys_evaluate_drivers (PointerRNA *ptr, AnimData *adt, float ctim
/* drivers are stored as F-Curves, but we cannot use the standard code, as we need to check if
* the depsgraph requested that this driver be evaluated...
*/
- for (fcu= adt->drivers.first; fcu; fcu= fcu->next)
- {
+ for (fcu= adt->drivers.first; fcu; fcu= fcu->next) {
ChannelDriver *driver= fcu->driver;
short ok= 0;
@@ -1336,7 +1334,7 @@ static void action_idcode_patch_check (ID *id, bAction *act)
/* ----------------------------------------- */
/* Evaluate Action Group */
-void animsys_evaluate_action_group (PointerRNA *ptr, bAction *act, bActionGroup *agrp, AnimMapper *remap, float ctime)
+void animsys_evaluate_action_group(PointerRNA *ptr, bAction *act, bActionGroup *agrp, AnimMapper *remap, float ctime)
{
FCurve *fcu;
@@ -1351,8 +1349,7 @@ void animsys_evaluate_action_group (PointerRNA *ptr, bAction *act, bActionGroup
return;
/* calculate then execute each curve */
- for (fcu= agrp->channels.first; (fcu) && (fcu->grp == agrp); fcu= fcu->next)
- {
+ for (fcu= agrp->channels.first; (fcu) && (fcu->grp == agrp); fcu= fcu->next) {
/* check if this curve should be skipped */
if ((fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED)) == 0) {
calculate_fcurve(fcu, ctime);
@@ -1362,7 +1359,7 @@ void animsys_evaluate_action_group (PointerRNA *ptr, bAction *act, bActionGroup
}
/* Evaluate Action (F-Curve Bag) */
-void animsys_evaluate_action (PointerRNA *ptr, bAction *act, AnimMapper *remap, float ctime)
+void animsys_evaluate_action(PointerRNA *ptr, bAction *act, AnimMapper *remap, float ctime)
{
/* check if mapper is appropriate for use here (we set to NULL if it's inappropriate) */
if (act == NULL) return;
@@ -1919,7 +1916,7 @@ static void nlastrip_evaluate_meta (PointerRNA *ptr, ListBase *channels, ListBas
}
/* evaluates the given evaluation strip */
-void nlastrip_evaluate (PointerRNA *ptr, ListBase *channels, ListBase *modifiers, NlaEvalStrip *nes)
+void nlastrip_evaluate(PointerRNA *ptr, ListBase *channels, ListBase *modifiers, NlaEvalStrip *nes)
{
NlaStrip *strip= nes->strip;
@@ -1952,7 +1949,7 @@ void nlastrip_evaluate (PointerRNA *ptr, ListBase *channels, ListBase *modifiers
}
/* write the accumulated settings to */
-void nladata_flush_channels (ListBase *channels)
+void nladata_flush_channels(ListBase *channels)
{
NlaEvalChannel *nec;
@@ -1968,8 +1965,7 @@ void nladata_flush_channels (ListBase *channels)
float value= nec->value;
/* write values - see animsys_write_rna_setting() to sync the code */
- switch (RNA_property_type(prop))
- {
+ switch (RNA_property_type(prop)) {
case PROP_BOOLEAN:
if (RNA_property_array_length(ptr, prop))
RNA_property_boolean_set_index(ptr, prop, array_index, ANIMSYS_FLOAT_AS_BOOL(value));
@@ -2180,7 +2176,7 @@ static void animsys_evaluate_overrides (PointerRNA *ptr, AnimData *adt)
* and that the flags for which parts of the anim-data settings need to be recalculated
* have been set already by the depsgraph. Now, we use the recalc
*/
-void BKE_animsys_evaluate_animdata (Scene *scene, ID *id, AnimData *adt, float ctime, short recalc)
+void BKE_animsys_evaluate_animdata(Scene *scene, ID *id, AnimData *adt, float ctime, short recalc)
{
PointerRNA id_ptr;
@@ -2217,7 +2213,9 @@ void BKE_animsys_evaluate_animdata (Scene *scene, ID *id, AnimData *adt, float c
* or be layered on top of existing animation data.
* - Drivers should be in the appropriate order to be evaluated without problems...
*/
- if ((recalc & ADT_RECALC_DRIVERS) /*&& (adt->recalc & ADT_RECALC_DRIVERS)*/) // XXX for now, don't check yet, as depsgraph hasn't been updated
+ if ((recalc & ADT_RECALC_DRIVERS)
+ /* XXX for now, don't check yet, as depsgraph hasn't been updated */
+ /* && (adt->recalc & ADT_RECALC_DRIVERS)*/)
{
animsys_evaluate_drivers(&id_ptr, adt, ctime);
}
@@ -2248,7 +2246,7 @@ void BKE_animsys_evaluate_animdata (Scene *scene, ID *id, AnimData *adt, float c
* 'local' (i.e. belonging in the nearest ID-block that setting is related to, not a
* standard 'root') block are overridden by a larger 'user'
*/
-void BKE_animsys_evaluate_all_animation (Main *main, Scene *scene, float ctime)
+void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime)
{
ID *id;
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 0f3e27a9b6e..b0d0ace2a7e 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -471,7 +471,7 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
next = pchan->child;
/* find the handle points, since this is inside bone space, the
- * first point = (0,0,0)
+ * first point = (0, 0, 0)
* last point = (0, length, 0) */
if (rest) {
invert_m4_m4(imat, pchan->bone->arm_mat);
@@ -566,13 +566,13 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
if (bone->segments > MAX_BBONE_SUBDIV)
bone->segments = MAX_BBONE_SUBDIV;
- forward_diff_bezier(0.0, h1[0], h2[0], 0.0, data[0],
+ BKE_curve_forward_diff_bezier(0.0, h1[0], h2[0], 0.0, data[0],
MAX_BBONE_SUBDIV, 4*sizeof(float));
- forward_diff_bezier(0.0, h1[1], length + h2[1], length, data[0]+1,
+ BKE_curve_forward_diff_bezier(0.0, h1[1], length + h2[1], length, data[0]+1,
MAX_BBONE_SUBDIV, 4*sizeof(float));
- forward_diff_bezier(0.0, h1[2], h2[2], 0.0, data[0]+2,
+ BKE_curve_forward_diff_bezier(0.0, h1[2], h2[2], 0.0, data[0]+2,
MAX_BBONE_SUBDIV, 4*sizeof(float));
- forward_diff_bezier(roll1, roll1 + 0.390464f*(roll2-roll1), roll2 - 0.390464f*(roll2-roll1), roll2, data[0]+3,
+ BKE_curve_forward_diff_bezier(roll1, roll1 + 0.390464f*(roll2-roll1), roll2 - 0.390464f*(roll2-roll1), roll2, data[0]+3,
MAX_BBONE_SUBDIV, 4*sizeof(float));
equalize_bezier(data[0], bone->segments); /* note: does stride 4! */
@@ -1028,13 +1028,13 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, float
if (armature_weight != 1.0f) {
copy_v3_v3(dco, co);
- mul_v3m3_dq( dco, (defMats) ? summat : NULL,dq);
+ mul_v3m3_dq(dco, (defMats) ? summat : NULL, dq);
sub_v3_v3(dco, co);
mul_v3_fl(dco, armature_weight);
add_v3_v3(co, dco);
}
else
- mul_v3m3_dq( co, (defMats) ? summat : NULL,dq);
+ mul_v3m3_dq(co, (defMats) ? summat : NULL, dq);
smat = summat;
}
@@ -1208,9 +1208,8 @@ void pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_m
else
mult_m4_m4m4(rotscale_mat, parchan->pose_mat, offs_bone);
-# if 1
/* Compose the loc matrix for this bone. */
- /* NOTE: That version deos not modify bone's loc when HINGE/NO_SCALE options are set. */
+ /* NOTE: That version does not modify bone's loc when HINGE/NO_SCALE options are set. */
/* In this case, use the object's space *orientation*. */
if (bone->flag & BONE_NO_LOCAL_LOCATION) {
@@ -1236,58 +1235,6 @@ void pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_m
/* Else (i.e. default, usual case), just use the same matrix for rotation/scaling, and location. */
else
copy_m4_m4(loc_mat, rotscale_mat);
-# endif
-# if 0
- /* Compose the loc matrix for this bone. */
- /* NOTE: That version modifies bone's loc when HINGE/NO_SCALE options are set. */
-
- /* In these cases we need to compute location separately */
- if (bone->flag & (BONE_HINGE|BONE_NO_SCALE|BONE_NO_LOCAL_LOCATION)) {
- float bone_loc[4][4], bone_rotscale[3][3], tmat4[4][4], tmat3[3][3];
- unit_m4(bone_loc);
- unit_m4(loc_mat);
- unit_m4(tmat4);
-
- mul_v3_m4v3(bone_loc[3], parchan->pose_mat, offs_bone[3]);
-
- /* "No local location" is not transformed by bone matrix. */
- /* This only affects orientations (rotations), as scale is always 1.0 here. */
- if (bone->flag & BONE_NO_LOCAL_LOCATION)
- unit_m3(bone_rotscale);
- else
- /* We could also use bone->bone_mat directly, here... */
- copy_m3_m4(bone_rotscale, offs_bone);
-
- if (bone->flag & BONE_HINGE) {
- copy_m3_m4(tmat3, parbone->arm_mat);
- /* for hinge-only, we use armature *rotation*, but pose mat *scale*! */
- if (!(bone->flag & BONE_NO_SCALE)) {
- float size[3], tsmat[3][3];
- mat4_to_size(size, parchan->pose_mat);
- size_to_mat3(tsmat, size);
- mul_m3_m3m3(tmat3, tsmat, tmat3);
- }
- mul_m3_m3m3(bone_rotscale, tmat3, bone_rotscale);
- }
- else if (bone->flag & BONE_NO_SCALE) {
- /* For no-scale only, normalized parent pose mat is enough! */
- copy_m3_m4(tmat3, parchan->pose_mat);
- normalize_m3(tmat3);
- mul_m3_m3m3(bone_rotscale, tmat3, bone_rotscale);
- }
- /* NO_LOCAL_LOCATION only. */
- else {
- copy_m3_m4(tmat3, parchan->pose_mat);
- mul_m3_m3m3(bone_rotscale, tmat3, bone_rotscale);
- }
-
- copy_m4_m3(tmat4, bone_rotscale);
- mult_m4_m4m4(loc_mat, bone_loc, tmat4);
- }
- /* Else, just use the same matrix for rotation/scaling, and location. */
- else
- copy_m4_m4(loc_mat, rotscale_mat);
-# endif
}
/* Root bones. */
else {
@@ -1372,7 +1319,7 @@ void armature_mat_pose_to_bone_ex(Object *ob, bPoseChannel *pchan, float inmat[]
/* same as object_mat3_to_rot() */
void pchan_mat3_to_rot(bPoseChannel *pchan, float mat[][3], short use_compat)
{
- switch(pchan->rotmode) {
+ switch (pchan->rotmode) {
case ROT_MODE_QUAT:
mat3_to_quat(pchan->quat, mat);
break;
@@ -1413,18 +1360,18 @@ void armature_mat_pose_to_delta(float delta_mat[][4], float pose_mat[][4], float
/* Called from RNA when rotation mode changes
* - the result should be that the rotations given in the provided pointers have had conversions
* applied (as appropriate), such that the rotation of the element hasn't 'visually' changed */
-void BKE_rotMode_change_values (float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode)
+void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode)
{
/* check if any change - if so, need to convert data */
if (newMode > 0) { /* to euler */
if (oldMode == ROT_MODE_AXISANGLE) {
/* axis-angle to euler */
- axis_angle_to_eulO( eul, newMode,axis, *angle);
+ axis_angle_to_eulO(eul, newMode, axis, *angle);
}
else if (oldMode == ROT_MODE_QUAT) {
/* quat to euler */
normalize_qt(quat);
- quat_to_eulO(eul, newMode,quat);
+ quat_to_eulO(eul, newMode, quat);
}
/* else { no conversion needed } */
}
@@ -1517,7 +1464,7 @@ void vec_roll_to_mat3(const float vec[3], const float roll, float mat[][3])
* was 0.000001, causes bug [#30438] (which is same as [#27675, imho).
* Reseting it to org value seems to cause no more [#23954]...
*/
- if (dot_v3v3(axis,axis) > 1.0e-13f) {
+ if (dot_v3v3(axis, axis) > 1.0e-13f) {
/* if nor is *not* a multiple of target ... */
normalize_v3(axis);
@@ -1531,7 +1478,7 @@ void vec_roll_to_mat3(const float vec[3], const float roll, float mat[][3])
float updown;
/* point same direction, or opposite? */
- updown = (dot_v3v3(target,nor) > 0) ? 1.0f : -1.0f;
+ updown = (dot_v3v3(target, nor) > 0) ? 1.0f : -1.0f;
/* I think this should work... */
bMatrix[0][0] = updown; bMatrix[0][1] = 0.0; bMatrix[0][2] = 0.0;
@@ -2362,8 +2309,8 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha
/* make a copy of starting conditions */
copy_v3_v3(loc, pchan->pose_mat[3]);
- mat4_to_eul( eul,pchan->pose_mat);
- mat4_to_size( size,pchan->pose_mat);
+ mat4_to_eul(eul, pchan->pose_mat);
+ mat4_to_size(size, pchan->pose_mat);
copy_v3_v3(eulo, eul);
copy_v3_v3(sizeo, size);
@@ -2438,16 +2385,6 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti
/* Construct the posemat based on PoseChannels, that we do before applying constraints. */
/* pose_mat(b) = pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) * chan_mat(b) */
armature_mat_bone_to_pose(pchan, pchan->chan_mat, pchan->pose_mat);
-#if 0 /* XXX Old code, will remove this later. */
- {
- float rotscale_mat[4][4], loc_mat[4][4];
- pchan_to_pose_mat(pchan, rotscale_mat, loc_mat);
- /* Rotation and scale. */
- mult_m4_m4m4(pchan->pose_mat, rotscale_mat, pchan->chan_mat);
- /* Location. */
- mul_v3_m4v3(pchan->pose_mat[3], loc_mat, pchan->chan_mat[3]);
- }
-#endif
/* Only rootbones get the cyclic offset (unless user doesn't want that). */
/* XXX That could be a problem for snapping and other "reverse transform" features... */
@@ -2498,7 +2435,7 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti
/* This only reads anim data from channels, and writes to channels */
/* This is the only function adding poses */
-void where_is_pose (Scene *scene, Object *ob)
+void where_is_pose(Scene *scene, Object *ob)
{
bArmature *arm;
Bone *bone;
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 9c9b207970c..198d644b211 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -431,7 +431,7 @@ int BKE_read_file_from_memfile(bContext *C, MemFile *memfile, ReportList *report
/* ***************** testing for break ************* */
-static void (*blender_test_break_cb)(void)= NULL;
+static void (*blender_test_break_cb)(void) = NULL;
void set_blender_test_break_cb(void (*func)(void) )
{
@@ -722,7 +722,7 @@ void BKE_undo_save_quit(void)
BLI_make_file_string("/", str, BLI_temporary_dir(), "quit.blend");
- file = BLI_open(str,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
+ file = BLI_open(str, O_BINARY + O_WRONLY + O_CREAT + O_TRUNC, 0666);
if (file == -1) {
//XXX error("Unable to save %s, check you have permissions", str);
return;
diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c
index 04ac6cbfb4c..e1f4e45e9c3 100644
--- a/source/blender/blenkernel/intern/bmfont.c
+++ b/source/blender/blenkernel/intern/bmfont.c
@@ -65,8 +65,8 @@ void printfGlyph(bmGlyph * glyph)
printf(" advan: %3d reser: %3d\n", glyph->advance, glyph->reserved);
}
-#define MAX2(x,y) ( (x)>(y) ? (x) : (y) )
-#define MAX3(x,y,z) MAX2( MAX2((x),(y)) , (z) )
+#define MAX2(x,y) ((x) > (y) ? (x) : (y))
+#define MAX3(x,y,z) MAX2(MAX2((x), (y)), (z))
void calcAlpha(ImBuf * ibuf)
{
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index a556c99dc7d..014b3f5e40b 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -230,8 +230,8 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
/* avoid head-on collision */
if (dot_v3v3(col.pce.nor, pa->prev_state.ave) < -0.99f) {
- /* don't know why, but uneven range [0.0,1.0] */
- /* works much better than even [-1.0,1.0] */
+ /* don't know why, but uneven range [0.0, 1.0] */
+ /* works much better than even [-1.0, 1.0] */
bbd->wanted_co[0] = BLI_frand();
bbd->wanted_co[1] = BLI_frand();
bbd->wanted_co[2] = BLI_frand();
@@ -262,7 +262,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
sub_v3_v3v3(vec, vel1, vel2);
- inp = dot_v3v3(vec,vec);
+ inp = dot_v3v3(vec, vec);
/* velocities not parallel */
if (inp != 0.0f) {
@@ -308,7 +308,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
sub_v3_v3v3(vec, vel1, vel2);
- inp = dot_v3v3(vec,vec);
+ inp = dot_v3v3(vec, vec);
/* velocities not parallel */
if (inp != 0.0f) {
@@ -583,7 +583,7 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
copy_v3_v3(bbd->wanted_co, pa->prev_state.ave);
/* may happen at birth */
- if (dot_v2v2(bbd->wanted_co,bbd->wanted_co)==0.0f) {
+ if (dot_v2v2(bbd->wanted_co, bbd->wanted_co)==0.0f) {
bbd->wanted_co[0] = 2.0f*(0.5f - BLI_frand());
bbd->wanted_co[1] = 2.0f*(0.5f - BLI_frand());
bbd->wanted_co[2] = 2.0f*(0.5f - BLI_frand());
@@ -610,7 +610,7 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti
ParticleData *enemy_pa = NULL;
BoidParticle *bpa;
/* friends & enemies */
- float closest_enemy[3] = {0.0f,0.0f,0.0f};
+ float closest_enemy[3] = {0.0f, 0.0f, 0.0f};
float closest_dist = fbr->distance + 1.0f;
float f_strength = 0.0f, e_strength = 0.0f;
float health = 0.0f;
@@ -748,7 +748,7 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float grou
SurfaceModifierData *surmd = NULL;
float x[3], v[3];
- surmd = (SurfaceModifierData *)modifiers_findByType ( bpa->ground, eModifierType_Surface );
+ surmd = (SurfaceModifierData *)modifiers_findByType(bpa->ground, eModifierType_Surface );
/* take surface velocity into account */
closest_point_on_surface(surmd, pa->state.co, x, NULL, v);
@@ -962,7 +962,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
set_boid_values(&val, bbd->part->boids, pa);
/* go through rules */
- switch(state->ruleset_type) {
+ switch (state->ruleset_type) {
case eBoidRulesetType_Fuzzy:
{
for (rule = state->rules.first; rule; rule = rule->next) {
@@ -1096,7 +1096,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
set_boid_values(&val, boids, pa);
/* make sure there's something in new velocity, location & rotation */
- copy_particle_key(&pa->state,&pa->prev_state,0);
+ copy_particle_key(&pa->state, &pa->prev_state, 0);
if (bbd->part->flag & PART_SIZEMASS)
pa_mass*=pa->size;
@@ -1170,13 +1170,13 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
angle = MIN2(angle, val.max_ave);
cross_v3_v3v3(nor, old_dir, wanted_dir);
- axis_angle_to_quat( q,nor, angle);
+ axis_angle_to_quat(q, nor, angle);
copy_v3_v3(new_dir, old_dir);
mul_qt_v3(q, new_dir);
normalize_v3(new_dir);
/* save direction in case resulting velocity too small */
- axis_angle_to_quat( q,nor, angle*dtime);
+ axis_angle_to_quat(q, nor, angle*dtime);
copy_v3_v3(pa->state.ave, old_dir);
mul_qt_v3(q, pa->state.ave);
normalize_v3(pa->state.ave);
@@ -1196,7 +1196,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
/* maintain minimum flying velocity if not landing */
if (level >= landing_level) {
- float len2 = dot_v2v2(new_vel,new_vel);
+ float len2 = dot_v2v2(new_vel, new_vel);
float root;
len2 = MAX2(len2, val.min_speed*val.min_speed);
@@ -1258,7 +1258,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
bpa->ground = boid_find_ground(bbd, pa, ground_co, ground_nor);
/* change modes, constrain movement & keep track of down vector */
- switch(bpa->data.mode) {
+ switch (bpa->data.mode) {
case eBoidMode_InAir:
{
float grav[3];
@@ -1427,7 +1427,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
cross_v3_v3v3(mat[1], mat[2], mat[0]);
/* apply rotation */
- mat3_to_quat_is_ok( q,mat);
+ mat3_to_quat_is_ok(q, mat);
copy_qt_qt(pa->state.rot, q);
}
@@ -1437,7 +1437,7 @@ BoidRule *boid_new_rule(int type)
if (type <= 0)
return NULL;
- switch(type) {
+ switch (type) {
case eBoidRuleType_Goal:
case eBoidRuleType_Avoid:
rule = MEM_callocN(sizeof(BoidRuleGoalAvoid), "BoidRuleGoalAvoid");
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index e7ba09d3959..917c59b35a1 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -75,6 +75,7 @@ static void brush_set_defaults(Brush *brush)
brush->ob_mode = OB_MODE_ALL_PAINT;
/* BRUSH SCULPT TOOL SETTINGS */
+ brush->weight= 1.0f; /* weight of brush 0 - 1.0 */
brush->size= 35; /* radius of the brush in pixels */
brush->alpha= 0.5f; /* brush strength/intensity probably variable should be renamed? */
brush->autosmooth_factor= 0.0f;
@@ -337,7 +338,7 @@ void brush_reset_sculpt(Brush *br)
brush_set_defaults(br);
brush_curve_preset(br, CURVE_PRESET_SMOOTH);
- switch(br->sculpt_tool) {
+ switch (br->sculpt_tool) {
case SCULPT_TOOL_CLAY:
br->flag |= BRUSH_FRONTFACE;
break;
@@ -710,6 +711,13 @@ float brush_alpha(const Scene *scene, Brush *brush)
return (ups->flag & UNIFIED_PAINT_ALPHA) ? ups->alpha : brush->alpha;
}
+float brush_weight(const Scene *scene, Brush *brush)
+{
+ UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
+
+ return (ups->flag & UNIFIED_PAINT_WEIGHT) ? ups->weight : brush->weight;
+}
+
/* scale unprojected radius to reflect a change in the brush's 2D size */
void brush_scale_unprojected_radius(float *unprojected_radius,
int new_brush_size,
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index 009b7ca7f99..f0bc2dddbad 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -106,7 +106,7 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
B0 = dot_v3v3(diff, e0 );
B1 = dot_v3v3(diff, e1 );
C = dot_v3v3(diff, diff );
- Det = fabs( A00 * A11 - A01 * A01 );
+ Det = fabs(A00 * A11 - A01 * A01);
S = A01 * B1 - A11 * B0;
T = A01 * B0 - A00 * B1;
@@ -383,7 +383,7 @@ static void mesh_faces_nearest_point(void *userdata, int index, const float co[3
nearest->index = index;
nearest->dist = dist;
copy_v3_v3(nearest->co, nearest_tmp);
- normal_tri_v3( nearest->no,t0, t1, t2);
+ normal_tri_v3(nearest->no, t0, t1, t2);
}
t1 = t2;
@@ -402,10 +402,10 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r
MFace *face = data->face + index;
float *t0, *t1, *t2, *t3;
- t0 = vert[ face->v1 ].co;
- t1 = vert[ face->v2 ].co;
- t2 = vert[ face->v3 ].co;
- t3 = face->v4 ? vert[ face->v4].co : NULL;
+ t0 = vert[face->v1].co;
+ t1 = vert[face->v2].co;
+ t2 = vert[face->v3].co;
+ t3 = face->v4 ? vert[face->v4].co : NULL;
do
@@ -421,7 +421,7 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r
hit->dist = dist;
madd_v3_v3v3fl(hit->co, ray->origin, ray->direction, dist);
- normal_tri_v3( hit->no,t0, t1, t2);
+ normal_tri_v3(hit->no, t0, t1, t2);
}
t1 = t2;
@@ -649,8 +649,7 @@ BVHTree* bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float
BVHTree *tree = bvhcache_find(&mesh->bvhCache, BVHTREE_FROM_EDGES);
//Not in cache
- if (tree == NULL)
- {
+ if (tree == NULL) {
int i;
int numEdges= mesh->getNumEdges(mesh);
MVert *vert = mesh->getVertDataArray(mesh, CD_MVERT);
@@ -675,8 +674,7 @@ BVHTree* bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float
}
}
}
- else
- {
+ else {
// printf("BVHTree is already build, using cached tree\n");
}
@@ -708,7 +706,7 @@ void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data)
if (!data->cached)
BLI_bvhtree_free(data->tree);
- memset( data, 0, sizeof(*data) );
+ memset(data, 0, sizeof(*data));
}
}
@@ -745,11 +743,11 @@ void bvhcache_insert(BVHCache *cache, BVHTree *tree, int type)
{
BVHCacheItem *item = NULL;
- assert( tree != NULL );
- assert( bvhcache_find(cache, type) == NULL );
+ assert(tree != NULL);
+ assert(bvhcache_find(cache, type) == NULL);
item = MEM_mallocN(sizeof(BVHCacheItem), "BVHCacheItem");
- assert( item != NULL );
+ assert(item != NULL);
item->type = type;
item->tree = tree;
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index 12801228950..2be22e0e28b 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -472,7 +472,7 @@ int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *cam
float shift[2];
float plane_tx[4][3];
float rot_obmat[3][3];
- const float zero[3]= {0,0,0};
+ const float zero[3]= {0, 0, 0};
CameraViewFrameData data_cb;
unsigned int i;
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 4de7df098c3..6ff612e3367 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -322,9 +322,9 @@ static void cdDM_drawVerts(DerivedMesh *dm)
GPU_vertex_setup(dm);
if ( !GPU_buffer_legacy(dm) ) {
if (dm->drawObject->tot_triangle_point)
- glDrawArrays(GL_POINTS,0, dm->drawObject->tot_triangle_point);
+ glDrawArrays(GL_POINTS, 0, dm->drawObject->tot_triangle_point);
else
- glDrawArrays(GL_POINTS,0, dm->drawObject->tot_loose_point);
+ glDrawArrays(GL_POINTS, 0, dm->drawObject->tot_loose_point);
}
GPU_buffer_unbind();
}
@@ -380,7 +380,7 @@ static void cdDM_drawUVEdges(DerivedMesh *dm)
}
if ( prevdraw != draw ) {
if ( prevdraw > 0 && (curpos-prevstart) > 0) {
- glDrawArrays(GL_LINES,prevstart,curpos-prevstart);
+ glDrawArrays(GL_LINES, prevstart, curpos-prevstart);
}
prevstart = curpos;
}
@@ -393,7 +393,7 @@ static void cdDM_drawUVEdges(DerivedMesh *dm)
prevdraw = draw;
}
if ( prevdraw > 0 && (curpos-prevstart) > 0 ) {
- glDrawArrays(GL_LINES,prevstart,curpos-prevstart);
+ glDrawArrays(GL_LINES, prevstart, curpos-prevstart);
}
}
GPU_buffer_unbind();
@@ -409,7 +409,7 @@ static void cdDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges
int i;
if ( GPU_buffer_legacy(dm) ) {
- DEBUG_VBO( "Using legacy code. cdDM_drawEdges\n" );
+ DEBUG_VBO("Using legacy code. cdDM_drawEdges\n");
glBegin(GL_LINES);
for (i = 0; i < dm->numEdgeData; i++, medge++) {
if ((drawAllEdges || (medge->flag & ME_EDGEDRAW)) &&
@@ -461,7 +461,7 @@ static void cdDM_drawLooseEdges(DerivedMesh *dm)
int i;
if ( GPU_buffer_legacy(dm) ) {
- DEBUG_VBO( "Using legacy code. cdDM_drawLooseEdges\n" );
+ DEBUG_VBO("Using legacy code. cdDM_drawLooseEdges\n");
glBegin(GL_LINES);
for (i = 0; i < dm->numEdgeData; i++, medge++) {
if (medge->flag&ME_LOOSEEDGE) {
@@ -531,7 +531,7 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
}
if ( GPU_buffer_legacy(dm) ) {
- DEBUG_VBO( "Using legacy code. cdDM_drawFacesSolid\n" );
+ DEBUG_VBO("Using legacy code. cdDM_drawFacesSolid\n");
glBegin(glmode = GL_QUADS);
for (a = 0; a < dm->numTessFaceData; a++, mface++) {
int new_glmode, new_matnr, new_shademodel;
@@ -558,10 +558,10 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
/* TODO make this better (cache facenormals as layer?) */
float nor[3];
if (mface->v4) {
- normal_quad_v3( nor,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co);
+ normal_quad_v3(nor, mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co);
}
else {
- normal_tri_v3( nor,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co);
+ normal_tri_v3(nor, mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co);
}
glNormal3fv(nor);
}
@@ -580,8 +580,8 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
glEnd();
}
else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
- GPU_vertex_setup( dm );
- GPU_normal_setup( dm );
+ GPU_vertex_setup(dm);
+ GPU_normal_setup(dm);
if ( !GPU_buffer_legacy(dm) ) {
glShadeModel(GL_SMOOTH);
for (a = 0; a < dm->drawObject->totmaterial; a++) {
@@ -591,7 +591,7 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
}
}
}
- GPU_buffer_unbind( );
+ GPU_buffer_unbind();
}
#undef PASSVERT
@@ -619,7 +619,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
cdDM_update_normals_from_pbvh(dm);
if ( GPU_buffer_legacy(dm) ) {
- DEBUG_VBO( "Using legacy code. cdDM_drawFacesTex_common\n" );
+ DEBUG_VBO("Using legacy code. cdDM_drawFacesTex_common\n");
for (i = 0; i < dm->numTessFaceData; i++, mf++) {
MVert *mvert;
DMDrawOption draw_option;
@@ -651,10 +651,10 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
else {
float nor[3];
if (mf->v4) {
- normal_quad_v3( nor,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co);
+ normal_quad_v3(nor, mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co);
}
else {
- normal_tri_v3( nor,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co);
+ normal_tri_v3(nor, mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co);
}
glNormal3fv(nor);
}
@@ -697,9 +697,9 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
if (!col)
col = mcol;
- GPU_vertex_setup( dm );
- GPU_normal_setup( dm );
- GPU_uv_setup( dm );
+ GPU_vertex_setup(dm);
+ GPU_normal_setup(dm);
+ GPU_uv_setup(dm);
if ( col != NULL ) {
#if 0
if ( realcol && dm->drawObject->colType == CD_TEXTURE_MCOL ) {
@@ -721,21 +721,21 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
colors[i*12+j*3+2] = col[i*4+j].r;
}
}
- GPU_color3_upload(dm,colors);
+ GPU_color3_upload(dm, colors);
MEM_freeN(colors);
if (realcol)
dm->drawObject->colType = CD_TEXTURE_MCOL;
else if (mcol)
dm->drawObject->colType = CD_MCOL;
}
- GPU_color_setup( dm );
+ GPU_color_setup(dm);
}
if ( !GPU_buffer_legacy(dm) ) {
int tottri = dm->drawObject->tot_triangle_point/3;
int next_actualFace= dm->drawObject->triangle_to_mface[0];
- glShadeModel( GL_SMOOTH );
+ glShadeModel(GL_SMOOTH);
/* lastFlag = 0; */ /* UNUSED */
for (i = 0; i < tottri; i++) {
int actualFace = next_actualFace;
@@ -789,7 +789,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
}
GPU_buffer_unbind();
- glShadeModel( GL_FLAT );
+ glShadeModel(GL_FLAT);
}
}
@@ -826,7 +826,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
/* back-buffer always uses legacy since VBO's would need the
* color array temporarily overwritten for drawing, then reset. */
if ( GPU_buffer_legacy(dm) || G.f & G_BACKBUFSEL) {
- DEBUG_VBO( "Using legacy code. cdDM_drawMappedFaces\n" );
+ DEBUG_VBO("Using legacy code. cdDM_drawMappedFaces\n");
for (i = 0; i < dm->numTessFaceData; i++, mf++) {
int drawSmooth = (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : (mf->flag & ME_SMOOTH);
DMDrawOption draw_option= DM_DRAW_OPTION_NORMAL;
@@ -856,10 +856,10 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
else {
float nor[3];
if (mf->v4) {
- normal_quad_v3( nor,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co);
+ normal_quad_v3(nor, mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co);
}
else {
- normal_tri_v3( nor,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co);
+ normal_tri_v3(nor, mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co);
}
glNormal3fv(nor);
}
@@ -1045,7 +1045,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
glShadeModel(GL_SMOOTH);
if ( GPU_buffer_legacy(dm) || setDrawOptions != NULL ) {
- DEBUG_VBO( "Using legacy code. cdDM_drawMappedFacesGLSL\n" );
+ DEBUG_VBO("Using legacy code. cdDM_drawMappedFacesGLSL\n");
memset(&attribs, 0, sizeof(attribs));
glBegin(GL_QUADS);
@@ -1088,10 +1088,10 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
/* TODO ideally a normal layer should always be available */
float nor[3];
if (mface->v4) {
- normal_quad_v3( nor,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co);
+ normal_quad_v3(nor, mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co);
}
else {
- normal_tri_v3( nor,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co);
+ normal_tri_v3(nor, mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co);
}
glNormal3fv(nor);
}
@@ -1140,10 +1140,10 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
GPU_buffer_unlock(buffer);
- GPU_interleaved_attrib_setup(buffer,datatypes,numdata);
+ GPU_interleaved_attrib_setup(buffer, datatypes, numdata);
}
- glDrawArrays(GL_TRIANGLES,start*3,numfaces*3);
+ glDrawArrays(GL_TRIANGLES, start*3, numfaces*3);
if ( numdata != 0 ) {
@@ -1186,8 +1186,8 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
numdata++;
}
if ( numdata != 0 ) {
- elementsize = GPU_attrib_element_size( datatypes, numdata );
- buffer = GPU_buffer_alloc( elementsize*dm->drawObject->tot_triangle_point);
+ elementsize = GPU_attrib_element_size(datatypes, numdata);
+ buffer = GPU_buffer_alloc(elementsize * dm->drawObject->tot_triangle_point);
if ( buffer == NULL ) {
GPU_buffer_unbind();
dm->drawObject->legacy = 1;
@@ -1213,17 +1213,17 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
if (dodraw && numdata != 0 ) {
offset = 0;
if (attribs.totorco) {
- copy_v3_v3((float *)&varray[elementsize*curface*3],(float *)attribs.orco.array[mface->v1]);
- copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize],(float *)attribs.orco.array[mface->v2]);
- copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize*2],(float *)attribs.orco.array[mface->v3]);
+ copy_v3_v3((float *)&varray[elementsize*curface*3], (float *)attribs.orco.array[mface->v1]);
+ copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize], (float *)attribs.orco.array[mface->v2]);
+ copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize*2], (float *)attribs.orco.array[mface->v3]);
offset += sizeof(float)*3;
}
for (b = 0; b < attribs.tottface; b++) {
MTFace *tf = &attribs.tface[b].array[a];
- copy_v2_v2((float *)&varray[elementsize*curface*3+offset],tf->uv[0]);
- copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize],tf->uv[1]);
+ copy_v2_v2((float *)&varray[elementsize*curface*3+offset], tf->uv[0]);
+ copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize], tf->uv[1]);
- copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize*2],tf->uv[2]);
+ copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize*2], tf->uv[2]);
offset += sizeof(float)*2;
}
for (b = 0; b < attribs.totmcol; b++) {
@@ -1255,16 +1255,16 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
if (dodraw && numdata != 0 ) {
offset = 0;
if (attribs.totorco) {
- copy_v3_v3((float *)&varray[elementsize*curface*3],(float *)attribs.orco.array[mface->v3]);
- copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize],(float *)attribs.orco.array[mface->v4]);
- copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize*2],(float *)attribs.orco.array[mface->v1]);
+ copy_v3_v3((float *)&varray[elementsize*curface*3], (float *)attribs.orco.array[mface->v3]);
+ copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize], (float *)attribs.orco.array[mface->v4]);
+ copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize*2], (float *)attribs.orco.array[mface->v1]);
offset += sizeof(float)*3;
}
for (b = 0; b < attribs.tottface; b++) {
MTFace *tf = &attribs.tface[b].array[a];
- copy_v2_v2((float *)&varray[elementsize*curface*3+offset],tf->uv[2]);
- copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize],tf->uv[3]);
- copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize*2],tf->uv[0]);
+ copy_v2_v2((float *)&varray[elementsize*curface*3+offset], tf->uv[2]);
+ copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize], tf->uv[3]);
+ copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize*2], tf->uv[0]);
offset += sizeof(float)*2;
}
for (b = 0; b < attribs.totmcol; b++) {
@@ -1300,9 +1300,9 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
if ( dodraw ) {
if ( numdata != 0 ) {
GPU_buffer_unlock(buffer);
- GPU_interleaved_attrib_setup(buffer,datatypes,numdata);
+ GPU_interleaved_attrib_setup(buffer, datatypes, numdata);
}
- glDrawArrays(GL_TRIANGLES,start*3,(curface-start)*3);
+ glDrawArrays(GL_TRIANGLES, start*3, (curface-start)*3);
}
}
GPU_buffer_unbind();
@@ -1374,9 +1374,9 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm,
float nor[3];
if (mf->v4)
- normal_quad_v3( nor,mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co, mvert[mf->v4].co);
+ normal_quad_v3(nor, mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co, mvert[mf->v4].co);
else
- normal_tri_v3( nor,mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co);
+ normal_tri_v3(nor, mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co);
glNormal3fv(nor);
}
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index a0c273cf962..b521285c626 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -51,9 +51,9 @@
#include "BKE_pointcache.h"
#ifdef _WIN32
-void tstart ( void )
+void tstart( void )
{}
-void tend ( void )
+void tend( void )
{
}
double tval( void )
@@ -64,13 +64,13 @@ double tval( void )
#include <sys/time.h>
static struct timeval _tstart, _tend;
static struct timezone tz;
-void tstart ( void )
+void tstart( void )
{
- gettimeofday ( &_tstart, &tz );
+ gettimeofday(&_tstart, &tz);
}
-void tend ( void )
+void tend(void)
{
- gettimeofday ( &_tend,&tz );
+ gettimeofday(&_tend, &tz);
}
double tval(void)
{
@@ -111,7 +111,7 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm );
* 1. create object
* 2. fill object with standard values or with the GUI settings if given
*/
-void cloth_init ( ClothModifierData *clmd )
+void cloth_init(ClothModifierData *clmd )
{
/* Initialize our new data structure to reasonable values. */
clmd->sim_parms->gravity[0] = 0.0;
@@ -191,8 +191,7 @@ static BVHTree *bvhselftree_build_from_cloth (ClothModifierData *clmd, float eps
bvhtree = BLI_bvhtree_new(cloth->numverts, epsilon, 4, 6);
// fill tree
- for (i = 0; i < cloth->numverts; i++, verts++)
- {
+ for (i = 0; i < cloth->numverts; i++, verts++) {
copy_v3_v3(&co[0*3], verts->xold);
BLI_bvhtree_insert(bvhtree, i, co, 1);
@@ -232,8 +231,7 @@ static BVHTree *bvhtree_build_from_cloth (ClothModifierData *clmd, float epsilon
bvhtree = BLI_bvhtree_new(cloth->numfaces, epsilon, 4, 26);
// fill tree
- for (i = 0; i < cloth->numfaces; i++, mfaces++)
- {
+ for (i = 0; i < cloth->numfaces; i++, mfaces++) {
copy_v3_v3(&co[0*3], verts[mfaces->v1].xold);
copy_v3_v3(&co[1*3], verts[mfaces->v2].xold);
copy_v3_v3(&co[2*3], verts[mfaces->v3].xold);
@@ -266,10 +264,8 @@ void bvhtree_update_from_cloth(ClothModifierData *clmd, int moving)
mfaces = cloth->mfaces;
// update vertex position in bvh tree
- if (verts && mfaces)
- {
- for (i = 0; i < cloth->numfaces; i++, mfaces++)
- {
+ if (verts && mfaces) {
+ for (i = 0; i < cloth->numfaces; i++, mfaces++) {
copy_v3_v3(&co[0*3], verts[mfaces->v1].txold);
copy_v3_v3(&co[1*3], verts[mfaces->v2].txold);
copy_v3_v3(&co[2*3], verts[mfaces->v3].txold);
@@ -278,8 +274,7 @@ void bvhtree_update_from_cloth(ClothModifierData *clmd, int moving)
copy_v3_v3(&co[3*3], verts[mfaces->v4].txold);
// copy new locations into array
- if (moving)
- {
+ if (moving) {
// update moving positions
copy_v3_v3(&co_moving[0*3], verts[mfaces->v1].tx);
copy_v3_v3(&co_moving[1*3], verts[mfaces->v2].tx);
@@ -319,15 +314,12 @@ void bvhselftree_update_from_cloth(ClothModifierData *clmd, int moving)
mfaces = cloth->mfaces;
// update vertex position in bvh tree
- if (verts && mfaces)
- {
- for (i = 0; i < cloth->numverts; i++, verts++)
- {
+ if (verts && mfaces) {
+ for (i = 0; i < cloth->numverts; i++, verts++) {
copy_v3_v3(&co[0*3], verts->txold);
// copy new locations into array
- if (moving)
- {
+ if (moving) {
// update moving positions
copy_v3_v3(&co_moving[0*3], verts->tx);
@@ -558,11 +550,9 @@ void cloth_free_modifier(ClothModifierData *clmd )
cloth = clmd->clothObject;
- if ( cloth )
- {
+ if ( cloth ) {
// If our solver provides a free function, call it
- if ( solvers [clmd->sim_parms->solver_type].free )
- {
+ if ( solvers [clmd->sim_parms->solver_type].free ) {
solvers [clmd->sim_parms->solver_type].free ( clmd );
}
@@ -574,11 +564,9 @@ void cloth_free_modifier(ClothModifierData *clmd )
cloth->numverts = 0;
// Free the springs.
- if ( cloth->springs != NULL )
- {
+ if ( cloth->springs != NULL ) {
LinkNode *search = cloth->springs;
- while (search)
- {
+ while (search) {
ClothSpring *spring = search->link;
MEM_freeN ( spring );
@@ -617,7 +605,7 @@ void cloth_free_modifier(ClothModifierData *clmd )
}
/* frees all */
-void cloth_free_modifier_extern ( ClothModifierData *clmd )
+void cloth_free_modifier_extern(ClothModifierData *clmd )
{
Cloth *cloth = NULL;
if (G.rt > 0)
@@ -628,14 +616,12 @@ void cloth_free_modifier_extern ( ClothModifierData *clmd )
cloth = clmd->clothObject;
- if ( cloth )
- {
+ if ( cloth ) {
if (G.rt > 0)
printf("cloth_free_modifier_extern in\n");
// If our solver provides a free function, call it
- if ( solvers [clmd->sim_parms->solver_type].free )
- {
+ if ( solvers [clmd->sim_parms->solver_type].free ) {
solvers [clmd->sim_parms->solver_type].free ( clmd );
}
@@ -647,11 +633,9 @@ void cloth_free_modifier_extern ( ClothModifierData *clmd )
cloth->numverts = 0;
// Free the springs.
- if ( cloth->springs != NULL )
- {
+ if ( cloth->springs != NULL ) {
LinkNode *search = cloth->springs;
- while (search)
- {
+ while (search) {
ClothSpring *spring = search->link;
MEM_freeN ( spring );
@@ -708,8 +692,7 @@ static void cloth_to_object (Object *ob, ClothModifierData *clmd, float (*verte
/* inverse matrix is not uptodate... */
invert_m4_m4(ob->imat, ob->obmat);
- for (i = 0; i < cloth->numverts; i++)
- {
+ for (i = 0; i < cloth->numverts; i++) {
copy_v3_v3 (vertexCos[i], cloth->verts[i].x);
mul_m4_v3(ob->imat, vertexCos[i]); /* cloth is in global coords */
}
@@ -745,21 +728,16 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
clothObj = clmd->clothObject;
- numverts = dm->getNumVerts ( dm );
+ numverts = dm->getNumVerts (dm);
verts = clothObj->verts;
- if (cloth_uses_vgroup(clmd))
- {
- for ( i = 0; i < numverts; i++, verts++ )
- {
+ if (cloth_uses_vgroup(clmd)) {
+ for ( i = 0; i < numverts; i++, verts++ ) {
dvert = dm->getVertData ( dm, i, CD_MDEFORMVERT );
- if ( dvert )
- {
- for ( j = 0; j < dvert->totweight; j++ )
- {
- if (( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_mass-1)) && (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL ))
- {
+ if ( dvert ) {
+ for ( j = 0; j < dvert->totweight; j++ ) {
+ if (( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_mass-1)) && (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )) {
verts->goal = dvert->dw [j].weight;
/* goalfac= 1.0f; */ /* UNUSED */
@@ -768,23 +746,19 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
// ABS ( clmd->sim_parms->maxgoal - clmd->sim_parms->mingoal );
*/
- verts->goal = ( float ) pow ( verts->goal , 4.0f );
- if ( verts->goal >=SOFTGOALSNAP )
- {
+ verts->goal = powf(verts->goal, 4.0f);
+ if ( verts->goal >=SOFTGOALSNAP ) {
verts->flags |= CLOTH_VERT_FLAG_PINNED;
}
}
- if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING )
- {
- if ( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_struct-1))
- {
+ if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING ) {
+ if ( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_struct-1)) {
verts->struct_stiff = dvert->dw [j].weight;
verts->shear_stiff = dvert->dw [j].weight;
}
- if ( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_bend-1))
- {
+ if ( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_bend-1)) {
verts->bend_stiff = dvert->dw [j].weight;
}
}
@@ -807,13 +781,12 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
MVert *mvert = NULL;
ClothVertex *verts = NULL;
float (*shapekey_rest)[3]= NULL;
- float tnull[3] = {0,0,0};
+ float tnull[3] = {0, 0, 0};
Cloth *cloth = NULL;
float maxdist = 0;
// If we have a clothObject, free it.
- if ( clmd->clothObject != NULL )
- {
+ if ( clmd->clothObject != NULL ) {
cloth_free_modifier ( clmd );
if (G.rt > 0)
printf("cloth_free_modifier cloth_from_object\n");
@@ -821,8 +794,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
// Allocate a new cloth object.
clmd->clothObject = MEM_callocN ( sizeof ( Cloth ), "cloth" );
- if ( clmd->clothObject )
- {
+ if ( clmd->clothObject ) {
clmd->clothObject->old_solver_type = 255;
// clmd->clothObject->old_collision_type = 255;
cloth = clmd->clothObject;
@@ -846,22 +818,20 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
if ( clmd->sim_parms->shapekey_rest )
shapekey_rest = dm->getVertDataArray ( dm, CD_CLOTH_ORCO );
- mvert = dm->getVertArray ( dm );
+ mvert = dm->getVertArray (dm);
verts = clmd->clothObject->verts;
// set initial values
- for ( i = 0; i < dm->getNumVerts(dm); i++, verts++ )
- {
- if (first)
- {
- copy_v3_v3( verts->x, mvert[i].co );
+ for ( i = 0; i < dm->getNumVerts(dm); i++, verts++ ) {
+ if (first) {
+ copy_v3_v3(verts->x, mvert[i].co);
- mul_m4_v3( ob->obmat, verts->x );
+ mul_m4_v3(ob->obmat, verts->x);
if ( shapekey_rest ) {
verts->xrest= shapekey_rest[i];
- mul_m4_v3( ob->obmat, verts->xrest );
+ mul_m4_v3(ob->obmat, verts->xrest);
}
else
verts->xrest = verts->x;
@@ -881,7 +851,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
copy_v3_v3 ( verts->xconst, verts->x );
copy_v3_v3 ( verts->txold, verts->x );
copy_v3_v3 ( verts->tx, verts->x );
- mul_v3_fl( verts->v, 0.0f );
+ mul_v3_fl(verts->v, 0.0f);
verts->impulse_count = 0;
copy_v3_v3 ( verts->impulse, tnull );
@@ -891,18 +861,15 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
// has to be happen before springs are build!
cloth_apply_vgroup (clmd, dm);
- if ( !cloth_build_springs ( clmd, dm ) )
- {
+ if ( !cloth_build_springs ( clmd, dm ) ) {
cloth_free_modifier ( clmd );
modifier_setError(&(clmd->modifier), "%s", TIP_("Can't build springs."));
printf("cloth_free_modifier cloth_build_springs\n");
return 0;
}
- for ( i = 0; i < dm->getNumVerts(dm); i++)
- {
- if ((!(cloth->verts[i].flags & CLOTH_VERT_FLAG_PINNED)) && (cloth->verts[i].goal > ALMOST_ZERO))
- {
+ for ( i = 0; i < dm->getNumVerts(dm); i++) {
+ if ((!(cloth->verts[i].flags & CLOTH_VERT_FLAG_PINNED)) && (cloth->verts[i].goal > ALMOST_ZERO)) {
cloth_add_spring (clmd, i, i, 0.0, CLOTH_SPRING_TYPE_GOAL);
}
}
@@ -917,8 +884,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
clmd->clothObject->bvhtree = bvhtree_build_from_cloth ( clmd, MAX2(clmd->coll_parms->epsilon, clmd->coll_parms->distance_repel) );
- for (i = 0; i < dm->getNumVerts(dm); i++)
- {
+ for (i = 0; i < dm->getNumVerts(dm); i++) {
maxdist = MAX2(maxdist, clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len*2.0f));
}
@@ -929,16 +895,15 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm )
{
- unsigned int numverts = dm->getNumVerts ( dm );
- unsigned int numfaces = dm->getNumTessFaces ( dm );
- MFace *mface = dm->getTessFaceArray( dm );
+ unsigned int numverts = dm->getNumVerts (dm);
+ unsigned int numfaces = dm->getNumTessFaces (dm);
+ MFace *mface = dm->getTessFaceArray(dm);
unsigned int i = 0;
/* Allocate our vertices. */
clmd->clothObject->numverts = numverts;
clmd->clothObject->verts = MEM_callocN ( sizeof ( ClothVertex ) * clmd->clothObject->numverts, "clothVertex" );
- if ( clmd->clothObject->verts == NULL )
- {
+ if ( clmd->clothObject->verts == NULL ) {
cloth_free_modifier ( clmd );
modifier_setError(&(clmd->modifier), "%s", TIP_("Out of memory on allocating clmd->clothObject->verts."));
printf("cloth_free_modifier clmd->clothObject->verts\n");
@@ -948,8 +913,7 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm )
// save face information
clmd->clothObject->numfaces = numfaces;
clmd->clothObject->mfaces = MEM_callocN ( sizeof ( MFace ) * clmd->clothObject->numfaces, "clothMFaces" );
- if ( clmd->clothObject->mfaces == NULL )
- {
+ if ( clmd->clothObject->mfaces == NULL ) {
cloth_free_modifier ( clmd );
modifier_setError(&(clmd->modifier), "%s", TIP_("Out of memory on allocating clmd->clothObject->mfaces."));
printf("cloth_free_modifier clmd->clothObject->mfaces\n");
@@ -972,13 +936,12 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm )
// be careful: implicit solver has to be resettet when using this one!
// --> only for implicit handling of this spring!
-int cloth_add_spring ( ClothModifierData *clmd, unsigned int indexA, unsigned int indexB, float restlength, int spring_type)
+int cloth_add_spring(ClothModifierData *clmd, unsigned int indexA, unsigned int indexB, float restlength, int spring_type)
{
Cloth *cloth = clmd->clothObject;
ClothSpring *spring = NULL;
- if (cloth)
- {
+ if (cloth) {
// TODO: look if this spring is already there
spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
@@ -1006,11 +969,9 @@ static void cloth_free_errorsprings(Cloth *cloth, EdgeHash *UNUSED(edgehash), Li
{
unsigned int i = 0;
- if ( cloth->springs != NULL )
- {
+ if ( cloth->springs != NULL ) {
LinkNode *search = cloth->springs;
- while (search)
- {
+ while (search) {
ClothSpring *spring = search->link;
MEM_freeN ( spring );
@@ -1021,11 +982,9 @@ static void cloth_free_errorsprings(Cloth *cloth, EdgeHash *UNUSED(edgehash), Li
cloth->springs = NULL;
}
- if (edgelist)
- {
- for ( i = 0; i < cloth->numverts; i++ )
- {
- BLI_linklist_free ( edgelist[i],NULL );
+ if (edgelist) {
+ for ( i = 0; i < cloth->numverts; i++ ) {
+ BLI_linklist_free ( edgelist[i], NULL );
}
MEM_freeN ( edgelist );
@@ -1041,11 +1000,11 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
ClothSpring *spring = NULL, *tspring = NULL, *tspring2 = NULL;
unsigned int struct_springs = 0, shear_springs=0, bend_springs = 0;
unsigned int i = 0;
- unsigned int numverts = (unsigned int)dm->getNumVerts ( dm );
- unsigned int numedges = (unsigned int)dm->getNumEdges ( dm );
- unsigned int numfaces = (unsigned int)dm->getNumTessFaces ( dm );
- MEdge *medge = dm->getEdgeArray ( dm );
- MFace *mface = dm->getTessFaceArray ( dm );
+ unsigned int numverts = (unsigned int)dm->getNumVerts (dm);
+ unsigned int numedges = (unsigned int)dm->getNumEdges (dm);
+ unsigned int numfaces = (unsigned int)dm->getNumTessFaces (dm);
+ MEdge *medge = dm->getEdgeArray (dm);
+ MFace *mface = dm->getTessFaceArray (dm);
int index2 = 0; // our second vertex index
LinkNode **edgelist = NULL;
EdgeHash *edgehash = NULL;
@@ -1062,8 +1021,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
if (!edgelist)
return 0;
- for ( i = 0; i < numverts; i++ )
- {
+ for ( i = 0; i < numverts; i++ ) {
edgelist[i] = NULL;
}
@@ -1074,12 +1032,10 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
edgehash = BLI_edgehash_new();
// structural springs
- for ( i = 0; i < numedges; i++ )
- {
+ for ( i = 0; i < numedges; i++ ) {
spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
- if ( spring )
- {
+ if ( spring ) {
spring->ij = MIN2(medge[i].v1, medge[i].v2);
spring->kl = MAX2(medge[i].v2, medge[i].v1);
spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest);
@@ -1104,22 +1060,19 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
if (struct_springs > 0)
clmd->sim_parms->avg_spring_len /= struct_springs;
- for (i = 0; i < numverts; i++)
- {
+ for (i = 0; i < numverts; i++) {
cloth->verts[i].avg_spring_len = cloth->verts[i].avg_spring_len * 0.49f / ((float)cloth->verts[i].spring_count);
}
// shear springs
- for ( i = 0; i < numfaces; i++ )
- {
+ for ( i = 0; i < numfaces; i++ ) {
// triangle faces already have shear springs due to structural geometry
if ( !mface[i].v4 )
continue;
spring = ( ClothSpring *) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
- if (!spring)
- {
+ if (!spring) {
cloth_free_errorsprings(cloth, edgehash, edgelist);
return 0;
}
@@ -1140,8 +1093,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
// if ( mface[i].v4 ) --> Quad face
spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
- if (!spring)
- {
+ if (!spring) {
cloth_free_errorsprings(cloth, edgehash, edgelist);
return 0;
}
@@ -1162,15 +1114,13 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
if (numfaces) {
// bending springs
search2 = cloth->springs;
- for ( i = struct_springs; i < struct_springs+shear_springs; i++ )
- {
+ for ( i = struct_springs; i < struct_springs+shear_springs; i++ ) {
if ( !search2 )
break;
tspring2 = search2->link;
search = edgelist[tspring2->kl];
- while ( search )
- {
+ while ( search ) {
tspring = search->link;
index2 = ( ( tspring->ij==tspring2->kl ) ? ( tspring->kl ) : ( tspring->ij ) );
@@ -1181,8 +1131,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
{
spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
- if (!spring)
- {
+ if (!spring) {
cloth_free_errorsprings(cloth, edgehash, edgelist);
return 0;
}
@@ -1192,7 +1141,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest);
spring->type = CLOTH_SPRING_TYPE_BENDING;
spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0f;
- BLI_edgehash_insert ( edgehash, spring->ij, spring->kl, NULL );
+ BLI_edgehash_insert(edgehash, spring->ij, spring->kl, NULL);
bend_springs++;
BLI_linklist_prepend ( &cloth->springs, spring );
@@ -1212,16 +1161,14 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
/* of the strands. -jahka */
search = cloth->springs;
search2 = search->next;
- while (search && search2)
- {
+ while (search && search2) {
tspring = search->link;
tspring2 = search2->link;
if (tspring->ij == tspring2->kl) {
spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
- if (!spring)
- {
+ if (!spring) {
cloth_free_errorsprings(cloth, edgehash, edgelist);
return 0;
}
@@ -1242,27 +1189,24 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
}
/* insert other near springs in edgehash AFTER bending springs are calculated (for selfcolls) */
- for ( i = 0; i < numedges; i++ ) // struct springs
- BLI_edgehash_insert ( edgehash, MIN2(medge[i].v1, medge[i].v2), MAX2(medge[i].v2, medge[i].v1), NULL );
-
- for ( i = 0; i < numfaces; i++ ) // edge springs
- {
- if (mface[i].v4)
- {
- BLI_edgehash_insert ( edgehash, MIN2(mface[i].v1, mface[i].v3), MAX2(mface[i].v3, mface[i].v1), NULL );
+ for (i = 0; i < numedges; i++) { /* struct springs */
+ BLI_edgehash_insert(edgehash, MIN2(medge[i].v1, medge[i].v2), MAX2(medge[i].v2, medge[i].v1), NULL);
+ }
+
+ for (i = 0; i < numfaces; i++) { /* edge springs */
+ if (mface[i].v4) {
+ BLI_edgehash_insert(edgehash, MIN2(mface[i].v1, mface[i].v3), MAX2(mface[i].v3, mface[i].v1), NULL);
- BLI_edgehash_insert ( edgehash, MIN2(mface[i].v2, mface[i].v4), MAX2(mface[i].v2, mface[i].v4), NULL );
+ BLI_edgehash_insert(edgehash, MIN2(mface[i].v2, mface[i].v4), MAX2(mface[i].v2, mface[i].v4), NULL);
}
}
cloth->numsprings = struct_springs + shear_springs + bend_springs;
- if ( edgelist )
- {
- for ( i = 0; i < numverts; i++ )
- {
- BLI_linklist_free ( edgelist[i],NULL );
+ if ( edgelist ) {
+ for ( i = 0; i < numverts; i++ ) {
+ BLI_linklist_free ( edgelist[i], NULL );
}
MEM_freeN ( edgelist );
@@ -1270,8 +1214,8 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
cloth->edgehash = edgehash;
- if (G.rt>0)
- printf("avg_len: %f\n",clmd->sim_parms->avg_spring_len);
+ if (G.rt > 0)
+ printf("avg_len: %f\n", clmd->sim_parms->avg_spring_len);
return 1;
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 5b03f73e120..609b2d3496c 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -80,12 +80,11 @@ void collision_move_object(CollisionModifierData *collmd, float step, float prev
float tv[3] = {0, 0, 0};
unsigned int i = 0;
- for ( i = 0; i < collmd->numverts; i++ )
- {
- sub_v3_v3v3 ( tv, collmd->xnew[i].co, collmd->x[i].co );
- VECADDS ( collmd->current_x[i].co, collmd->x[i].co, tv, prevstep );
- VECADDS ( collmd->current_xnew[i].co, collmd->x[i].co, tv, step );
- sub_v3_v3v3 ( collmd->current_v[i].co, collmd->current_xnew[i].co, collmd->current_x[i].co );
+ for ( i = 0; i < collmd->numverts; i++ ) {
+ sub_v3_v3v3(tv, collmd->xnew[i].co, collmd->x[i].co);
+ VECADDS(collmd->current_x[i].co, collmd->x[i].co, tv, prevstep);
+ VECADDS(collmd->current_xnew[i].co, collmd->x[i].co, tv, step);
+ sub_v3_v3v3(collmd->current_v[i].co, collmd->current_xnew[i].co, collmd->current_x[i].co);
}
bvhtree_update_from_mvert ( collmd->bvhtree, collmd->mfaces, collmd->numfaces, collmd->current_x, collmd->current_xnew, collmd->numverts, 1 );
@@ -101,8 +100,7 @@ BVHTree *bvhtree_build_from_mvert ( MFace *mfaces, unsigned int numfaces, MVert
tree = BLI_bvhtree_new ( numfaces*2, epsilon, 4, 26 );
// fill tree
- for ( i = 0; i < numfaces; i++, tface++ )
- {
+ for ( i = 0; i < numfaces; i++, tface++ ) {
copy_v3_v3 ( &co[0*3], x[tface->v1].co );
copy_v3_v3 ( &co[1*3], x[tface->v2].co );
copy_v3_v3 ( &co[2*3], x[tface->v3].co );
@@ -118,7 +116,7 @@ BVHTree *bvhtree_build_from_mvert ( MFace *mfaces, unsigned int numfaces, MVert
return tree;
}
-void bvhtree_update_from_mvert ( BVHTree * bvhtree, MFace *faces, int numfaces, MVert *x, MVert *xnew, int UNUSED(numverts), int moving )
+void bvhtree_update_from_mvert(BVHTree * bvhtree, MFace *faces, int numfaces, MVert *x, MVert *xnew, int UNUSED(numverts), int moving )
{
int i;
MFace *mfaces = faces;
@@ -128,10 +126,8 @@ void bvhtree_update_from_mvert ( BVHTree * bvhtree, MFace *faces, int numfaces,
if ( !bvhtree )
return;
- if ( x )
- {
- for ( i = 0; i < numfaces; i++, mfaces++ )
- {
+ if ( x ) {
+ for ( i = 0; i < numfaces; i++, mfaces++ ) {
copy_v3_v3 ( &co[0*3], x[mfaces->v1].co );
copy_v3_v3 ( &co[1*3], x[mfaces->v2].co );
copy_v3_v3 ( &co[2*3], x[mfaces->v3].co );
@@ -139,8 +135,7 @@ void bvhtree_update_from_mvert ( BVHTree * bvhtree, MFace *faces, int numfaces,
copy_v3_v3 ( &co[3*3], x[mfaces->v4].co );
// copy new locations into array
- if ( moving && xnew )
- {
+ if ( moving && xnew ) {
// update moving positions
copy_v3_v3 ( &co_moving[0*3], xnew[mfaces->v1].co );
copy_v3_v3 ( &co_moving[1*3], xnew[mfaces->v2].co );
@@ -150,8 +145,7 @@ void bvhtree_update_from_mvert ( BVHTree * bvhtree, MFace *faces, int numfaces,
ret = BLI_bvhtree_update_node ( bvhtree, i, co, co_moving, ( mfaces->v4 ? 4 : 3 ) );
}
- else
- {
+ else {
ret = BLI_bvhtree_update_node ( bvhtree, i, co, NULL, ( mfaces->v4 ? 4 : 3 ) );
}
@@ -174,7 +168,7 @@ Collision modifier code end
* copied from SOLVE_CUBIC.C --> GSL
*/
-#define mySWAP(a,b) do { double tmp = b ; b = a ; a = tmp ; } while (0)
+#define mySWAP(a, b) do { double tmp = b ; b = a ; a = tmp ; } while (0)
#if 0 /* UNUSED */
static int
gsl_poly_solve_cubic (double a, double b, double c,
@@ -451,7 +445,7 @@ static int cloth_get_collision_time ( double a[3], double b[3], double c[3], dou
static void collision_compute_barycentric ( float pv[3], float p1[3], float p2[3], float p3[3], float *w1, float *w2, float *w3 )
{
double tempV1[3], tempV2[3], tempV4[3];
- double a,b,c,d,e,f;
+ double a, b, c, d, e, f;
VECSUB ( tempV1, p1, p3 );
VECSUB ( tempV2, p2, p3 );
@@ -465,8 +459,7 @@ static void collision_compute_barycentric ( float pv[3], float p1[3], float p2[3
d = ( a * c - b * b );
- if ( ABS ( d ) < (double)ALMOST_ZERO )
- {
+ if ( ABS ( d ) < (double)ALMOST_ZERO ) {
*w1 = *w2 = *w3 = 1.0 / 3.0;
return;
}
@@ -504,8 +497,7 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
cloth1 = clmd->clothObject;
- for ( ; collpair != collision_end; collpair++ )
- {
+ for ( ; collpair != collision_end; collpair++ ) {
// only handle static collisions here
if ( collpair->flag & COLLISION_IN_FUTURE )
continue;
@@ -529,10 +521,10 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
collision_interpolateOnTriangle ( v2, collmd->current_v[collpair->bp1].co, collmd->current_v[collpair->bp2].co, collmd->current_v[collpair->bp3].co, u1, u2, u3 );
- sub_v3_v3v3 ( relativeVelocity, v2, v1 );
+ sub_v3_v3v3(relativeVelocity, v2, v1);
// Calculate the normal component of the relative velocity (actually only the magnitude - the direction is stored in 'normal').
- magrelVel = dot_v3v3( relativeVelocity, collpair->normal );
+ magrelVel = dot_v3v3(relativeVelocity, collpair->normal);
// printf("magrelVel: %f\n", magrelVel);
@@ -540,8 +532,7 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
// TODO
// If v_n_mag < 0 the edges are approaching each other.
- if ( magrelVel > ALMOST_ZERO )
- {
+ if ( magrelVel > ALMOST_ZERO ) {
// Calculate Impulse magnitude to stop all motion in normal direction.
float magtangent = 0, repulse = 0, d = 0;
double impulse = 0.0;
@@ -550,17 +541,16 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
// calculate tangential velocity
copy_v3_v3 ( temp, collpair->normal );
- mul_v3_fl( temp, magrelVel );
- sub_v3_v3v3 ( vrel_t_pre, relativeVelocity, temp );
+ mul_v3_fl(temp, magrelVel);
+ sub_v3_v3v3(vrel_t_pre, relativeVelocity, temp);
// Decrease in magnitude of relative tangential velocity due to coulomb friction
// in original formula "magrelVel" should be the "change of relative velocity in normal direction"
- magtangent = MIN2 ( clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf( dot_v3v3( vrel_t_pre,vrel_t_pre ) ) );
+ magtangent = MIN2(clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf(dot_v3v3(vrel_t_pre, vrel_t_pre)));
// Apply friction impulse.
- if ( magtangent > ALMOST_ZERO )
- {
- normalize_v3( vrel_t_pre );
+ if ( magtangent > ALMOST_ZERO ) {
+ normalize_v3(vrel_t_pre);
impulse = magtangent / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); // 2.0 *
VECADDMUL ( cloth1->verts[collpair->ap1].impulse, vrel_t_pre, w1 * impulse );
@@ -583,12 +573,11 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
cloth1->verts[collpair->ap3].impulse_count++;
// Apply repulse impulse if distance too short
- // I_r = -min(dt*kd, m(0,1d/dt - v_n))
+ // I_r = -min(dt*kd, m(0, 1d/dt - v_n))
spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale;
d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - collpair->distance;
- if ( ( magrelVel < 0.1f*d*spf ) && ( d > ALMOST_ZERO ) )
- {
+ if ( ( magrelVel < 0.1f*d*spf ) && ( d > ALMOST_ZERO ) ) {
repulse = MIN2 ( d*1.0f/spf, 0.1f*d*spf - magrelVel );
// stay on the safe side and clamp repulse
@@ -685,10 +674,8 @@ static CollPair* cloth_edge_collision ( ModifierData *md1, ModifierData *md2,
face2 = & ( collmd->mfaces[overlap->indexB] );
// check all 4 possible collisions
- for ( i = 0; i < 4; i++ )
- {
- if ( i == 0 )
- {
+ for ( i = 0; i < 4; i++ ) {
+ if ( i == 0 ) {
// fill faceA
ap1 = face1->v1;
ap2 = face1->v2;
@@ -699,10 +686,8 @@ static CollPair* cloth_edge_collision ( ModifierData *md1, ModifierData *md2,
bp2 = face2->v2;
bp3 = face2->v3;
}
- else if ( i == 1 )
- {
- if ( face1->v4 )
- {
+ else if ( i == 1 ) {
+ if ( face1->v4 ) {
// fill faceA
ap1 = face1->v1;
ap2 = face1->v3;
@@ -717,10 +702,8 @@ static CollPair* cloth_edge_collision ( ModifierData *md1, ModifierData *md2,
continue;
}
}
- if ( i == 2 )
- {
- if ( face2->v4 )
- {
+ if ( i == 2 ) {
+ if ( face2->v4 ) {
// fill faceA
ap1 = face1->v1;
ap2 = face1->v2;
@@ -735,10 +718,8 @@ static CollPair* cloth_edge_collision ( ModifierData *md1, ModifierData *md2,
continue;
}
}
- else if ( i == 3 )
- {
- if ( face1->v4 && face2->v4 )
- {
+ else if ( i == 3 ) {
+ if ( face1->v4 && face2->v4 ) {
// fill faceA
ap1 = face1->v1;
ap2 = face1->v3;
@@ -847,8 +828,7 @@ static int cloth_edge_collision_response_moving ( ClothModifierData *clmd, Colli
cloth1 = clmd->clothObject;
- for ( ; collpair != collision_end; collpair++ )
- {
+ for ( ; collpair != collision_end; collpair++ ) {
if (!(collpair->flag & COLLISION_IS_EDGES))
continue;
@@ -859,14 +839,13 @@ static int cloth_edge_collision_response_moving ( ClothModifierData *clmd, Colli
VECADDFAC(v1, cloth1->verts[collpair->ap1].tv, cloth1->verts[collpair->ap2].tv, w1);
VECADDFAC(v2, collmd->current_v[collpair->bp1].co, collmd->current_v[collpair->bp2].co, w2);
- sub_v3_v3v3 ( relativeVelocity, v2, v1);
+ sub_v3_v3v3(relativeVelocity, v2, v1);
// Calculate the normal component of the relative velocity (actually only the magnitude - the direction is stored in 'normal').
magrelVel = dot_v3v3 ( relativeVelocity, collpair->normal );
// If v_n_mag < 0 the edges are approaching each other.
- if ( magrelVel > ALMOST_ZERO )
- {
+ if ( magrelVel > ALMOST_ZERO ) {
// Calculate Impulse magnitude to stop all motion in normal direction.
float magtangent = 0, repulse = 0, d = 0;
double impulse = 0.0;
@@ -877,17 +856,16 @@ static int cloth_edge_collision_response_moving ( ClothModifierData *clmd, Colli
// calculate tangential velocity
copy_v3_v3 ( temp, collpair->normal );
- mul_v3_fl( temp, magrelVel );
- sub_v3_v3v3 ( vrel_t_pre, relativeVelocity, temp );
+ mul_v3_fl(temp, magrelVel);
+ sub_v3_v3v3(vrel_t_pre, relativeVelocity, temp);
// Decrease in magnitude of relative tangential velocity due to coulomb friction
// in original formula "magrelVel" should be the "change of relative velocity in normal direction"
- magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( dot_v3v3 ( vrel_t_pre,vrel_t_pre ) ) );
+ magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel, sqrt ( dot_v3v3 ( vrel_t_pre, vrel_t_pre ) ) );
// Apply friction impulse.
- if ( magtangent > ALMOST_ZERO )
- {
- normalize_v3( vrel_t_pre );
+ if ( magtangent > ALMOST_ZERO ) {
+ normalize_v3(vrel_t_pre);
impulse = magtangent;
VECADDMUL ( pimpulse, vrel_t_pre, impulse);
@@ -902,12 +880,11 @@ static int cloth_edge_collision_response_moving ( ClothModifierData *clmd, Colli
VECADDMUL ( pimpulse, collpair->normal, impulse);
// Apply repulse impulse if distance too short
- // I_r = -min(dt*kd, m(0,1d/dt - v_n))
+ // I_r = -min(dt*kd, m(0, 1d/dt - v_n))
spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale;
d = collpair->distance;
- if ( ( magrelVel < 0.1*d*spf && ( d > ALMOST_ZERO ) ) )
- {
+ if ( ( magrelVel < 0.1*d*spf && ( d > ALMOST_ZERO ) ) ) {
repulse = MIN2 ( d*1.0/spf, 0.1*d*spf - magrelVel );
// stay on the safe side and clamp repulse
@@ -949,8 +926,7 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
cloth1 = clmd->clothObject;
- for ( ; collpair != collision_end; collpair++ )
- {
+ for ( ; collpair != collision_end; collpair++ ) {
if (collpair->flag & COLLISION_IS_EDGES)
continue;
@@ -961,14 +937,13 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
// Calculate relative "velocity".
collision_interpolateOnTriangle ( v1, collmd->current_v[collpair->bp1].co, collmd->current_v[collpair->bp2].co, collmd->current_v[collpair->bp3].co, w1, w2, w3);
- sub_v3_v3v3 ( relativeVelocity, v1, cloth1->verts[collpair->collp].tv);
+ sub_v3_v3v3(relativeVelocity, v1, cloth1->verts[collpair->collp].tv);
// Calculate the normal component of the relative velocity (actually only the magnitude - the direction is stored in 'normal').
magrelVel = dot_v3v3 ( relativeVelocity, collpair->normal );
// If v_n_mag < 0 the edges are approaching each other.
- if ( magrelVel > ALMOST_ZERO )
- {
+ if ( magrelVel > ALMOST_ZERO ) {
// Calculate Impulse magnitude to stop all motion in normal direction.
float magtangent = 0, repulse = 0, d = 0;
double impulse = 0.0;
@@ -977,17 +952,16 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
// calculate tangential velocity
copy_v3_v3 ( temp, collpair->normal );
- mul_v3_fl( temp, magrelVel );
- sub_v3_v3v3 ( vrel_t_pre, relativeVelocity, temp );
+ mul_v3_fl(temp, magrelVel);
+ sub_v3_v3v3(vrel_t_pre, relativeVelocity, temp);
// Decrease in magnitude of relative tangential velocity due to coulomb friction
// in original formula "magrelVel" should be the "change of relative velocity in normal direction"
- magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( dot_v3v3 ( vrel_t_pre,vrel_t_pre ) ) );
+ magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel, sqrt ( dot_v3v3 ( vrel_t_pre, vrel_t_pre ) ) );
// Apply friction impulse.
- if ( magtangent > ALMOST_ZERO )
- {
- normalize_v3( vrel_t_pre );
+ if ( magtangent > ALMOST_ZERO ) {
+ normalize_v3(vrel_t_pre);
impulse = magtangent; // 2.0 *
VECADDMUL ( cloth1->verts[collpair->collp].impulse, vrel_t_pre, impulse);
@@ -1002,12 +976,11 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
cloth1->verts[collpair->collp].impulse_count++;
// Apply repulse impulse if distance too short
- // I_r = -min(dt*kd, m(0,1d/dt - v_n))
+ // I_r = -min(dt*kd, m(0, 1d/dt - v_n))
spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale;
d = -collpair->distance;
- if ( ( magrelVel < 0.1*d*spf ) && ( d > ALMOST_ZERO ) )
- {
+ if ( ( magrelVel < 0.1*d*spf ) && ( d > ALMOST_ZERO ) ) {
repulse = MIN2 ( d*1.0/spf, 0.1*d*spf - magrelVel );
// stay on the safe side and clamp repulse
@@ -1028,14 +1001,13 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
// Calculate relative "velocity".
collision_interpolateOnTriangle ( v1, cloth1->verts[collpair->ap1].tv, cloth1->verts[collpair->ap2].tv, cloth1->verts[collpair->ap3].tv, w1, w2, w3 );
- sub_v3_v3v3 ( relativeVelocity, collmd->current_v[collpair->collp].co, v1);
+ sub_v3_v3v3(relativeVelocity, collmd->current_v[collpair->collp].co, v1);
// Calculate the normal component of the relative velocity (actually only the magnitude - the direction is stored in 'normal').
magrelVel = dot_v3v3 ( relativeVelocity, collpair->normal );
// If v_n_mag < 0 the edges are approaching each other.
- if ( magrelVel > ALMOST_ZERO )
- {
+ if ( magrelVel > ALMOST_ZERO ) {
// Calculate Impulse magnitude to stop all motion in normal direction.
float magtangent = 0, repulse = 0, d = 0;
double impulse = 0.0;
@@ -1044,17 +1016,16 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
// calculate tangential velocity
copy_v3_v3 ( temp, collpair->normal );
- mul_v3_fl( temp, magrelVel );
- sub_v3_v3v3 ( vrel_t_pre, relativeVelocity, temp );
+ mul_v3_fl(temp, magrelVel);
+ sub_v3_v3v3(vrel_t_pre, relativeVelocity, temp);
// Decrease in magnitude of relative tangential velocity due to coulomb friction
// in original formula "magrelVel" should be the "change of relative velocity in normal direction"
- magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( dot_v3v3 ( vrel_t_pre,vrel_t_pre ) ) );
+ magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel, sqrt ( dot_v3v3 ( vrel_t_pre, vrel_t_pre ) ) );
// Apply friction impulse.
- if ( magtangent > ALMOST_ZERO )
- {
- normalize_v3( vrel_t_pre );
+ if ( magtangent > ALMOST_ZERO ) {
+ normalize_v3(vrel_t_pre);
impulse = magtangent; // 2.0 *
VECADDMUL ( pimpulse, vrel_t_pre, impulse);
@@ -1068,12 +1039,11 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
VECADDMUL ( pimpulse, collpair->normal, impulse);
// Apply repulse impulse if distance too short
- // I_r = -min(dt*kd, m(0,1d/dt - v_n))
+ // I_r = -min(dt*kd, m(0, 1d/dt - v_n))
spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale;
d = -collpair->distance;
- if ( ( magrelVel < 0.1*d*spf ) && ( d > ALMOST_ZERO ) )
- {
+ if ( ( magrelVel < 0.1*d*spf ) && ( d > ALMOST_ZERO ) ) {
repulse = MIN2 ( d*1.0/spf, 0.1*d*spf - magrelVel );
// stay on the safe side and clamp repulse
@@ -1202,10 +1172,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTree
face2 = & ( collmd->mfaces[overlap->indexB] );
// check all 4 possible collisions
- for ( i = 0; i < 4; i++ )
- {
- if ( i == 0 )
- {
+ for ( i = 0; i < 4; i++ ) {
+ if ( i == 0 ) {
// fill faceA
ap1 = face1->v1;
ap2 = face1->v2;
@@ -1216,10 +1184,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTree
bp2 = face2->v2;
bp3 = face2->v3;
}
- else if ( i == 1 )
- {
- if ( face1->v4 )
- {
+ else if ( i == 1 ) {
+ if ( face1->v4 ) {
// fill faceA
ap1 = face1->v1;
ap2 = face1->v3;
@@ -1234,10 +1200,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTree
continue;
}
}
- if ( i == 2 )
- {
- if ( face2->v4 )
- {
+ if ( i == 2 ) {
+ if ( face2->v4 ) {
// fill faceA
ap1 = face1->v1;
ap2 = face1->v2;
@@ -1252,10 +1216,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTree
continue;
}
}
- else if ( i == 3 )
- {
- if ( face1->v4 && face2->v4 )
- {
+ else if ( i == 3 ) {
+ if ( face1->v4 && face2->v4 ) {
// fill faceA
ap1 = face1->v1;
ap2 = face1->v3;
@@ -1417,10 +1379,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2,
face2 = & ( collmd->mfaces[overlap->indexB] );
// check all 4 possible collisions
- for ( i = 0; i < 4; i++ )
- {
- if ( i == 0 )
- {
+ for ( i = 0; i < 4; i++ ) {
+ if ( i == 0 ) {
// fill faceA
collpair->ap1 = face1->v1;
collpair->ap2 = face1->v2;
@@ -1431,10 +1391,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2,
collpair->bp2 = face2->v2;
collpair->bp3 = face2->v3;
}
- else if ( i == 1 )
- {
- if ( face1->v4 )
- {
+ else if ( i == 1 ) {
+ if ( face1->v4 ) {
// fill faceA
collpair->ap1 = face1->v1;
collpair->ap2 = face1->v4;
@@ -1448,10 +1406,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2,
else
i++;
}
- if ( i == 2 )
- {
- if ( face2->v4 )
- {
+ if ( i == 2 ) {
+ if ( face2->v4 ) {
// fill faceA
collpair->ap1 = face1->v1;
collpair->ap2 = face1->v2;
@@ -1465,10 +1421,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2,
else
break;
}
- else if ( i == 3 )
- {
- if ( face1->v4 && face2->v4 )
- {
+ else if ( i == 3 ) {
+ if ( face1->v4 && face2->v4 ) {
// fill faceA
collpair->ap1 = face1->v1;
collpair->ap2 = face1->v4;
@@ -1507,15 +1461,14 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2,
#ifdef USE_BULLET
// calc distance + normal
distance = plNearestPoints (
- verts1[collpair->ap1].txold, verts1[collpair->ap2].txold, verts1[collpair->ap3].txold, collmd->current_x[collpair->bp1].co, collmd->current_x[collpair->bp2].co, collmd->current_x[collpair->bp3].co, collpair->pa,collpair->pb,collpair->vector );
+ verts1[collpair->ap1].txold, verts1[collpair->ap2].txold, verts1[collpair->ap3].txold, collmd->current_x[collpair->bp1].co, collmd->current_x[collpair->bp2].co, collmd->current_x[collpair->bp3].co, collpair->pa, collpair->pb, collpair->vector );
#else
// just be sure that we don't add anything
distance = 2.0 * (double)( epsilon1 + epsilon2 + ALMOST_ZERO );
#endif
- if ( distance <= ( epsilon1 + epsilon2 + ALMOST_ZERO ) )
- {
- normalize_v3_v3( collpair->normal, collpair->vector );
+ if (distance <= (epsilon1 + epsilon2 + ALMOST_ZERO)) {
+ normalize_v3_v3(collpair->normal, collpair->vector);
collpair->distance = distance;
collpair->flag = 0;
@@ -1547,7 +1500,7 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2,
collision_interpolateOnTriangle ( v2, collmd->current_v[collpair->bp1].co, collmd->current_v[collpair->bp2].co, collmd->current_v[collpair->bp3].co, u1, u2, u3 );
- sub_v3_v3v3 ( relativeVelocity, v2, v1 );
+ sub_v3_v3v3(relativeVelocity, v2, v1);
if (sqrt(dot_v3v3(relativeVelocity, relativeVelocity)) >= distance)
{
@@ -1594,7 +1547,7 @@ static int cloth_collision_response_moving( ClothModifierData *clmd, CollisionMo
collision_interpolateOnTriangle ( v2, collmd->current_v[collpair->bp1].co, collmd->current_v[collpair->bp2].co, collmd->current_v[collpair->bp3].co, u1, u2, u3 );
- sub_v3_v3v3 ( relativeVelocity, v2, v1 );
+ sub_v3_v3v3(relativeVelocity, v2, v1);
// Calculate the normal component of the relative velocity (actually only the magnitude - the direction is stored in 'normal').
magrelVel = dot_v3v3 ( relativeVelocity, collpair->normal );
@@ -1615,17 +1568,17 @@ static int cloth_collision_response_moving( ClothModifierData *clmd, CollisionMo
// calculate tangential velocity
copy_v3_v3 ( temp, collpair->normal );
- mul_v3_fl( temp, magrelVel );
- sub_v3_v3v3 ( vrel_t_pre, relativeVelocity, temp );
+ mul_v3_fl(temp, magrelVel);
+ sub_v3_v3v3(vrel_t_pre, relativeVelocity, temp);
// Decrease in magnitude of relative tangential velocity due to coulomb friction
// in original formula "magrelVel" should be the "change of relative velocity in normal direction"
- magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( dot_v3v3 ( vrel_t_pre,vrel_t_pre ) ) );
+ magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel, sqrt ( dot_v3v3 ( vrel_t_pre, vrel_t_pre ) ) );
// Apply friction impulse.
if ( magtangent > ALMOST_ZERO )
{
- normalize_v3( vrel_t_pre );
+ normalize_v3(vrel_t_pre);
impulse = 2.0 * magtangent / ( 1.0 + w1*w1 + w2*w2 + w3*w3 );
VECADDMUL ( cloth1->verts[collpair->ap1].impulse, vrel_t_pre, w1 * impulse );
@@ -1648,7 +1601,7 @@ static int cloth_collision_response_moving( ClothModifierData *clmd, CollisionMo
cloth1->verts[collpair->ap3].impulse_count++;
// Apply repulse impulse if distance too short
- // I_r = -min(dt*kd, m(0,1d/dt - v_n))
+ // I_r = -min(dt*kd, m(0, 1d/dt - v_n))
/*
d = clmd->coll_parms->epsilon*8.0/9.0 + epsilon2*8.0/9.0 - collpair->distance;
if ( ( magrelVel < 0.1*d*clmd->sim_parms->stepsPerFrame ) && ( d > ALMOST_ZERO ) )
@@ -1682,7 +1635,7 @@ static float projectPointOntoLine(float *p, float *a, float *b)
return dot_v3v3(pa, ba) / dot_v3v3(ba, ba);
}
-static void calculateEENormal(float *np1, float *np2, float *np3, float *np4,float *out_normal)
+static void calculateEENormal(float *np1, float *np2, float *np3, float *np4, float *out_normal)
{
float line1[3], line2[3];
float length;
@@ -2008,14 +1961,14 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
// if ( !cloth_are_edges_adjacent ( clmd, collmd, &edgecollpair ) )
{
// always put coll points in p21/p22
- sub_v3_v3v3 ( x1, verts1[edgecollpair.p12].txold, verts1[edgecollpair.p11].txold );
- sub_v3_v3v3 ( v1, verts1[edgecollpair.p12].tv, verts1[edgecollpair.p11].tv );
+ sub_v3_v3v3(x1, verts1[edgecollpair.p12].txold, verts1[edgecollpair.p11].txold);
+ sub_v3_v3v3(v1, verts1[edgecollpair.p12].tv, verts1[edgecollpair.p11].tv);
- sub_v3_v3v3 ( x2, verts2[edgecollpair.p21].co, verts1[edgecollpair.p11].txold );
- sub_v3_v3v3 ( v2, velocity2[edgecollpair.p21].co, verts1[edgecollpair.p11].tv );
+ sub_v3_v3v3(x2, verts2[edgecollpair.p21].co, verts1[edgecollpair.p11].txold);
+ sub_v3_v3v3(v2, velocity2[edgecollpair.p21].co, verts1[edgecollpair.p11].tv);
- sub_v3_v3v3 ( x3, verts2[edgecollpair.p22].co, verts1[edgecollpair.p11].txold );
- sub_v3_v3v3 ( v3, velocity2[edgecollpair.p22].co, verts1[edgecollpair.p11].tv );
+ sub_v3_v3v3(x3, verts2[edgecollpair.p22].co, verts1[edgecollpair.p11].txold);
+ sub_v3_v3v3(v3, velocity2[edgecollpair.p22].co, verts1[edgecollpair.p11].tv);
numsolutions = cloth_get_collision_time ( x1, v1, x2, v2, x3, v3, solution );
@@ -2034,7 +1987,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
// printf("sol %d: %lf\n", k, solution[k]);
if ( ( solution[k] >= ALMOST_ZERO ) && ( solution[k] <= 1.0 ) && ( solution[k] > ALMOST_ZERO))
{
- float a,b;
+ float a, b;
float out_normal[3];
float distance;
float impulse = 0;
@@ -2283,14 +2236,12 @@ static void cloth_bvh_objcollisions_nearcheck ( ClothModifierData * clmd, Collis
#ifdef WITH_ELTOPO
machine_epsilon_offset(clmd->clothObject);
- for ( i = 0; i < numresult; i++ )
- {
+ for ( i = 0; i < numresult; i++ ) {
*collisions_index = cloth_collision ( (ModifierData *)clmd, (ModifierData *)collmd,
overlap+i, *collisions_index, dt, tri_visithash, arena );
}
- for ( i = 0; i < numresult; i++ )
- {
+ for ( i = 0; i < numresult; i++ ) {
*collisions_index = cloth_edge_collision ( (ModifierData *)clmd, (ModifierData *)collmd,
overlap+i, *collisions_index, visithash, arena );
}
@@ -2298,8 +2249,7 @@ static void cloth_bvh_objcollisions_nearcheck ( ClothModifierData * clmd, Collis
BLI_ghash_free(tri_visithash, NULL, NULL);
BLI_memarena_free(arena);
#else /* WITH_ELTOPO */
- for ( i = 0; i < numresult; i++ )
- {
+ for ( i = 0; i < numresult; i++ ) {
*collisions_index = cloth_collision ( (ModifierData *)clmd, (ModifierData *)collmd,
overlap+i, *collisions_index, dt );
}
@@ -2310,11 +2260,11 @@ static void cloth_bvh_objcollisions_nearcheck ( ClothModifierData * clmd, Collis
static int cloth_bvh_objcollisions_resolve ( ClothModifierData * clmd, CollisionModifierData *collmd, CollPair *collisions, CollPair *collisions_index)
{
Cloth *cloth = clmd->clothObject;
- int i=0, j = 0, /*numfaces = 0,*/ numverts = 0;
+ int i=0, j = 0, /*numfaces = 0, */ numverts = 0;
ClothVertex *verts = NULL;
int ret = 0;
int result = 0;
- float tnull[3] = {0,0,0};
+ float tnull[3] = {0, 0, 0};
/*numfaces = clmd->clothObject->numfaces;*/ /*UNUSED*/
numverts = clmd->clothObject->numverts;
@@ -2323,12 +2273,10 @@ static int cloth_bvh_objcollisions_resolve ( ClothModifierData * clmd, Collision
// process all collisions (calculate impulses, TODO: also repulses if distance too short)
result = 1;
- for ( j = 0; j < 5; j++ ) // 5 is just a value that ensures convergence
- {
+ for ( j = 0; j < 5; j++ ) { /* 5 is just a value that ensures convergence */
result = 0;
- if ( collmd->bvhtree )
- {
+ if ( collmd->bvhtree ) {
#ifdef WITH_ELTOPO
result += cloth_collision_response_moving(clmd, collmd, collisions, collisions_index);
result += cloth_edge_collision_response_moving(clmd, collmd, collisions, collisions_index);
@@ -2339,14 +2287,11 @@ static int cloth_bvh_objcollisions_resolve ( ClothModifierData * clmd, Collision
{
#else
// apply impulses in parallel
- if ( result )
- {
+ if (result) {
#endif
- for ( i = 0; i < numverts; i++ )
- {
+ for (i = 0; i < numverts; i++) {
// calculate "velocities" (just xnew = xold + v; no dt in v)
- if ( verts[i].impulse_count )
- {
+ if (verts[i].impulse_count) {
VECADDMUL ( verts[i].tv, verts[i].impulse, 1.0f / verts[i].impulse_count );
copy_v3_v3 ( verts[i].impulse, tnull );
verts[i].impulse_count = 0;
@@ -2361,7 +2306,7 @@ static int cloth_bvh_objcollisions_resolve ( ClothModifierData * clmd, Collision
}
// cloth - object collisions
-int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, float dt )
+int cloth_bvh_objcollision(Object *ob, ClothModifierData * clmd, float step, float dt )
{
Cloth *cloth= clmd->clothObject;
BVHTree *cloth_bvh= cloth->bvhtree;
@@ -2398,12 +2343,11 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
ret2 = 0;
- collisions = MEM_callocN(sizeof(CollPair *) *numcollobj , "CollPair");
- collisions_index = MEM_callocN(sizeof(CollPair *) *numcollobj , "CollPair");
+ collisions = MEM_callocN(sizeof(CollPair *) *numcollobj, "CollPair");
+ collisions_index = MEM_callocN(sizeof(CollPair *) *numcollobj, "CollPair");
// check all collision objects
- for (i = 0; i < numcollobj; i++)
- {
+ for (i = 0; i < numcollobj; i++) {
Object *collob= collobjs[i];
CollisionModifierData *collmd = (CollisionModifierData*)modifiers_findByType(collob, eModifierType_Collision);
BVHTreeOverlap *overlap = NULL;
@@ -2435,8 +2379,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
}
rounds++;
- for (i = 0; i < numcollobj; i++)
- {
+ for (i = 0; i < numcollobj; i++) {
if ( collisions[i] ) MEM_freeN ( collisions[i] );
}
@@ -2449,12 +2392,9 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
////////////////////////////////////////////////////////////
// verts come from clmd
- for ( i = 0; i < numverts; i++ )
- {
- if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )
- {
- if ( verts [i].flags & CLOTH_VERT_FLAG_PINNED )
- {
+ for ( i = 0; i < numverts; i++ ) {
+ if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL ) {
+ if ( verts [i].flags & CLOTH_VERT_FLAG_PINNED ) {
continue;
}
}
@@ -2467,10 +2407,8 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
////////////////////////////////////////////////////////////
// Test on *simple* selfcollisions
////////////////////////////////////////////////////////////
- if ( clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_SELF )
- {
- for (l = 0; l < (unsigned int)clmd->coll_parms->self_loop_count; l++)
- {
+ if ( clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_SELF ) {
+ for (l = 0; l < (unsigned int)clmd->coll_parms->self_loop_count; l++) {
// TODO: add coll quality rounds again
BVHTreeOverlap *overlap = NULL;
unsigned int result = 0;
@@ -2483,14 +2421,12 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
verts = cloth->verts;
- if ( cloth->bvhselftree )
- {
- // search for overlapping collision pairs
+ if ( cloth->bvhselftree ) {
+ // search for overlapping collision pairs
overlap = BLI_bvhtree_overlap ( cloth->bvhselftree, cloth->bvhselftree, &result );
// #pragma omp parallel for private(k, i, j) schedule(static)
- for ( k = 0; k < result; k++ )
- {
+ for ( k = 0; k < result; k++ ) {
float temp[3];
float length = 0;
float mindistance;
@@ -2500,8 +2436,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
mindistance = clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len + cloth->verts[j].avg_spring_len );
- if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )
- {
+ if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL ) {
if ( ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED ) &&
( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED ) )
{
@@ -2509,38 +2444,33 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
}
}
- sub_v3_v3v3 ( temp, verts[i].tx, verts[j].tx );
+ sub_v3_v3v3(temp, verts[i].tx, verts[j].tx);
if ( ( ABS ( temp[0] ) > mindistance ) || ( ABS ( temp[1] ) > mindistance ) || ( ABS ( temp[2] ) > mindistance ) ) continue;
// check for adjacent points (i must be smaller j)
- if ( BLI_edgehash_haskey ( cloth->edgehash, MIN2(i, j), MAX2(i, j) ) )
- {
+ if ( BLI_edgehash_haskey ( cloth->edgehash, MIN2(i, j), MAX2(i, j) ) ) {
continue;
}
- length = normalize_v3( temp );
+ length = normalize_v3(temp );
- if ( length < mindistance )
- {
+ if ( length < mindistance ) {
float correction = mindistance - length;
- if ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED )
- {
- mul_v3_fl( temp, -correction );
+ if ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED ) {
+ mul_v3_fl(temp, -correction);
VECADD ( verts[j].tx, verts[j].tx, temp );
}
- else if ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED )
- {
- mul_v3_fl( temp, correction );
+ else if ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED ) {
+ mul_v3_fl(temp, correction);
VECADD ( verts[i].tx, verts[i].tx, temp );
}
- else
- {
- mul_v3_fl( temp, correction * -0.5 );
+ else {
+ mul_v3_fl(temp, correction * -0.5);
VECADD ( verts[j].tx, verts[j].tx, temp );
- sub_v3_v3v3 ( verts[i].tx, verts[i].tx, temp );
+ sub_v3_v3v3(verts[i].tx, verts[i].tx, temp);
}
ret = 1;
ret2 += ret;
@@ -2560,13 +2490,10 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
////////////////////////////////////////////////////////////
// SELFCOLLISIONS: update velocities
////////////////////////////////////////////////////////////
- if ( ret2 )
- {
- for ( i = 0; i < cloth->numverts; i++ )
- {
- if ( ! ( verts [i].flags & CLOTH_VERT_FLAG_PINNED ) )
- {
- sub_v3_v3v3 ( verts[i].tv, verts[i].tx, verts[i].txold );
+ if ( ret2 ) {
+ for ( i = 0; i < cloth->numverts; i++ ) {
+ if ( ! ( verts [i].flags & CLOTH_VERT_FLAG_PINNED ) ) {
+ sub_v3_v3v3(verts[i].tv, verts[i].tx, verts[i].txold);
}
}
}
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 25391a34689..2955e20c9e2 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -202,7 +202,7 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset, int slope)
if (cuma->curve)
MEM_freeN(cuma->curve);
- switch(preset) {
+ switch (preset) {
case CURVE_PRESET_LINE: cuma->totpoint= 2; break;
case CURVE_PRESET_SHARP: cuma->totpoint= 4; break;
case CURVE_PRESET_SMOOTH: cuma->totpoint= 4; break;
@@ -214,7 +214,7 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset, int slope)
cuma->curve= MEM_callocN(cuma->totpoint*sizeof(CurveMapPoint), "curve points");
- switch(preset) {
+ switch (preset) {
case CURVE_PRESET_LINE:
cuma->curve[0].x= clipr->xmin;
cuma->curve[0].y= clipr->ymax;
@@ -252,10 +252,9 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset, int slope)
case CURVE_PRESET_MID9:
{
int i;
- for (i=0; i < cuma->totpoint; i++)
- {
- cuma->curve[i].x= i / ((float)cuma->totpoint-1);
- cuma->curve[i].y= 0.5;
+ for (i = 0; i < cuma->totpoint; i++) {
+ cuma->curve[i].x = i / ((float)cuma->totpoint - 1);
+ cuma->curve[i].y = 0.5;
}
}
break;
@@ -319,8 +318,8 @@ void curvemap_sethandle(CurveMap *cuma, int type)
/* reduced copy of garbled calchandleNurb() code in curve.c */
static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *next, int UNUSED(mode))
{
- float *p1,*p2,*p3,pt[3];
- float len,len_a, len_b;
+ float *p1, *p2, *p3, pt[3];
+ float len, len_a, len_b;
float dvec_a[2], dvec_b[2];
if (bezt->h1==0 && bezt->h2==0) {
@@ -500,8 +499,8 @@ static void curvemap_make_table(CurveMap *cuma, rctf *clipr)
for (a=0; a<cuma->totpoint-1; a++, fp += 2*CM_RESOL) {
correct_bezpart(bezt[a].vec[1], bezt[a].vec[2], bezt[a+1].vec[0], bezt[a+1].vec[1]);
- forward_diff_bezier(bezt[a].vec[1][0], bezt[a].vec[2][0], bezt[a+1].vec[0][0], bezt[a+1].vec[1][0], fp, CM_RESOL-1, 2*sizeof(float));
- forward_diff_bezier(bezt[a].vec[1][1], bezt[a].vec[2][1], bezt[a+1].vec[0][1], bezt[a+1].vec[1][1], fp+1, CM_RESOL-1, 2*sizeof(float));
+ BKE_curve_forward_diff_bezier(bezt[a].vec[1][0], bezt[a].vec[2][0], bezt[a+1].vec[0][0], bezt[a+1].vec[1][0], fp, CM_RESOL-1, 2*sizeof(float));
+ BKE_curve_forward_diff_bezier(bezt[a].vec[1][1], bezt[a].vec[2][1], bezt[a+1].vec[0][1], bezt[a+1].vec[1][1], fp+1, CM_RESOL-1, 2*sizeof(float));
}
/* store first and last handle for extrapolation, unit length */
@@ -1015,7 +1014,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management)
}
}
else {
- rgb_to_ycc(rgb[0],rgb[1],rgb[2],&ycc[0],&ycc[1],&ycc[2], ycc_mode);
+ rgb_to_ycc(rgb[0], rgb[1], rgb[2], &ycc[0], &ycc[1], &ycc[2], ycc_mode);
for (c=0; c<3; c++) {
ycc[c] *=INV_255;
if (ycc[c] < scopes->minmax[c][0]) scopes->minmax[c][0] = ycc[c];
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 0a6e8a163cc..47b497188ec 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -104,7 +104,7 @@
/* -------------- Naming -------------- */
/* Find the first available, non-duplicate name for a given constraint */
-void unique_constraint_name (bConstraint *con, ListBase *list)
+void unique_constraint_name(bConstraint *con, ListBase *list)
{
BLI_uniquename(list, con, "Const", '.', offsetof(bConstraint, name), sizeof(con->name));
}
@@ -177,7 +177,7 @@ bConstraintOb *constraints_make_evalob (Scene *scene, Object *ob, void *subdata,
}
/* cleanup after constraint evaluation */
-void constraints_clear_evalob (bConstraintOb *cob)
+void constraints_clear_evalob(bConstraintOb *cob)
{
float delta[4][4], imat[4][4];
@@ -272,7 +272,7 @@ static void constraint_pchan_diff_mat(bPoseChannel *pchan, float diff_mat[4][4])
* of a matrix from one space to another for constraint evaluation.
* For now, this is only implemented for Objects and PoseChannels.
*/
-void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4], short from, short to)
+void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4], short from, short to)
{
float diff_mat[4][4];
float imat[4][4];
@@ -1333,7 +1333,7 @@ static void followpath_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
if ((data->followflag & FOLLOWPATH_RADIUS)==0) { /* XXX - assume that scale correction means that radius will have some scale error in it - Campbell */
float obsize[3];
- mat4_to_size( obsize,cob->matrix);
+ mat4_to_size(obsize, cob->matrix);
if (obsize[0])
mul_v3_fl(cob->matrix[0], size[0] / obsize[0]);
if (obsize[1])
@@ -1475,8 +1475,8 @@ static void sizelimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
bSizeLimitConstraint *data = con->data;
float obsize[3], size[3];
- mat4_to_size( size,cob->matrix);
- mat4_to_size( obsize,cob->matrix);
+ mat4_to_size(size, cob->matrix);
+ mat4_to_size(obsize, cob->matrix);
if (data->flag & LIMIT_XMIN) {
if (size[0] < data->xmin)
@@ -2308,7 +2308,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
bConstraintTarget *ct= targets->first;
if (VALID_CONS_TARGET(ct)) {
- float vec[3],vec2[3];
+ float vec[3], vec2[3];
float totmat[3][3];
float tmpmat[3][3];
float invmat[3][3];
@@ -2542,9 +2542,9 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
copy_m4_m4(tmat, cob->matrix);
- mdet = determinant_m3( totmat[0][0],totmat[0][1],totmat[0][2],
- totmat[1][0],totmat[1][1],totmat[1][2],
- totmat[2][0],totmat[2][1],totmat[2][2]);
+ mdet = determinant_m3(totmat[0][0], totmat[0][1], totmat[0][2],
+ totmat[1][0], totmat[1][1], totmat[1][2],
+ totmat[2][0], totmat[2][1], totmat[2][2]);
if (mdet==0) {
unit_m3(totmat);
}
@@ -3311,7 +3311,7 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
/* obtain target effect */
switch (data->from) {
case 2: /* scale */
- mat4_to_size( dvec,ct->matrix);
+ mat4_to_size(dvec, ct->matrix);
break;
case 1: /* rotation (convert to degrees first) */
mat4_to_eulO(dvec, cob->rotOrder, ct->matrix);
@@ -3439,8 +3439,7 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
{
bShrinkwrapConstraint *scon = (bShrinkwrapConstraint *) con->data;
- if ( VALID_CONS_TARGET(ct) && (ct->tar->type == OB_MESH) )
- {
+ if ( VALID_CONS_TARGET(ct) && (ct->tar->type == OB_MESH) ) {
int fail = FALSE;
float co[3] = {0.0f, 0.0f, 0.0f};
float no[3] = {0.0f, 0.0f, 0.0f};
@@ -3461,12 +3460,10 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
unit_m4(ct->matrix);
- if (target != NULL)
- {
+ if (target != NULL) {
space_transform_from_matrixs(&transform, cob->matrix, ct->tar->obmat);
- switch(scon->shrinkType)
- {
+ switch (scon->shrinkType) {
case MOD_SHRINKWRAP_NEAREST_SURFACE:
case MOD_SHRINKWRAP_NEAREST_VERTEX:
@@ -3475,8 +3472,7 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
else
bvhtree_from_mesh_faces(&treeData, target, 0.0, 2, 6);
- if (treeData.tree == NULL)
- {
+ if (treeData.tree == NULL) {
fail = TRUE;
break;
}
@@ -3506,14 +3502,12 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
bvhtree_from_mesh_faces(&treeData, target, scon->dist, 4, 6);
- if (treeData.tree == NULL)
- {
+ if (treeData.tree == NULL) {
fail = TRUE;
break;
}
- if (normal_projection_project_vertex(0, co, no, &transform, treeData.tree, &hit, treeData.raycast_callback, &treeData) == FALSE)
- {
+ if (normal_projection_project_vertex(0, co, no, &transform, treeData.tree, &hit, treeData.raycast_callback, &treeData) == FALSE) {
fail = TRUE;
break;
}
@@ -3542,8 +3536,7 @@ static void shrinkwrap_evaluate (bConstraint *UNUSED(con), bConstraintOb *cob, L
bConstraintTarget *ct= targets->first;
/* only evaluate if there is a target */
- if (VALID_CONS_TARGET(ct))
- {
+ if (VALID_CONS_TARGET(ct)) {
copy_v3_v3(cob->matrix[3], ct->matrix[3]);
}
}
@@ -3609,8 +3602,8 @@ static void damptrack_flush_tars (bConstraint *con, ListBase *list, short nocopy
/* array of direction vectors for the tracking flags */
static const float track_dir_vecs[6][3] = {
- {+1,0,0}, {0,+1,0}, {0,0,+1}, /* TRACK_X, TRACK_Y, TRACK_Z */
- {-1,0,0}, {0,-1,0}, {0,0,-1} /* TRACK_NX, TRACK_NY, TRACK_NZ */
+ {+1, 0, 0}, {0, +1, 0}, {0, 0, +1}, /* TRACK_X, TRACK_Y, TRACK_Z */
+ {-1, 0, 0}, {0, -1, 0}, {0, 0, -1} /* TRACK_NX, TRACK_NY, TRACK_NZ */
};
static void damptrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets)
@@ -4328,7 +4321,7 @@ bConstraintTypeInfo *constraint_get_typeinfo (bConstraint *con)
/* Free data of a specific constraint if it has any info.
* be sure to run BIK_clear_data() when freeing an IK constraint,
* unless DAG_scene_sort is called. */
-void free_constraint_data (bConstraint *con)
+void free_constraint_data(bConstraint *con)
{
if (con->data) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
@@ -4343,7 +4336,7 @@ void free_constraint_data (bConstraint *con)
}
/* Free all constraints from a constraint-stack */
-void free_constraints (ListBase *list)
+void free_constraints(ListBase *list)
{
bConstraint *con;
@@ -4357,7 +4350,7 @@ void free_constraints (ListBase *list)
/* Remove the specified constraint from the given constraint stack */
-int remove_constraint (ListBase *list, bConstraint *con)
+int remove_constraint(ListBase *list, bConstraint *con)
{
if (con) {
free_constraint_data(con);
@@ -4369,7 +4362,7 @@ int remove_constraint (ListBase *list, bConstraint *con)
}
/* Remove all the constraints of the specified type from the given constraint stack */
-void remove_constraints_type (ListBase *list, short type, short last_only)
+void remove_constraints_type(ListBase *list, short type, short last_only)
{
bConstraint *con, *conp;
@@ -4495,7 +4488,7 @@ bConstraint *add_ob_constraint(Object *ob, const char *name, short type)
/* ......... */
/* Reassign links that constraints have to other data (called during file loading?) */
-void relink_constraints (ListBase *conlist)
+void relink_constraints(ListBase *conlist)
{
bConstraint *con;
bConstraintTarget *ct;
@@ -4525,7 +4518,7 @@ void relink_constraints (ListBase *conlist)
}
/* Run the given callback on all ID-blocks in list of constraints */
-void id_loop_constraints (ListBase *conlist, ConstraintIDFunc func, void *userdata)
+void id_loop_constraints(ListBase *conlist, ConstraintIDFunc func, void *userdata)
{
bConstraint *con;
@@ -4549,7 +4542,7 @@ static void con_extern_cb(bConstraint *UNUSED(con), ID **idpoin, void *UNUSED(us
}
/* duplicate all of the constraints in a constraint stack */
-void copy_constraints (ListBase *dst, const ListBase *src, int do_extern)
+void copy_constraints(ListBase *dst, const ListBase *src, int do_extern)
{
bConstraint *con, *srccon;
@@ -4603,7 +4596,7 @@ bConstraint *constraints_get_active (ListBase *list)
}
/* Set the given constraint as the active one (clearing all the others) */
-void constraints_set_active (ListBase *list, bConstraint *con)
+void constraints_set_active(ListBase *list, bConstraint *con)
{
bConstraint *c;
@@ -4620,7 +4613,7 @@ void constraints_set_active (ListBase *list, bConstraint *con)
/* -------- Constraints and Proxies ------- */
/* Rescue all constraints tagged as being CONSTRAINT_PROXY_LOCAL (i.e. added to bone that's proxy-synced in this file) */
-void extract_proxylocal_constraints (ListBase *dst, ListBase *src)
+void extract_proxylocal_constraints(ListBase *dst, ListBase *src)
{
bConstraint *con, *next;
@@ -4637,7 +4630,7 @@ void extract_proxylocal_constraints (ListBase *dst, ListBase *src)
}
/* Returns if the owner of the constraint is proxy-protected */
-short proxylocked_constraints_owner (Object *ob, bPoseChannel *pchan)
+short proxylocked_constraints_owner(Object *ob, bPoseChannel *pchan)
{
/* Currently, constraints can only be on object or bone level */
if (ob && ob->proxy) {
@@ -4666,7 +4659,7 @@ short proxylocked_constraints_owner (Object *ob, bPoseChannel *pchan)
* None of the actual calculations of the matrices should be done here! Also, this function is
* not to be used by any new constraints, particularly any that have multiple targets.
*/
-void get_constraint_target_matrix (struct Scene *scene, bConstraint *con, int n, short ownertype, void *ownerdata, float mat[][4], float ctime)
+void get_constraint_target_matrix(struct Scene *scene, bConstraint *con, int n, short ownertype, void *ownerdata, float mat[][4], float ctime)
{
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
ListBase targets = {NULL, NULL};
@@ -4735,7 +4728,7 @@ void get_constraint_target_matrix (struct Scene *scene, bConstraint *con, int n,
}
/* Get the list of targets required for solving a constraint */
-void get_constraint_targets_for_solving (bConstraint *con, bConstraintOb *cob, ListBase *targets, float ctime)
+void get_constraint_targets_for_solving(bConstraint *con, bConstraintOb *cob, ListBase *targets, float ctime)
{
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
@@ -4770,7 +4763,7 @@ void get_constraint_targets_for_solving (bConstraint *con, bConstraintOb *cob, L
* constraints_make_evalob and constraints_clear_evalob should be called before and
* after running this function, to sort out cob
*/
-void solve_constraints (ListBase *conlist, bConstraintOb *cob, float ctime)
+void solve_constraints(ListBase *conlist, bConstraintOb *cob, float ctime)
{
bConstraint *con;
float oldmat[4][4];
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index e9dd4d01b0e..7a5b4ef9b24 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -777,7 +777,7 @@ int CTX_data_mode_enum(const bContext *C)
Object *obedit= CTX_data_edit_object(C);
if (obedit) {
- switch(obedit->type) {
+ switch (obedit->type) {
case OB_MESH:
return CTX_MODE_EDIT_MESH;
case OB_CURVE:
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 9232fe8ec04..906757bdd62 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -70,7 +70,7 @@ static int cu_isectLL(const float v1[3], const float v2[3], const float v3[3], c
short cox, short coy,
float *labda, float *mu, float vec[3]);
-void unlink_curve(Curve *cu)
+void BKE_curve_unlink(Curve *cu)
{
int a;
@@ -95,7 +95,7 @@ void unlink_curve(Curve *cu)
}
/* frees editcurve entirely */
-void BKE_free_editfont(Curve *cu)
+void BKE_curve_editfont_free(Curve *cu)
{
if (cu->editfont) {
EditFont *ef= cu->editfont;
@@ -112,7 +112,7 @@ void BKE_free_editfont(Curve *cu)
}
}
-void free_curve_editNurb_keyIndex(EditNurb *editnurb)
+void BKE_curve_editNurb_keyIndex_free(EditNurb *editnurb)
{
if (!editnurb->keyindex) {
return;
@@ -121,26 +121,26 @@ void free_curve_editNurb_keyIndex(EditNurb *editnurb)
editnurb->keyindex= NULL;
}
-void free_curve_editNurb (Curve *cu)
+void BKE_curve_editNurb_free(Curve *cu)
{
if (cu->editnurb) {
- freeNurblist(&cu->editnurb->nurbs);
- free_curve_editNurb_keyIndex(cu->editnurb);
+ BKE_nurbList_free(&cu->editnurb->nurbs);
+ BKE_curve_editNurb_keyIndex_free(cu->editnurb);
MEM_freeN(cu->editnurb);
cu->editnurb= NULL;
}
}
/* don't free curve itself */
-void free_curve(Curve *cu)
+void BKE_curve_free(Curve *cu)
{
- freeNurblist(&cu->nurb);
+ BKE_nurbList_free(&cu->nurb);
BLI_freelistN(&cu->bev);
freedisplist(&cu->disp);
- BKE_free_editfont(cu);
+ BKE_curve_editfont_free(cu);
- free_curve_editNurb(cu);
- unlink_curve(cu);
+ BKE_curve_editNurb_free(cu);
+ BKE_curve_unlink(cu);
BKE_free_animdata((ID *)cu);
if (cu->mat) MEM_freeN(cu->mat);
@@ -151,7 +151,7 @@ void free_curve(Curve *cu)
if (cu->tb) MEM_freeN(cu->tb);
}
-Curve *add_curve(const char *name, int type)
+Curve *BKE_curve_add(const char *name, int type)
{
Curve *cu;
@@ -187,14 +187,14 @@ Curve *add_curve(const char *name, int type)
return cu;
}
-Curve *copy_curve(Curve *cu)
+Curve *BKE_curve_copy(Curve *cu)
{
Curve *cun;
int a;
cun= copy_libblock(&cu->id);
cun->nurb.first= cun->nurb.last= NULL;
- duplicateNurblist( &(cun->nurb), &(cu->nurb));
+ BKE_nurbList_duplicate(&(cun->nurb), &(cu->nurb));
cun->mat= MEM_dupallocN(cu->mat);
for (a=0; a<cun->totcol; a++) {
@@ -242,7 +242,7 @@ static void extern_local_curve(Curve *cu)
}
}
-void make_local_curve(Curve *cu)
+void BKE_curve_make_local(Curve *cu)
{
Main *bmain= G.main;
Object *ob;
@@ -273,7 +273,7 @@ void make_local_curve(Curve *cu)
extern_local_curve(cu);
}
else if (is_local && is_lib) {
- Curve *cu_new= copy_curve(cu);
+ Curve *cu_new= BKE_curve_copy(cu);
cu_new->id.us= 0;
BKE_id_lib_local_paths(bmain, cu->id.lib, &cu_new->id);
@@ -291,7 +291,7 @@ void make_local_curve(Curve *cu)
}
/* Get list of nurbs from editnurbs structure */
-ListBase *curve_editnurbs(Curve *cu)
+ListBase *BKE_curve_editNurbs_get(Curve *cu)
{
if (cu->editnurb) {
return &cu->editnurb->nurbs;
@@ -300,7 +300,7 @@ ListBase *curve_editnurbs(Curve *cu)
return NULL;
}
-short curve_type(Curve *cu)
+short BKE_curve_type_get(Curve *cu)
{
Nurb *nu;
int type= cu->type;
@@ -322,9 +322,9 @@ short curve_type(Curve *cu)
return type;
}
-void update_curve_dimension(Curve *cu)
+void BKE_curve_curve_dimension_update(Curve *cu)
{
- ListBase *nurbs= BKE_curve_nurbs(cu);
+ ListBase *nurbs= BKE_curve_nurbs_get(cu);
Nurb *nu= nurbs->first;
if (cu->flag&CU_3D) {
@@ -335,24 +335,24 @@ void update_curve_dimension(Curve *cu)
else {
for ( ; nu; nu= nu->next) {
nu->flag |= CU_2D;
- test2DNurb(nu);
+ BKE_nurb_test2D(nu);
/* since the handles are moved they need to be auto-located again */
if (nu->type == CU_BEZIER)
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
}
}
-void test_curve_type(Object *ob)
+void BKE_curve_type_test(Object *ob)
{
- ob->type= curve_type(ob->data);
+ ob->type= BKE_curve_type_get(ob->data);
if (ob->type==OB_CURVE)
- update_curve_dimension((Curve *)ob->data);
+ BKE_curve_curve_dimension_update((Curve *)ob->data);
}
-void tex_space_curve(Curve *cu)
+void BKE_curve_tex_space_calc(Curve *cu)
{
DispList *dl;
BoundBox *bb;
@@ -408,7 +408,7 @@ void tex_space_curve(Curve *cu)
}
}
-int count_curveverts(ListBase *nurb)
+int BKE_nurbList_verts_count(ListBase *nurb)
{
Nurb *nu;
int tot=0;
@@ -423,7 +423,7 @@ int count_curveverts(ListBase *nurb)
return tot;
}
-int count_curveverts_without_handles(ListBase *nurb)
+int BKE_nurbList_verts_count_without_handles(ListBase *nurb)
{
Nurb *nu;
int tot=0;
@@ -440,7 +440,7 @@ int count_curveverts_without_handles(ListBase *nurb)
/* **************** NURBS ROUTINES ******************** */
-void freeNurb(Nurb *nu)
+void BKE_nurb_free(Nurb *nu)
{
if (nu==NULL) return;
@@ -460,7 +460,7 @@ void freeNurb(Nurb *nu)
}
-void freeNurblist(ListBase *lb)
+void BKE_nurbList_free(ListBase *lb)
{
Nurb *nu, *next;
@@ -469,30 +469,30 @@ void freeNurblist(ListBase *lb)
nu= lb->first;
while (nu) {
next= nu->next;
- freeNurb(nu);
+ BKE_nurb_free(nu);
nu= next;
}
lb->first= lb->last= NULL;
}
-Nurb *duplicateNurb(Nurb *nu)
+Nurb *BKE_nurb_duplicate(Nurb *nu)
{
Nurb *newnu;
int len;
- newnu= (Nurb*)MEM_mallocN(sizeof(Nurb),"duplicateNurb");
+ newnu= (Nurb*)MEM_mallocN(sizeof(Nurb), "duplicateNurb");
if (newnu==NULL) return NULL;
memcpy(newnu, nu, sizeof(Nurb));
if (nu->bezt) {
newnu->bezt=
- (BezTriple*)MEM_mallocN((nu->pntsu)* sizeof(BezTriple),"duplicateNurb2");
+ (BezTriple*)MEM_mallocN((nu->pntsu)* sizeof(BezTriple), "duplicateNurb2");
memcpy(newnu->bezt, nu->bezt, nu->pntsu*sizeof(BezTriple));
}
else {
len= nu->pntsu*nu->pntsv;
newnu->bp=
- (BPoint*)MEM_mallocN((len)* sizeof(BPoint),"duplicateNurb3");
+ (BPoint*)MEM_mallocN((len)* sizeof(BPoint), "duplicateNurb3");
memcpy(newnu->bp, nu->bp, len*sizeof(BPoint));
newnu->knotsu= newnu->knotsv= NULL;
@@ -515,22 +515,22 @@ Nurb *duplicateNurb(Nurb *nu)
return newnu;
}
-void duplicateNurblist(ListBase *lb1, ListBase *lb2)
+void BKE_nurbList_duplicate(ListBase *lb1, ListBase *lb2)
{
Nurb *nu, *nun;
- freeNurblist(lb1);
+ BKE_nurbList_free(lb1);
nu= lb2->first;
while (nu) {
- nun= duplicateNurb(nu);
+ nun= BKE_nurb_duplicate(nu);
BLI_addtail(lb1, nun);
nu= nu->next;
}
}
-void test2DNurb(Nurb *nu)
+void BKE_nurb_test2D(Nurb *nu)
{
BezTriple *bezt;
BPoint *bp;
@@ -559,7 +559,7 @@ void test2DNurb(Nurb *nu)
}
}
-void minmaxNurb(Nurb *nu, float *min, float *max)
+void BKE_nurb_minmax(Nurb *nu, float *min, float *max)
{
BezTriple *bezt;
BPoint *bp;
@@ -586,7 +586,7 @@ void minmaxNurb(Nurb *nu, float *min, float *max)
}
/* be sure to call makeknots after this */
-void addNurbPoints(Nurb *nu, int number)
+void BKE_nurb_points_add(Nurb *nu, int number)
{
BPoint *tmp= nu->bp;
int i;
@@ -606,7 +606,7 @@ void addNurbPoints(Nurb *nu, int number)
nu->pntsu += number;
}
-void addNurbPointsBezier(Nurb *nu, int number)
+void BKE_nurb_bezierPoints_add(Nurb *nu, int number)
{
BezTriple *tmp= nu->bezt;
int i;
@@ -636,7 +636,7 @@ static void calcknots(float *knots, const short pnts, const short order, const s
float k;
int a;
- switch(flag & (CU_NURB_ENDPOINT|CU_NURB_BEZIER)) {
+ switch (flag & (CU_NURB_ENDPOINT|CU_NURB_BEZIER)) {
case CU_NURB_ENDPOINT:
k= 0.0;
for (a=1; a <= pnts_order; a++) {
@@ -706,7 +706,7 @@ static void makeknots(Nurb *nu, short uv)
if (nu->type == CU_NURBS) {
if (uv == 1) {
if (nu->knotsu) MEM_freeN(nu->knotsu);
- if (check_valid_nurb_u(nu)) {
+ if (BKE_nurb_check_valid_u(nu)) {
nu->knotsu= MEM_callocN(4+sizeof(float)*KNOTSU(nu), "makeknots");
if (nu->flagu & CU_NURB_CYCLIC) {
calcknots(nu->knotsu, nu->pntsu, nu->orderu, 0); /* cyclic should be uniform */
@@ -721,7 +721,7 @@ static void makeknots(Nurb *nu, short uv)
}
else if (uv == 2) {
if (nu->knotsv) MEM_freeN(nu->knotsv);
- if (check_valid_nurb_v(nu)) {
+ if (BKE_nurb_check_valid_v(nu)) {
nu->knotsv= MEM_callocN(4+sizeof(float)*KNOTSV(nu), "makeknots");
if (nu->flagv & CU_NURB_CYCLIC) {
calcknots(nu->knotsv, nu->pntsv, nu->orderv, 0); /* cyclic should be uniform */
@@ -736,12 +736,12 @@ static void makeknots(Nurb *nu, short uv)
}
}
-void nurbs_knot_calc_u(Nurb *nu)
+void BKE_nurb_knot_calc_u(Nurb *nu)
{
makeknots(nu, 1);
}
-void nurbs_knot_calc_v(Nurb *nu)
+void BKE_nurb_knot_calc_v(Nurb *nu)
{
makeknots(nu, 2);
}
@@ -749,7 +749,7 @@ void nurbs_knot_calc_v(Nurb *nu)
static void basisNurb(float t, short order, short pnts, float *knots, float *basis, int *start, int *end)
{
float d, e;
- int i, i1 = 0, i2 = 0 ,j, orderpluspnts, opp2, o2;
+ int i, i1 = 0, i2 = 0, j, orderpluspnts, opp2, o2;
orderpluspnts= order+pnts;
opp2 = orderpluspnts-1;
@@ -777,7 +777,7 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas
}
basis[i]= 0.0;
- /* this is order 2,3,... */
+ /* this is order 2, 3, ... */
for (j=2; j<=order; j++) {
if (i2+j>= orderpluspnts) i2= opp2-j;
@@ -809,7 +809,7 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas
}
-void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int resolv)
+void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int resolv)
/* coord_array has to be 3*4*resolu*resolv in size, and zero-ed */
{
BPoint *bp;
@@ -870,7 +870,7 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
jstart= (int *)MEM_mallocN(sizeof(float)*totv, "makeNurbfaces4");
jend= (int *)MEM_mallocN(sizeof(float)*totv, "makeNurbfaces5");
- /* precalculation of basisv and jstart,jend */
+ /* precalculation of basisv and jstart, jend */
if (nu->flagv & CU_NURB_CYCLIC) cycl= nu->orderv-1;
else cycl= 0;
v= vstart;
@@ -972,7 +972,7 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
MEM_freeN(jend);
}
-void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride)
+void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride)
/* coord_array has to be 3*4*pntsu*resolu in size and zero-ed
* tilt_array and radius_array will be written to if valid */
{
@@ -1074,9 +1074,9 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu
}
/* forward differencing method for bezier curve */
-void forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride)
+void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride)
{
- float rt0,rt1,rt2,rt3,f;
+ float rt0, rt1, rt2, rt3, f;
int a;
f= (float)it;
@@ -1122,7 +1122,7 @@ static void forward_diff_bezier_cotangent(float *p0, float *p1, float *p2, float
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-float *make_orco_surf(Object *ob)
+float *BKE_curve_surf_make_orco(Object *ob)
{
/* Note: this function is used in convertblender only atm, so
* suppose nonzero curve's render resolution should always be used */
@@ -1190,7 +1190,7 @@ float *make_orco_surf(Object *ob)
float *_tdata= MEM_callocN((nu->pntsu*resolu) * (nu->pntsv*resolv) *3*sizeof(float), "temp data");
float *tdata= _tdata;
- makeNurbfaces(nu, tdata, 0, resolu, resolv);
+ BKE_nurb_makeFaces(nu, tdata, 0, resolu, resolv);
for (b=0; b<sizeu; b++) {
int use_b= b;
@@ -1224,7 +1224,7 @@ float *make_orco_surf(Object *ob)
/* NOTE: This routine is tied to the order of vertex
* built by displist and as passed to the renderer.
*/
-float *make_orco_curve(Scene *scene, Object *ob)
+float *BKE_curve_make_orco(Scene *scene, Object *ob)
{
Curve *cu = ob->data;
DispList *dl;
@@ -1281,7 +1281,7 @@ float *make_orco_curve(Scene *scene, Object *ob)
}
for (u=0; u<sizev; u++) {
- for (v=0; v<sizeu; v++,fp+=3) {
+ for (v=0; v<sizeu; v++, fp+=3) {
if (cu->flag & CU_UV_ORCO) {
fp[0]= 2.0f*u/(sizev - 1) - 1.0f;
fp[1]= 2.0f*v/(sizeu - 1) - 1.0f;
@@ -1312,7 +1312,7 @@ float *make_orco_curve(Scene *scene, Object *ob)
/* ***************** BEVEL ****************** */
-void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
+void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, int forRender)
{
DispList *dl, *dlnew;
Curve *bevcu, *cu;
@@ -1544,13 +1544,13 @@ static int cu_isectLL(const float v1[3], const float v2[3], const float v3[3], c
}
-static short bevelinside(BevList *bl1,BevList *bl2)
+static short bevelinside(BevList *bl1, BevList *bl2)
{
/* is bl2 INSIDE bl1 ? with left-right method and "labda's" */
/* returns '1' if correct hole */
BevPoint *bevp, *prevbevp;
- float min,max,vec[3],hvec1[3],hvec2[3],lab,mu;
- int nr, links=0,rechts=0,mode;
+ float min, max, vec[3], hvec1[3], hvec2[3], lab, mu;
+ int nr, links=0, rechts=0, mode;
/* take first vertex of possible hole */
@@ -1558,7 +1558,7 @@ static short bevelinside(BevList *bl1,BevList *bl2)
hvec1[0]= bevp->vec[0];
hvec1[1]= bevp->vec[1];
hvec1[2]= 0.0;
- copy_v3_v3(hvec2,hvec1);
+ copy_v3_v3(hvec2, hvec1);
hvec2[0]+=1000;
/* test it with all edges of potential surounding poly */
@@ -1605,7 +1605,7 @@ struct bevelsort {
static int vergxcobev(const void *a1, const void *a2)
{
- const struct bevelsort *x1=a1,*x2=a2;
+ const struct bevelsort *x1=a1, *x2=a2;
if ( x1->left > x2->left ) return 1;
else if ( x1->left < x2->left) return -1;
@@ -1837,7 +1837,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter)
while (nr--) {
/* interpolate quats */
- float zaxis[3] = {0,0,1}, cross[3], q2[4];
+ float zaxis[3] = {0, 0, 1}, cross[3], q2[4];
interp_qt_qtqt(q, bevp0_quat, bevp2->quat, 0.5);
normalize_qt(q);
@@ -1872,7 +1872,7 @@ static void make_bevel_list_3D_zup(BevList *bl)
while (nr--) {
/* totally simple */
bisect_v3_v3v3v3(bevp1->dir, bevp0->vec, bevp1->vec, bevp2->vec);
- vec_to_quat( bevp1->quat,bevp1->dir, 5, 1);
+ vec_to_quat(bevp1->quat, bevp1->dir, 5, 1);
bevp0= bevp1;
bevp1= bevp2;
@@ -1896,7 +1896,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
while (nr--) {
if (nr+4 > bl->nr) { /* first time and second time, otherwise first point adjusts last */
- vec_to_quat( bevp1->quat,bevp1->dir, 5, 1);
+ vec_to_quat(bevp1->quat, bevp1->dir, 5, 1);
}
else {
float angle= angle_normalized_v3v3(bevp0->dir, bevp1->dir);
@@ -1930,7 +1930,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
*
* this is why we compare last with second last
* */
- float vec_1[3]= {0,1,0}, vec_2[3]= {0,1,0}, angle, ang_fac, cross_tmp[3];
+ float vec_1[3]= {0, 1, 0}, vec_2[3]= {0, 1, 0}, angle, ang_fac, cross_tmp[3];
BevPoint *bevp_first;
BevPoint *bevp_last;
@@ -2024,11 +2024,11 @@ static void make_bevel_list_3D_tangent(BevList *bl)
/* make perpendicular, modify tan in place, is ok */
float cross_tmp[3];
- float zero[3] = {0,0,0};
+ float zero[3] = {0, 0, 0};
cross_v3_v3v3(cross_tmp, bevp1->tan, bevp1->dir);
normalize_v3(cross_tmp);
- tri_to_quat( bevp1->quat,zero, cross_tmp, bevp1->tan); /* XXX - could be faster */
+ tri_to_quat(bevp1->quat, zero, cross_tmp, bevp1->tan); /* XXX - could be faster */
/* bevp0= bevp1; */ /* UNUSED */
bevp1= bevp2;
@@ -2038,7 +2038,7 @@ static void make_bevel_list_3D_tangent(BevList *bl)
static void make_bevel_list_3D(BevList *bl, int smooth_iter, int twist_mode)
{
- switch(twist_mode) {
+ switch (twist_mode) {
case CU_TWIST_TANGENT:
make_bevel_list_3D_tangent(bl);
break;
@@ -2072,7 +2072,7 @@ static void make_bevel_list_segment_3D(BevList *bl)
sub_v3_v3v3(bevp1->dir, bevp1->vec, bevp2->vec);
normalize_v3(bevp1->dir);
- vec_to_quat( bevp1->quat,bevp1->dir, 5, 1);
+ vec_to_quat(bevp1->quat, bevp1->dir, 5, 1);
axis_angle_to_quat(q, bevp1->dir, bevp1->alfa);
mul_qt_qtqt(bevp1->quat, q, bevp1->quat);
@@ -2083,7 +2083,7 @@ static void make_bevel_list_segment_3D(BevList *bl)
-void makeBevelList(Object *ob)
+void BKE_curve_bevelList_make(Object *ob)
{
/*
* - convert all curves to polys, with indication of resol and flags for double-vertices
@@ -2112,7 +2112,7 @@ void makeBevelList(Object *ob)
BLI_freelistN(&(cu->bev));
if (cu->editnurb && ob->type!=OB_FONT) {
- ListBase *nurbs= curve_editnurbs(cu);
+ ListBase *nurbs= BKE_curve_editNurbs_get(cu);
nu = nurbs->first;
}
else {
@@ -2128,7 +2128,7 @@ void makeBevelList(Object *ob)
/* check we are a single point? also check we are not a surface and that the orderu is sane,
* enforced in the UI but can go wrong possibly */
- if (!check_valid_nurb_u(nu)) {
+ if (!BKE_nurb_check_valid_u(nu)) {
bl= MEM_callocN(sizeof(BevList)+1*sizeof(BevPoint), "makeBevelList1");
BLI_addtail(&(cu->bev), bl);
bl->nr= 0;
@@ -2201,24 +2201,23 @@ void makeBevelList(Object *ob)
/* BevPoint must stay aligned to 4 so sizeof(BevPoint)/sizeof(float) works */
for (j=0; j<3; j++) {
- forward_diff_bezier( prevbezt->vec[1][j], prevbezt->vec[2][j],
- bezt->vec[0][j], bezt->vec[1][j],
- &(bevp->vec[j]), resolu, sizeof(BevPoint));
+ BKE_curve_forward_diff_bezier(prevbezt->vec[1][j], prevbezt->vec[2][j],
+ bezt->vec[0][j], bezt->vec[1][j],
+ &(bevp->vec[j]), resolu, sizeof(BevPoint));
}
/* if both arrays are NULL do nothiong */
- alfa_bezpart( prevbezt, bezt, nu,
- do_tilt ? &bevp->alfa : NULL,
- do_radius ? &bevp->radius : NULL,
- do_weight ? &bevp->weight : NULL,
- resolu, sizeof(BevPoint));
+ alfa_bezpart(prevbezt, bezt, nu,
+ do_tilt ? &bevp->alfa : NULL,
+ do_radius ? &bevp->radius : NULL,
+ do_weight ? &bevp->weight : NULL,
+ resolu, sizeof(BevPoint));
if (cu->twist_mode==CU_TWIST_TANGENT) {
- forward_diff_bezier_cotangent(
- prevbezt->vec[1], prevbezt->vec[2],
- bezt->vec[0], bezt->vec[1],
- bevp->tan, resolu, sizeof(BevPoint));
+ forward_diff_bezier_cotangent(prevbezt->vec[1], prevbezt->vec[2],
+ bezt->vec[0], bezt->vec[1],
+ bevp->tan, resolu, sizeof(BevPoint));
}
/* indicate with handlecodes double points */
@@ -2256,11 +2255,11 @@ void makeBevelList(Object *ob)
else bl->poly= -1;
bevp= (BevPoint *)(bl+1);
- makeNurbcurve( nu, &bevp->vec[0],
- do_tilt ? &bevp->alfa : NULL,
- do_radius ? &bevp->radius : NULL,
- do_weight ? &bevp->weight : NULL,
- resolu, sizeof(BevPoint));
+ BKE_nurb_makeCurve(nu, &bevp->vec[0],
+ do_tilt ? &bevp->alfa : NULL,
+ do_radius ? &bevp->radius : NULL,
+ do_weight ? &bevp->weight : NULL,
+ resolu, sizeof(BevPoint));
}
}
}
@@ -2299,7 +2298,7 @@ void makeBevelList(Object *ob)
memcpy(blnew, bl, sizeof(BevList));
blnew->nr= 0;
BLI_remlink(&(cu->bev), bl);
- BLI_insertlinkbefore(&(cu->bev),blnext,blnew); /* to make sure bevlijst is tuned with nurblist */
+ BLI_insertlinkbefore(&(cu->bev), blnext, blnew); /* to make sure bevlijst is tuned with nurblist */
bevp0= (BevPoint *)(bl+1);
bevp1= (BevPoint *)(blnew+1);
nr= bl->nr;
@@ -2367,7 +2366,7 @@ void makeBevelList(Object *ob)
bl= bl->next;
}
- qsort(sortdata,poly,sizeof(struct bevelsort), vergxcobev);
+ qsort(sortdata, poly, sizeof(struct bevelsort), vergxcobev);
sd= sortdata+1;
for (a=1; a<poly; a++, sd++) {
@@ -2442,7 +2441,7 @@ void makeBevelList(Object *ob)
/* from: make_bevel_list_3D_zup, could call but avoid a second loop.
* no need for tricky tilt calculation as with 3D curves */
bisect_v3_v3v3v3(bevp1->dir, bevp0->vec, bevp1->vec, bevp2->vec);
- vec_to_quat( bevp1->quat,bevp1->dir, 5, 1);
+ vec_to_quat(bevp1->quat, bevp1->dir, 5, 1);
/* done with inline make_bevel_list_3D_zup */
bevp0= bevp1;
@@ -2497,7 +2496,7 @@ void makeBevelList(Object *ob)
/* mode: is not zero when FCurve, is 2 when forced horizontal for autohandles */
static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode, int skip_align)
{
- float *p1,*p2,*p3, pt[3];
+ float *p1, *p2, *p3, pt[3];
float dvec_a[3], dvec_b[3];
float len, len_a, len_b;
const float eps= 1e-5;
@@ -2545,7 +2544,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n
if (len_b==0.0f) len_b=1.0f;
- if (ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM) || ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) { /* auto */
+ if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) || ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) { /* auto */
float tvec[3];
tvec[0]= dvec_b[0]/len_b + dvec_a[0]/len_a;
tvec[1]= dvec_b[1]/len_b + dvec_a[1]/len_a;
@@ -2558,7 +2557,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n
if (len_a>5.0f*len_b) len_a= 5.0f*len_b;
if (len_b>5.0f*len_a) len_b= 5.0f*len_a;
- if (ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM)) {
+ if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM)) {
len_a/=len;
madd_v3_v3v3fl(p2-3, p2, tvec, -len_a);
@@ -2584,7 +2583,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n
}
}
}
- if (ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) {
+ if (ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) {
len_b/=len;
madd_v3_v3v3fl(p2+3, p2, tvec, len_b);
@@ -2719,18 +2718,18 @@ static void calchandlesNurb_intern(Nurb *nu, int skip_align)
}
}
-void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
+void BKE_nurb_handle_calc(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
{
calchandleNurb_intern(bezt, prev, next, mode, FALSE);
}
-void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */
+void BKE_nurb_handles_calc(Nurb *nu) /* first, if needed, set handle flags */
{
calchandlesNurb_intern(nu, FALSE);
}
-void testhandlesNurb(Nurb *nu)
+void BKE_nurb_handles_test(Nurb *nu)
{
/* use when something has changed with handles.
* it treats all BezTriples with the following rules:
@@ -2770,10 +2769,10 @@ void testhandlesNurb(Nurb *nu)
bezt++;
}
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
-void autocalchandlesNurb(Nurb *nu, int flag)
+void BKE_nurb_handles_autocalc(Nurb *nu, int flag)
{
/* checks handle coordinates and calculates type */
@@ -2795,7 +2794,7 @@ void autocalchandlesNurb(Nurb *nu, int flag)
if (flag==0 || (bezt1->f1 & flag) ) {
bezt1->h1= 0;
/* distance too short: vectorhandle */
- if ( len_v3v3( bezt1->vec[1], bezt0->vec[1] ) < 0.0001f) {
+ if (len_v3v3(bezt1->vec[1], bezt0->vec[1]) < 0.0001f) {
bezt1->h1= HD_VECT;
leftsmall= 1;
}
@@ -2815,7 +2814,7 @@ void autocalchandlesNurb(Nurb *nu, int flag)
if (flag==0 || (bezt1->f3 & flag) ) {
bezt1->h2= 0;
/* distance too short: vectorhandle */
- if ( len_v3v3( bezt1->vec[1], bezt2->vec[1] ) < 0.0001f) {
+ if (len_v3v3(bezt1->vec[1], bezt2->vec[1]) < 0.0001f) {
bezt1->h2= HD_VECT;
rightsmall= 1;
}
@@ -2841,21 +2840,21 @@ void autocalchandlesNurb(Nurb *nu, int flag)
bezt2++;
}
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
-void autocalchandlesNurb_all(ListBase *editnurb, int flag)
+void BKE_nurbList_handles_autocalc(ListBase *editnurb, int flag)
{
Nurb *nu;
nu= editnurb->first;
while (nu) {
- autocalchandlesNurb(nu, flag);
+ BKE_nurb_handles_autocalc(nu, flag);
nu= nu->next;
}
}
-void sethandlesNurb(ListBase *editnurb, short code)
+void BKE_nurbList_handles_set(ListBase *editnurb, short code)
{
/* code==1: set autohandle */
/* code==2: set vectorhandle */
@@ -2884,7 +2883,7 @@ void sethandlesNurb(ListBase *editnurb, short code)
}
bezt++;
}
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
nu= nu->next;
}
@@ -2928,7 +2927,7 @@ void sethandlesNurb(ListBase *editnurb, short code)
bezt++;
}
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
nu= nu->next;
}
@@ -2958,7 +2957,7 @@ static void swapdata(void *adr1, void *adr2, int len)
}
}
-void switchdirectionNurb(Nurb *nu)
+void BKE_nurb_direction_switch(Nurb *nu)
{
BezTriple *bezt1, *bezt2;
BPoint *bp1, *bp2;
@@ -3064,9 +3063,9 @@ void switchdirectionNurb(Nurb *nu)
}
-float (*curve_getVertexCos(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3]
+float (*BKE_curve_vertexCos_get(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3]
{
- int i, numVerts = *numVerts_r = count_curveverts(lb);
+ int i, numVerts = *numVerts_r = BKE_nurbList_verts_count(lb);
float *co, (*cos)[3] = MEM_mallocN(sizeof(*cos)*numVerts, "cu_vcos");
Nurb *nu;
@@ -3075,7 +3074,7 @@ float (*curve_getVertexCos(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3]
if (nu->type == CU_BEZIER) {
BezTriple *bezt = nu->bezt;
- for (i=0; i<nu->pntsu; i++,bezt++) {
+ for (i=0; i<nu->pntsu; i++, bezt++) {
copy_v3_v3(co, bezt->vec[0]); co+=3;
copy_v3_v3(co, bezt->vec[1]); co+=3;
copy_v3_v3(co, bezt->vec[2]); co+=3;
@@ -3084,7 +3083,7 @@ float (*curve_getVertexCos(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3]
else {
BPoint *bp = nu->bp;
- for (i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
+ for (i=0; i<nu->pntsu*nu->pntsv; i++, bp++) {
copy_v3_v3(co, bp->vec); co+=3;
}
}
@@ -3093,7 +3092,7 @@ float (*curve_getVertexCos(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3]
return cos;
}
-void curve_applyVertexCos(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3])
+void BK_curve_vertexCos_apply(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3])
{
float *co = vertexCos[0];
Nurb *nu;
@@ -3103,7 +3102,7 @@ void curve_applyVertexCos(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3]
if (nu->type == CU_BEZIER) {
BezTriple *bezt = nu->bezt;
- for (i=0; i<nu->pntsu; i++,bezt++) {
+ for (i=0; i<nu->pntsu; i++, bezt++) {
copy_v3_v3(bezt->vec[0], co); co+=3;
copy_v3_v3(bezt->vec[1], co); co+=3;
copy_v3_v3(bezt->vec[2], co); co+=3;
@@ -3112,7 +3111,7 @@ void curve_applyVertexCos(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3]
else {
BPoint *bp = nu->bp;
- for (i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
+ for (i=0; i<nu->pntsu*nu->pntsv; i++, bp++) {
copy_v3_v3(bp->vec, co); co+=3;
}
}
@@ -3121,9 +3120,9 @@ void curve_applyVertexCos(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3]
}
}
-float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3]
+float (*BKE_curve_keyVertexCos_get(Curve *UNUSED(cu), ListBase *lb, float *key))[3]
{
- int i, numVerts = count_curveverts(lb);
+ int i, numVerts = BKE_nurbList_verts_count(lb);
float *co, (*cos)[3] = MEM_mallocN(sizeof(*cos)*numVerts, "cu_vcos");
Nurb *nu;
@@ -3132,7 +3131,7 @@ float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3]
if (nu->type == CU_BEZIER) {
BezTriple *bezt = nu->bezt;
- for (i=0; i<nu->pntsu; i++,bezt++) {
+ for (i=0; i<nu->pntsu; i++, bezt++) {
copy_v3_v3(co, key); co+=3; key+=3;
copy_v3_v3(co, key); co+=3; key+=3;
copy_v3_v3(co, key); co+=3; key+=3;
@@ -3142,7 +3141,7 @@ float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3]
else {
BPoint *bp = nu->bp;
- for (i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
+ for (i=0; i<nu->pntsu*nu->pntsv; i++, bp++) {
copy_v3_v3(co, key); co+=3; key+=3;
key++; /* skip tilt */
}
@@ -3152,7 +3151,7 @@ float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3]
return cos;
}
-void curve_applyKeyVertexTilts(Curve *UNUSED(cu), ListBase *lb, float *key)
+void BKE_curve_keyVertexTilts_apply(Curve *UNUSED(cu), ListBase *lb, float *key)
{
Nurb *nu;
int i;
@@ -3161,7 +3160,7 @@ void curve_applyKeyVertexTilts(Curve *UNUSED(cu), ListBase *lb, float *key)
if (nu->type == CU_BEZIER) {
BezTriple *bezt = nu->bezt;
- for (i=0; i<nu->pntsu; i++,bezt++) {
+ for (i=0; i<nu->pntsu; i++, bezt++) {
key+=3*3;
bezt->alfa= *key;
key+=3;
@@ -3170,7 +3169,7 @@ void curve_applyKeyVertexTilts(Curve *UNUSED(cu), ListBase *lb, float *key)
else {
BPoint *bp = nu->bp;
- for (i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
+ for (i=0; i<nu->pntsu*nu->pntsv; i++, bp++) {
key+=3;
bp->alfa= *key;
key++;
@@ -3179,7 +3178,7 @@ void curve_applyKeyVertexTilts(Curve *UNUSED(cu), ListBase *lb, float *key)
}
}
-int check_valid_nurb_u( struct Nurb *nu )
+int BKE_nurb_check_valid_u(struct Nurb *nu)
{
if (nu==NULL) return 0;
if (nu->pntsu <= 1) return 0;
@@ -3194,7 +3193,7 @@ int check_valid_nurb_u( struct Nurb *nu )
}
return 1;
}
-int check_valid_nurb_v( struct Nurb *nu)
+int BKE_nurb_check_valid_v(struct Nurb *nu)
{
if (nu==NULL) return 0;
if (nu->pntsv <= 1) return 0;
@@ -3210,7 +3209,7 @@ int check_valid_nurb_v( struct Nurb *nu)
return 1;
}
-int clamp_nurb_order_u( struct Nurb *nu )
+int BKE_nurb_order_clamp_u(struct Nurb *nu)
{
int change = 0;
if (nu->pntsu<nu->orderu) {
@@ -3218,13 +3217,13 @@ int clamp_nurb_order_u( struct Nurb *nu )
change= 1;
}
if (((nu->flagu & CU_NURB_CYCLIC)==0) && (nu->flagu & CU_NURB_BEZIER)) {
- CLAMP(nu->orderu, 3,4);
+ CLAMP(nu->orderu, 3, 4);
change= 1;
}
return change;
}
-int clamp_nurb_order_v( struct Nurb *nu)
+int BKE_nurb_order_clamp_v(struct Nurb *nu)
{
int change = 0;
if (nu->pntsv<nu->orderv) {
@@ -3232,17 +3231,17 @@ int clamp_nurb_order_v( struct Nurb *nu)
change= 1;
}
if (((nu->flagv & CU_NURB_CYCLIC)==0) && (nu->flagv & CU_NURB_BEZIER)) {
- CLAMP(nu->orderv, 3,4);
+ CLAMP(nu->orderv, 3, 4);
change= 1;
}
return change;
}
/* Get edit nurbs or normal nurbs list */
-ListBase *BKE_curve_nurbs(Curve *cu)
+ListBase *BKE_curve_nurbs_get(Curve *cu)
{
if (cu->editnurb) {
- return curve_editnurbs(cu);
+ return BKE_curve_editNurbs_get(cu);
}
return &cu->nurb;
@@ -3250,20 +3249,20 @@ ListBase *BKE_curve_nurbs(Curve *cu)
/* basic vertex data functions */
-int minmax_curve(Curve *cu, float min[3], float max[3])
+int BKE_curve_minmax(Curve *cu, float min[3], float max[3])
{
- ListBase *nurb_lb= BKE_curve_nurbs(cu);
+ ListBase *nurb_lb= BKE_curve_nurbs_get(cu);
Nurb *nu;
for (nu= nurb_lb->first; nu; nu= nu->next)
- minmaxNurb(nu, min, max);
+ BKE_nurb_minmax(nu, min, max);
return (nurb_lb->first != NULL);
}
-int curve_center_median(Curve *cu, float cent[3])
+int BKE_curve_center_median(Curve *cu, float cent[3])
{
- ListBase *nurb_lb= BKE_curve_nurbs(cu);
+ ListBase *nurb_lb= BKE_curve_nurbs_get(cu);
Nurb *nu;
int total= 0;
@@ -3297,11 +3296,11 @@ int curve_center_median(Curve *cu, float cent[3])
return (total != 0);
}
-int curve_center_bounds(Curve *cu, float cent[3])
+int BKE_curve_center_bounds(Curve *cu, float cent[3])
{
float min[3], max[3];
INIT_MINMAX(min, max);
- if (minmax_curve(cu, min, max)) {
+ if (BKE_curve_minmax(cu, min, max)) {
mid_v3_v3v3(cent, min, max);
return 1;
}
@@ -3309,9 +3308,9 @@ int curve_center_bounds(Curve *cu, float cent[3])
return 0;
}
-void curve_translate(Curve *cu, float offset[3], int do_keys)
+void BKE_curve_translate(Curve *cu, float offset[3], int do_keys)
{
- ListBase *nurb_lb= BKE_curve_nurbs(cu);
+ ListBase *nurb_lb= BKE_curve_nurbs_get(cu);
Nurb *nu;
int i;
@@ -3346,9 +3345,9 @@ void curve_translate(Curve *cu, float offset[3], int do_keys)
}
}
-void curve_delete_material_index(Curve *cu, int index)
+void BKE_curve_delete_material_index(Curve *cu, int index)
{
- const int curvetype= curve_type(cu);
+ const int curvetype= BKE_curve_type_get(cu);
if (curvetype == OB_FONT) {
struct CharInfo *info= cu->strinfo;
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 1514716d717..4666aa6a456 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -638,7 +638,7 @@ static void layerInitMinMax_mloopcol(void *vmin, void *vmax)
static void layerDefault_mloopcol(void *data, int count)
{
- MLoopCol default_mloopcol = {255,255,255,255};
+ MLoopCol default_mloopcol = {255, 255, 255, 255};
MLoopCol *mlcol = (MLoopCol*)data;
int i;
for (i = 0; i < count; i++)
@@ -986,11 +986,11 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
/* 9: CD_POLYINDEX */
{sizeof(int), "MIntProperty", 1, NULL, NULL, NULL, NULL, NULL, NULL},
/* 10: CD_PROP_FLT */
- {sizeof(MFloatProperty), "MFloatProperty",1,"Float", layerCopy_propFloat,NULL,NULL,NULL},
+ {sizeof(MFloatProperty), "MFloatProperty", 1, "Float", layerCopy_propFloat, NULL, NULL, NULL},
/* 11: CD_PROP_INT */
- {sizeof(MIntProperty), "MIntProperty",1,"Int",layerCopy_propInt,NULL,NULL,NULL},
+ {sizeof(MIntProperty), "MIntProperty", 1, "Int", layerCopy_propInt, NULL, NULL, NULL},
/* 12: CD_PROP_STR */
- {sizeof(MStringProperty), "MStringProperty",1,"String",layerCopy_propString,NULL,NULL,NULL},
+ {sizeof(MStringProperty), "MStringProperty", 1, "String", layerCopy_propString, NULL, NULL, NULL},
/* 13: CD_ORIGSPACE */
{sizeof(OrigSpaceFace), "OrigSpaceFace", 1, "UVMap", layerCopy_origspace_face, NULL,
layerInterp_origspace_face, layerSwap_origspace_face, layerDefault_origspace_face},
@@ -1026,7 +1026,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
/* 23: CD_CLOTH_ORCO */
{sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 24: CD_RECAST */
- {sizeof(MRecast), "MRecast", 1,"Recast",NULL,NULL,NULL,NULL}
+ {sizeof(MRecast), "MRecast", 1, "Recast", NULL, NULL, NULL, NULL}
/* BMESH ONLY */
,
@@ -1064,7 +1064,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
static const char *LAYERTYPENAMES[CD_NUMTYPES] = {
/* 0-4 */ "CDMVert", "CDMSticky", "CDMDeformVert", "CDMEdge", "CDMFace",
/* 5-9 */ "CDMTFace", "CDMCol", "CDOrigIndex", "CDNormal", "CDFlags",
- /* 10-14 */ "CDMFloatProperty", "CDMIntProperty","CDMStringProperty", "CDOrigSpace", "CDOrco",
+ /* 10-14 */ "CDMFloatProperty", "CDMIntProperty", "CDMStringProperty", "CDOrigSpace", "CDOrco",
/* 15-19 */ "CDMTexPoly", "CDMLoopUV", "CDMloopCol", "CDTangent", "CDMDisps",
/* 20-24 */"CDPreviewMCol", "CDIDMCol", "CDTextureMCol", "CDClothOrco", "CDMRecast"
@@ -2337,7 +2337,10 @@ int CustomData_layer_has_math(struct CustomData *data, int layer_n)
const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[layer_n].type);
if (typeInfo->equal && typeInfo->add && typeInfo->multiply &&
- typeInfo->initminmax && typeInfo->dominmax) return 1;
+ typeInfo->initminmax && typeInfo->dominmax)
+ {
+ return 1;
+ }
return 0;
}
@@ -2684,7 +2687,9 @@ int CustomData_verify_versions(struct CustomData *data, int index)
if (!typeInfo->defaultname && (index > 0) &&
data->layers[index-1].type == layer->type)
+ {
keeplayer = 0; /* multiple layers of which we only support one */
+ }
}
if (!keeplayer) {
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 1232177fa10..ebf5735c1cd 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -437,11 +437,51 @@ void defgroup_unique_name(bDeformGroup *dg, Object *ob)
BLI_uniquename_cb(defgroup_unique_check, &data, "Group", '.', dg->name, sizeof(dg->name));
}
-BLI_INLINE int is_char_sep(const char c)
+static int is_char_sep(const char c)
{
return ELEM4(c, '.', ' ', '-', '_');
}
+/* based on BLI_split_dirfile() / os.path.splitext(), "a.b.c" -> ("a.b", ".c") */
+
+void BKE_deform_split_suffix(const char string[MAX_VGROUP_NAME], char body[MAX_VGROUP_NAME], char suf[MAX_VGROUP_NAME])
+{
+ size_t len = BLI_strnlen(string, MAX_VGROUP_NAME);
+ size_t i;
+
+ body[0] = suf[0] = '\0';
+
+ for (i = len - 1; i > 1; i--) {
+ if (is_char_sep(string[i])) {
+ BLI_strncpy(body, string, i + 1);
+ BLI_strncpy(suf, string + i, (len + 1) - i);
+ return;
+ }
+ }
+
+ BLI_strncpy(body, string, len);
+}
+
+/* "a.b.c" -> ("a.", "b.c") */
+void BKE_deform_split_prefix(const char string[MAX_VGROUP_NAME], char pre[MAX_VGROUP_NAME], char body[MAX_VGROUP_NAME])
+{
+ size_t len = BLI_strnlen(string, MAX_VGROUP_NAME);
+ size_t i;
+
+ body[0] = pre[0] = '\0';
+
+ for (i = 1; i < len; i++) {
+ if (is_char_sep(string[i])) {
+ i++;
+ BLI_strncpy(pre, string, i + 1);
+ BLI_strncpy(body, string + i, (len + 1) - i);
+ return;
+ }
+ }
+
+ BLI_strncpy(body, string, len);
+}
+
/* finds the best possible flipped name. For renaming; check for unique names afterwards */
/* if strip_number: removes number extensions
* note: don't use sizeof() for 'name' or 'from_name' */
@@ -466,7 +506,7 @@ void flip_side_name(char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_
/* We first check the case with a .### extension, let's find the last period */
if (isdigit(name[len - 1])) {
index = strrchr(name, '.'); // last occurrence
- if (index && isdigit(index[1]) ) { // doesnt handle case bone.1abc2 correct..., whatever!
+ if (index && isdigit(index[1])) { // doesnt handle case bone.1abc2 correct..., whatever!
if (strip_number == 0) {
BLI_strncpy(number, index, sizeof(number));
}
@@ -478,8 +518,8 @@ void flip_side_name(char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_
BLI_strncpy(prefix, name, sizeof(prefix));
/* first case; separator . - _ with extensions r R l L */
- if (is_char_sep(name[len - 2]) ) {
- switch(name[len - 1]) {
+ if (is_char_sep(name[len - 2])) {
+ switch (name[len - 1]) {
case 'l':
prefix[len - 1] = 0;
strcpy(replace, "r");
@@ -499,8 +539,8 @@ void flip_side_name(char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_
}
}
/* case; beginning with r R l L , with separator after it */
- else if (is_char_sep(name[1]) ) {
- switch(name[0]) {
+ else if (is_char_sep(name[1])) {
+ switch (name[0]) {
case 'l':
strcpy(replace, "r");
BLI_strncpy(suffix, name + 1, sizeof(suffix));
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index aa6d42977ca..d8cdd728c16 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -87,18 +87,18 @@ DagNodeQueue * queue_create (int slots)
DagNodeQueueElem * elem;
int i;
- queue = MEM_mallocN(sizeof(DagNodeQueue),"DAG queue");
- queue->freenodes = MEM_mallocN(sizeof(DagNodeQueue),"DAG queue");
+ queue = MEM_mallocN(sizeof(DagNodeQueue), "DAG queue");
+ queue->freenodes = MEM_mallocN(sizeof(DagNodeQueue), "DAG queue");
queue->count = 0;
queue->maxlevel = 0;
queue->first = queue->last = NULL;
- elem = MEM_mallocN(sizeof(DagNodeQueueElem),"DAG queue elem3");
+ elem = MEM_mallocN(sizeof(DagNodeQueueElem), "DAG queue elem3");
elem->node = NULL;
elem->next = NULL;
queue->freenodes->first = queue->freenodes->last = elem;
for (i = 1; i <slots;i++) {
- elem = MEM_mallocN(sizeof(DagNodeQueueElem),"DAG queue elem4");
+ elem = MEM_mallocN(sizeof(DagNodeQueueElem), "DAG queue elem4");
elem->node = NULL;
elem->next = NULL;
queue->freenodes->last->next = elem;
@@ -159,10 +159,10 @@ void push_queue(DagNodeQueue *queue, DagNode *node)
int i;
if (node == NULL) {
- fprintf(stderr,"pushing null node\n");
+ fprintf(stderr, "pushing null node\n");
return;
}
- /*fprintf(stderr,"BFS push : %s %d\n",((ID *) node->ob)->name, queue->count);*/
+ /*fprintf(stderr, "BFS push : %s %d\n", ((ID *) node->ob)->name, queue->count);*/
elem = queue->freenodes->first;
if (elem != NULL) {
@@ -174,13 +174,13 @@ void push_queue(DagNodeQueue *queue, DagNode *node)
queue->freenodes->count--;
}
else { /* alllocating more */
- elem = MEM_mallocN(sizeof(DagNodeQueueElem),"DAG queue elem1");
+ elem = MEM_mallocN(sizeof(DagNodeQueueElem), "DAG queue elem1");
elem->node = NULL;
elem->next = NULL;
queue->freenodes->first = queue->freenodes->last = elem;
for (i = 1; i <DAGQUEUEALLOC;i++) {
- elem = MEM_mallocN(sizeof(DagNodeQueueElem),"DAG queue elem2");
+ elem = MEM_mallocN(sizeof(DagNodeQueueElem), "DAG queue elem2");
elem->node = NULL;
elem->next = NULL;
queue->freenodes->last->next = elem;
@@ -219,13 +219,13 @@ void push_stack(DagNodeQueue *queue, DagNode *node)
queue->freenodes->count--;
}
else { /* alllocating more */
- elem = MEM_mallocN(sizeof(DagNodeQueueElem),"DAG queue elem1");
+ elem = MEM_mallocN(sizeof(DagNodeQueueElem), "DAG queue elem1");
elem->node = NULL;
elem->next = NULL;
queue->freenodes->first = queue->freenodes->last = elem;
for (i = 1; i <DAGQUEUEALLOC;i++) {
- elem = MEM_mallocN(sizeof(DagNodeQueueElem),"DAG queue elem2");
+ elem = MEM_mallocN(sizeof(DagNodeQueueElem), "DAG queue elem2");
elem->node = NULL;
elem->next = NULL;
queue->freenodes->last->next = elem;
@@ -270,7 +270,7 @@ DagNode * pop_queue(DagNodeQueue *queue)
return node;
}
else {
- fprintf(stderr,"return null\n");
+ fprintf(stderr, "return null\n");
return NULL;
}
}
@@ -295,7 +295,7 @@ DagForest *dag_init(void)
{
DagForest *forest;
/* use callocN to init all zero */
- forest = MEM_callocN(sizeof(DagForest),"DAG root");
+ forest = MEM_callocN(sizeof(DagForest), "DAG root");
return forest;
}
@@ -376,8 +376,8 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
node = dag_get_node(dag, ob);
if ((ob->data) && (mask&DAG_RL_DATA)) {
- node2 = dag_get_node(dag,ob->data);
- dag_add_relation(dag,node,node2,DAG_RL_DATA, "Object-Data Relation");
+ node2 = dag_get_node(dag, ob->data);
+ dag_add_relation(dag, node, node2, DAG_RL_DATA, "Object-Data Relation");
node2->first_ancestor = ob;
node2->ancestor_count += 1;
}
@@ -401,18 +401,18 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
for (ct= targets.first; ct; ct= ct->next) {
if (ct->tar && ct->tar != ob) {
- // fprintf(stderr,"armature %s target :%s\n", ob->id.name, target->id.name);
+ // fprintf(stderr, "armature %s target :%s\n", ob->id.name, target->id.name);
node3 = dag_get_node(dag, ct->tar);
if (ct->subtarget[0]) {
- dag_add_relation(dag,node3,node, DAG_RL_OB_DATA|DAG_RL_DATA_DATA, cti->name);
+ dag_add_relation(dag, node3, node, DAG_RL_OB_DATA|DAG_RL_DATA_DATA, cti->name);
if (ct->tar->type == OB_MESH)
node3->customdata_mask |= CD_MASK_MDEFORMVERT;
}
else if (ELEM3(con->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO, CONSTRAINT_TYPE_SPLINEIK))
- dag_add_relation(dag,node3,node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, cti->name);
+ dag_add_relation(dag, node3, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, cti->name);
else
- dag_add_relation(dag,node3,node, DAG_RL_OB_DATA, cti->name);
+ dag_add_relation(dag, node3, node, DAG_RL_OB_DATA, cti->name);
}
}
@@ -460,31 +460,31 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
}
}
if (ob->parent) {
- node2 = dag_get_node(dag,ob->parent);
+ node2 = dag_get_node(dag, ob->parent);
- switch(ob->partype) {
+ switch (ob->partype) {
case PARSKEL:
- dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Parent");
+ dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Parent");
break;
case PARVERT1: case PARVERT3:
- dag_add_relation(dag,node2,node,DAG_RL_DATA_OB|DAG_RL_OB_OB, "Vertex Parent");
+ dag_add_relation(dag, node2, node, DAG_RL_DATA_OB|DAG_RL_OB_OB, "Vertex Parent");
node2->customdata_mask |= CD_MASK_ORIGINDEX;
break;
case PARBONE:
- dag_add_relation(dag,node2,node,DAG_RL_DATA_OB|DAG_RL_OB_OB, "Bone Parent");
+ dag_add_relation(dag, node2, node, DAG_RL_DATA_OB|DAG_RL_OB_OB, "Bone Parent");
break;
default:
if (ob->parent->type==OB_LATTICE)
- dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Lattice Parent");
+ dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Lattice Parent");
else if (ob->parent->type==OB_CURVE) {
Curve *cu= ob->parent->data;
if (cu->flag & CU_PATH)
- dag_add_relation(dag,node2,node,DAG_RL_DATA_OB|DAG_RL_OB_OB, "Curve Parent");
+ dag_add_relation(dag, node2, node, DAG_RL_DATA_OB|DAG_RL_OB_OB, "Curve Parent");
else
- dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Curve Parent");
+ dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Curve Parent");
}
else
- dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Parent");
+ dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Parent");
}
/* exception case: parent is duplivert */
if (ob->type==OB_MBALL && (ob->parent->transflag & OB_DUPLIVERTS)) {
@@ -533,17 +533,17 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
if (cam->dof_ob) {
node2 = dag_get_node(dag, cam->dof_ob);
- dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Camera DoF");
+ dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Camera DoF");
}
}
break;
case OB_MBALL:
{
- Object *mom= find_basis_mball(scene, ob);
+ Object *mom= BKE_metaball_basis_find(scene, ob);
if (mom!=ob) {
node2 = dag_get_node(dag, mom);
- dag_add_relation(dag,node,node2,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Metaball"); // mom depends on children!
+ dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Metaball"); // mom depends on children!
}
}
break;
@@ -554,16 +554,16 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
if (cu->bevobj) {
node2 = dag_get_node(dag, cu->bevobj);
- dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Curve Bevel");
+ dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Curve Bevel");
}
if (cu->taperobj) {
node2 = dag_get_node(dag, cu->taperobj);
- dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Curve Taper");
+ dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Curve Taper");
}
if (ob->type == OB_FONT) {
if (cu->textoncurve) {
node2 = dag_get_node(dag, cu->textoncurve);
- dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Texture On Curve");
+ dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Texture On Curve");
}
}
}
@@ -587,7 +587,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
if (!psys_check_enabled(ob, psys))
continue;
- if (ELEM(part->phystype,PART_PHYS_KEYED,PART_PHYS_BOIDS)) {
+ if (ELEM(part->phystype, PART_PHYS_KEYED, PART_PHYS_BOIDS)) {
ParticleTarget *pt = psys->targets.first;
for (; pt; pt=pt->next) {
@@ -677,7 +677,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
dag_add_relation(dag, node2, node, DAG_RL_DATA_OB|DAG_RL_OB_OB, cti->name);
}
- dag_add_relation(dag,scenenode,node,DAG_RL_SCENE, "Scene Relation");
+ dag_add_relation(dag, scenenode, node, DAG_RL_SCENE, "Scene Relation");
addtoroot = 0;
}
else if (cti->get_constraint_targets) {
@@ -712,7 +712,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
}
if (addtoroot == 1 )
- dag_add_relation(dag,scenenode,node,DAG_RL_SCENE, "Scene Relation");
+ dag_add_relation(dag, scenenode, node, DAG_RL_SCENE, "Scene Relation");
}
struct DagForest *build_dag(Main *bmain, Scene *sce, short mask)
@@ -729,7 +729,7 @@ struct DagForest *build_dag(Main *bmain, Scene *sce, short mask)
dag = sce->theDag;
sce->dagisvalid=1;
if ( dag)
- free_forest( dag );
+ free_forest(dag);
else {
dag = dag_init();
sce->theDag = dag;
@@ -831,7 +831,7 @@ void free_forest(DagForest *Dag)
}
-DagNode * dag_find_node (DagForest *forest,void * fob)
+DagNode * dag_find_node (DagForest *forest, void * fob)
{
if (forest->nodeHash)
return BLI_ghash_lookup(forest->nodeHash, fob);
@@ -847,7 +847,7 @@ DagNode * dag_add_node (DagForest *forest, void * fob)
{
DagNode *node;
- node = MEM_callocN(sizeof(DagNode),"DAG node");
+ node = MEM_callocN(sizeof(DagNode), "DAG node");
if (node) {
node->ob = fob;
node->color = DAG_WHITE;
@@ -872,7 +872,7 @@ DagNode * dag_add_node (DagForest *forest, void * fob)
return node;
}
-DagNode * dag_get_node (DagForest *forest,void * fob)
+DagNode * dag_get_node (DagForest *forest, void * fob)
{
DagNode *node;
@@ -884,7 +884,7 @@ DagNode * dag_get_node (DagForest *forest,void * fob)
-DagNode * dag_get_sub_node (DagForest *forest,void * fob)
+DagNode * dag_get_sub_node (DagForest *forest, void * fob)
{
DagNode *node;
DagAdjList *mainchild, *prev=NULL;
@@ -926,7 +926,7 @@ static void dag_add_parent_relation(DagForest *UNUSED(forest), DagNode *fob1, Da
itA = itA->next;
}
/* create new relation and insert at head. MALLOC alert! */
- itA = MEM_mallocN(sizeof(DagAdjList),"DAG adj list");
+ itA = MEM_mallocN(sizeof(DagAdjList), "DAG adj list");
itA->node = fob1;
itA->type = rel;
itA->count = 1;
@@ -951,7 +951,7 @@ void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel
itA = itA->next;
}
/* create new relation and insert at head. MALLOC alert! */
- itA = MEM_mallocN(sizeof(DagAdjList),"DAG adj list");
+ itA = MEM_mallocN(sizeof(DagAdjList), "DAG adj list");
itA->node = fob2;
itA->type = rel;
itA->count = 1;
@@ -1118,7 +1118,7 @@ void graph_bfs(void)
DagAdjList *itA;
int minheight;
- /* fprintf(stderr,"starting BFS\n ------------\n"); */
+ /* fprintf(stderr, "starting BFS\n ------------\n"); */
nqueue = queue_create(DAGQUEUEALLOC);
for ( i=0; i<50; i++)
pos[i] = 0;
@@ -1138,7 +1138,7 @@ void graph_bfs(void)
if (node->color == DAG_WHITE) {
node->color = DAG_GRAY;
node->BFS_dist = 1;
- push_queue(nqueue,node);
+ push_queue(nqueue, node);
while (nqueue->count) {
node = pop_queue(nqueue);
@@ -1149,11 +1149,11 @@ void graph_bfs(void)
itA->node->color = DAG_GRAY;
itA->node->BFS_dist = node->BFS_dist + 1;
itA->node->k = (float) minheight;
- push_queue(nqueue,itA->node);
+ push_queue(nqueue, itA->node);
}
else {
- fprintf(stderr,"bfs not dag tree edge color :%i\n",itA->node->color);
+ fprintf(stderr, "bfs not dag tree edge color :%i\n", itA->node->color);
}
@@ -1169,7 +1169,7 @@ void graph_bfs(void)
set_node_xy(node, node->BFS_dist*DEPSX*2, pos[node->BFS_dist]*DEPSY*2);
node->color = DAG_BLACK;
- // fprintf(stderr,"BFS node : %20s %i %5.0f %5.0f\n",((ID *) node->ob)->name,node->BFS_dist, node->x, node->y);
+ // fprintf(stderr, "BFS node : %20s %i %5.0f %5.0f\n", ((ID *) node->ob)->name, node->BFS_dist, node->x, node->y);
}
}
queue_delete(nqueue);
@@ -1190,7 +1190,7 @@ int pre_and_post_source_BFS(DagForest *dag, short mask, DagNode *source, graph_a
DagNodeQueue *nqueue;
DagAdjList *itA;
int retval = 0;
- /* fprintf(stderr,"starting BFS\n ------------\n"); */
+ /* fprintf(stderr, "starting BFS\n ------------\n"); */
/* Init
* dagnode.first is always the root (scene)
@@ -1207,7 +1207,7 @@ int pre_and_post_source_BFS(DagForest *dag, short mask, DagNode *source, graph_a
if (node->color == DAG_WHITE) {
node->color = DAG_GRAY;
node->BFS_dist = 1;
- pre_func(node->ob,data);
+ pre_func(node->ob, data);
while (nqueue->count) {
node = pop_queue(nqueue);
@@ -1217,8 +1217,8 @@ int pre_and_post_source_BFS(DagForest *dag, short mask, DagNode *source, graph_a
if ((itA->node->color == DAG_WHITE) && (itA->type & mask)) {
itA->node->color = DAG_GRAY;
itA->node->BFS_dist = node->BFS_dist + 1;
- push_queue(nqueue,itA->node);
- pre_func(node->ob,data);
+ push_queue(nqueue, itA->node);
+ pre_func(node->ob, data);
}
else { // back or cross edge
@@ -1226,10 +1226,10 @@ int pre_and_post_source_BFS(DagForest *dag, short mask, DagNode *source, graph_a
}
itA = itA->next;
}
- post_func(node->ob,data);
+ post_func(node->ob, data);
node->color = DAG_BLACK;
- // fprintf(stderr,"BFS node : %20s %i %5.0f %5.0f\n",((ID *) node->ob)->name,node->BFS_dist, node->x, node->y);
+ // fprintf(stderr, "BFS node : %20s %i %5.0f %5.0f\n", ((ID *) node->ob)->name, node->BFS_dist, node->x, node->y);
}
}
queue_delete(nqueue);
@@ -1251,7 +1251,7 @@ DagNodeQueue * graph_dfs(void)
int maxpos=0;
/* int is_cycle = 0; */ /* UNUSED */
/*
- *fprintf(stderr,"starting DFS\n ------------\n");
+ *fprintf(stderr, "starting DFS\n ------------\n");
*/
nqueue = queue_create(DAGQUEUEALLOC);
retqueue = queue_create(MainDag->numNodes);
@@ -1280,7 +1280,7 @@ DagNodeQueue * graph_dfs(void)
node->DFS_dist = 1;
node->DFS_dvtm = time;
time++;
- push_stack(nqueue,node);
+ push_stack(nqueue, node);
while (nqueue->count) {
//graph_print_queue(nqueue);
@@ -1299,13 +1299,13 @@ DagNodeQueue * graph_dfs(void)
time++;
itA->node->DFS_dist = node->DFS_dist + 1;
itA->node->k = (float) minheight;
- push_stack(nqueue,itA->node);
+ push_stack(nqueue, itA->node);
skip = 1;
break;
}
else {
if (itA->node->color == DAG_GRAY) { // back edge
- fprintf(stderr,"dfs back edge :%15s %15s\n",((ID *) node->ob)->name, ((ID *) itA->node->ob)->name);
+ fprintf(stderr, "dfs back edge :%15s %15s\n", ((ID *) node->ob)->name, ((ID *) itA->node->ob)->name);
/* is_cycle = 1; */ /* UNUSED */
}
else if (itA->node->color == DAG_BLACK) {
@@ -1316,7 +1316,7 @@ DagNodeQueue * graph_dfs(void)
if (node->DFS_dist >= itA->node->DFS_dist)
itA->node->DFS_dist = node->DFS_dist + 1;
- fprintf(stderr,"dfs forward or cross edge :%15s %i-%i %15s %i-%i\n",
+ fprintf(stderr, "dfs forward or cross edge :%15s %i-%i %15s %i-%i\n",
((ID *) node->ob)->name,
node->DFS_dvtm,
node->DFS_fntm,
@@ -1326,7 +1326,7 @@ DagNodeQueue * graph_dfs(void)
#endif
}
else
- fprintf(stderr,"dfs unknown edge\n");
+ fprintf(stderr, "dfs unknown edge\n");
}
itA = itA->next;
}
@@ -1348,16 +1348,16 @@ DagNodeQueue * graph_dfs(void)
}
set_node_xy(node, node->DFS_dist*DEPSX*2, pos[node->DFS_dist]*DEPSY*2);
- // fprintf(stderr,"DFS node : %20s %i %i %i %i\n",((ID *) node->ob)->name,node->BFS_dist, node->DFS_dist, node->DFS_dvtm, node->DFS_fntm );
+ // fprintf(stderr, "DFS node : %20s %i %i %i %i\n", ((ID *) node->ob)->name, node->BFS_dist, node->DFS_dist, node->DFS_dvtm, node->DFS_fntm );
- push_stack(retqueue,node);
+ push_stack(retqueue, node);
}
}
}
node = node->next;
} while (node);
-// fprintf(stderr,"i size : %i\n", maxpos);
+// fprintf(stderr, "i size : %i\n", maxpos);
queue_delete(nqueue);
return(retqueue);
@@ -1381,7 +1381,7 @@ int pre_and_post_source_DFS(DagForest *dag, short mask, DagNode *source, graph_a
int skip = 0;
int retval = 0;
/*
- *fprintf(stderr,"starting DFS\n ------------\n");
+ *fprintf(stderr, "starting DFS\n ------------\n");
*/
nqueue = queue_create(DAGQUEUEALLOC);
@@ -1406,8 +1406,8 @@ int pre_and_post_source_DFS(DagForest *dag, short mask, DagNode *source, graph_a
node->DFS_dist = 1;
node->DFS_dvtm = time;
time++;
- push_stack(nqueue,node);
- pre_func(node->ob,data);
+ push_stack(nqueue, node);
+ pre_func(node->ob, data);
while (nqueue->count) {
skip = 0;
@@ -1421,8 +1421,8 @@ int pre_and_post_source_DFS(DagForest *dag, short mask, DagNode *source, graph_a
time++;
itA->node->DFS_dist = node->DFS_dist + 1;
- push_stack(nqueue,itA->node);
- pre_func(node->ob,data);
+ push_stack(nqueue, itA->node);
+ pre_func(node->ob, data);
skip = 1;
break;
@@ -1444,7 +1444,7 @@ int pre_and_post_source_DFS(DagForest *dag, short mask, DagNode *source, graph_a
node->DFS_fntm = time;
time++;
- post_func(node->ob,data);
+ post_func(node->ob, data);
}
}
}
@@ -1462,13 +1462,13 @@ struct DagNodeQueue *get_obparents(struct DagForest *dag, void *ob)
DagNodeQueue *nqueue;
DagAdjList *itA;
- node = dag_find_node(dag,ob);
+ node = dag_find_node(dag, ob);
if (node==NULL) {
return NULL;
}
else if (node->ancestor_count == 1) { // simple case
nqueue = queue_create(1);
- push_queue(nqueue,node);
+ push_queue(nqueue, node);
}
else { /* need to go over the whole dag for adj list */
nqueue = queue_create(node->ancestor_count);
@@ -1479,7 +1479,7 @@ struct DagNodeQueue *get_obparents(struct DagForest *dag, void *ob)
itA = node->child;
while (itA != NULL) {
if ((itA->node == node) && (itA->type == DAG_RL_DATA)) {
- push_queue(nqueue,node);
+ push_queue(nqueue, node);
}
itA = itA->next;
}
@@ -1496,7 +1496,7 @@ struct DagNodeQueue *get_first_ancestors(struct DagForest *dag, void *ob)
DagNodeQueue *nqueue;
DagAdjList *itA;
- node = dag_find_node(dag,ob);
+ node = dag_find_node(dag, ob);
// need to go over the whole dag for adj list
nqueue = queue_create(node->ancestor_count);
@@ -1507,7 +1507,7 @@ struct DagNodeQueue *get_first_ancestors(struct DagForest *dag, void *ob)
itA = node->child;
while (itA != NULL) {
if (itA->node == node) {
- push_queue(nqueue,node);
+ push_queue(nqueue, node);
}
itA = itA->next;
}
@@ -1544,7 +1544,7 @@ struct DagNodeQueue *get_all_childs(struct DagForest *dag, void *ob)
node->color = DAG_GRAY;
time++;
- push_stack(nqueue,node);
+ push_stack(nqueue, node);
while (nqueue->count) {
@@ -1558,7 +1558,7 @@ struct DagNodeQueue *get_all_childs(struct DagForest *dag, void *ob)
itA->node->color = DAG_GRAY;
time++;
- push_stack(nqueue,itA->node);
+ push_stack(nqueue, itA->node);
skip = 1;
break;
}
@@ -1570,7 +1570,7 @@ struct DagNodeQueue *get_all_childs(struct DagForest *dag, void *ob)
node->color = DAG_BLACK;
time++;
- push_stack(retqueue,node);
+ push_stack(retqueue, node);
}
}
}
@@ -1598,7 +1598,7 @@ short are_obs_related(struct DagForest *dag, void *ob1, void *ob2)
}
#endif
-int is_acyclic( DagForest *dag)
+int is_acyclic(DagForest *dag)
{
return dag->is_acyclic;
}
@@ -1618,10 +1618,10 @@ void graph_print_queue(DagNodeQueue *nqueue)
queueElem = nqueue->first;
while (queueElem) {
- fprintf(stderr,"** %s %i %i-%i ",((ID *) queueElem->node->ob)->name,queueElem->node->color,queueElem->node->DFS_dvtm,queueElem->node->DFS_fntm);
+ fprintf(stderr, "** %s %i %i-%i ", ((ID *) queueElem->node->ob)->name, queueElem->node->color, queueElem->node->DFS_dvtm, queueElem->node->DFS_fntm);
queueElem = queueElem->next;
}
- fprintf(stderr,"\n");
+ fprintf(stderr, "\n");
}
void graph_print_queue_dist(DagNodeQueue *nqueue)
@@ -1632,16 +1632,16 @@ void graph_print_queue_dist(DagNodeQueue *nqueue)
queueElem = nqueue->first;
count = 0;
while (queueElem) {
- fprintf(stderr,"** %25s %2.2i-%2.2i ",((ID *) queueElem->node->ob)->name,queueElem->node->DFS_dvtm,queueElem->node->DFS_fntm);
- while (count < queueElem->node->DFS_dvtm-1) { fputc(' ',stderr); count++;}
- fputc('|',stderr);
- while (count < queueElem->node->DFS_fntm-2) { fputc('-',stderr); count++;}
- fputc('|',stderr);
- fputc('\n',stderr);
+ fprintf(stderr, "** %25s %2.2i-%2.2i ", ((ID *) queueElem->node->ob)->name, queueElem->node->DFS_dvtm, queueElem->node->DFS_fntm);
+ while (count < queueElem->node->DFS_dvtm-1) { fputc(' ', stderr); count++;}
+ fputc('|', stderr);
+ while (count < queueElem->node->DFS_fntm-2) { fputc('-', stderr); count++;}
+ fputc('|', stderr);
+ fputc('\n', stderr);
count = 0;
queueElem = queueElem->next;
}
- fprintf(stderr,"\n");
+ fprintf(stderr, "\n");
}
void graph_print_adj_list(void)
@@ -1651,14 +1651,14 @@ void graph_print_adj_list(void)
node = (getMainDag())->DagNode.first;
while (node) {
- fprintf(stderr,"node : %s col: %i",((ID *) node->ob)->name, node->color);
+ fprintf(stderr, "node : %s col: %i", ((ID *) node->ob)->name, node->color);
itA = node->child;
while (itA) {
- fprintf(stderr,"-- %s ",((ID *) itA->node->ob)->name);
+ fprintf(stderr, "-- %s ", ((ID *) itA->node->ob)->name);
itA = itA->next;
}
- fprintf(stderr,"\n");
+ fprintf(stderr, "\n");
node = node->next;
}
}
@@ -1722,8 +1722,8 @@ static void scene_sort_groups(Main *bmain, Scene *sce)
if (base->object->id.newid) {
go= (GroupObject *)base->object->id.newid;
base->object->id.newid= NULL;
- BLI_remlink( &group->gobject, go);
- BLI_addtail( &listb, go);
+ BLI_remlink(&group->gobject, go);
+ BLI_addtail(&listb, go);
}
}
/* copy the newly sorted listbase */
@@ -1760,7 +1760,7 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
rootnode = sce->theDag->DagNode.first;
rootnode->color = DAG_GRAY;
time++;
- push_stack(nqueue,rootnode);
+ push_stack(nqueue, rootnode);
while (nqueue->count) {
@@ -1774,7 +1774,7 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
itA->node->color = DAG_GRAY;
time++;
- push_stack(nqueue,itA->node);
+ push_stack(nqueue, itA->node);
skip = 1;
break;
}
@@ -1793,8 +1793,8 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
while (base && base->object != node->ob)
base = base->next;
if (base) {
- BLI_remlink(&sce->base,base);
- BLI_addhead(&tempbase,base);
+ BLI_remlink(&sce->base, base);
+ BLI_addhead(&tempbase, base);
}
}
}
@@ -1803,8 +1803,8 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
/* temporal correction for circular dependencies */
base = sce->base.first;
while (base) {
- BLI_remlink(&sce->base,base);
- BLI_addhead(&tempbase,base);
+ BLI_remlink(&sce->base, base);
+ BLI_addhead(&tempbase, base);
//if (G.debug & G_DEBUG)
printf("cyclic %s\n", base->object->id.name);
base = sce->base.first;
@@ -1930,7 +1930,7 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime)
}
-/* node was checked to have lasttime != curtime , and is of type ID_OB */
+/* node was checked to have lasttime != curtime, and is of type ID_OB */
static unsigned int flush_layer_node(Scene *sce, DagNode *node, int curtime)
{
DagAdjList *itA;
@@ -1952,7 +1952,7 @@ static unsigned int flush_layer_node(Scene *sce, DagNode *node, int curtime)
return node->lay;
}
-/* node was checked to have lasttime != curtime , and is of type ID_OB */
+/* node was checked to have lasttime != curtime, and is of type ID_OB */
static void flush_pointcache_reset(Scene *scene, DagNode *node, int curtime, int reset)
{
Main *bmain= G.main;
@@ -2245,7 +2245,7 @@ static void dag_object_time_update_flags(Object *ob)
Curve *cu;
Lattice *lt;
- switch(ob->type) {
+ switch (ob->type) {
case OB_MESH:
me= ob->data;
if (me->key) {
@@ -2897,7 +2897,7 @@ void DAG_pose_sort(Object *ob)
while (itA != NULL) {
if (itA->node->color == DAG_WHITE) {
itA->node->color = DAG_GRAY;
- push_stack(nqueue,itA->node);
+ push_stack(nqueue, itA->node);
skip = 1;
break;
}
@@ -2935,8 +2935,8 @@ void DAG_pose_sort(Object *ob)
// printf(" %s\n", pchan->name);
// }
- free_forest( dag );
- MEM_freeN( dag );
+ free_forest(dag);
+ MEM_freeN(dag);
ugly_hack_sorry= 1;
}
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 01d5d6ef2ad..3e8727897f3 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -1,4 +1,5 @@
/*
+
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -196,7 +197,7 @@ void addnormalsDispList(ListBase *lb)
for (; b<dl->nr; b++) {
- normal_quad_v3( nor,v1, v3, v4, v2);
+ normal_quad_v3(nor, v1, v3, v4, v2);
add_v3_v3(n1, nor);
add_v3_v3(n2, nor);
@@ -228,7 +229,7 @@ void count_displist(ListBase *lb, int *totvert, int *totface)
dl= lb->first;
while (dl) {
- switch(dl->type) {
+ switch (dl->type) {
case DL_SURF:
*totvert+= dl->nr*dl->parts;
*totface+= (dl->nr-1)*(dl->parts-1);
@@ -296,7 +297,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
else
resolu= nu->resolu;
- if (!check_valid_nurb_u(nu));
+ if (!BKE_nurb_check_valid_u(nu));
else if (nu->type == CU_BEZIER) {
/* count */
@@ -320,7 +321,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
dl= MEM_callocN(sizeof(DispList), "makeDispListbez");
/* len+1 because of 'forward_diff_bezier' function */
- dl->verts= MEM_callocN( (len+1)*3*sizeof(float), "dlverts");
+ dl->verts= MEM_callocN((len+1)*3*sizeof(float), "dlverts");
BLI_addtail(dispbase, dl);
dl->parts= 1;
dl->nr= len;
@@ -351,11 +352,11 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
else {
int j;
for (j=0; j<3; j++) {
- forward_diff_bezier( prevbezt->vec[1][j],
- prevbezt->vec[2][j],
- bezt->vec[0][j],
- bezt->vec[1][j],
- data+j, resolu, 3*sizeof(float));
+ BKE_curve_forward_diff_bezier(prevbezt->vec[1][j],
+ prevbezt->vec[2][j],
+ bezt->vec[0][j],
+ bezt->vec[1][j],
+ data + j, resolu, 3 * sizeof(float));
}
data+= 3*resolu;
@@ -384,7 +385,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
data= dl->verts;
if (nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
else dl->type= DL_SEGM;
- makeNurbcurve(nu, data, NULL, NULL, NULL, resolu, 3*sizeof(float));
+ BKE_nurb_makeCurve(nu, data, NULL, NULL, NULL, resolu, 3*sizeof(float));
}
else if (nu->type == CU_POLY) {
len= nu->pntsu;
@@ -672,9 +673,9 @@ void makeDispListMBall(Scene *scene, Object *ob)
freedisplist(&(ob->disp));
if (ob->type==OB_MBALL) {
- if (ob==find_basis_mball(scene, ob)) {
- metaball_polygonize(scene, ob, &ob->disp);
- tex_space_mball(ob);
+ if (ob==BKE_metaball_basis_find(scene, ob)) {
+ BKE_metaball_polygonize(scene, ob, &ob->disp);
+ BKE_metaball_tex_space_calc(ob);
object_deform_mball(ob, &ob->disp);
}
@@ -685,8 +686,8 @@ void makeDispListMBall(Scene *scene, Object *ob)
void makeDispListMBall_forRender(Scene *scene, Object *ob, ListBase *dispbase)
{
- metaball_polygonize(scene, ob, dispbase);
- tex_space_mball(ob);
+ BKE_metaball_polygonize(scene, ob, dispbase);
+ BKE_metaball_tex_space_calc(ob);
object_deform_mball(ob, dispbase);
}
@@ -730,7 +731,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
ModifierData *md = modifiers_getVirtualModifierList(ob);
ModifierData *pretessellatePoint;
Curve *cu= ob->data;
- ListBase *nurb= BKE_curve_nurbs(cu);
+ ListBase *nurb= BKE_curve_nurbs_get(cu);
int numVerts = 0;
int editmode = (!forRender && cu->editnurb);
float (*originalVerts)[3] = NULL;
@@ -753,9 +754,9 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
* tilts, which is passed through in the modifier stack.
* this is also the reason curves do not use a virtual
* shape key modifier yet. */
- deformedVerts= curve_getKeyVertexCos(cu, nurb, keyVerts);
+ deformedVerts= BKE_curve_keyVertexCos_get(cu, nurb, keyVerts);
originalVerts= MEM_dupallocN(deformedVerts);
- numVerts = count_curveverts_without_handles(nurb);
+ numVerts = BKE_nurbList_verts_count_without_handles(nurb);
}
}
@@ -770,7 +771,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
if (mti->type!=eModifierTypeType_OnlyDeform) continue;
if (!deformedVerts) {
- deformedVerts = curve_getVertexCos(cu, nurb, &numVerts);
+ deformedVerts = BKE_curve_vertexCos_get(cu, nurb, &numVerts);
originalVerts = MEM_dupallocN(deformedVerts);
}
@@ -782,9 +783,9 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
}
if (deformedVerts)
- curve_applyVertexCos(cu, nurb, deformedVerts);
+ BK_curve_vertexCos_apply(cu, nurb, deformedVerts);
if (keyVerts) /* these are not passed through modifier stack */
- curve_applyKeyVertexTilts(cu, nurb, keyVerts);
+ BKE_curve_keyVertexTilts_apply(cu, nurb, keyVerts);
if (keyVerts)
MEM_freeN(keyVerts);
@@ -834,7 +835,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
ModifierData *md = modifiers_getVirtualModifierList(ob);
ModifierData *pretessellatePoint;
Curve *cu= ob->data;
- ListBase *nurb= BKE_curve_nurbs(cu);
+ ListBase *nurb= BKE_curve_nurbs_get(cu);
int required_mode = 0, totvert = 0;
int editmode = (!forRender && cu->editnurb);
DerivedMesh *dm= NULL, *ndm;
@@ -956,7 +957,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
}
if (deformedVerts) {
- curve_applyVertexCos(ob->data, nurb, originalVerts);
+ BK_curve_vertexCos_apply(ob->data, nurb, originalVerts);
MEM_freeN(originalVerts);
MEM_freeN(deformedVerts);
}
@@ -969,7 +970,7 @@ static void displist_surf_indices(DispList *dl)
dl->totindex= 0;
- index=dl->index= MEM_mallocN( 4*sizeof(int)*(dl->parts+1)*(dl->nr+1), "index array nurbs");
+ index=dl->index= MEM_mallocN(4*sizeof(int)*(dl->parts+1)*(dl->nr+1), "index array nurbs");
for (a=0; a<dl->parts; a++) {
@@ -1023,7 +1024,7 @@ static void add_orco_dm(Scene *scene, Object *ob, DerivedMesh *dm, DerivedMesh *
dm->getVertCos(dm, orco);
}
else {
- orco= (float(*)[3])make_orco_curve(scene, ob);
+ orco= (float(*)[3])BKE_curve_make_orco(scene, ob);
}
for (a=0; a<totvert; a++) {
@@ -1108,7 +1109,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
float (*deformedVerts)[3];
if (!forRender && cu->editnurb)
- nubase= curve_editnurbs(cu);
+ nubase= BKE_curve_editNurbs_get(cu);
else
nubase= &cu->nurb;
@@ -1144,7 +1145,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
if (nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
else dl->type= DL_SEGM;
- makeNurbcurve(nu, data, NULL, NULL, NULL, resolu, 3*sizeof(float));
+ BKE_nurb_makeCurve(nu, data, NULL, NULL, NULL, resolu, 3*sizeof(float));
}
else {
len= (nu->pntsu*resolu) * (nu->pntsv*resolv);
@@ -1168,7 +1169,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
if (nu->flagv & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_U; /* reverse too! */
if (nu->flagu & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_V;
- makeNurbfaces(nu, data, 0, resolu, resolv);
+ BKE_nurb_makeFaces(nu, data, 0, resolu, resolv);
/* gl array drawing: using indices */
displist_surf_indices(dl);
@@ -1182,7 +1183,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
copy_displist(&cu->disp, dispbase);
if (!forRender) {
- tex_space_curve(cu);
+ BKE_curve_tex_space_calc(cu);
}
if (!forOrco)
@@ -1196,7 +1197,7 @@ static void rotateBevelPiece(Curve *cu, BevPoint *bevp, DispList *dlb, float wid
int b;
fp = dlb->verts;
- for (b = 0; b<dlb->nr; b++,fp += 3,data += 3) {
+ for (b = 0; b<dlb->nr; b++, fp += 3, data += 3) {
if (cu->flag & CU_3D) {
float vec[3];
@@ -1262,7 +1263,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
float (*deformedVerts)[3];
int numVerts;
- nubase= BKE_curve_nurbs(cu);
+ nubase= BKE_curve_nurbs_get(cu);
BLI_freelistN(&(cu->bev));
@@ -1273,10 +1274,10 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
if (!forOrco) curve_calc_modifiers_pre(scene, ob, forRender, &originalVerts, &deformedVerts, &numVerts);
- makeBevelList(ob);
+ BKE_curve_bevelList_make(ob);
/* If curve has no bevel will return nothing */
- makebevelcurve(scene, ob, &dlbev, forRender);
+ BKE_curve_bevel_make(scene, ob, &dlbev, forRender);
/* no bevel or extrude, and no width correction? */
if (!dlbev.first && cu->width==1.0f) {
@@ -1287,7 +1288,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
BevList *bl= cu->bev.first;
Nurb *nu= nubase->first;
- for (; bl && nu; bl=bl->next,nu=nu->next) {
+ for (; bl && nu; bl=bl->next, nu=nu->next) {
DispList *dl;
float *data;
BevPoint *bevp;
@@ -1356,7 +1357,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
/* for each point of poly make a bevel piece */
bevp= (BevPoint *)(bl+1);
- for (a=0; a<bl->nr; a++,bevp++) {
+ for (a=0; a<bl->nr; a++, bevp++) {
float fac=1.0;
if (cu->taperobj==NULL) {
if ( (cu->bevobj!=NULL) || !((cu->flag & CU_FRONT) || (cu->flag & CU_BACK)) )
@@ -1410,7 +1411,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
copy_displist(&cu->disp, dispbase);
if (!forRender) {
- tex_space_curve(cu);
+ BKE_curve_tex_space_calc(cu);
}
if (!forOrco) curve_calc_modifiers_post(scene, ob, dispbase, derivedFinal, forRender, originalVerts, deformedVerts);
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 9ce4d68eeed..c334a6f42a4 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -78,15 +78,15 @@
/* precalculated gaussian factors for 5x super sampling */
static float gaussianFactors[5] = { 0.996849f,
- 0.596145f,
- 0.596145f,
- 0.596145f,
- 0.524141f};
+ 0.596145f,
+ 0.596145f,
+ 0.596145f,
+ 0.524141f};
static float gaussianTotal = 3.309425f;
/* UV Image neighboring pixel table x and y list */
-static int neighX[8] = {1,1,0,-1,-1,-1, 0, 1};
-static int neighY[8] = {0,1,1, 1, 0,-1,-1,-1};
+static int neighX[8] = {1, 1, 0, -1, -1, -1, 0, 1};
+static int neighY[8] = {0, 1, 1, 1, 0, -1, -1, -1};
/* subframe_updateObject() flags */
#define UPDATE_PARENTS (1<<0)
@@ -110,7 +110,7 @@ static int neighY[8] = {0,1,1, 1, 0,-1,-1,-1};
#define MIN_WETNESS 0.001f
#define MAX_WETNESS 5.0f
/* dissolve macro */
-#define VALUE_DISSOLVE(VALUE, TIME, SCALE, LOG) (VALUE) = (LOG) ? (VALUE) * (pow(MIN_WETNESS,1.0f/(1.2f*((float)(TIME))/(SCALE)))) : (VALUE) - 1.0f/(TIME)*(SCALE)
+#define VALUE_DISSOLVE(VALUE, TIME, SCALE, LOG) (VALUE) = (LOG) ? (VALUE) * (pow(MIN_WETNESS, 1.0f/(1.2f*((float)(TIME))/(SCALE)))) : (VALUE) - 1.0f/(TIME)*(SCALE)
/***************************** Internal Structs ***************************/
@@ -231,13 +231,22 @@ static int dynamicPaint_surfaceNumOfPoints(DynamicPaintSurface *surface)
/* checks whether surface's format/type has realtime preview */
int dynamicPaint_surfaceHasColorPreview(DynamicPaintSurface *surface)
{
- if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) return 0;
+ if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) {
+ return 0;
+ }
else if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE ||
- surface->type == MOD_DPAINT_SURFACE_T_WAVE) return 0;
- else return 1;
+ surface->type == MOD_DPAINT_SURFACE_T_WAVE)
+ {
+ return 0;
+ }
+ else {
+ return 1;
+ }
+ }
+ else {
+ return 1;
}
- else return 1;
}
/* get currently active surface (in user interface) */
@@ -367,18 +376,18 @@ void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface)
}
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
- strcat(surface->output_name,"paintmap");
- strcat(surface->output_name2,"wetmap");
+ strcat(surface->output_name, "paintmap");
+ strcat(surface->output_name2, "wetmap");
surface_setUniqueOutputName(surface, surface->output_name2, 1);
}
else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE) {
- strcat(surface->output_name,"displace");
+ strcat(surface->output_name, "displace");
}
else if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) {
- strcat(surface->output_name,"weight");
+ strcat(surface->output_name, "weight");
}
else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
- strcat(surface->output_name,"wave");
+ strcat(surface->output_name, "wave");
}
surface_setUniqueOutputName(surface, surface->output_name, 0);
@@ -393,11 +402,15 @@ void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface)
static int surface_totalSamples(DynamicPaintSurface *surface)
{
if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ &&
- surface->flags & MOD_DPAINT_ANTIALIAS)
- return (surface->data->total_points*5);
+ surface->flags & MOD_DPAINT_ANTIALIAS)
+ {
+ return (surface->data->total_points * 5);
+ }
if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX &&
- surface->flags & MOD_DPAINT_ANTIALIAS && surface->data->adj_data)
+ surface->flags & MOD_DPAINT_ANTIALIAS && surface->data->adj_data)
+ {
return (surface->data->total_points+surface->data->adj_data->total_targets);
+ }
return surface->data->total_points;
}
@@ -548,8 +561,7 @@ static int surface_getBrushFlags(DynamicPaintSurface *surface, Scene *scene)
else
base = scene->base.first;
- while (base || go)
- {
+ while (base || go) {
brushObj = NULL;
/* select object */
@@ -559,8 +571,7 @@ static int surface_getBrushFlags(DynamicPaintSurface *surface, Scene *scene)
else
brushObj = base->object;
- if (!brushObj)
- {
+ if (!brushObj) {
if (surface->brush_group) go = go->next;
else base= base->next;
continue;
@@ -572,12 +583,10 @@ static int surface_getBrushFlags(DynamicPaintSurface *surface, Scene *scene)
base= base->next;
md = modifiers_findByType(brushObj, eModifierType_DynamicPaint);
- if (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))
- {
+ if (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render)) {
DynamicPaintModifierData *pmd2 = (DynamicPaintModifierData *)md;
- if (pmd2->brush)
- {
+ if (pmd2->brush) {
DynamicPaintBrushSettings *brush = pmd2->brush;
if (brush->flags & MOD_DPAINT_USES_VELOCITY)
@@ -711,14 +720,14 @@ static void surfaceGenerateGrid(struct DynamicPaintSurface *surface)
/* get dimensions */
sub_v3_v3v3(dim, grid->grid_bounds.max, grid->grid_bounds.min);
copy_v3_v3(td, dim);
- min_dim = MAX3(td[0],td[1],td[2]) / 1000.f;
+ min_dim = MAX3(td[0], td[1], td[2]) / 1000.f;
/* deactivate zero axises */
for (i=0; i<3; i++) {
if (td[i]<min_dim) {td[i]=1.0f; axis-=1;}
}
- if (axis == 0 || MAX3(td[0],td[1],td[2]) < 0.0001f) {
+ if (axis == 0 || MAX3(td[0], td[1], td[2]) < 0.0001f) {
MEM_freeN(grid_bounds);
MEM_freeN(bData->grid);
bData->grid = NULL;
@@ -888,8 +897,10 @@ void surface_freeUnusedData(DynamicPaintSurface *surface)
/* free bakedata if not active or surface is baked */
if (!(surface->flags & MOD_DPAINT_ACTIVE) ||
- (surface->pointcache && surface->pointcache->flag & PTCACHE_BAKED))
+ (surface->pointcache && surface->pointcache->flag & PTCACHE_BAKED))
+ {
free_bakeData(surface->data);
+ }
}
void dynamicPaint_freeSurfaceData(DynamicPaintSurface *surface)
@@ -1219,9 +1230,13 @@ static int surface_usesAdjData(DynamicPaintSurface *surface)
{
if (surface_usesAdjDistance(surface)) return 1;
if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX &&
- surface->flags & MOD_DPAINT_ANTIALIAS) return 1;
-
- return 0;
+ surface->flags & MOD_DPAINT_ANTIALIAS)
+ {
+ return 1;
+ }
+ else {
+ return 0;
+ }
}
/* initialize surface adjacency data */
@@ -1294,10 +1309,12 @@ static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int for
/* now check if total number of edges+faces for
* each vertex is even, if not -> vertex is on mesh edge */
for (i=0; i<sData->total_points; i++) {
- if ((temp_data[i]%2) ||
- temp_data[i] < 4)
+ if ((temp_data[i] % 2) ||
+ (temp_data[i] < 4))
+ {
ad->flags[i] |= ADJ_ON_MESH_EDGE;
-
+ }
+
/* reset temp data */
temp_data[i] = 0;
}
@@ -1411,8 +1428,8 @@ void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
}
/* interpolate final uv pos */
- interp_v3_v3v3v3( uv_final, &uv[0], &uv[3], &uv[6],
- f_data->barycentricWeights[i*samples].v);
+ interp_v3_v3v3v3(uv_final, &uv[0], &uv[3], &uv[6],
+ f_data->barycentricWeights[i*samples].v);
/* remap to -1.0 to 1.0 */
uv_final[0] = uv_final[0]*2.0f - 1.0f;
uv_final[1] = uv_final[1]*2.0f - 1.0f;
@@ -1452,7 +1469,7 @@ void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
#pragma omp parallel for schedule(static)
for (i=0; i<sData->total_points; i++) {
int face_ind = f_data->uv_p[i].face_index;
- float colors[3][4] = {{0.0f,0.0f,0.0f,0.0f}};
+ float colors[3][4] = {{0.0f, 0.0f, 0.0f, 0.0f}};
float final_color[4];
int j;
/* collect color values */
@@ -1465,8 +1482,8 @@ void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
}
/* interpolate final color */
- interp_v4_v4v4v4( final_color, colors[0], colors[1], colors[2],
- f_data->barycentricWeights[i*samples].v);
+ interp_v4_v4v4v4(final_color, colors[0], colors[1], colors[2],
+ f_data->barycentricWeights[i*samples].v);
copy_v3_v3(pPoint[i].color, final_color);
pPoint[i].alpha = final_color[3];
@@ -1863,8 +1880,10 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene
/* restore canvas derivedmesh if required */
if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE &&
- surface->flags & MOD_DPAINT_DISP_INCREMENTAL && surface->next)
+ surface->flags & MOD_DPAINT_DISP_INCREMENTAL && surface->next)
+ {
canvas_copyDerivedMesh(canvas, dm);
+ }
BKE_ptcache_validate(cache, surface->current_frame);
BKE_ptcache_write(&pid, surface->current_frame);
@@ -1895,8 +1914,8 @@ struct DerivedMesh *dynamicPaint_Modifier_do(DynamicPaintModifierData *pmd, Scen
* Tries to find the neighboring pixel in given (uv space) direction.
* Result is used by effect system to move paint on the surface.
*
-* px,py : origin pixel x and y
-* n_index : lookup direction index (use neighX,neighY to get final index)
+* px, py : origin pixel x and y
+* n_index : lookup direction index (use neighX, neighY to get final index)
*/
static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh *dm,
const char *uvname, int w, int h, int px, int py, int n_index)
@@ -1906,7 +1925,7 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
* and faster/simplier than including possible face tip point links)
*/
- int x,y;
+ int x, y;
PaintUVPoint *tPoint = NULL;
PaintUVPoint *cPoint = NULL;
@@ -2042,9 +2061,12 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
//printf("connected UV : %f,%f & %f,%f - %f,%f & %f,%f\n", s_uv1[0], s_uv1[1], s_uv2[0], s_uv2[1], t_uv1[0], t_uv1[1], t_uv2[0], t_uv2[1]);
if (((s_uv1[0] == t_uv1[0] && s_uv1[1] == t_uv1[1]) &&
- (s_uv2[0] == t_uv2[0] && s_uv2[1] == t_uv2[1]) ) ||
- ((s_uv2[0] == t_uv1[0] && s_uv2[1] == t_uv1[1]) &&
- (s_uv1[0] == t_uv2[0] && s_uv1[1] == t_uv2[1]) )) return ((px+neighX[n_index]) + w*(py+neighY[n_index]));
+ (s_uv2[0] == t_uv2[0] && s_uv2[1] == t_uv2[1]) ) ||
+ ((s_uv2[0] == t_uv1[0] && s_uv2[1] == t_uv1[1]) &&
+ (s_uv1[0] == t_uv2[0] && s_uv1[1] == t_uv2[1]) ))
+ {
+ return ((px+neighX[n_index]) + w*(py+neighY[n_index]));
+ }
/*
* Find a point that is relatively at same edge position
@@ -2099,7 +2121,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
0.4f, -0.2f,
-0.4f, 0.3f};
int ty;
- int w,h;
+ int w, h;
int numOfFaces;
char uvname[MAX_CUSTOMDATA_LAYER_NAME];
int active_points = 0;
@@ -2185,11 +2207,9 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
*/
if (!error) {
#pragma omp parallel for schedule(static)
- for (ty = 0; ty < h; ty++)
- {
+ for (ty = 0; ty < h; ty++) {
int tx;
- for (tx = 0; tx < w; tx++)
- {
+ for (tx = 0; tx < w; tx++) {
int i, sample;
int index = tx+w*ty;
PaintUVPoint *tPoint = (&tempPoints[index]);
@@ -2197,7 +2217,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
short isInside = 0; /* if point is inside a uv face */
float d1[2], d2[2], d3[2], point[5][2];
- float dot00,dot01,dot02,dot11,dot12, invDenom, u,v;
+ float dot00, dot01, dot02, dot11, dot12, invDenom, u, v;
/* Init per pixel settings */
tPoint->face_index = -1;
@@ -2238,7 +2258,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
if (faceBB[i].max[1] < (point[sample][1])) continue;
/* Calculate point inside a triangle check
- * for uv0,1,2 */
+ * for uv0, 1, 2 */
sub_v2_v2v2(d1, tface[i].uv[2], tface[i].uv[0]); // uv2 - uv0
sub_v2_v2v2(d2, tface[i].uv[1], tface[i].uv[0]); // uv1 - uv0
sub_v2_v2v2(d3, point[sample], tface[i].uv[0]); // point - uv0
@@ -2257,8 +2277,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
/* If collision wasn't found but the face is a quad
* do another check for the second half */
- if ((!isInside) && mface[i].v4)
- {
+ if ((!isInside) && mface[i].v4) {
/* change d2 to test the other half */
sub_v2_v2v2(d2, tface[i].uv[3], tface[i].uv[0]); // uv3 - uv0
@@ -2330,18 +2349,16 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
* (To avoid seams on uv island edges)
*/
#pragma omp parallel for schedule(static)
- for (ty = 0; ty < h; ty++)
- {
+ for (ty = 0; ty < h; ty++) {
int tx;
- for (tx = 0; tx < w; tx++)
- {
+ for (tx = 0; tx < w; tx++) {
int index = tx+w*ty;
PaintUVPoint *tPoint = (&tempPoints[index]);
/* If point isn't't on canvas mesh */
if (tPoint->face_index == -1) {
int u_min, u_max, v_min, v_max;
- int u,v, ind;
+ int u, v, ind;
float point[2];
/* get loop area */
@@ -2408,11 +2425,9 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
* When base loop is over convert found neighbor indexes to real ones
* Also count the final number of active surface points
*/
- for (ty = 0; ty < h; ty++)
- {
+ for (ty = 0; ty < h; ty++) {
int tx;
- for (tx = 0; tx < w; tx++)
- {
+ for (tx = 0; tx < w; tx++) {
int index = tx+w*ty;
PaintUVPoint *tPoint = (&tempPoints[index]);
@@ -2440,11 +2455,9 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
if (sData->adj_data) {
PaintAdjData *ed = sData->adj_data;
unsigned int n_pos = 0;
- for (ty = 0; ty < h; ty++)
- {
+ for (ty = 0; ty < h; ty++) {
int tx;
- for (tx = 0; tx < w; tx++)
- {
+ for (tx = 0; tx < w; tx++) {
int i, index = tx+w*ty;
if (tempPoints[index].face_index != -1) {
@@ -2576,8 +2589,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char* filenam
if (ibuf == NULL) {setError(surface->canvas, "Image save failed: Not enough free memory.");return;}
#pragma omp parallel for schedule(static)
- for (index = 0; index < sData->total_points; index++)
- {
+ for (index = 0; index < sData->total_points; index++) {
int pos=f_data->uv_p[index].pixel_index*4; /* image buffer position */
/* Set values of preferred type */
@@ -2684,7 +2696,7 @@ static void dynamicPaint_updateBrushMaterials(Object *brushOb, Material *ui_mat,
if (tot) {
bMats->ob_mats = MEM_callocN(sizeof(Material*)*(tot), "BrushMaterials");
for (i=0; i<tot; i++) {
- bMats->ob_mats[i] = RE_init_sample_material(give_current_material(brushOb,(i+1)), scene);
+ bMats->ob_mats[i] = RE_init_sample_material(give_current_material(brushOb, (i+1)), scene);
}
}
bMats->tot = tot;
@@ -2759,8 +2771,7 @@ static void mesh_faces_spherecast_dp(void *userdata, int index, const BVHTreeRay
{
float dist = bvhtree_ray_tri_intersection(ray, hit->dist, t0, t1, t2);
- if (dist >= 0 && dist < hit->dist)
- {
+ if (dist >= 0 && dist < hit->dist) {
hit->index = index;
hit->dist = dist;
hit->no[0] = (quad) ? 1.0f : 0.0f;
@@ -2780,7 +2791,7 @@ static void mesh_faces_spherecast_dp(void *userdata, int index, const BVHTreeRay
* To optimize brush detection speed this doesn't calculate hit normal.
* If ray hit the second half of a quad, no[0] is set to 1.0f, else 0.0f
*/
-static void mesh_faces_nearest_point_dp(void *userdata, int index, const float *co, BVHTreeNearest *nearest)
+static void mesh_faces_nearest_point_dp(void *userdata, int index, const float co[3], BVHTreeNearest *nearest)
{
const BVHTreeFromMesh *data = (BVHTreeFromMesh*) userdata;
MVert *vert = data->vert;
@@ -2799,8 +2810,7 @@ static void mesh_faces_nearest_point_dp(void *userdata, int index, const float *
int vertex, edge;
dist = nearest_point_in_tri_surface(t0, t1, t2, co, &vertex, &edge, nearest_tmp);
- if (dist < nearest->dist)
- {
+ if (dist < nearest->dist) {
nearest->index = index;
nearest->dist = dist;
copy_v3_v3(nearest->co, nearest_tmp);
@@ -3179,7 +3189,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
if (brush->flags & MOD_DPAINT_PROX_PROJECT && brush->collision != MOD_DPAINT_COL_VOLUME) {
mul_v3_fl(avg_brushNor, 1.0f/(float)numOfVerts);
/* instead of null vector use positive z */
- if (!(MIN3(avg_brushNor[0],avg_brushNor[1],avg_brushNor[2])))
+ if (!(MIN3(avg_brushNor[0], avg_brushNor[1], avg_brushNor[2])))
avg_brushNor[2] = 1.0f;
else
normalize_v3(avg_brushNor);
@@ -3188,8 +3198,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
/* check bounding box collision */
if (grid && meshBrush_boundsIntersect(&grid->grid_bounds, &mesh_bb, brush, brush_radius))
/* Build a bvh tree from transformed vertices */
- if (bvhtree_from_mesh_faces(&treeData, dm, 0.0f, 4, 8))
- {
+ if (bvhtree_from_mesh_faces(&treeData, dm, 0.0f, 4, 8)) {
int c_index;
int total_cells = grid->dim[0]*grid->dim[1]*grid->dim[2];
@@ -3203,8 +3212,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
/* loop through cell points and process brush */
#pragma omp parallel for schedule(static)
- for (id = 0; id < grid->s_num[c_index]; id++)
- {
+ for (id = 0; id < grid->s_num[c_index]; id++) {
int index = grid->t_index[grid->s_pos[c_index] + id];
int ss, samples = bData->s_num[index];
float total_sample = (float)samples;
@@ -3220,8 +3228,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
total_sample = gaussianTotal;
/* Supersampling */
- for (ss=0; ss<samples; ss++)
- {
+ for (ss=0; ss<samples; ss++) {
float ray_start[3], ray_dir[3];
float sample_factor = 0.0f;
@@ -3263,8 +3270,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
/* Check volume collision */
if (brush->collision == MOD_DPAINT_COL_VOLUME || brush->collision == MOD_DPAINT_COL_VOLDIST)
- if (BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_dir, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData) != -1)
- {
+ if (BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_dir, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData) != -1) {
/* We hit a triangle, now check if collision point normal is facing the point */
/* For optimization sake, hit point normal isn't calculated in ray cast loop */
@@ -3272,13 +3278,12 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
float dot;
if (quad) {v2=mface[hit.index].v3; v3=mface[hit.index].v4;}
- normal_tri_v3( hit.no, mvert[v1].co, mvert[v2].co, mvert[v3].co);
+ normal_tri_v3(hit.no, mvert[v1].co, mvert[v2].co, mvert[v3].co);
dot = ray_dir[0]*hit.no[0] + ray_dir[1]*hit.no[1] + ray_dir[2]*hit.no[2];
/* If ray and hit face normal are facing same direction
* hit point is inside a closed mesh. */
- if (dot>=0)
- {
+ if (dot>=0) {
float dist = hit.dist;
int f_index = hit.index;
@@ -3342,8 +3347,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
hit.dist = brush_radius;
/* Do a face normal directional raycast, and use that distance */
- if (BLI_bvhtree_ray_cast(treeData.tree, ray_start, proj_ray, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData) != -1)
- {
+ if (BLI_bvhtree_ray_cast(treeData.tree, ray_start, proj_ray, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData) != -1) {
proxDist = hit.dist;
madd_v3_v3v3fl(hitCo, ray_start, proj_ray, hit.dist); /* Calculate final hit coordinates */
hQuad = (hit.no[0] == 1.0f);
@@ -3398,7 +3402,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
/* velocity brush, only do on main sample */
if (brush->flags & MOD_DPAINT_USES_VELOCITY && ss==0 && brushVelocity) {
- int v1,v2,v3;
+ int v1, v2, v3;
float weights[4];
float brushPointVelocity[3];
float velocity[3];
@@ -3420,10 +3424,10 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
* todo: perhaps implement something that handles volume movement as well */
/* interpolate vertex speed vectors to get hit point velocity */
- interp_v3_v3v3v3( brushPointVelocity,
- brushVelocity[v1].v,
- brushVelocity[v2].v,
- brushVelocity[v3].v, weights);
+ interp_v3_v3v3v3(brushPointVelocity,
+ brushVelocity[v1].v,
+ brushVelocity[v2].v,
+ brushVelocity[v3].v, weights);
/* substract canvas point velocity */
if (bData->velocity) {
@@ -3446,8 +3450,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
/*
* Process hit color and alpha
*/
- if (surface->type == MOD_DPAINT_SURFACE_T_PAINT)
- {
+ if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
float sampleColor[3];
float alpha_factor = 1.0f;
@@ -3589,8 +3592,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
BLI_begin_threaded_malloc();
/* only continue if particle bb is close enough to canvas bb */
- if (boundsIntersectDist(&grid->grid_bounds, &part_bb, range))
- {
+ if (boundsIntersectDist(&grid->grid_bounds, &part_bb, range)) {
int c_index;
int total_cells = grid->dim[0]*grid->dim[1]*grid->dim[2];
@@ -3603,13 +3605,14 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
/* check cell bounding box */
if (!grid->s_num[c_index] ||
- !boundsIntersectDist(&grid->bounds[c_index], &part_bb, range))
+ !boundsIntersectDist(&grid->bounds[c_index], &part_bb, range))
+ {
continue;
+ }
/* loop through cell points */
#pragma omp parallel for schedule(static)
- for (id = 0; id < grid->s_num[c_index]; id++)
- {
+ for (id = 0; id < grid->s_num[c_index]; id++) {
int index = grid->t_index[grid->s_pos[c_index] + id];
float disp_intersect = 0.0f;
float radius = 0.0f;
@@ -3714,8 +3717,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
}
}
- if (strength > 0.001f)
- {
+ if (strength > 0.001f) {
float paintColor[4] = {0.0f};
float depth = 0.0f;
@@ -3781,8 +3783,7 @@ static int dynamicPaint_paintSinglePoint(DynamicPaintSurface *surface, float *po
* Loop through every surface point
*/
#pragma omp parallel for schedule(static)
- for (index = 0; index < sData->total_points; index++)
- {
+ for (index = 0; index < sData->total_points; index++) {
float distance = len_v3v3(pointCoord, bData->realCoord[bData->s_pos[index]].v);
float colorband[4] = {0.0f};
float strength;
@@ -3887,12 +3888,11 @@ static void dynamicPaint_prepareAdjacencyData(DynamicPaintSurface *surface, int
if ((!surface_usesAdjDistance(surface) && !force_init) || !sData->adj_data) return;
if (bData->bNeighs) MEM_freeN(bData->bNeighs);
- bNeighs = bData->bNeighs = MEM_mallocN(sData->adj_data->total_targets*sizeof(struct BakeAdjPoint),"PaintEffectBake");
+ bNeighs = bData->bNeighs = MEM_mallocN(sData->adj_data->total_targets*sizeof(struct BakeAdjPoint), "PaintEffectBake");
if (!bNeighs) return;
#pragma omp parallel for schedule(static)
- for (index = 0; index < sData->total_points; index++)
- {
+ for (index = 0; index < sData->total_points; index++) {
int i;
int numOfNeighs = adj_data->n_num[index];
@@ -3911,8 +3911,7 @@ static void dynamicPaint_prepareAdjacencyData(DynamicPaintSurface *surface, int
/* calculate average values (single thread) */
bData->average_dist = 0.0f;
- for (index = 0; index < sData->total_points; index++)
- {
+ for (index = 0; index < sData->total_points; index++) {
int i;
int numOfNeighs = adj_data->n_num[index];
@@ -4080,8 +4079,7 @@ static int dynamicPaint_prepareEffectStep(DynamicPaintSurface *surface, Scene *s
if (*force) {
#pragma omp parallel for schedule(static)
- for (index = 0; index < sData->total_points; index++)
- {
+ for (index = 0; index < sData->total_points; index++) {
float forc[3] = {0};
/* apply force fields */
@@ -4121,8 +4119,7 @@ static int dynamicPaint_prepareEffectStep(DynamicPaintSurface *surface, Scene *s
}
/* calculate average values (single thread) */
- for (index = 0; index < sData->total_points; index++)
- {
+ for (index = 0; index < sData->total_points; index++) {
average_force += (*force)[index*4+3];
}
average_force /= sData->total_points;
@@ -4171,8 +4168,7 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force
memcpy(prevPoint, sData->type_data, sData->total_points*sizeof(struct PaintPoint));
#pragma omp parallel for schedule(static)
- for (index = 0; index < sData->total_points; index++)
- {
+ for (index = 0; index < sData->total_points; index++) {
int i;
int numOfNeighs = sData->adj_data->n_num[index];
PaintPoint *pPoint = &((PaintPoint*)sData->type_data)[index];
@@ -4214,8 +4210,7 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force
memcpy(prevPoint, sData->type_data, sData->total_points*sizeof(struct PaintPoint));
#pragma omp parallel for schedule(static)
- for (index = 0; index < sData->total_points; index++)
- {
+ for (index = 0; index < sData->total_points; index++) {
int i;
int numOfNeighs = sData->adj_data->n_num[index];
float totalAlpha = 0.0f;
@@ -4256,8 +4251,7 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force
/*
* Drip Effect
*/
- if (surface->effect & MOD_DPAINT_EFFECT_DO_DRIP && force)
- {
+ if (surface->effect & MOD_DPAINT_EFFECT_DO_DRIP && force) {
float eff_scale = distance_scale*EFF_MOVEMENT_PER_FRAME*timescale/2.0f;
/* Copy current surface to the previous points array to read unmodified values */
memcpy(prevPoint, sData->type_data, sData->total_points*sizeof(struct PaintPoint));
@@ -4335,8 +4329,7 @@ void dynamicPaint_doWaveStep(DynamicPaintSurface *surface, float timescale)
if (!prevPoint) return;
/* calculate average neigh distance (single thread) */
- for (index = 0; index < sData->total_points; index++)
- {
+ for (index = 0; index < sData->total_points; index++) {
int i;
int numOfNeighs = sData->adj_data->n_num[index];
@@ -4435,8 +4428,7 @@ static void dynamicPaint_surfacePreStep(DynamicPaintSurface *surface, float time
int index;
#pragma omp parallel for schedule(static)
- for (index=0; index<sData->total_points; index++)
- {
+ for (index=0; index<sData->total_points; index++) {
/* Do drying dissolve effects */
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
PaintPoint *pPoint = &((PaintPoint*)sData->type_data)[index];
@@ -4651,8 +4643,7 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Scene *sc
* Prepare each surface point for a new step
*/
#pragma omp parallel for schedule(static)
- for (index=0; index<sData->total_points; index++)
- {
+ for (index=0; index<sData->total_points; index++) {
float prev_point[3] = {0.0f, 0.0f, 0.0f};
if (do_velocity_data && !new_bdata) {
copy_v3_v3(prev_point, bData->realCoord[bData->s_pos[index]].v);
@@ -4671,10 +4662,11 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Scene *sc
/* per sample coordinates */
for (ss=0; ss<bData->s_num[index]; ss++) {
- interp_v3_v3v3v3( bData->realCoord[bData->s_pos[index]+ss].v,
- canvas_verts[tPoint->v1].v,
- canvas_verts[tPoint->v2].v,
- canvas_verts[tPoint->v3].v, f_data->barycentricWeights[index*bData->s_num[index]+ss].v);
+ interp_v3_v3v3v3(bData->realCoord[bData->s_pos[index]+ss].v,
+ canvas_verts[tPoint->v1].v,
+ canvas_verts[tPoint->v2].v,
+ canvas_verts[tPoint->v3].v,
+ f_data->barycentricWeights[index * bData->s_num[index] + ss].v);
}
/* Calculate current pixel surface normal */
@@ -4682,8 +4674,8 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Scene *sc
normal_short_to_float_v3(n2, mvert[tPoint->v2].no);
normal_short_to_float_v3(n3, mvert[tPoint->v3].no);
- interp_v3_v3v3v3( bData->bNormal[index].invNorm,
- n1, n2, n3, f_data->barycentricWeights[index*bData->s_num[index]].v);
+ interp_v3_v3v3v3(bData->bNormal[index].invNorm,
+ n1, n2, n3, f_data->barycentricWeights[index*bData->s_num[index]].v);
mul_mat3_m4_v3(ob->obmat, bData->bNormal[index].invNorm);
normalize_v3(bData->bNormal[index].invNorm);
negate_v3(bData->bNormal[index].invNorm);
@@ -4796,8 +4788,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
else
base = scene->base.first;
- while (base || go)
- {
+ while (base || go) {
brushObj = NULL;
/* select object */
if (surface->brush_group) {
@@ -4821,12 +4812,10 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
/* check if target has an active dp modifier */
md = modifiers_findByType(brushObj, eModifierType_DynamicPaint);
- if (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))
- {
+ if (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render)) {
DynamicPaintModifierData *pmd2 = (DynamicPaintModifierData *)md;
/* make sure we're dealing with a brush */
- if (pmd2->brush)
- {
+ if (pmd2->brush) {
DynamicPaintBrushSettings *brush = pmd2->brush;
BrushMaterials bMats = {0};
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index 857f6e75e2c..884e4e15c8b 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -162,7 +162,7 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
/* no need to ensure the loop order, we know its ok */
else if (f->len == 3) {
- BLI_array_growone(looptris);
+ BLI_array_grow_one(looptris);
l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
for (j=0; l; l=BM_iter_step(&liter), j++) {
looptris[i][j] = l;
@@ -171,7 +171,7 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
}
else if (f->len == 4) {
BMLoop *ltmp[4];
- BLI_array_growitems(looptris, 2);
+ BLI_array_grow_items(looptris, 2);
l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
for (j=0; l; l=BM_iter_step(&liter), j++) {
@@ -219,7 +219,7 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
BLI_addfilledge(&sf_ctx, firstv, v);
totfilltri = BLI_edgefill_ex(&sf_ctx, FALSE, f->no);
- BLI_array_growitems(looptris, totfilltri);
+ BLI_array_grow_items(looptris, totfilltri);
for (efa = sf_ctx.fillfacebase.first; efa; efa=efa->next) {
BMLoop *l1= efa->v1->tmp.p;
@@ -387,14 +387,14 @@ static void emDM_foreachMappedEdge(
BM_mesh_elem_index_ensure(bmdm->tc->bm, BM_VERT);
eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
- for (i=0; eed; i++,eed=BM_iter_step(&iter))
+ for (i=0; eed; i++, eed=BM_iter_step(&iter))
func(userData, i,
bmdm->vertexCos[BM_elem_index_get(eed->v1)],
bmdm->vertexCos[BM_elem_index_get(eed->v2)]);
}
else {
eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
- for (i=0; eed; i++,eed=BM_iter_step(&iter))
+ for (i=0; eed; i++, eed=BM_iter_step(&iter))
func(userData, i, eed->v1->co, eed->v2->co);
}
}
@@ -415,7 +415,7 @@ static void emDM_drawMappedEdges(
glBegin(GL_LINES);
eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
- for (i=0; eed; i++,eed=BM_iter_step(&iter)) {
+ for (i=0; eed; i++, eed=BM_iter_step(&iter)) {
if (!setDrawOptions || (setDrawOptions(userData, i) != DM_DRAW_OPTION_SKIP)) {
glVertex3fv(bmdm->vertexCos[BM_elem_index_get(eed->v1)]);
glVertex3fv(bmdm->vertexCos[BM_elem_index_get(eed->v2)]);
@@ -426,7 +426,7 @@ static void emDM_drawMappedEdges(
else {
glBegin(GL_LINES);
eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
- for (i=0; eed; i++,eed=BM_iter_step(&iter)) {
+ for (i=0; eed; i++, eed=BM_iter_step(&iter)) {
if (!setDrawOptions || (setDrawOptions(userData, i) != DM_DRAW_OPTION_SKIP)) {
glVertex3fv(eed->v1->co);
glVertex3fv(eed->v2->co);
@@ -460,7 +460,7 @@ static void emDM_drawMappedEdgesInterp(
glBegin(GL_LINES);
eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
- for (i=0; eed; i++,eed=BM_iter_step(&iter)) {
+ for (i=0; eed; i++, eed=BM_iter_step(&iter)) {
if (!setDrawOptions || (setDrawOptions(userData, i) != DM_DRAW_OPTION_SKIP)) {
setDrawInterpOptions(userData, i, 0.0);
glVertex3fv(bmdm->vertexCos[BM_elem_index_get(eed->v1)]);
@@ -473,7 +473,7 @@ static void emDM_drawMappedEdgesInterp(
else {
glBegin(GL_LINES);
eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
- for (i=0; eed; i++,eed=BM_iter_step(&iter)) {
+ for (i=0; eed; i++, eed=BM_iter_step(&iter)) {
if (!setDrawOptions || (setDrawOptions(userData, i) != DM_DRAW_OPTION_SKIP)) {
setDrawInterpOptions(userData, i, 0.0);
glVertex3fv(eed->v1->co);
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 4f320b41184..7fb0cf9f0fa 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -129,7 +129,7 @@ PartDeflect *object_add_collision_fields(int type)
pd->f_damp = 1.0f;
/* set sensible defaults based on type */
- switch(type) {
+ switch (type) {
case PFIELD_VORTEX:
pd->shape = PFIELD_SHAPE_PLANE;
break;
@@ -419,8 +419,7 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
len = normalize_v3(norm);
// check all collision objects
- for (col = colls->first; col; col = col->next)
- {
+ for (col = colls->first; col; col = col->next) {
CollisionModifierData *collmd = col->collmd;
if (col->ob == eff->ob)
@@ -506,7 +505,8 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU
falloff=0.0f;
else if (eff->pd->zdir == PFIELD_Z_NEG && fac > 0.0f)
falloff=0.0f;
- else switch(eff->pd->falloff) {
+ else {
+ switch (eff->pd->falloff) {
case PFIELD_FALL_SPHERE:
falloff*= falloff_func_dist(eff->pd, efd->distance);
break;
@@ -529,6 +529,7 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU
falloff*= falloff_func_rad(eff->pd, r_fac);
break;
+ }
}
return falloff;
@@ -755,7 +756,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
strength= eff->pd->f_strength * efd->falloff;
- copy_v3_v3(tex_co,point->loc);
+ copy_v3_v3(tex_co, point->loc);
if (eff->pd->flag & PFIELD_TEX_2D) {
float fac=-dot_v3v3(tex_co, efd->nor);
@@ -766,7 +767,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
mul_m4_v3(eff->ob->imat, tex_co);
}
- hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL,NULL, 0, result);
+ hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result);
if (hasrgb && mode==PFIELD_TEX_RGB) {
force[0] = (0.5f - result->tr) * strength;
@@ -819,7 +820,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
{
PartDeflect *pd = eff->pd;
RNG *rng = pd->rng;
- float force[3]={0,0,0};
+ float force[3]={0, 0, 0};
float temp[3];
float fac;
float strength = pd->f_strength;
@@ -835,7 +836,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
copy_v3_v3(force, efd->vec_to_point);
- switch(pd->forcefield) {
+ switch (pd->forcefield) {
case PFIELD_WIND:
copy_v3_v3(force, efd->nor);
mul_v3_fl(force, strength * efd->falloff);
@@ -904,9 +905,9 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
else {
add_v3_v3v3(temp, efd->vec_to_point2, efd->nor2);
}
- force[0] = -1.0f + 2.0f * BLI_gTurbulence(pd->f_size, temp[0], temp[1], temp[2], 2,0,2);
- force[1] = -1.0f + 2.0f * BLI_gTurbulence(pd->f_size, temp[1], temp[2], temp[0], 2,0,2);
- force[2] = -1.0f + 2.0f * BLI_gTurbulence(pd->f_size, temp[2], temp[0], temp[1], 2,0,2);
+ force[0] = -1.0f + 2.0f * BLI_gTurbulence(pd->f_size, temp[0], temp[1], temp[2], 2, 0, 2);
+ force[1] = -1.0f + 2.0f * BLI_gTurbulence(pd->f_size, temp[1], temp[2], temp[0], 2, 0, 2);
+ force[2] = -1.0f + 2.0f * BLI_gTurbulence(pd->f_size, temp[2], temp[0], temp[1], 2, 0, 2);
mul_v3_fl(force, strength * efd->falloff);
break;
case PFIELD_DRAG:
@@ -992,7 +993,7 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
else if (eff->pd->forcefield == PFIELD_TEXTURE)
do_texture_effector(eff, &efd, point, force);
else {
- float temp1[3]={0,0,0}, temp2[3];
+ float temp1[3]={0, 0, 0}, temp2[3];
copy_v3_v3(temp1, force);
do_physical_effector(eff, &efd, point, force);
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index bb8cfe37a88..0414d69785f 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -71,7 +71,7 @@
/* ---------------------- Freeing --------------------------- */
/* Frees the F-Curve itself too, so make sure BLI_remlink is called before calling this... */
-void free_fcurve (FCurve *fcu)
+void free_fcurve(FCurve *fcu)
{
if (fcu == NULL)
return;
@@ -95,7 +95,7 @@ void free_fcurve (FCurve *fcu)
}
/* Frees a list of F-Curves */
-void free_fcurves (ListBase *list)
+void free_fcurves(ListBase *list)
{
FCurve *fcu, *fcn;
@@ -151,7 +151,7 @@ FCurve *copy_fcurve (FCurve *fcu)
}
/* duplicate a list of F-Curves */
-void copy_fcurves (ListBase *dst, ListBase *src)
+void copy_fcurves(ListBase *dst, ListBase *src)
{
FCurve *dfcu, *sfcu;
@@ -270,7 +270,7 @@ FCurve *iter_step_fcurve (FCurve *fcu_iter, const char rna_path[])
* - dataPrefix: i.e. 'pose.bones[' or 'nodes['
* - dataName: name of entity within "" immediately following the prefix
*/
-int list_find_data_fcurves (ListBase *dst, ListBase *src, const char *dataPrefix, const char *dataName)
+int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, const char *dataName)
{
FCurve *fcu;
int matches = 0;
@@ -357,7 +357,7 @@ FCurve *rna_get_fcurve (PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bActio
/* Binary search algorithm for finding where to insert BezTriple. (for use by insert_bezt_fcurve)
* Returns the index to insert at (data already at that index will be offset if replace is 0)
*/
-int binarysearch_bezt_index (BezTriple array[], float frame, int arraylen, short *replace)
+int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short *replace)
{
int start=0, end=arraylen;
int loopbreaker= 0, maxloop= arraylen * 2;
@@ -476,8 +476,8 @@ static void get_fcurve_end_keyframes (FCurve *fcu, BezTriple **first, BezTriple
/* Calculate the extents of F-Curve's data */
-void calc_fcurve_bounds (FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax,
- const short do_sel_only)
+void calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax,
+ const short do_sel_only)
{
float xminv=999999999.0f, xmaxv=-999999999.0f;
float yminv=999999999.0f, ymaxv=-999999999.0f;
@@ -558,8 +558,8 @@ void calc_fcurve_bounds (FCurve *fcu, float *xmin, float *xmax, float *ymin, flo
}
/* Calculate the extents of F-Curve's keyframes */
-void calc_fcurve_range (FCurve *fcu, float *start, float *end,
- const short do_sel_only, const short do_min_length)
+void calc_fcurve_range(FCurve *fcu, float *start, float *end,
+ const short do_sel_only, const short do_min_length)
{
float min=999999999.0f, max=-999999999.0f;
short foundvert= FALSE;
@@ -610,7 +610,7 @@ void calc_fcurve_range (FCurve *fcu, float *start, float *end,
* Usability of keyframes refers to whether they should be displayed,
* and also whether they will have any influence on the final result.
*/
-short fcurve_are_keyframes_usable (FCurve *fcu)
+short fcurve_are_keyframes_usable(FCurve *fcu)
{
/* F-Curve must exist */
if (fcu == NULL)
@@ -671,7 +671,7 @@ short fcurve_are_keyframes_usable (FCurve *fcu)
/* Can keyframes be added to F-Curve?
* Keyframes can only be added if they are already visible
*/
-short fcurve_is_keyframable (FCurve *fcu)
+short fcurve_is_keyframable(FCurve *fcu)
{
/* F-Curve's keyframes must be "usable" (i.e. visible + have an effect on final result) */
if (fcurve_are_keyframes_usable(fcu) == 0)
@@ -688,7 +688,7 @@ short fcurve_is_keyframable (FCurve *fcu)
/* ***************************** Keyframe Column Tools ********************************* */
/* add a BezTriple to a column */
-void bezt_add_to_cfra_elem (ListBase *lb, BezTriple *bezt)
+void bezt_add_to_cfra_elem(ListBase *lb, BezTriple *bezt)
{
CfraElem *ce, *cen;
@@ -721,7 +721,7 @@ void bezt_add_to_cfra_elem (ListBase *lb, BezTriple *bezt)
/* Basic sampling callback which acts as a wrapper for evaluate_fcurve()
* 'data' arg here is unneeded here...
*/
-float fcurve_samplingcb_evalcurve (FCurve *fcu, void *UNUSED(data), float evaltime)
+float fcurve_samplingcb_evalcurve(FCurve *fcu, void *UNUSED(data), float evaltime)
{
/* assume any interference from drivers on the curve is intended... */
return evaluate_fcurve(fcu, evaltime);
@@ -731,7 +731,7 @@ float fcurve_samplingcb_evalcurve (FCurve *fcu, void *UNUSED(data), float evalti
/* Main API function for creating a set of sampled curve data, given some callback function
* used to retrieve the values to store.
*/
-void fcurve_store_samples (FCurve *fcu, void *data, int start, int end, FcuSampleFunc sample_cb)
+void fcurve_store_samples(FCurve *fcu, void *data, int start, int end, FcuSampleFunc sample_cb)
{
FPoint *fpt, *new_fpt;
int cfra;
@@ -775,7 +775,7 @@ void fcurve_store_samples (FCurve *fcu, void *data, int start, int end, FcuSampl
/* This function recalculates the handles of an F-Curve
* If the BezTriples have been rearranged, sort them first before using this.
*/
-void calchandles_fcurve (FCurve *fcu)
+void calchandles_fcurve(FCurve *fcu)
{
BezTriple *bezt, *prev, *next;
int a= fcu->totvert;
@@ -800,10 +800,10 @@ void calchandles_fcurve (FCurve *fcu)
if (bezt->vec[2][0] < bezt->vec[1][0]) bezt->vec[2][0]= bezt->vec[1][0];
/* calculate auto-handles */
- calchandleNurb(bezt, prev, next, 1); /* 1==special autohandle */
+ BKE_nurb_handle_calc(bezt, prev, next, 1); /* 1==special autohandle */
/* for automatic ease in and out */
- if (ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM) && ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) {
+ if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) {
/* only do this on first or last beztriple */
if ((a == 0) || (a == fcu->totvert-1)) {
/* set both handles to have same horizontal value as keyframe */
@@ -828,7 +828,7 @@ void calchandles_fcurve (FCurve *fcu)
* -> Vector handles: become 'nothing' when (one half selected AND other not)
* - PHASE 2: recalculate handles
*/
-void testhandles_fcurve (FCurve *fcu, const short use_handle)
+void testhandles_fcurve(FCurve *fcu, const short use_handle)
{
BezTriple *bezt;
unsigned int a;
@@ -884,7 +884,7 @@ void testhandles_fcurve (FCurve *fcu, const short use_handle)
/* This function sorts BezTriples so that they are arranged in chronological order,
* as tools working on F-Curves expect that the BezTriples are in order.
*/
-void sort_time_fcurve (FCurve *fcu)
+void sort_time_fcurve(FCurve *fcu)
{
short ok= 1;
@@ -927,7 +927,7 @@ void sort_time_fcurve (FCurve *fcu)
}
/* This function tests if any BezTriples are out of order, thus requiring a sort */
-short test_time_fcurve (FCurve *fcu)
+short test_time_fcurve(FCurve *fcu)
{
unsigned int a;
@@ -1144,8 +1144,8 @@ static float dvar_eval_rotDiff (ChannelDriver *driver, DriverVar *dvar)
// TODO: this needs to take into account space conversions...
static float dvar_eval_locDiff (ChannelDriver *driver, DriverVar *dvar)
{
- float loc1[3] = {0.0f,0.0f,0.0f};
- float loc2[3] = {0.0f,0.0f,0.0f};
+ float loc1[3] = {0.0f, 0.0f, 0.0f};
+ float loc2[3] = {0.0f, 0.0f, 0.0f};
/* get two location values */
// NOTE: for now, these are all just worldspace
@@ -1240,7 +1240,7 @@ static float dvar_eval_transChan (ChannelDriver *driver, DriverVar *dvar)
Object *ob= (Object *)dtar_id_ensure_proxy_from(dtar->id);
bPoseChannel *pchan;
float mat[4][4];
- float oldEul[3] = {0.0f,0.0f,0.0f};
+ float oldEul[3] = {0.0f, 0.0f, 0.0f};
short useEulers=0, rotOrder=ROT_MODE_EUL;
/* check if this target has valid data */
@@ -1394,7 +1394,7 @@ static DriverVarTypeInfo *get_dvar_typeinfo (int type)
/* Driver API --------------------------------- */
/* This frees the driver variable itself */
-void driver_free_variable (ChannelDriver *driver, DriverVar *dvar)
+void driver_free_variable(ChannelDriver *driver, DriverVar *dvar)
{
/* sanity checks */
if (dvar == NULL)
@@ -1424,7 +1424,7 @@ void driver_free_variable (ChannelDriver *driver, DriverVar *dvar)
}
/* Change the type of driver variable */
-void driver_change_variable_type (DriverVar *dvar, int type)
+void driver_change_variable_type(DriverVar *dvar, int type)
{
DriverVarTypeInfo *dvti= get_dvar_typeinfo(type);
@@ -1547,7 +1547,7 @@ ChannelDriver *fcurve_copy_driver (ChannelDriver *driver)
/* Driver Evaluation -------------------------- */
/* Evaluate a Driver Variable to get a value that contributes to the final */
-float driver_get_variable_value (ChannelDriver *driver, DriverVar *dvar)
+float driver_get_variable_value(ChannelDriver *driver, DriverVar *dvar)
{
DriverVarTypeInfo *dvti;
@@ -1655,9 +1655,8 @@ static float evaluate_driver (ChannelDriver *driver, const float evaltime)
{
driver->curval= 0.0f;
}
- else
- {
- /* this evaluates the expression using Python,and returns its result:
+ else {
+ /* this evaluates the expression using Python, and returns its result:
* - on errors it reports, then returns 0.0f
*/
driver->curval= BPY_driver_exec(driver, evaltime);
@@ -2077,7 +2076,7 @@ static float fcurve_eval_samples (FCurve *fcu, FPoint *fpts, float evaltime)
/* Evaluate and return the value of the given F-Curve at the specified frame ("evaltime")
* Note: this is also used for drivers
*/
-float evaluate_fcurve (FCurve *fcu, float evaltime)
+float evaluate_fcurve(FCurve *fcu, float evaltime)
{
float cvalue= 0.0f;
float devaltime;
@@ -2117,13 +2116,13 @@ float evaluate_fcurve (FCurve *fcu, float evaltime)
}
/* Calculate the value of the given F-Curve at the given frame, and set its curval */
-void calculate_fcurve (FCurve *fcu, float ctime)
+void calculate_fcurve(FCurve *fcu, float ctime)
{
/* only calculate + set curval (overriding the existing value) if curve has
* any data which warrants this...
*/
- if ( (fcu->totvert) || (fcu->driver && !(fcu->driver->flag & DRIVER_FLAG_INVALID)) ||
- list_has_suitable_fmodifier(&fcu->modifiers, 0, FMI_TYPE_GENERATE_CURVE) )
+ if ((fcu->totvert) || (fcu->driver && !(fcu->driver->flag & DRIVER_FLAG_INVALID)) ||
+ list_has_suitable_fmodifier(&fcu->modifiers, 0, FMI_TYPE_GENERATE_CURVE))
{
/* calculate and set curval (evaluates driver too if necessary) */
fcu->curval= evaluate_fcurve(fcu, ctime);
diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c
index a930818dd15..9f7d76d251d 100644
--- a/source/blender/blenkernel/intern/fluidsim.c
+++ b/source/blender/blenkernel/intern/fluidsim.c
@@ -86,7 +86,7 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob,
totface = dm->getNumTessFaces(dm);
*numVertices = totvert;
- verts = MEM_callocN( totvert*3*sizeof(float), "elbeemmesh_vertices");
+ verts = MEM_callocN(totvert*3*sizeof(float), "elbeemmesh_vertices");
for (i=0; i<totvert; i++) {
copy_v3_v3(&verts[i*3], mvert[i].co);
if (useGlobalCoords) { mul_m4_v3(ob->obmat, &verts[i*3]); }
@@ -98,7 +98,7 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob,
if (mface[i].v4) { countTris++; }
}
*numTriangles = countTris;
- tris = MEM_callocN( countTris*3*sizeof(int), "elbeemmesh_triangles");
+ tris = MEM_callocN(countTris*3*sizeof(int), "elbeemmesh_triangles");
countTris = 0;
for (i=0; i<totface; i++) {
int face[4];
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index ed5cf5e7924..92c73b23239 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -318,8 +318,7 @@ static void fcm_fn_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, floa
/* get function pointer to the func to use:
* WARNING: must perform special argument validation hereto guard against crashes
*/
- switch (data->type)
- {
+ switch (data->type) {
/* simple ones */
case FCM_GENERATOR_FN_SIN: /* sine wave */
fn= sin;
@@ -1059,7 +1058,7 @@ FModifier *copy_fmodifier (FModifier *src)
}
/* Duplicate all of the F-Modifiers in the Modifier stacks */
-void copy_fmodifiers (ListBase *dst, ListBase *src)
+void copy_fmodifiers(ListBase *dst, ListBase *src)
{
FModifier *fcm, *srcfcm;
@@ -1082,7 +1081,7 @@ void copy_fmodifiers (ListBase *dst, ListBase *src)
}
/* Remove and free the given F-Modifier from the given stack */
-int remove_fmodifier (ListBase *modifiers, FModifier *fcm)
+int remove_fmodifier(ListBase *modifiers, FModifier *fcm)
{
FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm);
@@ -1113,7 +1112,7 @@ int remove_fmodifier (ListBase *modifiers, FModifier *fcm)
}
/* Remove all of a given F-Curve's modifiers */
-void free_fmodifiers (ListBase *modifiers)
+void free_fmodifiers(ListBase *modifiers)
{
FModifier *fcm, *fmn;
@@ -1148,7 +1147,7 @@ FModifier *find_active_fmodifier (ListBase *modifiers)
}
/* Set the active F-Modifier */
-void set_active_fmodifier (ListBase *modifiers, FModifier *fcm)
+void set_active_fmodifier(ListBase *modifiers, FModifier *fcm)
{
FModifier *fm;
@@ -1169,7 +1168,7 @@ void set_active_fmodifier (ListBase *modifiers, FModifier *fcm)
* - mtype - type of modifier (if 0, doesn't matter)
* - acttype - type of action to perform (if -1, doesn't matter)
*/
-short list_has_suitable_fmodifier (ListBase *modifiers, int mtype, short acttype)
+short list_has_suitable_fmodifier(ListBase *modifiers, int mtype, short acttype)
{
FModifier *fcm;
@@ -1253,7 +1252,7 @@ static float eval_fmodifier_influence (FModifier *fcm, float evaltime)
* so nevaltime gets set to whatever the last time-modifying modifier likes...
* - we start from the end of the stack, as only the last one matters for now
*/
-float evaluate_time_fmodifiers (ListBase *modifiers, FCurve *fcu, float cvalue, float evaltime)
+float evaluate_time_fmodifiers(ListBase *modifiers, FCurve *fcu, float cvalue, float evaltime)
{
FModifier *fcm;
@@ -1302,7 +1301,7 @@ float evaluate_time_fmodifiers (ListBase *modifiers, FCurve *fcu, float cvalue,
/* Evalautes the given set of F-Curve Modifiers using the given data
* Should only be called after evaluate_time_fmodifiers() has been called...
*/
-void evaluate_value_fmodifiers (ListBase *modifiers, FCurve *fcu, float *cvalue, float evaltime)
+void evaluate_value_fmodifiers(ListBase *modifiers, FCurve *fcu, float *cvalue, float evaltime)
{
FModifier *fcm;
@@ -1339,7 +1338,7 @@ void evaluate_value_fmodifiers (ListBase *modifiers, FCurve *fcu, float *cvalue,
/* Bake modifiers for given F-Curve to curve sample data, in the frame range defined
* by start and end (inclusive).
*/
-void fcurve_bake_modifiers (FCurve *fcu, int start, int end)
+void fcurve_bake_modifiers(FCurve *fcu, int start, int end)
{
ChannelDriver *driver;
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index b2759f18e9b..a7f01393a02 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -68,8 +68,7 @@ void free_vfont(struct VFont *vf)
if (vf == NULL) return;
if (vf->data) {
- while (vf->data->characters.first)
- {
+ while (vf->data->characters.first) {
VChar *che = vf->data->characters.first;
while (che->nurbsbase.first) {
@@ -136,8 +135,7 @@ struct TmpFont *vfont_find_tmpfont(VFont *vfont)
// Try finding the font from font list
tmpfnt = ttfdata.first;
- while (tmpfnt)
- {
+ while (tmpfnt) {
if (tmpfnt->vfont == vfont)
break;
tmpfnt = tmpfnt->next;
@@ -280,7 +278,7 @@ VFont *load_vfont(Main *bmain, const char *name)
static VFont *which_vfont(Curve *cu, CharInfo *info)
{
- switch(info->flag & (CU_CHINFO_BOLD|CU_CHINFO_ITALIC)) {
+ switch (info->flag & (CU_CHINFO_BOLD|CU_CHINFO_ITALIC)) {
case CU_CHINFO_BOLD:
if (cu->vfontb) return(cu->vfontb); else return(cu->vfont);
case CU_CHINFO_ITALIC:
@@ -319,7 +317,7 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i
Nurb *nu2;
BPoint *bp;
- nu2 =(Nurb*) MEM_callocN(sizeof(Nurb),"underline_nurb");
+ nu2 =(Nurb*) MEM_callocN(sizeof(Nurb), "underline_nurb");
if (nu2 == NULL) return;
nu2->resolu= cu->resolu;
nu2->bezt = NULL;
@@ -333,7 +331,7 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i
nu2->orderv = 1;
nu2->flagu = CU_NURB_CYCLIC;
- bp = (BPoint*)MEM_callocN(4 * sizeof(BPoint),"underline_bp");
+ bp = (BPoint*)MEM_callocN(4 * sizeof(BPoint), "underline_bp");
if (bp == NULL) {
MEM_freeN(nu2);
return;
@@ -384,7 +382,7 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
}
#endif
- /* make a copy at distance ofsx,ofsy with shear*/
+ /* make a copy at distance ofsx, ofsy with shear*/
fsize= cu->fsize;
shear= cu->shear;
si= (float)sin(rot);
@@ -397,11 +395,10 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
nu1 = che->nurbsbase.first;
// Create the character
- while (nu1)
- {
+ while (nu1) {
bezt1 = nu1->bezt;
if (bezt1) {
- nu2 =(Nurb*) MEM_mallocN(sizeof(Nurb),"duplichar_nurb");
+ nu2 =(Nurb*) MEM_mallocN(sizeof(Nurb), "duplichar_nurb");
if (nu2 == NULL) break;
memcpy(nu2, nu1, sizeof(struct Nurb));
nu2->resolu= cu->resolu;
@@ -419,7 +416,7 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
/* nu2->trim.last = 0; */
i = nu2->pntsu;
- bezt2 = (BezTriple*)MEM_mallocN(i * sizeof(BezTriple),"duplichar_bezt2");
+ bezt2 = (BezTriple*)MEM_mallocN(i * sizeof(BezTriple), "duplichar_bezt2");
if (bezt2 == NULL) {
MEM_freeN(nu2);
break;
@@ -586,14 +583,14 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
/* calc offset and rotation of each char */
ct = chartransdata =
- (struct chartrans*)MEM_callocN((slen+1)* sizeof(struct chartrans),"buildtext");
+ (struct chartrans*)MEM_callocN((slen+1)* sizeof(struct chartrans), "buildtext");
/* We assume the worst case: 1 character per line (is freed at end anyway) */
- linedata= MEM_mallocN(sizeof(float)*(slen*2 + 1),"buildtext2");
- linedata2= MEM_mallocN(sizeof(float)*(slen*2 + 1),"buildtext3");
- linedata3= MEM_callocN(sizeof(float)*(slen*2 + 1),"buildtext4");
- linedata4= MEM_callocN(sizeof(float)*(slen*2 + 1),"buildtext5");
+ linedata = MEM_mallocN(sizeof(float) * (slen * 2 + 1), "buildtext2");
+ linedata2 = MEM_mallocN(sizeof(float) * (slen * 2 + 1), "buildtext3");
+ linedata3 = MEM_callocN(sizeof(float) * (slen * 2 + 1), "buildtext4");
+ linedata4 = MEM_callocN(sizeof(float) * (slen * 2 + 1), "buildtext5");
linedist= cu->linedist;
@@ -822,10 +819,15 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
}
}
else if ((cu->spacemode==CU_JUSTIFY) && (cu->tb[0].w != 0.0f)) {
- float curofs= 0.0f;
- for (i=0; i<=slen; i++) {
- for (j=i; (mem[j]) && (mem[j]!='\n') &&
- (mem[j]!='\r') && (chartransdata[j].dobreak==0) && (j<slen); j++);
+ float curofs = 0.0f;
+ for (i = 0; i <= slen; i++) {
+ for (j=i; (mem[j]) && (mem[j]!='\n') &&
+ (mem[j] != '\r') && (chartransdata[j].dobreak == 0) && (j < slen);
+ j++)
+ {
+ /* pass */
+ }
+
if ((mem[j]!='\r') && (mem[j]!='\n') &&
((chartransdata[j].dobreak!=0))) {
if (mem[i]==' ') curofs += (linedata3[ct->linenr]-linedata[ct->linenr])/linedata4[ct->linenr];
@@ -833,7 +835,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
}
if (mem[i]=='\n' || mem[i]=='\r' || chartransdata[i].dobreak) curofs= 0;
ct++;
- }
+ }
}
}
@@ -950,7 +952,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
if ((mode==FO_CURSUP || mode==FO_PAGEUP) && ct->linenr==0);
else if ((mode==FO_CURSDOWN || mode==FO_PAGEDOWN) && ct->linenr==lnr);
else {
- switch(mode) {
+ switch (mode) {
case FO_CURSUP: lnr= ct->linenr-1; break;
case FO_CURSDOWN: lnr= ct->linenr+1; break;
case FO_PAGEUP: lnr= ct->linenr-10; break;
@@ -1009,7 +1011,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
if (mode == FO_EDIT) {
/* make nurbdata */
- freeNurblist(&cu->nurb);
+ BKE_nurbList_free(&cu->nurb);
ct= chartransdata;
if (cu->sepchar==0) {
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 811cb881f6e..9ea4eafdd73 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -54,7 +54,7 @@
/* --------- Memory Management ------------ */
/* Free strokes belonging to a gp-frame */
-void free_gpencil_strokes (bGPDframe *gpf)
+void free_gpencil_strokes(bGPDframe *gpf)
{
bGPDstroke *gps, *gpsn;
@@ -72,7 +72,7 @@ void free_gpencil_strokes (bGPDframe *gpf)
}
/* Free all of a gp-layer's frames */
-void free_gpencil_frames (bGPDlayer *gpl)
+void free_gpencil_frames(bGPDlayer *gpl)
{
bGPDframe *gpf, *gpfn;
@@ -90,7 +90,7 @@ void free_gpencil_frames (bGPDlayer *gpl)
}
/* Free all of the gp-layers for a viewport (list should be &gpd->layers or so) */
-void free_gpencil_layers (ListBase *list)
+void free_gpencil_layers(ListBase *list)
{
bGPDlayer *gpl, *gpln;
@@ -108,7 +108,7 @@ void free_gpencil_layers (ListBase *list)
}
/* Free all of GPencil datablock's related data, but not the block itself */
-void free_gpencil_data (bGPdata *gpd)
+void free_gpencil_data(bGPdata *gpd)
{
/* free layers */
free_gpencil_layers(&gpd->layers);
@@ -299,7 +299,7 @@ bGPdata *gpencil_data_duplicate (bGPdata *src)
/* -------- GP-Frame API ---------- */
/* delete the last stroke of the given frame */
-void gpencil_frame_delete_laststroke (bGPDlayer *gpl, bGPDframe *gpf)
+void gpencil_frame_delete_laststroke(bGPDlayer *gpl, bGPDframe *gpf)
{
bGPDstroke *gps= (gpf) ? gpf->strokes.last : NULL;
int cfra = (gpf) ? gpf->framenum : 0; /* assume that the current frame was not locked */
@@ -447,7 +447,7 @@ bGPDframe *gpencil_layer_getframe (bGPDlayer *gpl, int cframe, short addnew)
}
/* delete the given frame from a layer */
-void gpencil_layer_delframe (bGPDlayer *gpl, bGPDframe *gpf)
+void gpencil_layer_delframe(bGPDlayer *gpl, bGPDframe *gpf)
{
/* error checking */
if (ELEM(NULL, gpl, gpf))
@@ -479,7 +479,7 @@ bGPDlayer *gpencil_layer_getactive (bGPdata *gpd)
}
/* set the active gp-layer */
-void gpencil_layer_setactive (bGPdata *gpd, bGPDlayer *active)
+void gpencil_layer_setactive(bGPdata *gpd, bGPDlayer *active)
{
bGPDlayer *gpl;
@@ -496,7 +496,7 @@ void gpencil_layer_setactive (bGPdata *gpd, bGPDlayer *active)
}
/* delete the active gp-layer */
-void gpencil_layer_delactive (bGPdata *gpd)
+void gpencil_layer_delactive(bGPdata *gpd)
{
bGPDlayer *gpl= gpencil_layer_getactive(gpd);
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index b20a59ed6f8..079d157e41d 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -170,7 +170,7 @@ static int add_to_group_internal(Group *group, Object *ob)
}
go= MEM_callocN(sizeof(GroupObject), "groupobject");
- BLI_addtail( &group->gobject, go);
+ BLI_addtail(&group->gobject, go);
go->ob= ob;
diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c
index b52576ec465..cd246681f3c 100644
--- a/source/blender/blenkernel/intern/idcode.c
+++ b/source/blender/blenkernel/intern/idcode.c
@@ -53,7 +53,7 @@ static IDType idtypes[]= {
{ ID_BR, "Brush", "brushes", IDTYPE_FLAGS_ISLINKABLE},
{ ID_CA, "Camera", "cameras", IDTYPE_FLAGS_ISLINKABLE},
{ ID_CU, "Curve", "curves", IDTYPE_FLAGS_ISLINKABLE},
- { ID_GD, "GPencil", "grease_pencil",IDTYPE_FLAGS_ISLINKABLE}, /* rename gpencil */
+ { ID_GD, "GPencil", "grease_pencil", IDTYPE_FLAGS_ISLINKABLE}, /* rename gpencil */
{ ID_GR, "Group", "groups", IDTYPE_FLAGS_ISLINKABLE},
{ ID_ID, "ID", "ids", 0}, /* plural is fake */
{ ID_IM, "Image", "images", IDTYPE_FLAGS_ISLINKABLE},
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index bb51325a6ef..dfe73ae20db 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -581,8 +581,7 @@ void IDP_FreeIterBeforeEnd(void *vself)
static void IDP_FreeGroup(IDProperty *prop)
{
IDProperty *loop;
- for (loop=prop->data.group.first; loop; loop=loop->next)
- {
+ for (loop=prop->data.group.first; loop; loop=loop->next) {
IDP_FreeProperty(loop);
}
BLI_freelistN(&prop->data.group);
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 6e0330f5316..9c5c99592ed 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -578,7 +578,7 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char
BLI_strncpy(ibuf->name, name, sizeof(ibuf->name));
ibuf->userflags |= IB_BITMAPDIRTY;
- switch(uvtestgrid) {
+ switch (uvtestgrid) {
case 1:
BKE_image_buf_fill_checker(rect, rect_float, width, height);
break;
@@ -929,7 +929,7 @@ char BKE_ftype_to_imtype(const int ftype)
int BKE_imtype_is_movie(const char imtype)
{
- switch(imtype) {
+ switch (imtype) {
case R_IMF_IMTYPE_AVIRAW:
case R_IMF_IMTYPE_AVIJPEG:
case R_IMF_IMTYPE_AVICODEC:
@@ -946,7 +946,7 @@ int BKE_imtype_is_movie(const char imtype)
int BKE_imtype_supports_zbuf(const char imtype)
{
- switch(imtype) {
+ switch (imtype) {
case R_IMF_IMTYPE_IRIZ:
case R_IMF_IMTYPE_OPENEXR: /* but not R_IMF_IMTYPE_MULTILAYER */
return 1;
@@ -956,7 +956,7 @@ int BKE_imtype_supports_zbuf(const char imtype)
int BKE_imtype_supports_compress(const char imtype)
{
- switch(imtype) {
+ switch (imtype) {
case R_IMF_IMTYPE_PNG:
return 1;
}
@@ -965,7 +965,7 @@ int BKE_imtype_supports_compress(const char imtype)
int BKE_imtype_supports_quality(const char imtype)
{
- switch(imtype) {
+ switch (imtype) {
case R_IMF_IMTYPE_JPEG90:
case R_IMF_IMTYPE_JP2:
case R_IMF_IMTYPE_AVIJPEG:
@@ -979,7 +979,7 @@ char BKE_imtype_valid_channels(const char imtype)
char chan_flag= IMA_CHAN_FLAG_RGB; /* assume all support rgb */
/* alpha */
- switch(imtype) {
+ switch (imtype) {
case R_IMF_IMTYPE_TARGA:
case R_IMF_IMTYPE_IRIS:
case R_IMF_IMTYPE_PNG:
@@ -995,7 +995,7 @@ char BKE_imtype_valid_channels(const char imtype)
}
/* bw */
- switch(imtype) {
+ switch (imtype) {
case R_IMF_IMTYPE_PNG:
case R_IMF_IMTYPE_JPEG90:
case R_IMF_IMTYPE_TARGA:
@@ -1036,38 +1036,38 @@ char BKE_imtype_valid_depths(const char imtype)
* creator.c help info */
char BKE_imtype_from_arg(const char *imtype_arg)
{
- if (!strcmp(imtype_arg,"TGA")) return R_IMF_IMTYPE_TARGA;
- else if (!strcmp(imtype_arg,"IRIS")) return R_IMF_IMTYPE_IRIS;
+ if (!strcmp(imtype_arg, "TGA")) return R_IMF_IMTYPE_TARGA;
+ else if (!strcmp(imtype_arg, "IRIS")) return R_IMF_IMTYPE_IRIS;
#ifdef WITH_DDS
- else if (!strcmp(imtype_arg,"DDS")) return R_IMF_IMTYPE_DDS;
+ else if (!strcmp(imtype_arg, "DDS")) return R_IMF_IMTYPE_DDS;
#endif
- else if (!strcmp(imtype_arg,"JPEG")) return R_IMF_IMTYPE_JPEG90;
- else if (!strcmp(imtype_arg,"IRIZ")) return R_IMF_IMTYPE_IRIZ;
- else if (!strcmp(imtype_arg,"RAWTGA")) return R_IMF_IMTYPE_RAWTGA;
- else if (!strcmp(imtype_arg,"AVIRAW")) return R_IMF_IMTYPE_AVIRAW;
- else if (!strcmp(imtype_arg,"AVIJPEG")) return R_IMF_IMTYPE_AVIJPEG;
- else if (!strcmp(imtype_arg,"PNG")) return R_IMF_IMTYPE_PNG;
- else if (!strcmp(imtype_arg,"AVICODEC")) return R_IMF_IMTYPE_AVICODEC;
- else if (!strcmp(imtype_arg,"QUICKTIME")) return R_IMF_IMTYPE_QUICKTIME;
- else if (!strcmp(imtype_arg,"BMP")) return R_IMF_IMTYPE_BMP;
+ else if (!strcmp(imtype_arg, "JPEG")) return R_IMF_IMTYPE_JPEG90;
+ else if (!strcmp(imtype_arg, "IRIZ")) return R_IMF_IMTYPE_IRIZ;
+ else if (!strcmp(imtype_arg, "RAWTGA")) return R_IMF_IMTYPE_RAWTGA;
+ else if (!strcmp(imtype_arg, "AVIRAW")) return R_IMF_IMTYPE_AVIRAW;
+ else if (!strcmp(imtype_arg, "AVIJPEG")) return R_IMF_IMTYPE_AVIJPEG;
+ else if (!strcmp(imtype_arg, "PNG")) return R_IMF_IMTYPE_PNG;
+ else if (!strcmp(imtype_arg, "AVICODEC")) return R_IMF_IMTYPE_AVICODEC;
+ else if (!strcmp(imtype_arg, "QUICKTIME")) return R_IMF_IMTYPE_QUICKTIME;
+ else if (!strcmp(imtype_arg, "BMP")) return R_IMF_IMTYPE_BMP;
#ifdef WITH_HDR
- else if (!strcmp(imtype_arg,"HDR")) return R_IMF_IMTYPE_RADHDR;
+ else if (!strcmp(imtype_arg, "HDR")) return R_IMF_IMTYPE_RADHDR;
#endif
#ifdef WITH_TIFF
- else if (!strcmp(imtype_arg,"TIFF")) return R_IMF_IMTYPE_TIFF;
+ else if (!strcmp(imtype_arg, "TIFF")) return R_IMF_IMTYPE_TIFF;
#endif
#ifdef WITH_OPENEXR
- else if (!strcmp(imtype_arg,"EXR")) return R_IMF_IMTYPE_OPENEXR;
- else if (!strcmp(imtype_arg,"MULTILAYER")) return R_IMF_IMTYPE_MULTILAYER;
+ else if (!strcmp(imtype_arg, "EXR")) return R_IMF_IMTYPE_OPENEXR;
+ else if (!strcmp(imtype_arg, "MULTILAYER")) return R_IMF_IMTYPE_MULTILAYER;
#endif
- else if (!strcmp(imtype_arg,"MPEG")) return R_IMF_IMTYPE_FFMPEG;
- else if (!strcmp(imtype_arg,"FRAMESERVER")) return R_IMF_IMTYPE_FRAMESERVER;
+ else if (!strcmp(imtype_arg, "MPEG")) return R_IMF_IMTYPE_FFMPEG;
+ else if (!strcmp(imtype_arg, "FRAMESERVER")) return R_IMF_IMTYPE_FRAMESERVER;
#ifdef WITH_CINEON
- else if (!strcmp(imtype_arg,"CINEON")) return R_IMF_IMTYPE_CINEON;
- else if (!strcmp(imtype_arg,"DPX")) return R_IMF_IMTYPE_DPX;
+ else if (!strcmp(imtype_arg, "CINEON")) return R_IMF_IMTYPE_CINEON;
+ else if (!strcmp(imtype_arg, "DPX")) return R_IMF_IMTYPE_DPX;
#endif
#ifdef WITH_OPENJPEG
- else if (!strcmp(imtype_arg,"JP2")) return R_IMF_IMTYPE_JP2;
+ else if (!strcmp(imtype_arg, "JP2")) return R_IMF_IMTYPE_JP2;
#endif
else return R_IMF_IMTYPE_INVALID;
}
@@ -1110,12 +1110,15 @@ int BKE_add_image_extension(char *string, const char imtype)
}
#ifdef WITH_TIFF
else if (imtype==R_IMF_IMTYPE_TIFF) {
- if (!BLI_testextensie(string, ".tif") &&
- !BLI_testextensie(string, ".tiff")) extension= ".tif";
+ if (!BLI_testextensie(string, ".tif") &&
+ !BLI_testextensie(string, ".tiff"))
+ {
+ extension= ".tif";
+ }
}
#endif
#ifdef WITH_OPENEXR
- else if ( ELEM(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
+ else if (ELEM(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
if (!BLI_testextensie(string, ".exr"))
extension= ".exr";
}
@@ -1141,7 +1144,7 @@ int BKE_add_image_extension(char *string, const char imtype)
}
#endif
else { // R_IMF_IMTYPE_AVICODEC, R_IMF_IMTYPE_AVIRAW, R_IMF_IMTYPE_AVIJPEG, R_IMF_IMTYPE_JPEG90, R_IMF_IMTYPE_QUICKTIME etc
- if (!( BLI_testextensie(string, ".jpg") || BLI_testextensie(string, ".jpeg")))
+ if (!(BLI_testextensie(string, ".jpg") || BLI_testextensie(string, ".jpeg")))
extension= ".jpg";
}
@@ -1791,7 +1794,7 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
if (ima==NULL)
return;
- switch(signal) {
+ switch (signal) {
case IMA_SIGNAL_FREE:
image_free_buffers(ima);
if (iuser)
@@ -2600,7 +2603,7 @@ int BKE_image_user_get_frame(const ImageUser *iuser, int cfra, int fieldnr)
/* cyclic */
if (iuser->cycl) {
- cfra= ( (cfra) % len );
+ cfra= ((cfra) % len);
if (cfra < 0) cfra+= len;
if (cfra==0) cfra= len;
}
@@ -2618,7 +2621,7 @@ int BKE_image_user_get_frame(const ImageUser *iuser, int cfra, int fieldnr)
framenr+= iuser->offset;
if (iuser->cycl) {
- framenr= ( (framenr) % len );
+ framenr= ((framenr) % len);
while (framenr < 0) framenr+= len;
if (framenr==0) framenr= len;
}
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c
index 675c0771140..1441bd7b12b 100644
--- a/source/blender/blenkernel/intern/image_gen.c
+++ b/source/blender/blenkernel/intern/image_gen.c
@@ -169,12 +169,10 @@ static void checker_board_color_fill(unsigned char *rect, float *rect_float, int
hue_step= power_of_2_max_i(width / 8);
if (hue_step < 8) hue_step= 8;
- for (y= 0; y < height; y++)
- {
+ for (y= 0; y < height; y++) {
val= 0.1 + (y * (0.4 / height)); /* use a number lower then 1.0 else its too bright */
- for (x= 0; x < width; x++)
- {
+ for (x= 0; x < width; x++) {
hue= (float)((double)(x/hue_step) * 1.0 / width * hue_step);
hsv_to_rgb(hue, sat, val, &r, &g, &b);
@@ -291,12 +289,10 @@ static void checker_board_text(unsigned char *rect, float *rect_float, int width
BLF_buffer(mono, rect_float, rect, width, height, 4);
- for (y= 0; y < height; y+=step)
- {
+ for (y= 0; y < height; y+=step) {
text[1]= '1';
- for (x= 0; x < width; x+=step)
- {
+ for (x= 0; x < width; x+=step) {
/* hard coded offset */
pen_x = x + 33;
pen_y = y + 44;
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index a4edc1e531a..d4861a27057 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -87,7 +87,7 @@ void itstart(void)
}
static void itend(void)
{
- gettimeofday(&_itend,&itz);
+ gettimeofday(&_itend, &itz);
}
double itval(void)
{
@@ -98,8 +98,8 @@ double itval(void)
}
#endif
-static float I[3][3] = {{1,0,0},{0,1,0},{0,0,1}};
-static float ZERO[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}};
+static float I[3][3] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
+static float ZERO[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
/*
#define C99
@@ -119,9 +119,9 @@ struct Cloth;
typedef float lfVector[3];
typedef struct fmatrix3x3 {
float m[3][3]; /* 3x3 matrix */
- unsigned int c,r; /* column and row number */
+ unsigned int c, r; /* column and row number */
int pinned; /* is this vertex allowed to move? */
- float n1,n2,n3; /* three normal vectors for collision constrains */
+ float n1, n2, n3; /* three normal vectors for collision constrains */
unsigned int vcount; /* vertex count */
unsigned int scount; /* spring count */
} fmatrix3x3;
@@ -168,7 +168,7 @@ DO_INLINE void mul_fvectorT_fvectorS(float to[3][3], float vectorA[3], float vec
/* printf vector[3] on console: for debug output */
static void print_fvector(float m3[3])
{
- printf("%f\n%f\n%f\n\n",m3[0],m3[1],m3[2]);
+ printf("%f\n%f\n%f\n\n", m3[0], m3[1], m3[2]);
}
///////////////////////////
@@ -178,8 +178,7 @@ static void print_fvector(float m3[3])
DO_INLINE void print_lfvector(float (*fLongVector)[3], unsigned int verts)
{
unsigned int i = 0;
- for (i = 0; i < verts; i++)
- {
+ for (i = 0; i < verts; i++) {
print_fvector(fLongVector[i]);
}
}
@@ -193,8 +192,7 @@ DO_INLINE lfVector *create_lfvector(unsigned int verts)
/* delete long vector */
DO_INLINE void del_lfvector(float (*fLongVector)[3])
{
- if (fLongVector != NULL)
- {
+ if (fLongVector != NULL) {
MEM_freeN (fLongVector);
// cloth_aligned_free(&MEMORY_BASE, fLongVector);
}
@@ -208,8 +206,7 @@ DO_INLINE void cp_lfvector(float (*to)[3], float (*from)[3], unsigned int verts)
DO_INLINE void init_lfvector(float (*fLongVector)[3], float vector[3], unsigned int verts)
{
unsigned int i = 0;
- for (i = 0; i < verts; i++)
- {
+ for (i = 0; i < verts; i++) {
copy_v3_v3(fLongVector[i], vector);
}
}
@@ -223,8 +220,7 @@ DO_INLINE void mul_lfvectorS(float (*to)[3], float (*fLongVector)[3], float scal
{
unsigned int i = 0;
- for (i = 0; i < verts; i++)
- {
+ for (i = 0; i < verts; i++) {
mul_fvector_S(to[i], fLongVector[i], scalar);
}
}
@@ -233,8 +229,7 @@ DO_INLINE void mul_lfvectorS(float (*to)[3], float (*fLongVector)[3], float scal
DO_INLINE void submul_lfvectorS(float (*to)[3], float (*fLongVector)[3], float scalar, unsigned int verts)
{
unsigned int i = 0;
- for (i = 0; i < verts; i++)
- {
+ for (i = 0; i < verts; i++) {
VECSUBMUL(to[i], fLongVector[i], scalar);
}
}
@@ -258,8 +253,7 @@ DO_INLINE void add_lfvector_lfvector(float (*to)[3], float (*fLongVectorA)[3], f
{
unsigned int i = 0;
- for (i = 0; i < verts; i++)
- {
+ for (i = 0; i < verts; i++) {
VECADD(to[i], fLongVectorA[i], fLongVectorB[i]);
}
@@ -269,8 +263,7 @@ DO_INLINE void add_lfvector_lfvectorS(float (*to)[3], float (*fLongVectorA)[3],
{
unsigned int i = 0;
- for (i = 0; i < verts; i++)
- {
+ for (i = 0; i < verts; i++) {
VECADDS(to[i], fLongVectorA[i], fLongVectorB[i], bS);
}
@@ -280,8 +273,7 @@ DO_INLINE void add_lfvectorS_lfvectorS(float (*to)[3], float (*fLongVectorA)[3],
{
unsigned int i = 0;
- for (i = 0; i < verts; i++)
- {
+ for (i = 0; i < verts; i++) {
VECADDSS(to[i], fLongVectorA[i], aS, fLongVectorB[i], bS);
}
}
@@ -289,8 +281,7 @@ DO_INLINE void add_lfvectorS_lfvectorS(float (*to)[3], float (*fLongVectorA)[3],
DO_INLINE void sub_lfvector_lfvectorS(float (*to)[3], float (*fLongVectorA)[3], float (*fLongVectorB)[3], float bS, unsigned int verts)
{
unsigned int i = 0;
- for (i = 0; i < verts; i++)
- {
+ for (i = 0; i < verts; i++) {
VECSUBS(to[i], fLongVectorA[i], fLongVectorB[i], bS);
}
@@ -300,8 +291,7 @@ DO_INLINE void sub_lfvector_lfvector(float (*to)[3], float (*fLongVectorA)[3], f
{
unsigned int i = 0;
- for (i = 0; i < verts; i++)
- {
+ for (i = 0; i < verts; i++) {
sub_v3_v3v3(to[i], fLongVectorA[i], fLongVectorB[i]);
}
@@ -313,9 +303,9 @@ DO_INLINE void sub_lfvector_lfvector(float (*to)[3], float (*fLongVectorA)[3], f
/* printf 3x3 matrix on console: for debug output */
static void print_fmatrix(float m3[3][3])
{
- printf("%f\t%f\t%f\n",m3[0][0],m3[0][1],m3[0][2]);
- printf("%f\t%f\t%f\n",m3[1][0],m3[1][1],m3[1][2]);
- printf("%f\t%f\t%f\n\n",m3[2][0],m3[2][1],m3[2][2]);
+ printf("%f\t%f\t%f\n", m3[0][0], m3[0][1], m3[0][2]);
+ printf("%f\t%f\t%f\n", m3[1][0], m3[1][1], m3[1][2]);
+ printf("%f\t%f\t%f\n\n", m3[2][0], m3[2][1], m3[2][2]);
}
#endif
@@ -350,15 +340,12 @@ DO_INLINE void inverse_fmatrix(float to[3][3], float from[3][3])
unsigned int i, j;
float d;
- if ((d=det_fmatrix(from))==0)
- {
+ if ((d=det_fmatrix(from)) == 0) {
printf("can't build inverse");
exit(0);
}
- for (i=0;i<3;i++)
- {
- for (j=0;j<3;j++)
- {
+ for (i=0;i<3;i++) {
+ for (j=0;j<3;j++) {
int i1=(i+1)%3;
int i2=(i+2)%3;
int j1=(j+1)%3;
@@ -380,9 +367,9 @@ DO_INLINE void inverse_fmatrix(float to[3][3], float from[3][3])
/* STATUS: verified */
DO_INLINE void mul_fmatrix_S(float matrix[3][3], float scalar)
{
- mul_fvector_S(matrix[0], matrix[0],scalar);
- mul_fvector_S(matrix[1], matrix[1],scalar);
- mul_fvector_S(matrix[2], matrix[2],scalar);
+ mul_fvector_S(matrix[0], matrix[0], scalar);
+ mul_fvector_S(matrix[1], matrix[1], scalar);
+ mul_fvector_S(matrix[2], matrix[2], scalar);
}
/* a vector multiplied by a 3x3 matrix */
@@ -398,17 +385,17 @@ DO_INLINE void mul_fvector_fmatrix(float *to, float *from, float matrix[3][3])
/* STATUS: verified */
DO_INLINE void mul_fmatrix_fvector(float *to, float matrix[3][3], float from[3])
{
- to[0] = dot_v3v3(matrix[0],from);
- to[1] = dot_v3v3(matrix[1],from);
- to[2] = dot_v3v3(matrix[2],from);
+ to[0] = dot_v3v3(matrix[0], from);
+ to[1] = dot_v3v3(matrix[1], from);
+ to[2] = dot_v3v3(matrix[2], from);
}
/* 3x3 matrix multiplied by a 3x3 matrix */
/* STATUS: verified */
DO_INLINE void mul_fmatrix_fmatrix(float to[3][3], float matrixA[3][3], float matrixB[3][3])
{
- mul_fvector_fmatrix(to[0], matrixA[0],matrixB);
- mul_fvector_fmatrix(to[1], matrixA[1],matrixB);
- mul_fvector_fmatrix(to[2], matrixA[2],matrixB);
+ mul_fvector_fmatrix(to[0], matrixA[0], matrixB);
+ mul_fvector_fmatrix(to[1], matrixA[1], matrixB);
+ mul_fvector_fmatrix(to[2], matrixA[2], matrixB);
}
/* 3x3 matrix addition with 3x3 matrix */
DO_INLINE void add_fmatrix_fmatrix(float to[3][3], float matrixA[3][3], float matrixB[3][3])
@@ -472,9 +459,9 @@ DO_INLINE void muladd_fvector_fmatrix(float to[3], float from[3], float matrix[3
/* 3x3 matrix multiplied and added to/by a 3x3 matrix and added to another 3x3 matrix */
DO_INLINE void muladd_fmatrix_fmatrix(float to[3][3], float matrixA[3][3], float matrixB[3][3])
{
- muladd_fvector_fmatrix(to[0], matrixA[0],matrixB);
- muladd_fvector_fmatrix(to[1], matrixA[1],matrixB);
- muladd_fvector_fmatrix(to[2], matrixA[2],matrixB);
+ muladd_fvector_fmatrix(to[0], matrixA[0], matrixB);
+ muladd_fvector_fmatrix(to[1], matrixA[1], matrixB);
+ muladd_fvector_fmatrix(to[2], matrixA[2], matrixB);
}
/* a vector multiplied and sub'd to/by a 3x3 matrix */
DO_INLINE void mulsub_fvector_fmatrix(float to[3], float from[3], float matrix[3][3])
@@ -486,9 +473,9 @@ DO_INLINE void mulsub_fvector_fmatrix(float to[3], float from[3], float matrix[3
/* 3x3 matrix multiplied and sub'd to/by a 3x3 matrix and added to another 3x3 matrix */
DO_INLINE void mulsub_fmatrix_fmatrix(float to[3][3], float matrixA[3][3], float matrixB[3][3])
{
- mulsub_fvector_fmatrix(to[0], matrixA[0],matrixB);
- mulsub_fvector_fmatrix(to[1], matrixA[1],matrixB);
- mulsub_fvector_fmatrix(to[2], matrixA[2],matrixB);
+ mulsub_fvector_fmatrix(to[0], matrixA[0], matrixB);
+ mulsub_fvector_fmatrix(to[1], matrixA[1], matrixB);
+ mulsub_fvector_fmatrix(to[2], matrixA[2], matrixB);
}
/* 3x3 matrix multiplied+added by a vector */
/* STATUS: verified */
@@ -535,8 +522,7 @@ DO_INLINE fmatrix3x3 *create_bfmatrix(unsigned int verts, unsigned int springs)
/* delete big matrix */
DO_INLINE void del_bfmatrix(fmatrix3x3 *matrix)
{
- if (matrix != NULL)
- {
+ if (matrix != NULL) {
MEM_freeN (matrix);
}
}
@@ -545,7 +531,7 @@ DO_INLINE void del_bfmatrix(fmatrix3x3 *matrix)
DO_INLINE void cp_bfmatrix(fmatrix3x3 *to, fmatrix3x3 *from)
{
// TODO bounds checking
- memcpy(to, from, sizeof(fmatrix3x3) * (from[0].vcount+from[0].scount) );
+ memcpy(to, from, sizeof(fmatrix3x3) * (from[0].vcount+from[0].scount));
}
/* init big matrix */
@@ -554,8 +540,7 @@ DO_INLINE void init_bfmatrix(fmatrix3x3 *matrix, float m3[3][3])
{
unsigned int i;
- for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
- {
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
cp_fmatrix(matrix[i].m, m3);
}
}
@@ -564,15 +549,13 @@ DO_INLINE void init_bfmatrix(fmatrix3x3 *matrix, float m3[3][3])
// slow in parallel
DO_INLINE void initdiag_bfmatrix(fmatrix3x3 *matrix, float m3[3][3])
{
- unsigned int i,j;
- float tmatrix[3][3] = {{0,0,0},{0,0,0},{0,0,0}};
+ unsigned int i, j;
+ float tmatrix[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
- for (i = 0; i < matrix[0].vcount; i++)
- {
+ for (i = 0; i < matrix[0].vcount; i++) {
cp_fmatrix(matrix[i].m, m3);
}
- for (j = matrix[0].vcount; j < matrix[0].vcount+matrix[0].scount; j++)
- {
+ for (j = matrix[0].vcount; j < matrix[0].vcount+matrix[0].scount; j++) {
cp_fmatrix(matrix[j].m, tmatrix);
}
}
@@ -581,8 +564,7 @@ DO_INLINE void initdiag_bfmatrix(fmatrix3x3 *matrix, float m3[3][3])
DO_INLINE void mul_bfmatrix_S(fmatrix3x3 *matrix, float scalar)
{
unsigned int i = 0;
- for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
- {
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
mul_fmatrix_S(matrix[i].m, scalar);
}
}
@@ -601,15 +583,13 @@ DO_INLINE void mul_bfmatrix_lfvector( float (*to)[3], fmatrix3x3 *from, lfVector
{
#pragma omp section
{
- for (i = from[0].vcount; i < from[0].vcount+from[0].scount; i++)
- {
+ for (i = from[0].vcount; i < from[0].vcount+from[0].scount; i++) {
muladd_fmatrix_fvector(to[from[i].c], from[i].m, fLongVector[from[i].r]);
}
}
#pragma omp section
{
- for (i = 0; i < from[0].vcount+from[0].scount; i++)
- {
+ for (i = 0; i < from[0].vcount+from[0].scount; i++) {
muladd_fmatrix_fvector(temp[from[i].r], from[i].m, fLongVector[from[i].c]);
}
}
@@ -627,8 +607,7 @@ DO_INLINE void mul_prevfmatrix_lfvector( float (*to)[3], fmatrix3x3 *from, lfVec
{
unsigned int i = 0;
- for (i = 0; i < from[0].vcount; i++)
- {
+ for (i = 0; i < from[0].vcount; i++) {
mul_fmatrix_fvector(to[from[i].r], from[i].m, fLongVector[from[i].c]);
}
}
@@ -639,8 +618,7 @@ DO_INLINE void add_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmatrix
unsigned int i = 0;
/* process diagonal elements */
- for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
- {
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
add_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
}
@@ -651,8 +629,7 @@ DO_INLINE void addadd_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmat
unsigned int i = 0;
/* process diagonal elements */
- for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
- {
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
addadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
}
@@ -663,8 +640,7 @@ DO_INLINE void subadd_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmat
unsigned int i = 0;
/* process diagonal elements */
- for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
- {
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
subadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
}
@@ -675,8 +651,7 @@ DO_INLINE void sub_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmatrix
unsigned int i = 0;
/* process diagonal elements */
- for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
- {
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
sub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
}
@@ -687,8 +662,7 @@ DO_INLINE void sub_bfmatrix_Smatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmatrix3
unsigned int i = 0;
/* process diagonal elements */
- for (i = 0; i < matrix[0].vcount; i++)
- {
+ for (i = 0; i < matrix[0].vcount; i++) {
sub_fmatrix_fmatrix(to[matrix[i].c].m, from[matrix[i].c].m, matrix[i].m);
}
@@ -699,8 +673,7 @@ DO_INLINE void addsub_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmat
unsigned int i = 0;
/* process diagonal elements */
- for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
- {
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
addsub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);
}
@@ -713,8 +686,7 @@ DO_INLINE void subadd_bfmatrixS_bfmatrixS( fmatrix3x3 *to, fmatrix3x3 *from, flo
unsigned int i = 0;
/* process diagonal elements */
- for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
- {
+ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) {
subadd_fmatrixS_fmatrixS(to[i].m, from[i].m, aS, matrix[i].m, bS);
}
@@ -729,7 +701,7 @@ typedef struct Implicit_Data
fmatrix3x3 *A, *dFdV, *dFdX, *S, *P, *Pinv, *bigI, *M;
} Implicit_Data;
-int implicit_init (Object *UNUSED(ob), ClothModifierData *clmd)
+int implicit_init(Object *UNUSED(ob), ClothModifierData *clmd)
{
unsigned int i = 0;
unsigned int pinned = 0;
@@ -772,12 +744,10 @@ int implicit_init (Object *UNUSED(ob), ClothModifierData *clmd)
id->dV = create_lfvector(cloth->numverts);
id->z = create_lfvector(cloth->numverts);
- for (i=0;i<cloth->numverts;i++)
- {
+ for (i=0;i<cloth->numverts;i++) {
id->A[i].r = id->A[i].c = id->dFdV[i].r = id->dFdV[i].c = id->dFdX[i].r = id->dFdX[i].c = id->P[i].c = id->P[i].r = id->Pinv[i].c = id->Pinv[i].r = id->bigI[i].c = id->bigI[i].r = id->M[i].r = id->M[i].c = i;
- if (verts [i].flags & CLOTH_VERT_FLAG_PINNED)
- {
+ if (verts [i].flags & CLOTH_VERT_FLAG_PINNED) {
id->S[pinned].pinned = 1;
id->S[pinned].c = id->S[pinned].r = i;
pinned++;
@@ -791,8 +761,7 @@ int implicit_init (Object *UNUSED(ob), ClothModifierData *clmd)
// init springs
search = cloth->springs;
- for (i=0;i<cloth->numsprings;i++)
- {
+ for (i=0;i<cloth->numsprings;i++) {
spring = search->link;
// dFdV_start[i].r = big_I[i].r = big_zero[i].r =
@@ -810,25 +779,22 @@ int implicit_init (Object *UNUSED(ob), ClothModifierData *clmd)
initdiag_bfmatrix(id->bigI, I);
- for (i = 0; i < cloth->numverts; i++)
- {
+ for (i = 0; i < cloth->numverts; i++) {
copy_v3_v3(id->X[i], verts[i].x);
}
return 1;
}
-int implicit_free (ClothModifierData *clmd)
+int implicit_free(ClothModifierData *clmd)
{
Implicit_Data *id;
Cloth *cloth;
cloth = (Cloth *)clmd->clothObject;
- if (cloth)
- {
+ if (cloth) {
id = cloth->implicit;
- if (id)
- {
+ if (id) {
del_bfmatrix(id->A);
del_bfmatrix(id->dFdV);
del_bfmatrix(id->dFdX);
@@ -858,14 +824,14 @@ int implicit_free (ClothModifierData *clmd)
DO_INLINE float fb(float length, float L)
{
float x = length/L;
- return (-11.541f*pow(x,4)+34.193f*pow(x,3)-39.083f*pow(x,2)+23.116f*x-9.713f);
+ return (-11.541f*pow(x, 4)+34.193f*pow(x, 3)-39.083f*pow(x, 2)+23.116f*x-9.713f);
}
DO_INLINE float fbderiv(float length, float L)
{
float x = length/L;
- return (-46.164f*pow(x,3)+102.579f*pow(x,2)-78.166f*x+23.116f);
+ return (-46.164f*pow(x, 3)+102.579f*pow(x, 2)-78.166f*x+23.116f);
}
DO_INLINE float fbstar(float length, float L, float kb, float cb)
@@ -886,12 +852,10 @@ DO_INLINE float fbstar_jacobi(float length, float L, float kb, float cb)
float tempfb = kb * fb(length, L);
float fbstar = cb * (length - L);
- if (tempfb < fbstar)
- {
+ if (tempfb < fbstar) {
return cb;
}
- else
- {
+ else {
return kb * fbderiv(length, L);
}
}
@@ -900,8 +864,7 @@ DO_INLINE void filter(lfVector *V, fmatrix3x3 *S)
{
unsigned int i=0;
- for (i=0;i<S[0].vcount;i++)
- {
+ for (i = 0; i < S[0].vcount; i++) {
mul_fvector_fmatrix(V[S[i].r], V[S[i].r], S[i].m);
}
}
@@ -924,24 +887,23 @@ static int cg_filtered(lfVector *ldV, fmatrix3x3 *lA, lfVector *lB, lfVector *z
add_lfvector_lfvector(ldV, ldV, z, numverts);
- // r = B - Mul(tmp,A,X); // just use B if X known to be zero
+ // r = B - Mul(tmp, A, X); // just use B if X known to be zero
cp_lfvector(r, lB, numverts);
mul_bfmatrix_lfvector(tmp, lA, ldV);
sub_lfvector_lfvector(r, r, tmp, numverts);
- filter(r,S);
+ filter(r, S);
cp_lfvector(d, r, numverts);
s = dot_lfvector(r, r, numverts);
starget = s * sqrt(conjgrad_epsilon);
- while (s>starget && conjgrad_loopcount < conjgrad_looplimit)
- {
- // Mul(q,A,d); // q = A*d;
+ while (s>starget && conjgrad_loopcount < conjgrad_looplimit) {
+ // Mul(q, A, d); // q = A*d;
mul_bfmatrix_lfvector(q, lA, d);
- filter(q,S);
+ filter(q, S);
a = s/dot_lfvector(d, q, numverts);
@@ -957,7 +919,7 @@ static int cg_filtered(lfVector *ldV, fmatrix3x3 *lA, lfVector *lB, lfVector *z
//d = r+d*(s/s_prev);
add_lfvector_lfvectorS(d, r, d, (s/s_prev), numverts);
- filter(d,S);
+ filter(d, S);
conjgrad_loopcount++;
}
@@ -979,8 +941,7 @@ DO_INLINE void BuildPPinv(fmatrix3x3 *lA, fmatrix3x3 *P, fmatrix3x3 *Pinv)
// Take only the diagonal blocks of A
// #pragma omp parallel for private(i) if (lA[0].vcount > CLOTH_OPENMP_LIMIT)
- for (i = 0; i<lA[0].vcount; i++)
- {
+ for (i = 0; i<lA[0].vcount; i++) {
// block diagonalizer
cp_fmatrix(P[i].m, lA[i].m);
inverse_fmatrix(Pinv[i].m, P[i].m);
@@ -1165,7 +1126,7 @@ static int cg_filtered_pre(lfVector *dv, fmatrix3x3 *lA, lfVector *lB, lfVector
DO_INLINE void dfdx_spring_type1(float to[3][3], float extent[3], float length, float L, float dot, float k)
{
// dir is unit length direction, rest is spring's restlength, k is spring constant.
- // return (outerprod(dir,dir)*k + (I - outerprod(dir,dir))*(k - ((k*L)/length)));
+ // return (outerprod(dir, dir)*k + (I - outerprod(dir, dir))*(k - ((k*L)/length)));
float temp[3][3];
float temp1 = k*(1.0 - (L/length));
@@ -1187,7 +1148,7 @@ DO_INLINE void dfdx_spring_type1(float to[3][3], float extent[3], float length,
DO_INLINE void dfdx_spring_type2(float to[3][3], float dir[3], float length, float L, float k, float cb)
{
- // return outerprod(dir,dir)*fbstar_jacobi(length, L, k, cb);
+ // return outerprod(dir, dir)*fbstar_jacobi(length, L, k, cb);
mul_fvectorT_fvectorS(to, dir, dir, fbstar_jacobi(length, L, k, cb));
}
@@ -1198,10 +1159,10 @@ DO_INLINE void dfdv_damp(float to[3][3], float dir[3], float damping)
}
-DO_INLINE void dfdx_spring(float to[3][3], float dir[3],float length,float L,float k)
+DO_INLINE void dfdx_spring(float to[3][3], float dir[3], float length, float L, float k)
{
// dir is unit length direction, rest is spring's restlength, k is spring constant.
- //return ( (I-outerprod(dir,dir))*Min(1.0f,rest/length) - I) * -k;
+ //return ( (I-outerprod(dir, dir))*Min(1.0f, rest/length) - I) * -k;
mul_fvectorT_fvector(to, dir, dir);
sub_fmatrix_fmatrix(to, I, to);
@@ -1211,13 +1172,13 @@ DO_INLINE void dfdx_spring(float to[3][3], float dir[3],float length,float L,fl
}
// unused atm
-DO_INLINE void dfdx_damp(float to[3][3], float dir[3],float length,const float vel[3],float rest,float damping)
+DO_INLINE void dfdx_damp(float to[3][3], float dir[3], float length, const float vel[3], float rest, float damping)
{
// inner spring damping vel is the relative velocity of the endpoints.
- // return (I-outerprod(dir,dir)) * (-damping * -(dot(dir,vel)/Max(length,rest)));
+ // return (I-outerprod(dir, dir)) * (-damping * -(dot(dir, vel)/Max(length, rest)));
mul_fvectorT_fvector(to, dir, dir);
sub_fmatrix_fmatrix(to, I, to);
- mul_fmatrix_S(to, (-damping * -(dot_v3v3(dir,vel)/MAX2(length,rest))));
+ mul_fmatrix_S(to, (-damping * -(dot_v3v3(dir, vel)/MAX2(length, rest))));
}
@@ -1227,17 +1188,17 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
ClothVertex *verts = cloth->verts;
float extent[3];
float length = 0, dot = 0;
- float dir[3] = {0,0,0};
+ float dir[3] = {0, 0, 0};
float vel[3];
float k = 0.0f;
float L = s->restlen;
float cb; /* = clmd->sim_parms->structural; */ /*UNUSED*/
- float nullf[3] = {0,0,0};
- float stretch_force[3] = {0,0,0};
- float bending_force[3] = {0,0,0};
- float damping_force[3] = {0,0,0};
- float nulldfdx[3][3]={ {0,0,0}, {0,0,0}, {0,0,0}};
+ float nullf[3] = {0, 0, 0};
+ float stretch_force[3] = {0, 0, 0};
+ float bending_force[3] = {0, 0, 0};
+ float damping_force[3] = {0, 0, 0};
+ float nulldfdx[3][3]={ {0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
float scaling = 0.0;
@@ -1255,8 +1216,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
s->flags &= ~CLOTH_SPRING_FLAG_NEEDED;
- if (length > ALMOST_ZERO)
- {
+ if (length > ALMOST_ZERO) {
/*
if (length>L)
{
@@ -1270,16 +1230,13 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
*/
mul_fvector_S(dir, extent, 1.0f/length);
}
- else
- {
+ else {
mul_fvector_S(dir, extent, 0.0f);
}
// calculate force of structural + shear springs
- if ((s->type & CLOTH_SPRING_TYPE_STRUCTURAL) || (s->type & CLOTH_SPRING_TYPE_SHEAR))
- {
- if (length > L || no_compress)
- {
+ if ((s->type & CLOTH_SPRING_TYPE_STRUCTURAL) || (s->type & CLOTH_SPRING_TYPE_SHEAR)) {
+ if (length > L || no_compress) {
s->flags |= CLOTH_SPRING_FLAG_NEEDED;
k = clmd->sim_parms->structural;
@@ -1337,10 +1294,8 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
// dfdx_spring(s->dfdx, dir, length, 0.0, k);
// dfdv_damp(s->dfdv, dir, MIN2(1.0, (clmd->sim_parms->goalfrict/100.0)));
}
- else // calculate force of bending springs
- {
- if (length < L)
- {
+ else { /* calculate force of bending springs */
+ if (length < L) {
s->flags |= CLOTH_SPRING_FLAG_NEEDED;
k = clmd->sim_parms->bending;
@@ -1351,17 +1306,15 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
mul_fvector_S(bending_force, dir, fbstar(length, L, k, cb));
VECADD(s->f, s->f, bending_force);
- dfdx_spring_type2(s->dfdx, dir, length,L, k, cb);
+ dfdx_spring_type2(s->dfdx, dir, length, L, k, cb);
}
}
}
DO_INLINE void cloth_apply_spring_force(ClothModifierData *UNUSED(clmd), ClothSpring *s, lfVector *lF, lfVector *UNUSED(X), lfVector *UNUSED(V), fmatrix3x3 *dFdV, fmatrix3x3 *dFdX)
{
- if (s->flags & CLOTH_SPRING_FLAG_NEEDED)
- {
- if (!(s->type & CLOTH_SPRING_TYPE_BENDING))
- {
+ if (s->flags & CLOTH_SPRING_FLAG_NEEDED) {
+ if (!(s->type & CLOTH_SPRING_TYPE_BENDING)) {
sub_fmatrix_fmatrix(dFdV[s->ij].m, dFdV[s->ij].m, s->dfdv);
sub_fmatrix_fmatrix(dFdV[s->kl].m, dFdV[s->kl].m, s->dfdv);
add_fmatrix_fmatrix(dFdV[s->matrix_index].m, dFdV[s->matrix_index].m, s->dfdv);
@@ -1381,7 +1334,7 @@ DO_INLINE void cloth_apply_spring_force(ClothModifierData *UNUSED(clmd), ClothSp
static void CalcFloat( float *v1, float *v2, float *v3, float *n)
{
- float n1[3],n2[3];
+ float n1[3], n2[3];
n1[0]= v1[0]-v2[0];
n2[0]= v2[0]-v3[0];
@@ -1397,7 +1350,7 @@ static void CalcFloat( float *v1, float *v2, float *v3, float *n)
static void CalcFloat4( float *v1, float *v2, float *v3, float *v4, float *n)
{
/* real cross! */
- float n1[3],n2[3];
+ float n1[3], n2[3];
n1[0]= v1[0]-v3[0];
n1[1]= v1[1]-v3[1];
@@ -1486,8 +1439,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
}
/* gather colliders */
- if (colliders && collfac > 0.0f) for (col = colliders->first; col; col = col->next)
- {
+ if (colliders && collfac > 0.0f) for (col = colliders->first; col; col = col->next) {
MVert *loc0 = col->collmd->x;
MVert *loc1 = col->collmd->xnew;
float vel[3];
@@ -1560,7 +1512,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVector *lF, lfVector *lX, lfVector *lV, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX, ListBase *effectors, float time, fmatrix3x3 *M)
{
- /* Collect forces and derivatives: F,dFdX,dFdV */
+ /* Collect forces and derivatives: F, dFdX, dFdV */
Cloth *cloth = clmd->clothObject;
unsigned int i = 0;
float spring_air = clmd->sim_parms->Cvi * 0.01f; /* viscosity of air scaled in percent */
@@ -1593,8 +1545,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
/* multiply lF with mass matrix
* force = mass * acceleration (in this case: gravity)
*/
- for (i = 0; i < numverts; i++)
- {
+ for (i = 0; i < numverts; i++) {
float temp[3];
copy_v3_v3(temp, lF[i]);
mul_fmatrix_fvector(lF[i], M[i].m, temp);
@@ -1603,8 +1554,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
submul_lfvectorS(lF, lV, spring_air, numverts);
/* handle external forces like wind */
- if (effectors)
- {
+ if (effectors) {
// 0 = force, 1 = normalized force
winvec = create_lfvector(cloth->numverts);
@@ -1612,25 +1562,23 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
printf("winvec: out of memory in implicit.c\n");
// precalculate wind forces
- for (i = 0; i < cloth->numverts; i++)
- {
+ for (i = 0; i < cloth->numverts; i++) {
pd_point_from_loc(clmd->scene, (float*)lX[i], (float*)lV[i], i, &epoint);
pdDoEffectors(effectors, NULL, clmd->sim_parms->effector_weights, &epoint, winvec[i], NULL);
}
- for (i = 0; i < cloth->numfaces; i++)
- {
- float trinormal[3]={0,0,0}; // normalized triangle normal
- float triunnormal[3]={0,0,0}; // not-normalized-triangle normal
- float tmp[3]={0,0,0};
+ for (i = 0; i < cloth->numfaces; i++) {
+ float trinormal[3]={0, 0, 0}; // normalized triangle normal
+ float triunnormal[3]={0, 0, 0}; // not-normalized-triangle normal
+ float tmp[3]={0, 0, 0};
float factor = (mfaces[i].v4) ? 0.25 : 1.0 / 3.0;
factor *= 0.02;
// calculate face normal
if (mfaces[i].v4)
- CalcFloat4(lX[mfaces[i].v1],lX[mfaces[i].v2],lX[mfaces[i].v3],lX[mfaces[i].v4],triunnormal);
+ CalcFloat4(lX[mfaces[i].v1], lX[mfaces[i].v2], lX[mfaces[i].v3], lX[mfaces[i].v4], triunnormal);
else
- CalcFloat(lX[mfaces[i].v1],lX[mfaces[i].v2],lX[mfaces[i].v3],triunnormal);
+ CalcFloat(lX[mfaces[i].v1], lX[mfaces[i].v2], lX[mfaces[i].v3], triunnormal);
normalize_v3_v3(trinormal, triunnormal);
@@ -1650,8 +1598,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
VECADDS(lF[mfaces[i].v3], lF[mfaces[i].v3], tmp, factor);
// add wind from v4
- if (mfaces[i].v4)
- {
+ if (mfaces[i].v4) {
copy_v3_v3(tmp, trinormal);
mul_v3_fl(tmp, calculateVertexWindForce(winvec[mfaces[i].v4], triunnormal));
VECADDS(lF[mfaces[i].v4], lF[mfaces[i].v4], tmp, factor);
@@ -1661,9 +1608,9 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
/* Hair has only edges */
if (cloth->numfaces == 0) {
ClothSpring *spring;
- float edgevec[3]={0,0,0}; //edge vector
- float edgeunnormal[3]={0,0,0}; // not-normalized-edge normal
- float tmp[3]={0,0,0};
+ float edgevec[3]={0, 0, 0}; //edge vector
+ float edgeunnormal[3]={0, 0, 0}; // not-normalized-edge normal
+ float tmp[3]={0, 0, 0};
float factor = 0.01;
search = cloth->springs;
@@ -1692,8 +1639,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
// calculate spring forces
search = cloth->springs;
- while (search)
- {
+ while (search) {
// only handle active springs
// if (((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED) && !(springs[i].flags & CSPRING_FLAG_DEACTIVATE))|| !(clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED)) {}
cloth_calc_spring_force(clmd, search->link, lF, lX, lV, dFdV, dFdX, time);
@@ -1703,8 +1649,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
// apply spring forces
search = cloth->springs;
- while (search)
- {
+ while (search) {
// only handle active springs
// if (((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED) && !(springs[i].flags & CSPRING_FLAG_DEACTIVATE))|| !(clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED))
cloth_apply_spring_force(clmd, search->link, lF, lX, lV, dFdV, dFdX);
@@ -1823,7 +1768,7 @@ int cloth_calc_helper_forces(Object *UNUSED(ob), ClothModifierData * clmd, float
return 1;
}
-int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase *effectors)
+int implicit_solver(Object *ob, float frame, ClothModifierData *clmd, ListBase *effectors)
{
unsigned int i=0;
float step=0.0f, tf=clmd->sim_parms->timescale;
@@ -1836,21 +1781,17 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
Implicit_Data *id = cloth->implicit;
int do_extra_solve;
- if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) /* do goal stuff */
- {
- for (i = 0; i < numverts; i++)
- {
+ if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) { /* do goal stuff */
+ for (i = 0; i < numverts; i++) {
// update velocities with constrained velocities from pinned verts
- if (verts [i].flags & CLOTH_VERT_FLAG_PINNED)
- {
+ if (verts [i].flags & CLOTH_VERT_FLAG_PINNED) {
sub_v3_v3v3(id->V[i], verts[i].xconst, verts[i].xold);
// mul_v3_fl(id->V[i], clmd->sim_parms->stepsPerFrame);
}
}
}
- while (step < tf)
- {
+ while (step < tf) {
// damping velocity for artistic reasons
mul_lfvectorS(id->V, id->V, clmd->sim_parms->vel_damping, numverts);
@@ -1864,13 +1805,10 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
add_lfvector_lfvectorS(id->Xnew, id->X, id->Vnew, dt, numverts);
/* move pinned verts to correct position */
- for (i = 0; i < numverts; i++)
- {
- if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL)
- {
- if (verts [i].flags & CLOTH_VERT_FLAG_PINNED)
- {
- float tvect[3] = {.0,.0,.0};
+ for (i = 0; i < numverts; i++) {
+ if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) {
+ if (verts[i].flags & CLOTH_VERT_FLAG_PINNED) {
+ float tvect[3] = {0.0f, 0.0f, 0.0f};
sub_v3_v3v3(tvect, verts[i].xconst, verts[i].xold);
mul_fvector_S(tvect, tvect, step+dt);
VECADD(tvect, tvect, verts[i].xold);
@@ -1881,14 +1819,12 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
copy_v3_v3(verts[i].txold, id->X[i]);
}
- if (clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_ENABLED && clmd->clothObject->bvhtree)
- {
+ if (clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_ENABLED && clmd->clothObject->bvhtree) {
// collisions
// itstart();
// update verts to current positions
- for (i = 0; i < numverts; i++)
- {
+ for (i = 0; i < numverts; i++) {
copy_v3_v3(verts[i].tx, id->Xnew[i]);
sub_v3_v3v3(verts[i].tv, verts[i].tx, verts[i].txold);
@@ -1904,8 +1840,7 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
do_extra_solve = cloth_bvh_objcollision(ob, clmd, step/clmd->sim_parms->timescale, dt/clmd->sim_parms->timescale);
// copy corrected positions back to simulation
- for (i = 0; i < numverts; i++)
- {
+ for (i = 0; i < numverts; i++) {
// correct velocity again, just to be sure we had to change it due to adaptive collisions
sub_v3_v3v3(verts[i].tv, verts[i].tx, id->X[i]);
}
@@ -1913,11 +1848,9 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
//if (do_extra_solve)
// cloth_calc_helper_forces(ob, clmd, initial_cos, step/clmd->sim_parms->timescale, dt/clmd->sim_parms->timescale);
- for (i = 0; i < numverts; i++)
- {
+ for (i = 0; i < numverts; i++) {
- if (do_extra_solve)
- {
+ if (do_extra_solve) {
if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) && (verts [i].flags & CLOTH_VERT_FLAG_PINNED))
continue;
@@ -1933,8 +1866,7 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
// if there were collisions, advance the velocity from v_n+1/2 to v_n+1
- if (do_extra_solve)
- {
+ if (do_extra_solve) {
// V = Vnew;
cp_lfvector(id->V, id->Vnew, numverts);
@@ -1944,8 +1876,7 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
simulate_implicit_euler(id->Vnew, id->X, id->V, id->F, id->dFdV, id->dFdX, dt / 2.0f, id->A, id->B, id->dV, id->S, id->z, id->olddV, id->P, id->Pinv, id->M, id->bigI);
}
}
- else
- {
+ else {
// X = Xnew;
cp_lfvector(id->X, id->Xnew, numverts);
}
@@ -1959,16 +1890,13 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
step += dt;
}
- for (i = 0; i < numverts; i++)
- {
- if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) && (verts [i].flags & CLOTH_VERT_FLAG_PINNED))
- {
+ for (i = 0; i < numverts; i++) {
+ if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) && (verts [i].flags & CLOTH_VERT_FLAG_PINNED)) {
copy_v3_v3(verts[i].txold, verts[i].xconst); // TODO: test --> should be .x
copy_v3_v3(verts[i].x, verts[i].xconst);
copy_v3_v3(verts[i].v, id->V[i]);
}
- else
- {
+ else {
copy_v3_v3(verts[i].txold, id->X[i]);
copy_v3_v3(verts[i].x, id->X[i]);
copy_v3_v3(verts[i].v, id->V[i]);
@@ -1980,15 +1908,14 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
return 1;
}
-void implicit_set_positions (ClothModifierData *clmd)
+void implicit_set_positions(ClothModifierData *clmd)
{
Cloth *cloth = clmd->clothObject;
ClothVertex *verts = cloth->verts;
unsigned int numverts = cloth->numverts, i;
Implicit_Data *id = cloth->implicit;
- for (i = 0; i < numverts; i++)
- {
+ for (i = 0; i < numverts; i++) {
copy_v3_v3(id->X[i], verts[i].x);
copy_v3_v3(id->V[i], verts[i].v);
}
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 2fd1d291363..c2d101f9d3b 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -81,7 +81,7 @@
/* Free data from old IPO-Blocks (those which haven't been converted), but not IPO block itself */
// XXX this shouldn't be necessary anymore, but may occur while not all data is converted yet
-void free_ipo (Ipo *ipo)
+void free_ipo(Ipo *ipo)
{
IpoCurve *icu, *icn;
int n= 0;
@@ -1906,7 +1906,7 @@ void do_versions_ipos_to_animato(Main *main)
AnimData *adt= BKE_id_add_animdata(id);
- SEQ_BEGIN(ed, seq) {
+ SEQ_BEGIN (ed, seq) {
IpoCurve *icu = (seq->ipo) ? seq->ipo->curve.first : NULL;
short adrcode = SEQ_FAC1;
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 0a1c0467244..54a2613991a 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -1594,7 +1594,7 @@ void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb)
int a, tot;
/* count */
- tot = count_curveverts(nurb);
+ tot = BKE_nurbList_verts_count(nurb);
if (tot == 0) return;
if (kb->data) MEM_freeN(kb->data);
@@ -1647,7 +1647,7 @@ void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
nu = nurb->first;
fp = kb->data;
- tot = count_curveverts(nurb);
+ tot = BKE_nurbList_verts_count(nurb);
tot = MIN2(kb->totelem, tot);
@@ -1742,7 +1742,7 @@ float (*key_to_vertcos(Object * ob, KeyBlock * kb))[3]
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu = (Curve *)ob->data;
- tot = count_curveverts(&cu->nurb);
+ tot = BKE_nurbList_verts_count(&cu->nurb);
}
if (tot == 0) return NULL;
@@ -1822,7 +1822,7 @@ void vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu = (Curve *)ob->data;
elemsize = cu->key->elemsize;
- tot = count_curveverts(&cu->nurb);
+ tot = BKE_nurbList_verts_count(&cu->nurb);
}
if (tot == 0) {
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index f182d7bcb7c..e78da48d153 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -131,9 +131,9 @@ void resizelattice(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
}
co = vertexCos[0];
- for (w=0,wc=fw; w<wNew; w++,wc+=dw) {
- for (v=0,vc=fv; v<vNew; v++,vc+=dv) {
- for (u=0,uc=fu; u<uNew; u++,co+=3,uc+=du) {
+ for (w=0, wc=fw; w<wNew; w++, wc+=dw) {
+ for (v=0, vc=fv; v<vNew; v++, vc+=dv) {
+ for (u=0, uc=fu; u<uNew; u++, co+=3, uc+=du) {
co[0] = uc;
co[1] = vc;
co[2] = wc;
@@ -177,7 +177,7 @@ void resizelattice(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
bp= lt->def;
- for (i=0; i<lt->pntsu*lt->pntsv*lt->pntsw; i++,bp++) {
+ for (i=0; i<lt->pntsu*lt->pntsv*lt->pntsw; i++, bp++) {
copy_v3_v3(bp->vec, vertexCos[i]);
}
@@ -322,9 +322,9 @@ void init_latt_deform(Object *oblatt, Object *ob)
invert_m4_m4(imat, lt->latmat);
}
- for (w=0,fw=lt->fw; w<lt->pntsw; w++,fw+=lt->dw) {
- for (v=0,fv=lt->fv; v<lt->pntsv; v++, fv+=lt->dv) {
- for (u=0,fu=lt->fu; u<lt->pntsu; u++, bp++, co+=3, fp+=3, fu+=lt->du) {
+ for (w=0, fw=lt->fw; w<lt->pntsw; w++, fw+=lt->dw) {
+ for (v=0, fv=lt->fv; v<lt->pntsv; v++, fv+=lt->dv) {
+ for (u=0, fu=lt->fu; u<lt->pntsu; u++, bp++, co+=3, fp+=3, fu+=lt->du) {
if (dl) {
fp[0] = co[0] - fu;
fp[1] = co[1] - fv;
@@ -342,7 +342,7 @@ void init_latt_deform(Object *oblatt, Object *ob)
}
}
-void calc_latt_deform(Object *ob, float *co, float weight)
+void calc_latt_deform(Object *ob, float co[3], float weight)
{
Lattice *lt= ob->data;
float u, v, w, tu[4], tv[4], tw[4];
@@ -568,7 +568,7 @@ static int calc_curve_deform(Scene *scene, Object *par, float co[3],
/* this is not exactly the same as 2.4x, since the axis is having rotation removed rather than
* changing the axis before calculating the tilt but serves much the same purpose */
- float dir_flat[3]={0,0,0}, q[4];
+ float dir_flat[3]={0, 0, 0}, q[4];
copy_v3_v3(dir_flat, dir);
dir_flat[cd->no_rot_axis-1]= 0.0f;
@@ -774,7 +774,7 @@ void curve_deform_vector(Scene *scene, Object *cuOb, Object *target,
if (calc_curve_deform(scene, cuOb, vec, target->trackflag, &cd, quat)) {
float qmat[3][3];
- quat_to_mat3( qmat,quat);
+ quat_to_mat3(qmat, quat);
mul_m3_m3m3(mat, qmat, cd.objectspace3);
}
else
@@ -937,7 +937,7 @@ float (*lattice_getVertexCos(struct Object *ob, int *numVerts_r))[3]
if (lt->editlatt) lt= lt->editlatt->latt;
numVerts = *numVerts_r = lt->pntsu*lt->pntsv*lt->pntsw;
- vertexCos = MEM_mallocN(sizeof(*vertexCos)*numVerts,"lt_vcos");
+ vertexCos = MEM_mallocN(sizeof(*vertexCos)*numVerts, "lt_vcos");
for (i=0; i<numVerts; i++) {
copy_v3_v3(vertexCos[i], lt->def[i].vec);
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 7e756e853b1..2924ea457a8 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -182,7 +182,7 @@ int id_make_local(ID *id, int test)
if (id->flag & LIB_INDIRECT)
return 0;
- switch(GS(id->name)) {
+ switch (GS(id->name)) {
case ID_SCE:
return 0; /* not implemented */
case ID_LI:
@@ -198,12 +198,12 @@ int id_make_local(ID *id, int test)
return 1;
case ID_CU:
if (!test) {
- make_local_curve((Curve*)id);
+ BKE_curve_make_local((Curve*)id);
make_local_key(((Curve*)id)->key);
}
return 1;
case ID_MB:
- if (!test) make_local_mball((MetaBall*)id);
+ if (!test) BKE_metaball_make_local((MetaBall*)id);
return 1;
case ID_MA:
if (!test) make_local_material((Material*)id);
@@ -279,7 +279,7 @@ int id_copy(ID *id, ID **newid, int test)
/* conventions:
* - make shallow copy, only this ID block
* - id.us of the new ID is set to 1 */
- switch(GS(id->name)) {
+ switch (GS(id->name)) {
case ID_SCE:
return 0; /* can't be copied from here */
case ID_LI:
@@ -291,10 +291,10 @@ int id_copy(ID *id, ID **newid, int test)
if (!test) *newid= (ID*)copy_mesh((Mesh*)id);
return 1;
case ID_CU:
- if (!test) *newid= (ID*)copy_curve((Curve*)id);
+ if (!test) *newid= (ID*)BKE_curve_copy((Curve*)id);
return 1;
case ID_MB:
- if (!test) *newid= (ID*)copy_mball((MetaBall*)id);
+ if (!test) *newid= (ID*)BKE_metaball_copy((MetaBall*)id);
return 1;
case ID_MA:
if (!test) *newid= (ID*)copy_material((Material*)id);
@@ -368,7 +368,7 @@ int id_unlink(ID *id, int test)
Main *mainlib= G.main;
ListBase *lb;
- switch(GS(id->name)) {
+ switch (GS(id->name)) {
case ID_TXT:
if (test) return 1;
unlink_text(mainlib, (Text*)id);
@@ -425,7 +425,7 @@ int id_single_user(bContext *C, ID *id, PointerRNA *ptr, PropertyRNA *prop)
ListBase *which_libbase(Main *mainlib, short type)
{
- switch( type ) {
+ switch ( type ) {
case ID_SCE:
return &(mainlib->scene);
case ID_LI:
@@ -589,7 +589,7 @@ static ID *alloc_libblock_notest(short type)
{
ID *id= NULL;
- switch( type ) {
+ switch ( type ) {
case ID_SCE:
id= MEM_callocN(sizeof(Scene), "scene");
break;
@@ -796,7 +796,7 @@ void free_libblock(ListBase *lb, void *idv)
BPY_id_release(id);
#endif
- switch( GS(id->name) ) { /* GetShort from util.h */
+ switch ( GS(id->name) ) { /* GetShort from util.h */
case ID_SCE:
free_scene((Scene *)id);
break;
@@ -810,10 +810,10 @@ void free_libblock(ListBase *lb, void *idv)
free_mesh((Mesh *)id, 1);
break;
case ID_CU:
- free_curve((Curve *)id);
+ BKE_curve_free((Curve *)id);
break;
case ID_MB:
- free_mball((MetaBall *)id);
+ BKE_metaball_free((MetaBall *)id);
break;
case ID_MA:
free_material((Material *)id);
@@ -886,7 +886,7 @@ void free_libblock(ListBase *lb, void *idv)
free_gpencil_data((bGPdata *)id);
break;
case ID_MC:
- free_movieclip((MovieClip *)id);
+ BKE_movieclip_free((MovieClip *)id);
break;
}
@@ -1010,14 +1010,13 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor
BLI_dynstr_append(pupds, numstr);
/* icon */
- switch(GS(id->name))
- {
+ switch (GS(id->name)) {
case ID_MA: /* fall through */
case ID_TE: /* fall through */
case ID_IM: /* fall through */
case ID_WO: /* fall through */
case ID_LA: /* fall through */
- BLI_snprintf(numstr, sizeof(numstr), "%%i%d", BKE_icon_getid(id) );
+ BLI_snprintf(numstr, sizeof(numstr), "%%i%d", BKE_icon_getid(id));
BLI_dynstr_append(pupds, numstr);
break;
default:
@@ -1218,7 +1217,7 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
continue;
}
/* this format specifier is from hell... */
- BLI_snprintf(name, sizeof(id->name) - 2,"%s.%.3d", left, nr);
+ BLI_snprintf(name, sizeof(id->name) - 2, "%s.%.3d", left, nr);
return 1;
}
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 6d44282c60a..e52a9217673 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -493,7 +493,7 @@ short *give_totcolp(Object *ob)
/* same as above but for ID's */
Material ***give_matarar_id(ID *id)
{
- switch(GS(id->name)) {
+ switch (GS(id->name)) {
case ID_ME:
return &(((Mesh *)id)->mat);
break;
@@ -509,7 +509,7 @@ Material ***give_matarar_id(ID *id)
short *give_totcolp_id(ID *id)
{
- switch(GS(id->name)) {
+ switch (GS(id->name)) {
case ID_ME:
return &(((Mesh *)id)->totcol);
break;
@@ -525,12 +525,12 @@ short *give_totcolp_id(ID *id)
static void data_delete_material_index_id(ID *id, short index)
{
- switch(GS(id->name)) {
+ switch (GS(id->name)) {
case ID_ME:
mesh_delete_material_index((Mesh *)id, index);
break;
case ID_CU:
- curve_delete_material_index((Curve *)id, index);
+ BKE_curve_delete_material_index((Curve *)id, index);
break;
case ID_MB:
/* meta-elems don't have materials atm */
@@ -800,7 +800,7 @@ void assign_material(Object *ob, Material *ma, short act)
matar= MEM_callocN(sizeof(void *)*act, "matarray2");
matbits= MEM_callocN(sizeof(char)*act, "matbits1");
if ( ob->totcol) {
- memcpy(matar, ob->mat, sizeof(void *)*( ob->totcol ));
+ memcpy(matar, ob->mat, sizeof(void *) * ob->totcol);
memcpy(matbits, ob->matbits, sizeof(char)*(*totcolp));
MEM_freeN(ob->mat);
MEM_freeN(ob->matbits);
@@ -1054,31 +1054,31 @@ int material_in_material(Material *parmat, Material *mat)
/* ****************** */
#if 0 /* UNUSED */
static char colname_array[125][20]= {
-"Black","DarkRed","HalfRed","Red","Red",
-"DarkGreen","DarkOlive","Brown","Chocolate","OrangeRed",
-"HalfGreen","GreenOlive","DryOlive","Goldenrod","DarkOrange",
-"LightGreen","Chartreuse","YellowGreen","Yellow","Gold",
-"Green","LawnGreen","GreenYellow","LightOlive","Yellow",
-"DarkBlue","DarkPurple","HotPink","VioletPink","RedPink",
-"SlateGray","DarkGrey","PalePurple","IndianRed","Tomato",
-"SeaGreen","PaleGreen","GreenKhaki","LightBrown","LightSalmon",
-"SpringGreen","PaleGreen","MediumOlive","YellowBrown","LightGold",
-"LightGreen","LightGreen","LightGreen","GreenYellow","PaleYellow",
-"HalfBlue","DarkSky","HalfMagenta","VioletRed","DeepPink",
-"SteelBlue","SkyBlue","Orchid","LightHotPink","HotPink",
-"SeaGreen","SlateGray","MediumGrey","Burlywood","LightPink",
-"SpringGreen","Aquamarine","PaleGreen","Khaki","PaleOrange",
-"SpringGreen","SeaGreen","PaleGreen","PaleWhite","YellowWhite",
-"LightBlue","Purple","MediumOrchid","Magenta","Magenta",
-"RoyalBlue","SlateBlue","MediumOrchid","Orchid","Magenta",
-"DeepSkyBlue","LightSteelBlue","LightSkyBlue","Violet","LightPink",
-"Cyan","DarkTurquoise","SkyBlue","Grey","Snow",
-"Mint","Mint","Aquamarine","MintCream","Ivory",
-"Blue","Blue","DarkMagenta","DarkOrchid","Magenta",
-"SkyBlue","RoyalBlue","LightSlateBlue","MediumOrchid","Magenta",
-"DodgerBlue","SteelBlue","MediumPurple","PalePurple","Plum",
-"DeepSkyBlue","PaleBlue","LightSkyBlue","PalePurple","Thistle",
-"Cyan","ColdBlue","PaleTurquoise","GhostWhite","White"
+"Black", "DarkRed", "HalfRed", "Red", "Red",
+"DarkGreen", "DarkOlive", "Brown", "Chocolate", "OrangeRed",
+"HalfGreen", "GreenOlive", "DryOlive", "Goldenrod", "DarkOrange",
+"LightGreen", "Chartreuse", "YellowGreen", "Yellow", "Gold",
+"Green", "LawnGreen", "GreenYellow", "LightOlive", "Yellow",
+"DarkBlue", "DarkPurple", "HotPink", "VioletPink", "RedPink",
+"SlateGray", "DarkGrey", "PalePurple", "IndianRed", "Tomato",
+"SeaGreen", "PaleGreen", "GreenKhaki", "LightBrown", "LightSalmon",
+"SpringGreen", "PaleGreen", "MediumOlive", "YellowBrown", "LightGold",
+"LightGreen", "LightGreen", "LightGreen", "GreenYellow", "PaleYellow",
+"HalfBlue", "DarkSky", "HalfMagenta", "VioletRed", "DeepPink",
+"SteelBlue", "SkyBlue", "Orchid", "LightHotPink", "HotPink",
+"SeaGreen", "SlateGray", "MediumGrey", "Burlywood", "LightPink",
+"SpringGreen", "Aquamarine", "PaleGreen", "Khaki", "PaleOrange",
+"SpringGreen", "SeaGreen", "PaleGreen", "PaleWhite", "YellowWhite",
+"LightBlue", "Purple", "MediumOrchid", "Magenta", "Magenta",
+"RoyalBlue", "SlateBlue", "MediumOrchid", "Orchid", "Magenta",
+"DeepSkyBlue", "LightSteelBlue", "LightSkyBlue", "Violet", "LightPink",
+"Cyan", "DarkTurquoise", "SkyBlue", "Grey", "Snow",
+"Mint", "Mint", "Aquamarine", "MintCream", "Ivory",
+"Blue", "Blue", "DarkMagenta", "DarkOrchid", "Magenta",
+"SkyBlue", "RoyalBlue", "LightSlateBlue", "MediumOrchid", "Magenta",
+"DodgerBlue", "SteelBlue", "MediumPurple", "PalePurple", "Plum",
+"DeepSkyBlue", "PaleBlue", "LightSkyBlue", "PalePurple", "Thistle",
+"Cyan", "ColdBlue", "PaleTurquoise", "GhostWhite", "White"
};
void automatname(Material *ma)
@@ -1316,13 +1316,13 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
break;
case MA_RAMP_HUE:
{
- float rH,rS,rV;
- float colH,colS,colV;
- float tmpr,tmpg,tmpb;
- rgb_to_hsv(col[0],col[1],col[2],&colH,&colS,&colV);
+ float rH, rS, rV;
+ float colH, colS, colV;
+ float tmpr, tmpg, tmpb;
+ rgb_to_hsv(col[0], col[1], col[2], &colH, &colS, &colV);
if (colS != 0) {
- rgb_to_hsv(r_col[0],r_col[1],r_col[2],&rH,&rS,&rV);
- hsv_to_rgb( colH , rS, rV, &tmpr, &tmpg, &tmpb);
+ rgb_to_hsv(r_col[0], r_col[1], r_col[2], &rH, &rS, &rV);
+ hsv_to_rgb(colH, rS, rV, &tmpr, &tmpg, &tmpb);
r_col[0] = facm*(r_col[0]) + fac*tmpr;
r_col[1] = facm*(r_col[1]) + fac*tmpg;
r_col[2] = facm*(r_col[2]) + fac*tmpb;
@@ -1331,33 +1331,33 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
break;
case MA_RAMP_SAT:
{
- float rH,rS,rV;
- float colH,colS,colV;
- rgb_to_hsv(r_col[0],r_col[1],r_col[2],&rH,&rS,&rV);
+ float rH, rS, rV;
+ float colH, colS, colV;
+ rgb_to_hsv(r_col[0], r_col[1], r_col[2], &rH, &rS, &rV);
if (rS != 0) {
- rgb_to_hsv(col[0],col[1],col[2],&colH,&colS,&colV);
- hsv_to_rgb( rH, (facm*rS +fac*colS), rV, r_col+0, r_col+1, r_col+2);
+ rgb_to_hsv(col[0], col[1], col[2], &colH, &colS, &colV);
+ hsv_to_rgb(rH, (facm*rS +fac*colS), rV, r_col+0, r_col+1, r_col+2);
}
}
break;
case MA_RAMP_VAL:
{
- float rH,rS,rV;
- float colH,colS,colV;
- rgb_to_hsv(r_col[0],r_col[1],r_col[2],&rH,&rS,&rV);
- rgb_to_hsv(col[0],col[1],col[2],&colH,&colS,&colV);
- hsv_to_rgb( rH, rS, (facm*rV +fac*colV), r_col+0, r_col+1, r_col+2);
+ float rH, rS, rV;
+ float colH, colS, colV;
+ rgb_to_hsv(r_col[0], r_col[1], r_col[2], &rH, &rS, &rV);
+ rgb_to_hsv(col[0], col[1], col[2], &colH, &colS, &colV);
+ hsv_to_rgb(rH, rS, (facm*rV +fac*colV), r_col+0, r_col+1, r_col+2);
}
break;
case MA_RAMP_COLOR:
{
- float rH,rS,rV;
- float colH,colS,colV;
- float tmpr,tmpg,tmpb;
- rgb_to_hsv(col[0],col[1],col[2],&colH,&colS,&colV);
+ float rH, rS, rV;
+ float colH, colS, colV;
+ float tmpr, tmpg, tmpb;
+ rgb_to_hsv(col[0], col[1], col[2], &colH, &colS, &colV);
if (colS != 0) {
- rgb_to_hsv(r_col[0],r_col[1],r_col[2],&rH,&rS,&rV);
- hsv_to_rgb( colH, colS, rV, &tmpr, &tmpg, &tmpb);
+ rgb_to_hsv(r_col[0], r_col[1], r_col[2], &rH, &rS, &rV);
+ hsv_to_rgb(colH, colS, rV, &tmpr, &tmpg, &tmpb);
r_col[0] = facm*(r_col[0]) + fac*tmpr;
r_col[1] = facm*(r_col[1]) + fac*tmpg;
r_col[2] = facm*(r_col[2]) + fac*tmpb;
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index c06d796d562..8b2e66812c7 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -65,6 +65,106 @@
#include "BKE_object.h"
#include "BKE_material.h"
+/* Data types */
+
+typedef struct point { /* a three-dimensional point */
+ float x, y, z; /* its coordinates */
+} MB_POINT;
+
+typedef struct vertex { /* surface vertex */
+ MB_POINT position, normal; /* position and surface normal */
+} VERTEX;
+
+typedef struct vertices { /* list of vertices in polygonization */
+ int count, max; /* # vertices, max # allowed */
+ VERTEX *ptr; /* dynamically allocated */
+} VERTICES;
+
+typedef struct corner { /* corner of a cube */
+ int i, j, k; /* (i, j, k) is index within lattice */
+ float x, y, z, value; /* location and function value */
+ struct corner *next;
+} CORNER;
+
+typedef struct cube { /* partitioning cell (cube) */
+ int i, j, k; /* lattice location of cube */
+ CORNER *corners[8]; /* eight corners */
+} CUBE;
+
+typedef struct cubes { /* linked list of cubes acting as stack */
+ CUBE cube; /* a single cube */
+ struct cubes *next; /* remaining elements */
+} CUBES;
+
+typedef struct centerlist { /* list of cube locations */
+ int i, j, k; /* cube location */
+ struct centerlist *next; /* remaining elements */
+} CENTERLIST;
+
+typedef struct edgelist { /* list of edges */
+ int i1, j1, k1, i2, j2, k2; /* edge corner ids */
+ int vid; /* vertex id */
+ struct edgelist *next; /* remaining elements */
+} EDGELIST;
+
+typedef struct intlist { /* list of integers */
+ int i; /* an integer */
+ struct intlist *next; /* remaining elements */
+} INTLIST;
+
+typedef struct intlists { /* list of list of integers */
+ INTLIST *list; /* a list of integers */
+ struct intlists *next; /* remaining elements */
+} INTLISTS;
+
+typedef struct process { /* parameters, function, storage */
+ /* what happens here? floats, I think. */
+ /* float (*function)(void); */ /* implicit surface function */
+ float (*function)(float, float, float);
+ float size, delta; /* cube size, normal delta */
+ int bounds; /* cube range within lattice */
+ CUBES *cubes; /* active cubes */
+ VERTICES vertices; /* surface vertices */
+ CENTERLIST **centers; /* cube center hash table */
+ CORNER **corners; /* corner value hash table */
+ EDGELIST **edges; /* edge and vertex id hash table */
+} PROCESS;
+
+/* dividing scene using octal tree makes polygonisation faster */
+typedef struct ml_pointer {
+ struct ml_pointer *next, *prev;
+ struct MetaElem *ml;
+} ml_pointer;
+
+typedef struct octal_node {
+ struct octal_node *nodes[8]; /* children of current node */
+ struct octal_node *parent; /* parent of current node */
+ struct ListBase elems; /* ListBase of MetaElem pointers (ml_pointer) */
+ float x_min, y_min, z_min; /* 1st border point */
+ float x_max, y_max, z_max; /* 7th border point */
+ float x, y, z; /* center of node */
+ int pos, neg; /* number of positive and negative MetaElements in the node */
+ int count; /* number of MetaElems, which belongs to the node */
+} octal_node;
+
+typedef struct octal_tree {
+ struct octal_node *first; /* first node */
+ int pos, neg; /* number of positive and negative MetaElements in the scene */
+ short depth; /* number of scene subdivision */
+} octal_tree;
+
+struct pgn_elements {
+ struct pgn_elements *next, *prev;
+ char *data;
+};
+
+/* Forward declarations */
+static int vertid(CORNER *c1, CORNER *c2, PROCESS *p, MetaBall *mb);
+static int setcenter(CENTERLIST *table[], int i, int j, int k);
+static CORNER *setcorner(PROCESS* p, int i, int j, int k);
+static void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
+ float (*function)(float, float, float), MB_POINT *p, MetaBall *mb, int f);
+
/* Global variables */
static float thresh= 0.6f;
@@ -73,7 +173,7 @@ static MetaElem **mainb;
static octal_tree *metaball_tree = NULL;
/* Functions */
-void unlink_mball(MetaBall *mb)
+void BKE_metaball_unlink(MetaBall *mb)
{
int a;
@@ -85,9 +185,9 @@ void unlink_mball(MetaBall *mb)
/* do not free mball itself */
-void free_mball(MetaBall *mb)
+void BKE_metaball_free(MetaBall *mb)
{
- unlink_mball(mb);
+ BKE_metaball_unlink(mb);
if (mb->adt) {
BKE_free_animdata((ID *)mb);
@@ -99,7 +199,7 @@ void free_mball(MetaBall *mb)
if (mb->disp.first) freedisplist(&mb->disp);
}
-MetaBall *add_mball(const char *name)
+MetaBall *BKE_metaball_add(const char *name)
{
MetaBall *mb;
@@ -115,7 +215,7 @@ MetaBall *add_mball(const char *name)
return mb;
}
-MetaBall *copy_mball(MetaBall *mb)
+MetaBall *BKE_metaball_copy(MetaBall *mb)
{
MetaBall *mbn;
int a;
@@ -143,7 +243,7 @@ static void extern_local_mball(MetaBall *mb)
}
}
-void make_local_mball(MetaBall *mb)
+void BKE_metaball_make_local(MetaBall *mb)
{
Main *bmain= G.main;
Object *ob;
@@ -174,7 +274,7 @@ void make_local_mball(MetaBall *mb)
extern_local_mball(mb);
}
else if (is_local && is_lib) {
- MetaBall *mb_new= copy_mball(mb);
+ MetaBall *mb_new= BKE_metaball_copy(mb);
mb_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
@@ -194,7 +294,7 @@ void make_local_mball(MetaBall *mb)
/* most simple meta-element adding function
* don't do context manipulation here (rna uses) */
-MetaElem *add_metaball_element(MetaBall *mb, const int type)
+MetaElem *BKE_metaball_element_add(MetaBall *mb, const int type)
{
MetaElem *ml= MEM_callocN(sizeof(MetaElem), "metaelem");
@@ -204,7 +304,7 @@ MetaElem *add_metaball_element(MetaBall *mb, const int type)
ml->s= 2.0;
ml->flag= MB_SCALE_RAD;
- switch(type) {
+ switch (type) {
case MB_BALL:
ml->type = MB_BALL;
ml->expx= ml->expy= ml->expz= 1.0;
@@ -246,7 +346,7 @@ MetaElem *add_metaball_element(MetaBall *mb, const int type)
* basic MetaBall (usually with name Meta). All other MetaBalls (with
* names Meta.001, Meta.002, etc) are included in this Bounding Box.
*/
-void tex_space_mball(Object *ob)
+void BKE_metaball_tex_space_calc(Object *ob)
{
DispList *dl;
BoundBox *bb;
@@ -290,7 +390,7 @@ void tex_space_mball(Object *ob)
boundbox_set_from_min_max(bb, min, max);
}
-float *make_orco_mball(Object *ob, ListBase *dispbase)
+float *BKE_metaball_make_orco(Object *ob, ListBase *dispbase)
{
BoundBox *bb;
DispList *dl;
@@ -342,7 +442,7 @@ float *make_orco_mball(Object *ob, ListBase *dispbase)
* It test last character of Object ID name. If last character
* is digit it return 0, else it return 1.
*/
-int is_basis_mball(Object *ob)
+int BKE_metaball_is_basis(Object *ob)
{
int len;
@@ -353,7 +453,7 @@ int is_basis_mball(Object *ob)
}
/* return nonzero if ob1 is a basis mball for ob */
-int is_mball_basis_for (Object *ob1, Object *ob2)
+int BKE_metaball_is_basis_for(Object *ob1, Object *ob2)
{
int basis1nr, basis2nr;
char basis1name[MAX_ID_NAME], basis2name[MAX_ID_NAME];
@@ -361,7 +461,7 @@ int is_mball_basis_for (Object *ob1, Object *ob2)
BLI_split_name_num(basis1name, &basis1nr, ob1->id.name+2, '.');
BLI_split_name_num(basis2name, &basis2nr, ob2->id.name+2, '.');
- if (!strcmp(basis1name, basis2name)) return is_basis_mball(ob1);
+ if (!strcmp(basis1name, basis2name)) return BKE_metaball_is_basis(ob1);
else return 0;
}
@@ -371,7 +471,7 @@ int is_mball_basis_for (Object *ob1, Object *ob2)
* are copied to all metaballs in same "group" (metaballs with same base name: MBall,
* MBall.001, MBall.002, etc). The most important is to copy properties to the base metaball,
* because this metaball influence polygonisation of metaballs. */
-void copy_mball_properties(Scene *scene, Object *active_object)
+void BKE_metaball_properties_copy(Scene *scene, Object *active_object)
{
Scene *sce_iter= scene;
Base *base;
@@ -416,11 +516,11 @@ void copy_mball_properties(Scene *scene, Object *active_object)
*
* warning!, is_basis_mball() can fail on returned object, see long note above.
*/
-Object *find_basis_mball(Scene *scene, Object *basis)
+Object *BKE_metaball_basis_find(Scene *scene, Object *basis)
{
Scene *sce_iter= scene;
Base *base;
- Object *ob,*bob= basis;
+ Object *ob, *bob= basis;
MetaElem *ml=NULL;
int basisnr, obnr;
char basisname[MAX_ID_NAME], obname[MAX_ID_NAME];
@@ -514,22 +614,22 @@ Object *find_basis_mball(Scene *scene, Object *basis)
#define HASHBIT (5)
#define HASHSIZE (size_t)(1<<(3*HASHBIT)) /*! < hash table size (32768) */
-#define HASH(i,j,k) ((((( (i) & 31)<<5) | ( (j) & 31))<<5 ) | ( (k) & 31) )
+#define HASH(i, j, k) ((((( (i) & 31)<<5) | ( (j) & 31))<<5 ) | ( (k) & 31) )
#define MB_BIT(i, bit) (((i)>>(bit))&1)
-#define FLIP(i,bit) ((i)^1<<(bit)) /* flip the given bit of i */
+#define FLIP(i, bit) ((i)^1<<(bit)) /* flip the given bit of i */
/* **************** POLYGONIZATION ************************ */
-void calc_mballco(MetaElem *ml, float vec[3])
+static void calc_mballco(MetaElem *ml, float vec[3])
{
if (ml->mat) {
mul_m4_v3((float (*)[4])ml->mat, vec);
}
}
-float densfunc(MetaElem *ball, float x, float y, float z)
+static float densfunc(MetaElem *ball, float x, float y, float z)
{
float dist2 = 0.0, dx, dy, dz;
float vec[3];
@@ -605,7 +705,7 @@ float densfunc(MetaElem *ball, float x, float y, float z)
}
}
-octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z, short depth)
+static octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z, short depth)
{
if (!depth) return node;
@@ -613,13 +713,13 @@ octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z
if (y < node->y) {
if (x < node->x) {
if (node->nodes[0])
- return find_metaball_octal_node(node->nodes[0],x,y,z,depth--);
+ return find_metaball_octal_node(node->nodes[0], x, y, z, depth--);
else
return node;
}
else {
if (node->nodes[1])
- return find_metaball_octal_node(node->nodes[1],x,y,z,depth--);
+ return find_metaball_octal_node(node->nodes[1], x, y, z, depth--);
else
return node;
}
@@ -627,13 +727,13 @@ octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z
else {
if (x < node->x) {
if (node->nodes[3])
- return find_metaball_octal_node(node->nodes[3],x,y,z,depth--);
+ return find_metaball_octal_node(node->nodes[3], x, y, z, depth--);
else
return node;
}
else {
if (node->nodes[2])
- return find_metaball_octal_node(node->nodes[2],x,y,z,depth--);
+ return find_metaball_octal_node(node->nodes[2], x, y, z, depth--);
else
return node;
}
@@ -643,13 +743,13 @@ octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z
if (y < node->y) {
if (x < node->x) {
if (node->nodes[4])
- return find_metaball_octal_node(node->nodes[4],x,y,z,depth--);
+ return find_metaball_octal_node(node->nodes[4], x, y, z, depth--);
else
return node;
}
else {
if (node->nodes[5])
- return find_metaball_octal_node(node->nodes[5],x,y,z,depth--);
+ return find_metaball_octal_node(node->nodes[5], x, y, z, depth--);
else
return node;
}
@@ -657,13 +757,13 @@ octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z
else {
if (x < node->x) {
if (node->nodes[7])
- return find_metaball_octal_node(node->nodes[7],x,y,z,depth--);
+ return find_metaball_octal_node(node->nodes[7], x, y, z, depth--);
else
return node;
}
else {
if (node->nodes[6])
- return find_metaball_octal_node(node->nodes[6],x,y,z,depth--);
+ return find_metaball_octal_node(node->nodes[6], x, y, z, depth--);
else
return node;
}
@@ -673,7 +773,7 @@ octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z
return node;
}
-float metaball(float x, float y, float z)
+static float metaball(float x, float y, float z)
/* float x, y, z; */
{
struct octal_node *node;
@@ -713,7 +813,7 @@ static int *indices=NULL;
static int totindex, curindex;
-void accum_mballfaces(int i1, int i2, int i3, int i4)
+static void accum_mballfaces(int i1, int i2, int i3, int i4)
{
int *newi, *cur;
/* static int i=0; I would like to delete altogether, but I don't dare to, yet */
@@ -746,7 +846,7 @@ void accum_mballfaces(int i1, int i2, int i3, int i4)
}
/* ******************* MEMORY MANAGEMENT *********************** */
-void *new_pgn_element(int size)
+static void *new_pgn_element(int size)
{
/* during polygonize 1000s of elements are allocated
* and never freed in between. Freeing only done at the end.
@@ -781,7 +881,7 @@ void *new_pgn_element(int size)
}
}
- cur= MEM_callocN( sizeof(struct pgn_elements), "newpgn");
+ cur= MEM_callocN(sizeof(struct pgn_elements), "newpgn");
cur->data= MEM_callocN(blocksize, "newpgn");
BLI_addtail(&lb, cur);
@@ -789,7 +889,7 @@ void *new_pgn_element(int size)
return cur->data;
}
-void freepolygonize(PROCESS *p)
+static void freepolygonize(PROCESS *p)
{
MEM_freeN(p->corners);
MEM_freeN(p->edges);
@@ -819,9 +919,9 @@ static INTLISTS *cubetable[256];
/* edge: LB, LT, LN, LF, RB, RT, RN, RF, BN, BF, TN, TF */
static int corner1[12] = {
- LBN,LTN,LBN,LBF,RBN,RTN,RBN,RBF,LBN,LBF,LTN,LTF};
+ LBN, LTN, LBN, LBF, RBN, RTN, RBN, RBF, LBN, LBF, LTN, LTF};
static int corner2[12] = {
- LBF,LTF,LTN,LTF,RBF,RTF,RTN,RTF,RBN,RBF,RTN,RTF};
+ LBF, LTF, LTN, LTF, RBF, RTF, RTN, RTF, RBN, RBF, RTN, RTF};
static int leftface[12] = {
B, L, L, F, R, T, N, R, N, B, T, F};
/* face on left when going corner1 to corner2 */
@@ -832,7 +932,7 @@ static int rightface[12] = {
/* docube: triangulate the cube directly, without decomposition */
-void docube(CUBE *cube, PROCESS *p, MetaBall *mb)
+static void docube(CUBE *cube, PROCESS *p, MetaBall *mb)
{
INTLISTS *polys;
CORNER *c1, *c2;
@@ -853,7 +953,7 @@ void docube(CUBE *cube, PROCESS *p, MetaBall *mb)
count++;
}
if (count>2) {
- switch(count) {
+ switch (count) {
case 3:
accum_mballfaces(indexar[2], indexar[1], indexar[0], 0);
break;
@@ -900,7 +1000,7 @@ void docube(CUBE *cube, PROCESS *p, MetaBall *mb)
* if surface crosses face, compute other four corners of adjacent cube
* and add new cube to cube stack */
-void testface(int i, int j, int k, CUBE* old, int bit, int c1, int c2, int c3, int c4, PROCESS *p)
+static void testface(int i, int j, int k, CUBE* old, int bit, int c1, int c2, int c3, int c4, PROCESS *p)
{
CUBE newc;
CUBES *oldcubes = p->cubes;
@@ -951,7 +1051,7 @@ void testface(int i, int j, int k, CUBE* old, int bit, int c1, int c2, int c3, i
/* setcorner: return corner with the given lattice location
* set (and cache) its function value */
-CORNER *setcorner (PROCESS* p, int i, int j, int k)
+static CORNER *setcorner (PROCESS* p, int i, int j, int k)
{
/* for speed, do corner value caching here */
CORNER *c;
@@ -986,7 +1086,7 @@ CORNER *setcorner (PROCESS* p, int i, int j, int k)
/* nextcwedge: return next clockwise edge from given edge around given face */
-int nextcwedge (int edge, int face)
+static int nextcwedge (int edge, int face)
{
switch (edge) {
case LB:
@@ -1020,7 +1120,7 @@ int nextcwedge (int edge, int face)
/* otherface: return face adjoining edge that is not the given face */
-int otherface (int edge, int face)
+static int otherface (int edge, int face)
{
int other = leftface[edge];
return face == other? rightface[edge] : other;
@@ -1029,7 +1129,7 @@ int otherface (int edge, int face)
/* makecubetable: create the 256 entry table for cubical polygonization */
-void makecubetable (void)
+static void makecubetable (void)
{
static int isdone= 0;
int i, e, c, done[12], pos[8];
@@ -1070,7 +1170,7 @@ void makecubetable (void)
}
}
-void BKE_freecubetable(void)
+void BKE_metaball_cubeTable_free(void)
{
int i;
INTLISTS *lists, *nlists;
@@ -1097,10 +1197,10 @@ void BKE_freecubetable(void)
/**** Storage ****/
-/* setcenter: set (i,j,k) entry of table[]
+/* setcenter: set (i, j, k) entry of table[]
* return 1 if already set; otherwise, set and return 0 */
-int setcenter(CENTERLIST *table[], int i, int j, int k)
+static int setcenter(CENTERLIST *table[], int i, int j, int k)
{
int index;
CENTERLIST *newc, *l, *q;
@@ -1125,7 +1225,7 @@ int setcenter(CENTERLIST *table[], int i, int j, int k)
/* setedge: set vertex id for edge */
-void setedge (EDGELIST *table[],
+static void setedge (EDGELIST *table[],
int i1, int j1,
int k1, int i2,
int j2, int k2,
@@ -1161,7 +1261,7 @@ void setedge (EDGELIST *table[],
/* getedge: return vertex id for edge; return -1 if not set */
-int getedge (EDGELIST *table[],
+static int getedge (EDGELIST *table[],
int i1, int j1, int k1,
int i2, int j2, int k2)
{
@@ -1179,10 +1279,13 @@ int getedge (EDGELIST *table[],
k2=t;
}
q = table[HASH(i1, j1, k1)+HASH(i2, j2, k2)];
- for (; q != NULL; q = q->next)
+ for (; q != NULL; q = q->next) {
if (q->i1 == i1 && q->j1 == j1 && q->k1 == k1 &&
q->i2 == i2 && q->j2 == j2 && q->k2 == k2)
+ {
return q->vid;
+ }
+ }
return -1;
}
@@ -1199,7 +1302,7 @@ int getedge (EDGELIST *table[],
/* addtovertices: add v to sequence of vertices */
-void addtovertices (VERTICES *vertices, VERTEX v)
+static void addtovertices (VERTICES *vertices, VERTEX v)
{
if (vertices->count == vertices->max) {
int i;
@@ -1217,7 +1320,7 @@ void addtovertices (VERTICES *vertices, VERTEX v)
/* vnormal: compute unit length surface normal at point */
-void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v)
+static void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v)
{
float delta= 0.2f*p->delta;
float f = p->function(point->x, point->y, point->z);
@@ -1267,7 +1370,7 @@ void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v)
}
-int vertid (CORNER *c1, CORNER *c2, PROCESS *p, MetaBall *mb)
+static int vertid (CORNER *c1, CORNER *c2, PROCESS *p, MetaBall *mb)
{
VERTEX v;
MB_POINT a, b;
@@ -1296,13 +1399,13 @@ int vertid (CORNER *c1, CORNER *c2, PROCESS *p, MetaBall *mb)
/* converge: from two points of differing sign, converge to zero crossing */
/* watch it: p1 and p2 are used to calculate */
-void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
+static void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
float (*function)(float, float, float), MB_POINT *p, MetaBall *mb, int f)
{
int i = 0;
MB_POINT pos, neg;
float positive = 0.0f, negative = 0.0f;
- float dx = 0.0f ,dy = 0.0f ,dz = 0.0f;
+ float dx = 0.0f, dy = 0.0f, dz = 0.0f;
if (v1 < 0) {
pos= *p2;
@@ -1350,7 +1453,7 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
while (1) {
if (i++ == RES) return;
p->x = 0.5f*(pos.x + neg.x);
- if ((function(p->x,p->y,p->z)) > 0.0f) pos.x = p->x; else neg.x = p->x;
+ if ((function(p->x, p->y, p->z)) > 0.0f) pos.x = p->x; else neg.x = p->x;
}
}
@@ -1360,7 +1463,7 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
while (1) {
if (i++ == RES) return;
p->y = 0.5f*(pos.y + neg.y);
- if ((function(p->x,p->y,p->z)) > 0.0f) pos.y = p->y; else neg.y = p->y;
+ if ((function(p->x, p->y, p->z)) > 0.0f) pos.y = p->y; else neg.y = p->y;
}
}
@@ -1370,7 +1473,7 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
while (1) {
if (i++ == RES) return;
p->z = 0.5f*(pos.z + neg.z);
- if ((function(p->x,p->y,p->z)) > 0.0f) pos.z = p->z; else neg.z = p->z;
+ if ((function(p->x, p->y, p->z)) > 0.0f) pos.z = p->z; else neg.z = p->z;
}
}
@@ -1396,7 +1499,7 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
}
/* ************************************** */
-void add_cube(PROCESS *mbproc, int i, int j, int k, int count)
+static void add_cube(PROCESS *mbproc, int i, int j, int k, int count)
{
CUBES *ncube;
int n;
@@ -1420,18 +1523,18 @@ void add_cube(PROCESS *mbproc, int i, int j, int k, int count)
/* set corners of initial cube: */
for (n = 0; n < 8; n++)
- ncube->cube.corners[n] = setcorner(mbproc, a+MB_BIT(n,2), b+MB_BIT(n,1), c+MB_BIT(n,0));
+ ncube->cube.corners[n] = setcorner(mbproc, a+MB_BIT(n, 2), b+MB_BIT(n, 1), c+MB_BIT(n, 0));
}
}
}
-void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
+static void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
{
MB_POINT IN, in, OUT, out; /*point;*/
MetaElem *ml;
int i, j, k, c_i, c_j, c_k;
- int index[3]={1,0,-1};
+ int index[3]={1, 0, -1};
float f =0.0f;
float in_v /*, out_v*/;
MB_POINT workp;
@@ -1507,7 +1610,7 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
ny = abs((out.y - in.y)/mbproc->size);
nz = abs((out.z - in.z)/mbproc->size);
- MAXN = MAX3(nx,ny,nz);
+ MAXN = MAX3(nx, ny, nz);
if (MAXN!=0.0f) {
dx = (out.x - in.x)/MAXN;
dy = (out.y - in.y)/MAXN;
@@ -1546,7 +1649,7 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
}
}
-void polygonize(PROCESS *mbproc, MetaBall *mb)
+static void polygonize(PROCESS *mbproc, MetaBall *mb)
{
CUBE c;
int a;
@@ -1586,7 +1689,7 @@ void polygonize(PROCESS *mbproc, MetaBall *mb)
}
}
-float init_meta(Scene *scene, Object *ob) /* return totsize */
+static float init_meta(Scene *scene, Object *ob) /* return totsize */
{
Scene *sce_iter= scene;
Base *base;
@@ -1671,7 +1774,7 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
if (ml->s > 10.0f) ml->s = 10.0f;
/* Rotation of MetaElem is stored in quat */
- quat_to_mat4( temp3,ml->quat);
+ quat_to_mat4(temp3, ml->quat);
/* Translation of MetaElem */
unit_m4(temp2);
@@ -1695,7 +1798,7 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
/* MetaBall transformation */
mult_m4_m4m4(mat, temp2, temp1);
- invert_m4_m4(imat,mat);
+ invert_m4_m4(imat, mat);
mainb[a]->rad2= ml->rad*ml->rad;
@@ -1781,11 +1884,11 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
calc_mballco(mainb[a], vec);
- size= fabsf( vec[0] );
+ size= fabsf(vec[0]);
if ( size > totsize ) totsize= size;
- size= fabsf( vec[1] );
+ size= fabsf(vec[1]);
if ( size > totsize ) totsize= size;
- size= fabsf( vec[2] );
+ size= fabsf(vec[2]);
if ( size > totsize ) totsize= size;
vec[0]= mainb[a]->x - mainb[a]->rad;
@@ -1794,11 +1897,11 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
calc_mballco(mainb[a], vec);
- size= fabsf( vec[0] );
+ size= fabsf(vec[0]);
if ( size > totsize ) totsize= size;
- size= fabsf( vec[1] );
+ size= fabsf(vec[1]);
if ( size > totsize ) totsize= size;
- size= fabsf( vec[2] );
+ size= fabsf(vec[2]);
if ( size > totsize ) totsize= size;
}
@@ -1812,7 +1915,7 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
/* if MetaElem lies in node, then node includes MetaElem pointer (ml_p)
* pointing at MetaElem (ml)
*/
-void fill_metaball_octal_node(octal_node *node, MetaElem *ml, short i)
+static void fill_metaball_octal_node(octal_node *node, MetaElem *ml, short i)
{
ml_pointer *ml_p;
@@ -1844,16 +1947,16 @@ void fill_metaball_octal_node(octal_node *node, MetaElem *ml, short i)
* +------+------+
*
*/
-void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y, float size_z, short depth)
+static void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y, float size_z, short depth)
{
MetaElem *ml;
ml_pointer *ml_p;
- float x,y,z;
- int a,i;
+ float x, y, z;
+ int a, i;
/* create new nodes */
for (a=0;a<8;a++) {
- node->nodes[a]= MEM_mallocN(sizeof(octal_node),"octal_node");
+ node->nodes[a]= MEM_mallocN(sizeof(octal_node), "octal_node");
for (i=0;i<8;i++)
node->nodes[a]->nodes[i]= NULL;
node->nodes[a]->parent= node;
@@ -2101,7 +2204,7 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y,
}
/* free all octal nodes recursively */
-void free_metaball_octal_node(octal_node *node)
+static void free_metaball_octal_node(octal_node *node)
{
int a;
for (a=0;a<8;a++) {
@@ -2112,7 +2215,7 @@ void free_metaball_octal_node(octal_node *node)
}
/* If scene include more then one MetaElem, then octree is used */
-void init_metaball_octal_tree(int depth)
+static void init_metaball_octal_tree(int depth)
{
struct octal_node *node;
ml_pointer *ml_p;
@@ -2170,7 +2273,7 @@ void init_metaball_octal_tree(int depth)
subdivide_metaball_octal_node(node, size[0], size[1], size[2], metaball_tree->depth);
}
-void metaball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
+void BKE_metaball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
{
PROCESS mbproc;
MetaBall *mb;
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 59dd7db43da..c7f6bf93831 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -128,18 +128,22 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
CustomDataLayer *l1, *l2;
int i, i1=0, i2=0, tot, j;
- for (i=0; i<c1->totlayer; i++) {
- if (ELEM7(c1->layers[i].type, CD_MVERT, CD_MEDGE, CD_MPOLY,
- CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT))
+ for (i = 0; i < c1->totlayer; i++) {
+ if (ELEM7(c1->layers[i].type, CD_MVERT, CD_MEDGE, CD_MPOLY,
+ CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT))
+ {
i1++;
+ }
}
-
- for (i=0; i<c2->totlayer; i++) {
- if (ELEM7(c2->layers[i].type, CD_MVERT, CD_MEDGE, CD_MPOLY,
- CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT))
+
+ for (i = 0; i < c2->totlayer; i++) {
+ if (ELEM7(c2->layers[i].type, CD_MVERT, CD_MEDGE, CD_MPOLY,
+ CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT))
+ {
i2++;
+ }
}
-
+
if (i1 != i2)
return MESHCMP_CDLAYERS_MISMATCH;
@@ -148,12 +152,16 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
i1 = 0; i2 = 0;
for (i=0; i < tot; i++) {
while (i1 < c1->totlayer && !ELEM7(l1->type, CD_MVERT, CD_MEDGE, CD_MPOLY,
- CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT))
+ CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT))
+ {
i1++, l1++;
+ }
- while (i2 < c2->totlayer && !ELEM7(l2->type, CD_MVERT, CD_MEDGE, CD_MPOLY,
- CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT))
+ while (i2 < c2->totlayer && !ELEM7(l2->type, CD_MVERT, CD_MEDGE, CD_MPOLY,
+ CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT))
+ {
i2++, l2++;
+ }
if (l1->type == CD_MVERT) {
MVert *v1 = l1->data;
@@ -1608,7 +1616,7 @@ void mesh_to_curve(Scene *scene, Object *ob)
BLI_edgehash_free(eh, NULL);
if (edges.first) {
- Curve *cu = add_curve(ob->id.name+2, OB_CURVE);
+ Curve *cu = BKE_curve_add(ob->id.name+2, OB_CURVE);
cu->flag |= CU_3D;
while (edges.first) {
@@ -1867,8 +1875,8 @@ void mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpolys,
BLI_array_empty(vertcos);
BLI_array_empty(vertnos);
- BLI_array_growitems(vertcos, mp->totloop);
- BLI_array_growitems(vertnos, mp->totloop);
+ BLI_array_grow_items(vertcos, mp->totloop);
+ BLI_array_grow_items(vertnos, mp->totloop);
for (j=0; j < mp->totloop; j++) {
int vindex = ml[j].v;
@@ -1877,7 +1885,7 @@ void mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpolys,
}
BLI_array_empty(edgevecbuf);
- BLI_array_growitems(edgevecbuf, mp->totloop);
+ BLI_array_grow_items(edgevecbuf, mp->totloop);
accumulate_vertex_normals_poly(vertnos, pnors[i], vertcos, edgevecbuf, mp->totloop);
}
@@ -2414,8 +2422,8 @@ int mesh_recalcTessellation(CustomData *fdata,
#ifdef USE_TESSFACE_SPEEDUP
#define ML_TO_MF(i1, i2, i3) \
- BLI_array_growone(mface_to_poly_map); \
- BLI_array_growone(mface); \
+ BLI_array_grow_one(mface_to_poly_map); \
+ BLI_array_grow_one(mface); \
mface_to_poly_map[mface_index] = poly_index; \
mf= &mface[mface_index]; \
/* set loop indices, transformed to vert indices later */ \
@@ -2433,8 +2441,8 @@ int mesh_recalcTessellation(CustomData *fdata,
/* ALMOST IDENTICAL TO DEFINE ABOVE (see EXCEPTION) */
#define ML_TO_MF_QUAD() \
- BLI_array_growone(mface_to_poly_map); \
- BLI_array_growone(mface); \
+ BLI_array_grow_one(mface_to_poly_map); \
+ BLI_array_grow_one(mface); \
mface_to_poly_map[mface_index] = poly_index; \
mf= &mface[mface_index]; \
/* set loop indices, transformed to vert indices later */ \
@@ -2492,10 +2500,10 @@ int mesh_recalcTessellation(CustomData *fdata,
totfilltri = BLI_edgefill(&sf_ctx, FALSE);
if (totfilltri) {
- BLI_array_growitems(mface_to_poly_map, totfilltri);
- BLI_array_growitems(mface, totfilltri);
+ BLI_array_grow_items(mface_to_poly_map, totfilltri);
+ BLI_array_grow_items(mface, totfilltri);
if (poly_orig_index) {
- BLI_array_growitems(mface_orig_index, totfilltri);
+ BLI_array_grow_items(mface_orig_index, totfilltri);
}
for (f = sf_ctx.fillfacebase.first; f; f = f->next, mf++) {
@@ -2664,7 +2672,7 @@ int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
k = 0;
for (i = 0; i<totpoly; i++, mp++) {
if (ELEM(mp->totloop, 3, 4)) {
- BLI_array_growone(mface);
+ BLI_array_grow_one(mface);
mf = &mface[k];
mf->mat_nr = mp->mat_nr;
@@ -3054,10 +3062,13 @@ void mesh_flush_hidden_from_verts(const MVert *mvert,
for (i = 0; i < totedge; i++) {
MEdge *e = &medge[i];
if (mvert[e->v1].flag & ME_HIDE ||
- mvert[e->v2].flag & ME_HIDE)
+ mvert[e->v2].flag & ME_HIDE)
+ {
e->flag |= ME_HIDE;
- else
+ }
+ else {
e->flag &= ~ME_HIDE;
+ }
}
for (i = 0; i < totpoly; i++) {
MPoly *p = &mpoly[i];
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 12aa6232cb0..98cbc957201 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -296,7 +296,7 @@ int modifiers_getCageIndex(struct Scene *scene, Object *ob, int *lastPossibleCag
}
/* Find the last modifier acting on the cage. */
- for (i=0; md; i++,md=md->next) {
+ for (i=0; md; i++, md=md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
md->scene= scene;
diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c
index 573b8a725b3..99bb3468320 100644
--- a/source/blender/blenkernel/intern/modifiers_bmesh.c
+++ b/source/blender/blenkernel/intern/modifiers_bmesh.c
@@ -117,8 +117,8 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
BLI_array_empty(verts);
BLI_array_empty(edges);
- BLI_array_growitems(verts, mp->totloop);
- BLI_array_growitems(edges, mp->totloop);
+ BLI_array_grow_items(verts, mp->totloop);
+ BLI_array_grow_items(edges, mp->totloop);
ml = mloop + mp->loopstart;
for (j = 0; j < mp->totloop; j++, ml++) {
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 9a640bcb8eb..14db68e434a 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -450,7 +450,7 @@ static MovieClip *movieclip_alloc(const char *name)
* otherwise creates new.
* does not load ibuf itself
* pass on optional frame for #name images */
-MovieClip *BKE_add_movieclip_file(const char *name)
+MovieClip *BKE_movieclip_file_add(const char *name)
{
MovieClip *clip;
MovieClipUser user;
@@ -462,7 +462,7 @@ MovieClip *BKE_add_movieclip_file(const char *name)
BLI_path_abs(str, G.main->name);
/* exists? */
- file = BLI_open(str, O_BINARY|O_RDONLY,0);
+ file = BLI_open(str, O_BINARY | O_RDONLY, 0);
if (file == -1)
return NULL;
close(file);
@@ -517,7 +517,7 @@ static void real_ibuf_size(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, in
*height = ibuf->y;
if (clip->flag & MCLIP_USE_PROXY) {
- switch(user->render_size) {
+ switch (user->render_size) {
case MCLIP_PROXY_RENDER_SIZE_25:
(*width) *= 4;
(*height) *= 4;
@@ -925,8 +925,8 @@ void BKE_movieclip_get_size(MovieClip *clip, MovieClipUser *user, int *width, in
real_ibuf_size(clip, user, ibuf, width, height);
}
else {
- *width = 0;
- *height = 0;
+ *width = clip->lastsize[0];
+ *height = clip->lastsize[1];
}
if (ibuf)
@@ -1149,14 +1149,14 @@ void BKE_movieclip_build_proxy_frame(MovieClip *clip, int clip_flag, struct Movi
}
}
-void free_movieclip(MovieClip *clip)
+void BKE_movieclip_free(MovieClip *clip)
{
free_buffers(clip);
BKE_tracking_free(&clip->tracking);
}
-void unlink_movieclip(Main *bmain, MovieClip *clip)
+void BKE_movieclip_unlink(Main *bmain, MovieClip *clip)
{
bScreen *scr;
ScrArea *area;
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 7580f2eee4d..f3901cec506 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -747,7 +747,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
copy_v3_v3(origco[i], me->mvert[i].co);
for (i = 0; i < me->totvert; ++i) {
- float avg_no[3] = {0,0,0}, center[3] = {0,0,0}, push[3];
+ float avg_no[3] = {0, 0, 0}, center[3] = {0, 0, 0}, push[3];
float dist;
int tot = 0;
@@ -835,7 +835,7 @@ static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl
MDisps *mdisps;
int lvl= mmd->totlvl;
- if (totlvl > multires_max_levels)
+ if ((totlvl > multires_max_levels) || (me->totpoly == 0))
return;
multires_force_update(ob);
@@ -942,7 +942,7 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm
MPoly *mpoly = me->mpoly;
MDisps *mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
int *gridOffset;
- int i, k, /*numGrids,*/ gridSize, dGridSize, dSkip;
+ int i, k, /*numGrids, */ gridSize, dGridSize, dSkip;
int totloop, totpoly;
/* this happens in the dm made by bmesh_mdisps_space_set */
@@ -1017,7 +1017,7 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm
column_vectors_to_mat3(mat, tx, ty, no);
- switch(op) {
+ switch (op) {
case APPLY_DISPLACEMENTS:
/* Convert displacement to object space
* and add to grid points */
@@ -1545,9 +1545,9 @@ void multires_free(Multires *mr)
}
static void create_old_vert_face_map(ListBase **map, IndexNode **mem, const MultiresFace *mface,
- const int totvert, const int totface)
+ const int totvert, const int totface)
{
- int i,j;
+ int i, j;
IndexNode *node = NULL;
(*map) = MEM_callocN(sizeof(ListBase) * totvert, "vert face map");
@@ -1566,7 +1566,7 @@ static void create_old_vert_face_map(ListBase **map, IndexNode **mem, const Mult
static void create_old_vert_edge_map(ListBase **map, IndexNode **mem, const MultiresEdge *medge,
const int totvert, const int totedge)
{
- int i,j;
+ int i, j;
IndexNode *node = NULL;
(*map) = MEM_callocN(sizeof(ListBase) * totvert, "vert edge map");
@@ -2043,7 +2043,7 @@ static void multires_apply_smat(Scene *scene, Object *ob, float smat[3][3])
/* MLoop *mloop = me->mloop; */ /* UNUSED */
MDisps *mdisps;
int *gridOffset;
- int i, /*numGrids,*/ gridSize, dGridSize, dSkip, totvert;
+ int i, /*numGrids, */ gridSize, dGridSize, dSkip, totvert;
float (*vertCos)[3] = NULL;
MultiresModifierData *mmd= get_multires_modifier(scene, ob, 1);
MultiresModifierData high_mmd;
diff --git a/source/blender/blenkernel/intern/navmesh_conversion.c b/source/blender/blenkernel/intern/navmesh_conversion.c
index 34e0be1de92..24382b3bf91 100644
--- a/source/blender/blenkernel/intern/navmesh_conversion.c
+++ b/source/blender/blenkernel/intern/navmesh_conversion.c
@@ -57,8 +57,7 @@ BLI_INLINE int left(const float* a, const float* b, const float* c)
int polyNumVerts(const unsigned short* p, const int vertsPerPoly)
{
int i, nv = 0;
- for (i=0; i<vertsPerPoly; i++)
- {
+ for (i=0; i<vertsPerPoly; i++) {
if (p[i]==0xffff)
break;
nv++;
@@ -71,8 +70,7 @@ int polyIsConvex(const unsigned short* p, const int vertsPerPoly, const float* v
int j, nv = polyNumVerts(p, vertsPerPoly);
if (nv<3)
return 0;
- for (j=0; j<nv; j++)
- {
+ for (j=0; j<nv; j++) {
const float* v = &verts[3*p[j]];
const float* v_next = &verts[3*p[(j+1)%nv]];
const float* v_prev = &verts[3*p[(nv+j-1)%nv]];
@@ -88,8 +86,8 @@ float distPointToSegmentSq(const float* point, const float* a, const float* b)
float abx[3], dx[3];
float d, t;
- sub_v3_v3v3(abx, b,a);
- sub_v3_v3v3(dx, point,a);
+ sub_v3_v3v3(abx, b, a);
+ sub_v3_v3v3(dx, point, a);
d = abx[0]*abx[0]+abx[2]*abx[2];
t = abx[0]*dx[0]+abx[2]*dx[2];
@@ -119,8 +117,7 @@ int buildRawVertIndicesData(DerivedMesh* dm, int *nverts_r, float **verts_r,
MFace *faces;
nverts = dm->getNumVerts(dm);
- if (nverts>=0xffff)
- {
+ if (nverts>=0xffff) {
printf("Converting navmesh: Error! Too many vertices. Max number of vertices %d\n", 0xffff);
return 0;
}
@@ -128,8 +125,7 @@ int buildRawVertIndicesData(DerivedMesh* dm, int *nverts_r, float **verts_r,
dm->getVertCos(dm, (float(*)[3])verts);
//flip coordinates
- for (vi=0; vi<nverts; vi++)
- {
+ for (vi=0; vi<nverts; vi++) {
SWAP(float, verts[3*vi+1], verts[3*vi+2]);
}
@@ -137,8 +133,7 @@ int buildRawVertIndicesData(DerivedMesh* dm, int *nverts_r, float **verts_r,
nfaces = dm->getNumTessFaces(dm);
faces = dm->getTessFaceArray(dm);
ntris = nfaces;
- for (fi=0; fi<nfaces; fi++)
- {
+ for (fi=0; fi<nfaces; fi++) {
MFace* face = &faces[fi];
if (face->v4)
ntris++;
@@ -149,15 +144,13 @@ int buildRawVertIndicesData(DerivedMesh* dm, int *nverts_r, float **verts_r,
tris = MEM_callocN(sizeof(unsigned short)*3*ntris, "buildRawVertIndicesData tris");
tri = tris;
triIdx = 0;
- for (fi=0; fi<nfaces; fi++)
- {
+ for (fi=0; fi<nfaces; fi++) {
MFace* face = &faces[fi];
tri[3*triIdx+0] = (unsigned short) face->v1;
tri[3*triIdx+1] = (unsigned short) face->v3;
tri[3*triIdx+2] = (unsigned short) face->v2;
trisToFacesMap[triIdx++]=fi;
- if (face->v4)
- {
+ if (face->v4) {
tri[3*triIdx+0] = (unsigned short) face->v1;
tri[3*triIdx+1] = (unsigned short) face->v4;
tri[3*triIdx+2] = (unsigned short) face->v3;
@@ -187,8 +180,7 @@ int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys,
unsigned short* newPoly = MEM_callocN(sizeof(unsigned short)*capacity, "buildPolygonsByDetailedMeshes newPoly");
memset(newPoly, 0xff, sizeof(unsigned short)*capacity);
- for (polyidx=0; polyidx<npolys; polyidx++)
- {
+ for (polyidx=0; polyidx<npolys; polyidx++) {
size_t i;
int j, k;
int nv = 0;
@@ -202,22 +194,18 @@ int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys,
int adjustedNv;
int allBorderTraversed;
- for (j=0; j<dtrisNum && btri==-1;j++)
- {
+ for (j=0; j<dtrisNum && btri==-1;j++) {
int curpolytri = dtrisBase+j;
- for (k=0; k<3; k++)
- {
+ for (k=0; k<3; k++) {
unsigned short neighbortri = dtris[curpolytri*3*2+3+k];
- if ( neighbortri==0xffff || dtrisToPolysMap[neighbortri]!=polyidx+1)
- {
+ if ( neighbortri==0xffff || dtrisToPolysMap[neighbortri]!=polyidx+1) {
btri = curpolytri;
bedge = k;
break;
}
}
}
- if (btri==-1 || bedge==-1)
- {
+ if (btri==-1 || bedge==-1) {
//can't find triangle with border edge
MEM_freeN(traversedTris);
MEM_freeN(newPoly);
@@ -229,13 +217,10 @@ int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys,
tri = btri;
edge = (bedge+1)%3;
traversedTris[tri-dtrisBase] = 1;
- while (tri!=btri || edge!=bedge)
- {
+ while (tri != btri || edge != bedge) {
int neighbortri = dtris[tri*3*2+3+edge];
- if (neighbortri==0xffff || dtrisToPolysMap[neighbortri]!=polyidx+1)
- {
- if (nv==capacity)
- {
+ if (neighbortri==0xffff || dtrisToPolysMap[neighbortri]!=polyidx+1) {
+ if (nv==capacity) {
unsigned short* newPolyBig;
capacity += vertsPerPoly;
newPolyBig = MEM_callocN(sizeof(unsigned short)*capacity, "buildPolygonsByDetailedMeshes newPolyBig");
@@ -251,16 +236,13 @@ int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys,
else {
//move to next tri
int twinedge = -1;
- for (k=0; k<3; k++)
- {
- if (dtris[neighbortri*3*2+3+k] == tri)
- {
+ for (k=0; k<3; k++) {
+ if (dtris[neighbortri*3*2+3+k] == tri) {
twinedge = k;
break;
}
}
- if (twinedge==-1)
- {
+ if (twinedge==-1) {
printf("Converting navmesh: Error! Can't find neighbor edge - invalid adjacency info\n");
MEM_freeN(traversedTris);
goto returnLabel;
@@ -273,8 +255,7 @@ int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys,
adjustedPoly = MEM_callocN(sizeof(unsigned short)*nv, "buildPolygonsByDetailedMeshes adjustedPoly");
adjustedNv = 0;
- for (i=0; i<nv; i++)
- {
+ for (i=0; i<nv; i++) {
unsigned short prev = newPoly[(nv+i-1)%nv];
unsigned short cur = newPoly[i];
unsigned short next = newPoly[(i+1)%nv];
@@ -288,17 +269,13 @@ int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys,
nv = adjustedNv;
allBorderTraversed = 1;
- for (i=0; i<dtrisNum; i++)
- {
- if (traversedTris[i]==0)
- {
+ for (i=0; i<dtrisNum; i++) {
+ if (traversedTris[i]==0) {
//check whether it has border edges
int curpolytri = dtrisBase+i;
- for (k=0; k<3; k++)
- {
+ for (k=0; k<3; k++) {
unsigned short neighbortri = dtris[curpolytri*3*2+3+k];
- if ( neighbortri==0xffff || dtrisToPolysMap[neighbortri]!=polyidx+1)
- {
+ if ( neighbortri==0xffff || dtrisToPolysMap[neighbortri]!=polyidx+1) {
allBorderTraversed = 0;
break;
}
@@ -306,10 +283,8 @@ int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys,
}
}
- if (nv<=vertsPerPoly && allBorderTraversed)
- {
- for (i=0; i<nv; i++)
- {
+ if (nv<=vertsPerPoly && allBorderTraversed) {
+ for (i=0; i<nv; i++) {
polys[polyidx*vertsPerPoly*2+i] = newPoly[i];
}
}
@@ -353,8 +328,7 @@ int buildNavMeshData(const int nverts, const float* verts,
unsigned short *dtris, *dmeshes, *polys;
int *dtrisToPolysMap, *dtrisToTrisMap;
- if (!recastData)
- {
+ if (!recastData) {
printf("Converting navmesh: Error! Can't find recast custom data\n");
return 0;
}
@@ -370,17 +344,14 @@ int buildNavMeshData(const int nverts, const float* verts,
//search first valid triangle - triangle of convex polygon
validTriStart = -1;
- for (i=0; i< ntris; i++)
- {
- if (recastData[trisToFacesMap[trisMapping[i]]]>0)
- {
+ for (i=0; i< ntris; i++) {
+ if (recastData[trisToFacesMap[trisMapping[i]]]>0) {
validTriStart = i;
break;
}
}
- if (validTriStart<0)
- {
+ if (validTriStart<0) {
printf("Converting navmesh: Error! No valid polygons in mesh\n");
MEM_freeN(trisMapping);
return 0;
@@ -396,8 +367,7 @@ int buildNavMeshData(const int nverts, const float* verts,
//and reserve memory for adjacency info
dtris = MEM_callocN(sizeof(unsigned short)*3*2*ndtris, "buildNavMeshData dtris");
memset(dtris, 0xffff, sizeof(unsigned short)*3*2*ndtris);
- for (i=0; i<ndtris; i++)
- {
+ for (i=0; i<ndtris; i++) {
memcpy(dtris+3*2*i, tris+3*dtrisToTrisMap[i], sizeof(unsigned short)*3);
}
@@ -405,11 +375,9 @@ int buildNavMeshData(const int nverts, const float* verts,
prevPolyIdx = -1;
newPolyIdx = 0;
dtrisToPolysMap = MEM_callocN(sizeof(int)*ndtris, "buildNavMeshData dtrisToPolysMap");
- for (i=0; i<ndtris; i++)
- {
+ for (i=0; i<ndtris; i++) {
curPolyIdx = recastData[trisToFacesMap[dtrisToTrisMap[i]]];
- if (curPolyIdx!=prevPolyIdx)
- {
+ if (curPolyIdx!=prevPolyIdx) {
newPolyIdx++;
prevPolyIdx=curPolyIdx;
}
@@ -426,13 +394,10 @@ int buildNavMeshData(const int nverts, const float* verts,
memset(dmeshes, 0, npolys*4*sizeof(unsigned short));
dmesh = NULL;
prevpolyidx = 0;
- for (i=0; i<ndtris; i++)
- {
+ for (i=0; i<ndtris; i++) {
int curpolyidx = dtrisToPolysMap[i];
- if (curpolyidx!=prevpolyidx)
- {
- if (curpolyidx!=prevpolyidx+1)
- {
+ if (curpolyidx!=prevpolyidx) {
+ if (curpolyidx!=prevpolyidx+1) {
printf("Converting navmesh: Error! Wrong order of detailed mesh faces\n");
return 0;
}
@@ -476,17 +441,15 @@ int buildNavMeshDataByDerivedMesh(DerivedMesh *dm, int *vertsPerPoly,
unsigned short *tris=NULL;
res = buildRawVertIndicesData(dm, nverts, verts, &ntris, &tris, trisToFacesMap, &recastData);
- if (!res)
- {
+ if (!res) {
printf("Converting navmesh: Error! Can't get vertices and indices from mesh\n");
goto exit;
}
res = buildNavMeshData(*nverts, *verts, ntris, tris, recastData, *trisToFacesMap,
- ndtris, dtris, npolys, dmeshes,polys, vertsPerPoly,
+ ndtris, dtris, npolys, dmeshes, polys, vertsPerPoly,
dtrisToPolysMap, dtrisToTrisMap);
- if (!res)
- {
+ if (!res) {
printf("Converting navmesh: Error! Can't get vertices and indices from mesh\n");
goto exit;
}
@@ -501,12 +464,10 @@ exit:
int polyFindVertex(const unsigned short* p, const int vertsPerPoly, unsigned short vertexIdx)
{
int i, res = -1;
- for (i=0; i<vertsPerPoly; i++)
- {
+ for (i=0; i<vertsPerPoly; i++) {
if (p[i]==0xffff)
break;
- if (p[i]==vertexIdx)
- {
+ if (p[i] == vertexIdx) {
res = i;
break;
}
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 56fec119cce..96c62a32139 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -73,7 +73,7 @@
/* Remove the given NLA strip from the NLA track it occupies, free the strip's data,
* and the strip itself.
*/
-void free_nlastrip (ListBase *strips, NlaStrip *strip)
+void free_nlastrip(ListBase *strips, NlaStrip *strip)
{
NlaStrip *cs, *csn;
@@ -111,7 +111,7 @@ void free_nlastrip (ListBase *strips, NlaStrip *strip)
/* Remove the given NLA track from the set of NLA tracks, free the track's data,
* and the track itself.
*/
-void free_nlatrack (ListBase *tracks, NlaTrack *nlt)
+void free_nlatrack(ListBase *tracks, NlaTrack *nlt)
{
NlaStrip *strip, *stripn;
@@ -135,7 +135,7 @@ void free_nlatrack (ListBase *tracks, NlaTrack *nlt)
/* Free the elements of type NLA Tracks provided in the given list, but do not free
* the list itself since that is not free-standing
*/
-void free_nladata (ListBase *tracks)
+void free_nladata(ListBase *tracks)
{
NlaTrack *nlt, *nltn;
@@ -216,7 +216,7 @@ NlaTrack *copy_nlatrack (NlaTrack *nlt)
}
/* Copy all NLA data */
-void copy_nladata (ListBase *dst, ListBase *src)
+void copy_nladata(ListBase *dst, ListBase *src)
{
NlaTrack *nlt, *nlt_d;
@@ -357,7 +357,7 @@ NlaStrip *add_nla_soundstrip (Scene *scene, Speaker *speaker)
strip->end = (float)ceil((double)info.length * FPS);
}
- else
+ else
#endif
{
strip->end = 10.0f;
@@ -373,7 +373,7 @@ NlaStrip *add_nla_soundstrip (Scene *scene, Speaker *speaker)
strip->extendmode = NLASTRIP_EXTEND_NOTHING; /* nothing to extend... */
/* strip should be referenced as-is */
- strip->scale= 1.0f;
+ strip->scale = 1.0f;
strip->repeat = 1.0f;
/* return this strip */
@@ -486,7 +486,7 @@ static float nlastrip_get_frame_transition (NlaStrip *strip, float cframe, short
* only secure for 'internal' (i.e. within AnimSys evaluation) operations,
* but should not be directly relied on for stuff which interacts with editors
*/
-float nlastrip_get_frame (NlaStrip *strip, float cframe, short mode)
+float nlastrip_get_frame(NlaStrip *strip, float cframe, short mode)
{
switch (strip->type) {
case NLASTRIP_TYPE_META: /* meta - for now, does the same as transition (is really just an empty container) */
@@ -506,7 +506,7 @@ float nlastrip_get_frame (NlaStrip *strip, float cframe, short mode)
* Public API method - perform this mapping using the given AnimData block
* and perform any necessary sanity checks on the value
*/
-float BKE_nla_tweakedit_remap (AnimData *adt, float cframe, short mode)
+float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, short mode)
{
NlaStrip *strip;
@@ -546,7 +546,7 @@ float BKE_nla_tweakedit_remap (AnimData *adt, float cframe, short mode)
/* (these functions are used for NLA-Tracks and also for nested/meta-strips) */
/* Check if there is any space in the given list to add the given strip */
-short BKE_nlastrips_has_space (ListBase *strips, float start, float end)
+short BKE_nlastrips_has_space(ListBase *strips, float start, float end)
{
NlaStrip *strip;
@@ -580,7 +580,7 @@ short BKE_nlastrips_has_space (ListBase *strips, float start, float end)
/* Rearrange the strips in the track so that they are always in order
* (usually only needed after a strip has been moved)
*/
-void BKE_nlastrips_sort_strips (ListBase *strips)
+void BKE_nlastrips_sort_strips(ListBase *strips)
{
ListBase tmp = {NULL, NULL};
NlaStrip *strip, *sstrip, *stripn;
@@ -624,7 +624,7 @@ void BKE_nlastrips_sort_strips (ListBase *strips)
/* Add the given NLA-Strip to the given list of strips, assuming that it
* isn't currently a member of another list
*/
-short BKE_nlastrips_add_strip (ListBase *strips, NlaStrip *strip)
+short BKE_nlastrips_add_strip(ListBase *strips, NlaStrip *strip)
{
NlaStrip *ns;
short not_added = 1;
@@ -662,7 +662,7 @@ short BKE_nlastrips_add_strip (ListBase *strips, NlaStrip *strip)
* contained within 'Meta-Strips' which act as strips which contain strips.
* temp: are the meta-strips to be created 'temporary' ones used for transforms?
*/
-void BKE_nlastrips_make_metas (ListBase *strips, short temp)
+void BKE_nlastrips_make_metas(ListBase *strips, short temp)
{
NlaStrip *mstrip = NULL;
NlaStrip *strip, *stripn;
@@ -714,7 +714,7 @@ void BKE_nlastrips_make_metas (ListBase *strips, short temp)
}
/* Split a meta-strip into a set of normal strips */
-void BKE_nlastrips_clear_metastrip (ListBase *strips, NlaStrip *strip)
+void BKE_nlastrips_clear_metastrip(ListBase *strips, NlaStrip *strip)
{
NlaStrip *cs, *csn;
@@ -739,7 +739,7 @@ void BKE_nlastrips_clear_metastrip (ListBase *strips, NlaStrip *strip)
* sel: only consider selected meta-strips, otherwise all meta-strips are removed
* onlyTemp: only remove the 'temporary' meta-strips used for transforms
*/
-void BKE_nlastrips_clear_metas (ListBase *strips, short onlySel, short onlyTemp)
+void BKE_nlastrips_clear_metas(ListBase *strips, short onlySel, short onlyTemp)
{
NlaStrip *strip, *stripn;
@@ -766,7 +766,7 @@ void BKE_nlastrips_clear_metas (ListBase *strips, short onlySel, short onlyTemp)
/* Add the given NLA-Strip to the given Meta-Strip, assuming that the
* strip isn't attached to anyy list of strips
*/
-short BKE_nlameta_add_strip (NlaStrip *mstrip, NlaStrip *strip)
+short BKE_nlameta_add_strip(NlaStrip *mstrip, NlaStrip *strip)
{
/* sanity checks */
if (ELEM(NULL, mstrip, strip))
@@ -816,7 +816,7 @@ short BKE_nlameta_add_strip (NlaStrip *mstrip, NlaStrip *strip)
/* Adjust the settings of NLA-Strips contained within a Meta-Strip (recursively),
* until the Meta-Strips children all fit within the Meta-Strip's new dimensions
*/
-void BKE_nlameta_flush_transforms (NlaStrip *mstrip)
+void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
{
NlaStrip *strip;
float oStart, oEnd, offset;
@@ -915,7 +915,7 @@ NlaTrack *BKE_nlatrack_find_active (ListBase *tracks)
/* Toggle the 'solo' setting for the given NLA-track, making sure that it is the only one
* that has this status in its AnimData block.
*/
-void BKE_nlatrack_solo_toggle (AnimData *adt, NlaTrack *nlt)
+void BKE_nlatrack_solo_toggle(AnimData *adt, NlaTrack *nlt)
{
NlaTrack *nt;
@@ -947,7 +947,7 @@ void BKE_nlatrack_solo_toggle (AnimData *adt, NlaTrack *nlt)
/* Make the given NLA-track the active one for the given stack. If no track is provided,
* this function can be used to simply deactivate all the NLA tracks in the given stack too.
*/
-void BKE_nlatrack_set_active (ListBase *tracks, NlaTrack *nlt_a)
+void BKE_nlatrack_set_active(ListBase *tracks, NlaTrack *nlt_a)
{
NlaTrack *nlt;
@@ -965,7 +965,7 @@ void BKE_nlatrack_set_active (ListBase *tracks, NlaTrack *nlt_a)
}
/* Check if there is any space in the given track to add a strip of the given length */
-short BKE_nlatrack_has_space (NlaTrack *nlt, float start, float end)
+short BKE_nlatrack_has_space(NlaTrack *nlt, float start, float end)
{
/* sanity checks
* - track must exist
@@ -987,7 +987,7 @@ short BKE_nlatrack_has_space (NlaTrack *nlt, float start, float end)
/* Rearrange the strips in the track so that they are always in order
* (usually only needed after a strip has been moved)
*/
-void BKE_nlatrack_sort_strips (NlaTrack *nlt)
+void BKE_nlatrack_sort_strips(NlaTrack *nlt)
{
/* sanity checks */
if (ELEM(NULL, nlt, nlt->strips.first))
@@ -1000,7 +1000,7 @@ void BKE_nlatrack_sort_strips (NlaTrack *nlt)
/* Add the given NLA-Strip to the given NLA-Track, assuming that it
* isn't currently attached to another one
*/
-short BKE_nlatrack_add_strip (NlaTrack *nlt, NlaStrip *strip)
+short BKE_nlatrack_add_strip(NlaTrack *nlt, NlaStrip *strip)
{
/* sanity checks */
if (ELEM(NULL, nlt, strip))
@@ -1013,7 +1013,7 @@ short BKE_nlatrack_add_strip (NlaTrack *nlt, NlaStrip *strip)
/* Get the extents of the given NLA-Track including gaps between strips,
* returning whether this succeeded or not
*/
-short BKE_nlatrack_get_bounds (NlaTrack *nlt, float bounds[2])
+short BKE_nlatrack_get_bounds(NlaTrack *nlt, float bounds[2])
{
NlaStrip *strip;
@@ -1061,7 +1061,7 @@ NlaStrip *BKE_nlastrip_find_active (NlaTrack *nlt)
}
/* Make the given NLA-Strip the active one within the given block */
-void BKE_nlastrip_set_active (AnimData *adt, NlaStrip *strip)
+void BKE_nlastrip_set_active(AnimData *adt, NlaStrip *strip)
{
NlaTrack *nlt;
NlaStrip *nls;
@@ -1083,7 +1083,7 @@ void BKE_nlastrip_set_active (AnimData *adt, NlaStrip *strip)
/* Does the given NLA-strip fall within the given bounds (times)? */
-short BKE_nlastrip_within_bounds (NlaStrip *strip, float min, float max)
+short BKE_nlastrip_within_bounds(NlaStrip *strip, float min, float max)
{
const float stripLen= (strip) ? strip->end - strip->start : 0.0f;
const float boundsLen= fabsf(max - min);
@@ -1096,15 +1096,15 @@ short BKE_nlastrip_within_bounds (NlaStrip *strip, float min, float max)
* - first 2 cases cover when the strip length is less than the bounding area
* - second 2 cases cover when the strip length is greater than the bounding area
*/
- if ( (stripLen < boundsLen) &&
- !(IN_RANGE(strip->start, min, max) ||
- IN_RANGE(strip->end, min, max)) )
+ if ((stripLen < boundsLen) &&
+ !(IN_RANGE(strip->start, min, max) ||
+ IN_RANGE(strip->end, min, max)))
{
return 0;
}
- if ( (stripLen > boundsLen) &&
- !(IN_RANGE(min, strip->start, strip->end) ||
- IN_RANGE(max, strip->start, strip->end)) )
+ if ((stripLen > boundsLen) &&
+ !(IN_RANGE(min, strip->start, strip->end) ||
+ IN_RANGE(max, strip->start, strip->end)) )
{
return 0;
}
@@ -1116,7 +1116,7 @@ short BKE_nlastrip_within_bounds (NlaStrip *strip, float min, float max)
/* Recalculate the start and end frames for the current strip, after changing
* the extents of the action or the mapping (repeats or scale factor) info
*/
-void BKE_nlastrip_recalculate_bounds (NlaStrip *strip)
+void BKE_nlastrip_recalculate_bounds(NlaStrip *strip)
{
float actlen, mapping;
@@ -1171,7 +1171,7 @@ static short nlastrip_is_first (AnimData *adt, NlaStrip *strip)
/* Animated Strips ------------------------------------------- */
/* Check if the given NLA-Track has any strips with own F-Curves */
-short BKE_nlatrack_has_animated_strips (NlaTrack *nlt)
+short BKE_nlatrack_has_animated_strips(NlaTrack *nlt)
{
NlaStrip *strip;
@@ -1190,7 +1190,7 @@ short BKE_nlatrack_has_animated_strips (NlaTrack *nlt)
}
/* Check if given NLA-Tracks have any strips with own F-Curves */
-short BKE_nlatracks_have_animated_strips (ListBase *tracks)
+short BKE_nlatracks_have_animated_strips(ListBase *tracks)
{
NlaTrack *nlt;
@@ -1209,7 +1209,7 @@ short BKE_nlatracks_have_animated_strips (ListBase *tracks)
}
/* Validate the NLA-Strips 'control' F-Curves based on the flags set*/
-void BKE_nlastrip_validate_fcurves (NlaStrip *strip)
+void BKE_nlastrip_validate_fcurves(NlaStrip *strip)
{
FCurve *fcu;
@@ -1272,7 +1272,7 @@ static int nla_editbone_name_check(void *arg, const char *name)
* as we need to ensure that the name is unique over several lists of tracks,
* not just a single track.
*/
-void BKE_nlastrip_validate_name (AnimData *adt, NlaStrip *strip)
+void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip)
{
GHash *gh;
NlaStrip *tstrip;
@@ -1416,7 +1416,7 @@ static void BKE_nlastrip_validate_autoblends (NlaTrack *nlt, NlaStrip *nls)
}
/* Ensure that auto-blending and other settings are set correctly */
-void BKE_nla_validate_state (AnimData *adt)
+void BKE_nla_validate_state(AnimData *adt)
{
NlaStrip *strip, *fstrip=NULL;
NlaTrack *nlt;
@@ -1470,7 +1470,7 @@ void BKE_nla_validate_state (AnimData *adt)
* so no checks for this are performed.
*/
// TODO: maybe we should have checks for this too...
-void BKE_nla_action_pushdown (AnimData *adt)
+void BKE_nla_action_pushdown(AnimData *adt)
{
NlaStrip *strip;
@@ -1518,7 +1518,7 @@ void BKE_nla_action_pushdown (AnimData *adt)
/* Find the active strip + track combo, and set them up as the tweaking track,
* and return if successful or not.
*/
-short BKE_nla_tweakmode_enter (AnimData *adt)
+short BKE_nla_tweakmode_enter(AnimData *adt)
{
NlaTrack *nlt, *activeTrack=NULL;
NlaStrip *strip, *activeStrip=NULL;
@@ -1619,7 +1619,7 @@ short BKE_nla_tweakmode_enter (AnimData *adt)
}
/* Exit tweakmode for this AnimData block */
-void BKE_nla_tweakmode_exit (AnimData *adt)
+void BKE_nla_tweakmode_exit(AnimData *adt)
{
NlaStrip *strip;
NlaTrack *nlt;
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 2fb3f81b147..b2a85ad0629 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -141,8 +141,8 @@ void ntreeInitTypes(bNodeTree *ntree)
/* needed info if the pynode script fails now: */
node->storage= ntree;
if (node->id!=NULL) { /* not an empty script node */
- node->custom1= 0;
- node->custom1= BSET(node->custom1,NODE_DYNAMIC_ADDEXIST);
+ node->custom1 = 0;
+ node->custom1 = BSET(node->custom1, NODE_DYNAMIC_ADDEXIST);
}
// if (node->typeinfo)
// node->typeinfo->initfunc(node);
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index bc9411b7e02..9959edaac16 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -56,6 +56,7 @@
#include "DNA_space_types.h"
#include "DNA_view3d_types.h"
#include "DNA_world_types.h"
+#include "DNA_object_types.h"
#include "BLI_blenlib.h"
#include "BLI_bpath.h"
@@ -162,9 +163,9 @@ void object_free_particlesystems(Object *ob)
while (ob->particlesystem.first) {
ParticleSystem *psys = ob->particlesystem.first;
- BLI_remlink(&ob->particlesystem,psys);
+ BLI_remlink(&ob->particlesystem, psys);
- psys_free(ob,psys);
+ psys_free(ob, psys);
}
}
@@ -319,8 +320,8 @@ void free_object(Object *ob)
id->us--;
if (id->us==0) {
if (ob->type==OB_MESH) unlink_mesh(ob->data);
- else if (ob->type==OB_CURVE) unlink_curve(ob->data);
- else if (ob->type==OB_MBALL) unlink_mball(ob->data);
+ else if (ob->type==OB_CURVE) BKE_curve_unlink(ob->data);
+ else if (ob->type==OB_MBALL) BKE_metaball_unlink(ob->data);
}
ob->data= NULL;
}
@@ -459,7 +460,7 @@ void unlink_object(Object *ob)
}
}
else if (ELEM(OB_MBALL, ob->type, obt->type)) {
- if (is_mball_basis_for (obt, ob))
+ if (BKE_metaball_is_basis_for (obt, ob))
obt->recalc|= OB_RECALC_DATA;
}
@@ -541,7 +542,7 @@ void unlink_object(Object *ob)
BoidParticle *bpa;
int p;
- for (p=0,pa=tpsys->particles; p<tpsys->totpart; p++,pa++) {
+ for (p=0, pa=tpsys->particles; p<tpsys->totpart; p++, pa++) {
bpa = pa->boid;
if (bpa->ground == ob)
bpa->ground = NULL;
@@ -625,10 +626,11 @@ void unlink_object(Object *ob)
#endif
if (sce->ed) {
Sequence *seq;
- SEQ_BEGIN(sce->ed, seq)
- if (seq->scene_camera==ob) {
- seq->scene_camera= NULL;
+ SEQ_BEGIN (sce->ed, seq) {
+ if (seq->scene_camera == ob) {
+ seq->scene_camera = NULL;
}
+ }
SEQ_END
}
}
@@ -748,10 +750,10 @@ static void *add_obdata_from_type(int type)
{
switch (type) {
case OB_MESH: return add_mesh("Mesh");
- case OB_CURVE: return add_curve("Curve", OB_CURVE);
- case OB_SURF: return add_curve("Surf", OB_SURF);
- case OB_FONT: return add_curve("Text", OB_FONT);
- case OB_MBALL: return add_mball("Meta");
+ case OB_CURVE: return BKE_curve_add("Curve", OB_CURVE);
+ case OB_SURF: return BKE_curve_add("Surf", OB_SURF);
+ case OB_FONT: return BKE_curve_add("Text", OB_FONT);
+ case OB_MBALL: return BKE_metaball_add("Meta");
case OB_CAMERA: return add_camera("Camera");
case OB_LAMP: return add_lamp("Lamp");
case OB_LATTICE: return add_lattice("Lattice");
@@ -1325,7 +1327,7 @@ void object_copy_proxy_drivers(Object *ob, Object *target)
if ((Object *)dtar->id == target)
dtar->id= (ID *)ob;
else {
- /* only on local objects because this causes indirect links a -> b -> c,blend to point directly to a.blend
+ /* only on local objects because this causes indirect links a -> b -> c, blend to point directly to a.blend
* when a.blend has a proxy thats linked into c.blend */
if (ob->id.lib==NULL)
id_lib_extern((ID *)dtar->id);
@@ -1444,7 +1446,7 @@ void object_scale_to_mat3(Object *ob, float mat[][3])
{
float vec[3];
mul_v3_v3v3(vec, ob->size, ob->dscale);
- size_to_mat3( mat,vec);
+ size_to_mat3(mat, vec);
}
void object_rot_to_mat3(Object *ob, float mat[][3])
@@ -1483,7 +1485,7 @@ void object_rot_to_mat3(Object *ob, float mat[][3])
void object_mat3_to_rot(Object *ob, float mat[][3], short use_compat)
{
- switch(ob->rotmode) {
+ switch (ob->rotmode) {
case ROT_MODE_QUAT:
{
float dquat[4];
@@ -1691,12 +1693,12 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
/* vec: 4 items! */
- if ( where_on_path(par, ctime, vec, dir, cu->flag & CU_FOLLOW ? quat:NULL, &radius, NULL) ) {
+ if (where_on_path(par, ctime, vec, dir, cu->flag & CU_FOLLOW ? quat:NULL, &radius, NULL)) {
if (cu->flag & CU_FOLLOW) {
#if 0
float x1, q[4];
- vec_to_quat( quat,dir, ob->trackflag, ob->upflag);
+ vec_to_quat(quat, dir, ob->trackflag, ob->upflag);
/* the tilt */
normalize_v3(dir);
@@ -1800,7 +1802,7 @@ static void give_parvert(Object *par, int nr, float vec[3])
}
if (count==0) {
- /* keep as 0,0,0 */
+ /* keep as 0, 0, 0 */
}
else if (count > 0) {
mul_v3_fl(vec, 1.0f / count);
@@ -1821,7 +1823,7 @@ static void give_parvert(Object *par, int nr, float vec[3])
ListBase *nurbs;
cu= par->data;
- nurbs= BKE_curve_nurbs(cu);
+ nurbs= BKE_curve_nurbs_get(cu);
nu= nurbs->first;
count= 0;
@@ -1895,8 +1897,8 @@ static void ob_parvert3(Object *ob, Object *par, float mat[][4])
give_parvert(par, ob->par2, v2);
give_parvert(par, ob->par3, v3);
- tri_to_quat( q,v1, v2, v3);
- quat_to_mat3( cmat,q);
+ tri_to_quat(q, v1, v2, v3);
+ quat_to_mat3(cmat, q);
copy_m4_m3(mat, cmat);
if (ob->type==OB_CURVE) {
@@ -1917,7 +1919,7 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[
int a;
// include framerate
- fac1= ( 1.0f / (1.0f + fabsf(ob->sf)) );
+ fac1= (1.0f / (1.0f + fabsf(ob->sf)) );
if (fac1 >= 1.0f) return 0;
fac2= 1.0f-fac1;
@@ -2025,11 +2027,11 @@ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[
if (ob->partype & PARSLOW) copy_m4_m4(slowmat, obmat);
- switch(ob->partype & PARTYPE) {
+ switch (ob->partype & PARTYPE) {
case PAROBJECT:
ok= 0;
if (par->type==OB_CURVE) {
- if ( ((Curve *)par->data)->flag & CU_PATH ) {
+ if (((Curve *)par->data)->flag & CU_PATH ) {
ob_parcurve(scene, ob, par, tmat);
ok= 1;
}
@@ -2082,7 +2084,7 @@ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[
copy_m3_m4(originmat, tmat);
// origin, voor help line
- if ( (ob->partype & PARTYPE)==PARSKEL ) {
+ if ((ob->partype & PARTYPE)==PARSKEL ) {
copy_v3_v3(ob->orig, par->obmat[3]);
}
else {
@@ -2168,7 +2170,7 @@ void what_does_parent(Scene *scene, Object *ob, Object *workob)
BoundBox *unit_boundbox(void)
{
BoundBox *bb;
- float min[3] = {-1.0f,-1.0f,-1.0f}, max[3] = {-1.0f,-1.0f,-1.0f};
+ float min[3] = {-1.0f, -1.0f, -1.0f}, max[3] = {-1.0f, -1.0f, -1.0f};
bb= MEM_callocN(sizeof(BoundBox), "OB-BoundBox");
boundbox_set_from_min_max(bb, min, max);
@@ -2196,7 +2198,7 @@ BoundBox *object_get_boundbox(Object *ob)
bb = mesh_get_bb(ob);
}
else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
- bb= ob->bb ? ob->bb : ( (Curve *)ob->data )->bb;
+ bb= ob->bb ? ob->bb : ((Curve *)ob->data )->bb;
}
else if (ob->type==OB_MBALL) {
bb= ob->bb;
@@ -2222,7 +2224,7 @@ void object_get_dimensions(Object *ob, float vec[3])
if (bb) {
float scale[3];
- mat4_to_size( scale,ob->obmat);
+ mat4_to_size(scale, ob->obmat);
vec[0] = fabsf(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]);
vec[1] = fabsf(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]);
@@ -2241,7 +2243,7 @@ void object_set_dimensions(Object *ob, const float *value)
if (bb) {
float scale[3], len[3];
- mat4_to_size( scale,ob->obmat);
+ mat4_to_size(scale, ob->obmat);
len[0] = bb->vec[4][0] - bb->vec[0][0];
len[1] = bb->vec[2][1] - bb->vec[0][1];
@@ -2260,14 +2262,14 @@ void minmax_object(Object *ob, float min[3], float max[3])
int a;
short change= FALSE;
- switch(ob->type) {
+ switch (ob->type) {
case OB_CURVE:
case OB_FONT:
case OB_SURF:
{
Curve *cu= ob->data;
- if (cu->bb==NULL) tex_space_curve(cu);
+ if (cu->bb==NULL) BKE_curve_tex_space_calc(cu);
bb= *(cu->bb);
for (a=0; a<8; a++) {
@@ -2568,7 +2570,7 @@ void object_handle_update(Scene *scene, Object *ob)
}
/* includes all keys and modifiers */
- switch(ob->type) {
+ switch (ob->type) {
case OB_MESH:
{
#if 0 // XXX, comment for 2.56a release, background wont set 'scene->customdata_mask'
@@ -2643,7 +2645,7 @@ void object_handle_update(Scene *scene, Object *ob)
else if (psys->flag & PSYS_DELETE) {
tpsys=psys->next;
BLI_remlink(&ob->particlesystem, psys);
- psys_free(ob,psys);
+ psys_free(ob, psys);
psys= tpsys;
}
else
@@ -2784,8 +2786,7 @@ int ray_hit_boundbox(struct BoundBox *bb, float ray_start[3], float ray_normal[3
int result = 0;
int i;
- for (i = 0; i < 12 && result == 0; i++)
- {
+ for (i = 0; i < 12 && result == 0; i++) {
float lambda;
int v1, v2, v3;
v1 = triangle_indexes[i][0];
@@ -2812,8 +2813,7 @@ int object_insert_ptcache(Object *ob)
BLI_sortlist(&ob->pc_ids, pc_cmp);
- for (link=ob->pc_ids.first, i = 0; link; link=link->next, i++)
- {
+ for (link=ob->pc_ids.first, i = 0; link; link=link->next, i++) {
int index = GET_INT_FROM_POINTER(link->data);
if (i < index)
@@ -2897,7 +2897,7 @@ static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, int
int newkey= 0;
if (key==NULL) {
- key= lt->key= add_key( (ID *)lt);
+ key= lt->key= add_key((ID *)lt);
key->type= KEY_RELATIVE;
newkey= 1;
}
@@ -2931,11 +2931,11 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int
Curve *cu= ob->data;
Key *key= cu->key;
KeyBlock *kb;
- ListBase *lb= BKE_curve_nurbs(cu);
+ ListBase *lb= BKE_curve_nurbs_get(cu);
int newkey= 0;
if (key==NULL) {
- key= cu->key= add_key( (ID *)cu);
+ key= cu->key= add_key((ID *)cu);
key->type = KEY_RELATIVE;
newkey= 1;
}
@@ -2958,7 +2958,7 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int
/* create new block with prepared data */
kb = add_keyblock_ctime(key, name, FALSE);
- kb->totelem= count_curveverts(lb);
+ kb->totelem= BKE_nurbList_verts_count(lb);
kb->data= data;
}
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index 907de7888cb..4ddcd6f4b51 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -172,12 +172,12 @@ static float gaussRand (void)
/**
* Some useful functions
* */
-MINLINE float lerp(float a,float b,float f)
+MINLINE float lerp(float a, float b, float f)
{
return a + (b-a)*f;
}
-MINLINE float catrom(float p0,float p1,float p2,float p3,float f)
+MINLINE float catrom(float p0, float p1, float p2, float p3, float f)
{
return 0.5f *((2.0f * p1) +
(-p0 + p2) * f +
@@ -191,29 +191,27 @@ MINLINE float omega(float k, float depth)
}
// modified Phillips spectrum
-static float Ph(struct Ocean* o, float kx,float kz )
+static float Ph(struct Ocean* o, float kx, float kz )
{
float tmp;
float k2 = kx*kx + kz*kz;
- if (k2 == 0.0f)
- {
+ if (k2 == 0.0f) {
return 0.0f; // no DC component
}
// damp out the waves going in the direction opposite the wind
tmp = (o->_wx * kx + o->_wz * kz)/sqrtf(k2);
- if (tmp < 0)
- {
+ if (tmp < 0) {
tmp *= o->_damp_reflections;
}
- return o->_A * expf( -1.0f / (k2*(o->_L*o->_L))) * expf(-k2 * (o->_l*o->_l)) * powf(fabsf(tmp),o->_wind_alignment) / (k2*k2);
+ return o->_A * expf( -1.0f / (k2*(o->_L*o->_L))) * expf(-k2 * (o->_l*o->_l)) * powf(fabsf(tmp), o->_wind_alignment) / (k2*k2);
}
-static void compute_eigenstuff(struct OceanResult *ocr, float jxx,float jzz,float jxz)
+static void compute_eigenstuff(struct OceanResult *ocr, float jxx, float jzz, float jxz)
{
- float a,b,qplus,qminus;
+ float a, b, qplus, qminus;
a = jxx + jzz;
b = sqrt((jxx - jzz)*(jxx - jzz) + 4 * jxz * jxz);
@@ -306,15 +304,15 @@ float BKE_ocean_jminus_to_foam(float jminus, float coverage)
return foam*foam;
}
-void BKE_ocean_eval_uv(struct Ocean *oc, struct OceanResult *ocr, float u,float v)
+void BKE_ocean_eval_uv(struct Ocean *oc, struct OceanResult *ocr, float u, float v)
{
- int i0,i1,j0,j1;
- float frac_x,frac_z;
- float uu,vv;
+ int i0, i1, j0, j1;
+ float frac_x, frac_z;
+ float uu, vv;
- // first wrap the texture so 0 <= (u,v) < 1
- u = fmodf(u,1.0f);
- v = fmodf(v,1.0f);
+ // first wrap the texture so 0 <= (u, v) < 1
+ u = fmodf(u, 1.0f);
+ v = fmodf(v, 1.0f);
if (u < 0) u += 1.0f;
if (v < 0) v += 1.0f;
@@ -340,7 +338,7 @@ void BKE_ocean_eval_uv(struct Ocean *oc, struct OceanResult *ocr, float u,float
j1 = j1 % oc->_N;
-#define BILERP(m) (lerp(lerp(m[i0*oc->_N+j0],m[i1*oc->_N+j0],frac_x),lerp(m[i0*oc->_N+j1],m[i1*oc->_N+j1],frac_x),frac_z))
+#define BILERP(m) (lerp(lerp(m[i0*oc->_N+j0], m[i1*oc->_N+j0], frac_x), lerp(m[i0*oc->_N+j1], m[i1*oc->_N+j1], frac_x), frac_z))
{
if (oc->_do_disp_y) {
ocr->disp[1] = BILERP(oc->_disp_y);
@@ -362,7 +360,7 @@ void BKE_ocean_eval_uv(struct Ocean *oc, struct OceanResult *ocr, float u,float
}
if (oc->_do_jacobian) {
- compute_eigenstuff(ocr, BILERP(oc->_Jxx),BILERP(oc->_Jzz),BILERP(oc->_Jxz));
+ compute_eigenstuff(ocr, BILERP(oc->_Jxx), BILERP(oc->_Jzz), BILERP(oc->_Jxz));
}
}
#undef BILERP
@@ -371,15 +369,15 @@ void BKE_ocean_eval_uv(struct Ocean *oc, struct OceanResult *ocr, float u,float
}
// use catmullrom interpolation rather than linear
-void BKE_ocean_eval_uv_catrom(struct Ocean *oc, struct OceanResult *ocr, float u,float v)
+void BKE_ocean_eval_uv_catrom(struct Ocean *oc, struct OceanResult *ocr, float u, float v)
{
- int i0,i1,i2,i3,j0,j1,j2,j3;
- float frac_x,frac_z;
- float uu,vv;
+ int i0, i1, i2, i3, j0, j1, j2, j3;
+ float frac_x, frac_z;
+ float uu, vv;
- // first wrap the texture so 0 <= (u,v) < 1
- u = fmod(u,1.0f);
- v = fmod(v,1.0f);
+ // first wrap the texture so 0 <= (u, v) < 1
+ u = fmod(u, 1.0f);
+ v = fmod(v, 1.0f);
if (u < 0) u += 1.0f;
if (v < 0) v += 1.0f;
@@ -414,25 +412,22 @@ void BKE_ocean_eval_uv_catrom(struct Ocean *oc, struct OceanResult *ocr, float u
j0 = j0 < 0 ? j0 + oc->_N : j0;
j3 = j3 >= oc->_N ? j3 - oc->_N : j3;
-#define INTERP(m) catrom(catrom(m[i0*oc->_N+j0],m[i1*oc->_N+j0],m[i2*oc->_N+j0],m[i3*oc->_N+j0],frac_x),\
- catrom(m[i0*oc->_N+j1],m[i1*oc->_N+j1],m[i2*oc->_N+j1],m[i3*oc->_N+j1],frac_x),\
- catrom(m[i0*oc->_N+j2],m[i1*oc->_N+j2],m[i2*oc->_N+j2],m[i3*oc->_N+j2],frac_x),\
- catrom(m[i0*oc->_N+j3],m[i1*oc->_N+j3],m[i2*oc->_N+j3],m[i3*oc->_N+j3],frac_x),\
+#define INTERP(m) catrom(catrom(m[i0*oc->_N+j0], m[i1*oc->_N+j0], m[i2*oc->_N+j0], m[i3*oc->_N+j0], frac_x), \
+ catrom(m[i0*oc->_N+j1], m[i1*oc->_N+j1], m[i2*oc->_N+j1], m[i3*oc->_N+j1], frac_x), \
+ catrom(m[i0*oc->_N+j2], m[i1*oc->_N+j2], m[i2*oc->_N+j2], m[i3*oc->_N+j2], frac_x), \
+ catrom(m[i0*oc->_N+j3], m[i1*oc->_N+j3], m[i2*oc->_N+j3], m[i3*oc->_N+j3], frac_x), \
frac_z)
{
- if (oc->_do_disp_y)
- {
+ if (oc->_do_disp_y) {
ocr->disp[1] = INTERP(oc->_disp_y);
}
- if (oc->_do_normals)
- {
+ if (oc->_do_normals) {
ocr->normal[0] = INTERP(oc->_N_x);
ocr->normal[1] = oc->_N_y/*INTERP(oc->_N_y) (MEM01)*/;
ocr->normal[2] = INTERP(oc->_N_z);
}
- if (oc->_do_chop)
- {
+ if (oc->_do_chop) {
ocr->disp[0] = INTERP(oc->_disp_x);
ocr->disp[2] = INTERP(oc->_disp_z);
}
@@ -441,9 +436,8 @@ void BKE_ocean_eval_uv_catrom(struct Ocean *oc, struct OceanResult *ocr, float u
ocr->disp[2] = 0.0;
}
- if (oc->_do_jacobian)
- {
- compute_eigenstuff(ocr, INTERP(oc->_Jxx),INTERP(oc->_Jzz),INTERP(oc->_Jxz));
+ if (oc->_do_jacobian) {
+ compute_eigenstuff(ocr, INTERP(oc->_Jxx), INTERP(oc->_Jzz), INTERP(oc->_Jxz));
}
}
#undef INTERP
@@ -452,20 +446,20 @@ void BKE_ocean_eval_uv_catrom(struct Ocean *oc, struct OceanResult *ocr, float u
}
-void BKE_ocean_eval_xz(struct Ocean *oc, struct OceanResult *ocr, float x,float z)
+void BKE_ocean_eval_xz(struct Ocean *oc, struct OceanResult *ocr, float x, float z)
{
- BKE_ocean_eval_uv(oc, ocr, x/oc->_Lx,z/oc->_Lz);
+ BKE_ocean_eval_uv(oc, ocr, x/oc->_Lx, z/oc->_Lz);
}
-void BKE_ocean_eval_xz_catrom(struct Ocean *oc, struct OceanResult *ocr, float x,float z)
+void BKE_ocean_eval_xz_catrom(struct Ocean *oc, struct OceanResult *ocr, float x, float z)
{
- BKE_ocean_eval_uv_catrom(oc, ocr, x/oc->_Lx,z/oc->_Lz);
+ BKE_ocean_eval_uv_catrom(oc, ocr, x/oc->_Lx, z/oc->_Lz);
}
-// note that this doesn't wrap properly for i,j < 0, but its
+// note that this doesn't wrap properly for i, j < 0, but its
// not really meant for that being just a way to get the raw data out
// to save in some image format.
-void BKE_ocean_eval_ij(struct Ocean *oc, struct OceanResult *ocr, int i,int j)
+void BKE_ocean_eval_ij(struct Ocean *oc, struct OceanResult *ocr, int i, int j)
{
BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_READ);
@@ -474,8 +468,7 @@ void BKE_ocean_eval_ij(struct Ocean *oc, struct OceanResult *ocr, int i,int j)
ocr->disp[1] = oc->_do_disp_y ? oc->_disp_y[i*oc->_N+j] : 0.0f;
- if (oc->_do_chop)
- {
+ if (oc->_do_chop) {
ocr->disp[0] = oc->_disp_x[i*oc->_N+j];
ocr->disp[2] = oc->_disp_z[i*oc->_N+j];
}
@@ -484,8 +477,7 @@ void BKE_ocean_eval_ij(struct Ocean *oc, struct OceanResult *ocr, int i,int j)
ocr->disp[2] = 0.0f;
}
- if (oc->_do_normals)
- {
+ if (oc->_do_normals) {
ocr->normal[0] = oc->_N_x[i*oc->_N+j];
ocr->normal[1] = oc->_N_y/*oc->_N_y[i*oc->_N+j] (MEM01)*/;
ocr->normal[2] = oc->_N_z[i*oc->_N+j];
@@ -493,9 +485,8 @@ void BKE_ocean_eval_ij(struct Ocean *oc, struct OceanResult *ocr, int i,int j)
normalize_v3(ocr->normal);
}
- if (oc->_do_jacobian)
- {
- compute_eigenstuff(ocr, oc->_Jxx[i*oc->_N+j],oc->_Jzz[i*oc->_N+j],oc->_Jxz[i*oc->_N+j]);
+ if (oc->_do_jacobian) {
+ compute_eigenstuff(ocr, oc->_Jxx[i*oc->_N+j], oc->_Jzz[i*oc->_N+j], oc->_Jxz[i*oc->_N+j]);
}
BLI_rw_mutex_unlock(&oc->oceanmutex);
@@ -511,19 +502,17 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
// compute a new htilda
#pragma omp parallel for private(i, j)
- for (i = 0 ; i < o->_M ; ++i)
- {
+ for (i = 0 ; i < o->_M ; ++i) {
// note the <= _N/2 here, see the fftw doco about
// the mechanics of the complex->real fft storage
- for ( j = 0 ; j <= o->_N / 2 ; ++j)
- {
+ for ( j = 0 ; j <= o->_N / 2 ; ++j) {
fftw_complex exp_param1;
fftw_complex exp_param2;
fftw_complex conj_param;
- init_complex(exp_param1, 0.0, omega(o->_k[i*(1+o->_N/2)+j],o->_depth)*t);
- init_complex(exp_param2, 0.0, -omega(o->_k[i*(1+o->_N/2)+j],o->_depth)*t);
+ init_complex(exp_param1, 0.0, omega(o->_k[i*(1+o->_N/2)+j], o->_depth)*t);
+ init_complex(exp_param2, 0.0, -omega(o->_k[i*(1+o->_N/2)+j], o->_depth)*t);
exp_complex(exp_param1, exp_param1);
exp_complex(exp_param2, exp_param2);
conj_complex(conj_param, o->_h0_minus[i*o->_N+j]);
@@ -541,8 +530,7 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
#pragma omp section
{
- if (o->_do_disp_y)
- {
+ if (o->_do_disp_y) {
// y displacement
fftw_execute(o->_disp_y_plan);
}
@@ -550,13 +538,10 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
#pragma omp section
{
- if (o->_do_chop)
- {
+ if (o->_do_chop) {
// x displacement
- for ( i = 0 ; i < o->_M ; ++i)
- {
- for ( j = 0 ; j <= o->_N / 2 ; ++j)
- {
+ for ( i = 0 ; i < o->_M ; ++i) {
+ for ( j = 0 ; j <= o->_N / 2 ; ++j) {
fftw_complex mul_param;
fftw_complex minus_i;
@@ -575,13 +560,10 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
#pragma omp section
{
- if (o->_do_chop)
- {
+ if (o->_do_chop) {
// z displacement
- for ( i = 0 ; i < o->_M ; ++i)
- {
- for ( j = 0 ; j <= o->_N / 2 ; ++j)
- {
+ for ( i = 0 ; i < o->_M ; ++i) {
+ for ( j = 0 ; j <= o->_N / 2 ; ++j) {
fftw_complex mul_param;
fftw_complex minus_i;
@@ -600,13 +582,10 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
#pragma omp section
{
- if (o->_do_jacobian)
- {
+ if (o->_do_jacobian) {
// Jxx
- for ( i = 0 ; i < o->_M ; ++i)
- {
- for ( j = 0 ; j <= o->_N / 2 ; ++j)
- {
+ for ( i = 0 ; i < o->_M ; ++i) {
+ for ( j = 0 ; j <= o->_N / 2 ; ++j) {
fftw_complex mul_param;
//init_complex(mul_param, -scale, 0);
@@ -620,10 +599,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
}
fftw_execute(o->_Jxx_plan);
- for ( i = 0 ; i < o->_M ; ++i)
- {
- for ( j = 0 ; j < o->_N ; ++j)
- {
+ for ( i = 0 ; i < o->_M ; ++i) {
+ for ( j = 0 ; j < o->_N ; ++j) {
o->_Jxx[i*o->_N+j] += 1.0;
}
}
@@ -632,13 +609,10 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
#pragma omp section
{
- if (o->_do_jacobian)
- {
+ if (o->_do_jacobian) {
// Jzz
- for ( i = 0 ; i < o->_M ; ++i)
- {
- for ( j = 0 ; j <= o->_N / 2 ; ++j)
- {
+ for ( i = 0 ; i < o->_M ; ++i) {
+ for ( j = 0 ; j <= o->_N / 2 ; ++j) {
fftw_complex mul_param;
//init_complex(mul_param, -scale, 0);
@@ -651,10 +625,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
}
}
fftw_execute(o->_Jzz_plan);
- for ( i = 0 ; i < o->_M ; ++i)
- {
- for ( j = 0 ; j < o->_N ; ++j)
- {
+ for ( i = 0 ; i < o->_M ; ++i) {
+ for ( j = 0 ; j < o->_N ; ++j) {
o->_Jzz[i*o->_N+j] += 1.0;
}
}
@@ -663,13 +635,10 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
#pragma omp section
{
- if (o->_do_jacobian)
- {
+ if (o->_do_jacobian) {
// Jxz
- for ( i = 0 ; i < o->_M ; ++i)
- {
- for ( j = 0 ; j <= o->_N / 2 ; ++j)
- {
+ for ( i = 0 ; i < o->_M ; ++i) {
+ for ( j = 0 ; j <= o->_N / 2 ; ++j) {
fftw_complex mul_param;
//init_complex(mul_param, -scale, 0);
@@ -688,12 +657,9 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
#pragma omp section
{
// fft normals
- if (o->_do_normals)
- {
- for ( i = 0 ; i < o->_M ; ++i)
- {
- for ( j = 0 ; j <= o->_N / 2 ; ++j)
- {
+ if (o->_do_normals) {
+ for ( i = 0 ; i < o->_M ; ++i) {
+ for ( j = 0 ; j <= o->_N / 2 ; ++j) {
fftw_complex mul_param;
init_complex(mul_param, 0.0, -1.0);
@@ -709,12 +675,9 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
#pragma omp section
{
- if (o->_do_normals)
- {
- for ( i = 0 ; i < o->_M ; ++i)
- {
- for ( j = 0 ; j <= o->_N / 2 ; ++j)
- {
+ if (o->_do_normals) {
+ for ( i = 0 ; i < o->_M ; ++i) {
+ for ( j = 0 ; j <= o->_N / 2 ; ++j) {
fftw_complex mul_param;
init_complex(mul_param, 0.0, -1.0);
@@ -747,7 +710,7 @@ static void set_height_normalize_factor(struct Ocean *oc)
float res = 1.0;
float max_h = 0.0;
- int i,j;
+ int i, j;
if (!oc->_do_disp_y) return;
@@ -757,12 +720,9 @@ static void set_height_normalize_factor(struct Ocean *oc)
BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_READ);
- for (i = 0; i < oc->_M; ++i)
- {
- for (j = 0; j < oc->_N; ++j)
- {
- if ( max_h < fabsf(oc->_disp_y[i*oc->_N+j]))
- {
+ for (i = 0; i < oc->_M; ++i) {
+ for (j = 0; j < oc->_N; ++j) {
+ if ( max_h < fabsf(oc->_disp_y[i*oc->_N+j])) {
max_h = fabsf(oc->_disp_y[i*oc->_N+j]);
}
}
@@ -786,10 +746,10 @@ struct Ocean *BKE_add_ocean(void)
return oc;
}
-void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, float l, float A, float w, float damp,
+void BKE_init_ocean(struct Ocean* o, int M, int N, float Lx, float Lz, float V, float l, float A, float w, float damp,
float alignment, float depth, float time, short do_height_field, short do_chop, short do_normals, short do_jacobian, int seed)
{
- int i,j,ii;
+ int i, j, ii;
BLI_rw_mutex_lock(&o->oceanmutex, THREAD_LOCK_WRITE);
@@ -832,7 +792,7 @@ void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, f
o->_kx[i] = 2.0f * (float)M_PI * i / o->_Lx;
// the -ve components
- for (i = o->_M-1,ii=0 ; i > o->_M/2 ; --i,++ii)
+ for (i = o->_M-1, ii=0 ; i > o->_M/2 ; --i, ++ii)
o->_kx[i] = -2.0f * (float)M_PI * ii / o->_Lx;
// the +ve components and DC
@@ -840,7 +800,7 @@ void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, f
o->_kz[i] = 2.0f * (float)M_PI * i / o->_Lz;
// the -ve components
- for (i = o->_N-1,ii=0 ; i > o->_N/2 ; --i,++ii)
+ for (i = o->_N-1, ii=0 ; i > o->_N/2 ; --i, ++ii)
o->_kz[i] = -2.0f * (float)M_PI * ii / o->_Lz;
// pre-calculate the k matrix
@@ -851,17 +811,15 @@ void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, f
/*srand(seed);*/
BLI_srand(seed);
- for (i = 0 ; i < o->_M ; ++i)
- {
- for (j = 0 ; j < o->_N ; ++j)
- {
+ for (i = 0 ; i < o->_M ; ++i) {
+ for (j = 0 ; j < o->_N ; ++j) {
float r1 = gaussRand();
float r2 = gaussRand();
fftw_complex r1r2;
init_complex(r1r2, r1, r2);
mul_complex_f(o->_h0[i*o->_N+j], r1r2, (float)(sqrt(Ph(o, o->_kx[i], o->_kz[j]) / 2.0f)));
- mul_complex_f(o->_h0_minus[i*o->_N+j], r1r2, (float)(sqrt(Ph(o, -o->_kx[i],-o->_kz[j]) / 2.0f)));
+ mul_complex_f(o->_h0_minus[i*o->_N+j], r1r2, (float)(sqrt(Ph(o, -o->_kx[i], -o->_kz[j]) / 2.0f)));
}
}
@@ -870,7 +828,7 @@ void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, f
if (o->_do_disp_y) {
o->_disp_y = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_disp_y");
- o->_disp_y_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in, o->_disp_y, FFTW_ESTIMATE);
+ o->_disp_y_plan = fftw_plan_dft_c2r_2d(o->_M, o->_N, o->_fft_in, o->_disp_y, FFTW_ESTIMATE);
}
if (o->_do_normals) {
@@ -881,8 +839,8 @@ void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, f
/*o->_N_y = (float*) fftwf_malloc(o->_M * o->_N * sizeof(float)); (MEM01)*/
o->_N_z = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_N_z");
- o->_N_x_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_nx, o->_N_x, FFTW_ESTIMATE);
- o->_N_z_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_nz, o->_N_z, FFTW_ESTIMATE);
+ o->_N_x_plan = fftw_plan_dft_c2r_2d(o->_M, o->_N, o->_fft_in_nx, o->_N_x, FFTW_ESTIMATE);
+ o->_N_z_plan = fftw_plan_dft_c2r_2d(o->_M, o->_N, o->_fft_in_nz, o->_N_z, FFTW_ESTIMATE);
}
if (o->_do_chop) {
@@ -892,8 +850,8 @@ void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, f
o->_disp_x = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_disp_x");
o->_disp_z = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_disp_z");
- o->_disp_x_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_x, o->_disp_x, FFTW_ESTIMATE);
- o->_disp_z_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_z, o->_disp_z, FFTW_ESTIMATE);
+ o->_disp_x_plan = fftw_plan_dft_c2r_2d(o->_M, o->_N, o->_fft_in_x, o->_disp_x, FFTW_ESTIMATE);
+ o->_disp_z_plan = fftw_plan_dft_c2r_2d(o->_M, o->_N, o->_fft_in_z, o->_disp_z, FFTW_ESTIMATE);
}
if (o->_do_jacobian) {
o->_fft_in_jxx = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_jxx");
@@ -904,9 +862,9 @@ void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, f
o->_Jzz = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_Jzz");
o->_Jxz = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_Jxz");
- o->_Jxx_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_jxx, o->_Jxx, FFTW_ESTIMATE);
- o->_Jzz_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_jzz, o->_Jzz, FFTW_ESTIMATE);
- o->_Jxz_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_jxz, o->_Jxz, FFTW_ESTIMATE);
+ o->_Jxx_plan = fftw_plan_dft_c2r_2d(o->_M, o->_N, o->_fft_in_jxx, o->_Jxx, FFTW_ESTIMATE);
+ o->_Jzz_plan = fftw_plan_dft_c2r_2d(o->_M, o->_N, o->_fft_in_jzz, o->_Jzz, FFTW_ESTIMATE);
+ o->_Jxz_plan = fftw_plan_dft_c2r_2d(o->_M, o->_N, o->_fft_in_jxz, o->_Jxz, FFTW_ESTIMATE);
}
BLI_rw_mutex_unlock(&o->oceanmutex);
@@ -921,14 +879,12 @@ void BKE_free_ocean_data(struct Ocean *oc)
BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_WRITE);
- if (oc->_do_disp_y)
- {
+ if (oc->_do_disp_y) {
fftw_destroy_plan(oc->_disp_y_plan);
MEM_freeN(oc->_disp_y);
}
- if (oc->_do_normals)
- {
+ if (oc->_do_normals) {
MEM_freeN(oc->_fft_in_nx);
MEM_freeN(oc->_fft_in_nz);
fftw_destroy_plan(oc->_N_x_plan);
@@ -938,8 +894,7 @@ void BKE_free_ocean_data(struct Ocean *oc)
MEM_freeN(oc->_N_z);
}
- if (oc->_do_chop)
- {
+ if (oc->_do_chop) {
MEM_freeN(oc->_fft_in_x);
MEM_freeN(oc->_fft_in_z);
fftw_destroy_plan(oc->_disp_x_plan);
@@ -948,8 +903,7 @@ void BKE_free_ocean_data(struct Ocean *oc)
MEM_freeN(oc->_disp_z);
}
- if (oc->_do_jacobian)
- {
+ if (oc->_do_jacobian) {
MEM_freeN(oc->_fft_in_jxx);
MEM_freeN(oc->_fft_in_jzz);
MEM_freeN(oc->_fft_in_jxz);
@@ -1002,7 +956,7 @@ static void cache_filename(char *string, const char *path, const char *relbase,
char cachepath[FILE_MAX];
const char *fname;
- switch(type) {
+ switch (type) {
case CACHE_TYPE_FOAM:
fname= "foam_";
break;
@@ -1043,8 +997,7 @@ void BKE_free_ocean_cache(struct OceanCache *och)
if (!och) return;
if (och->ibufs_disp) {
- for (i=och->start, f=0; i<=och->end; i++, f++)
- {
+ for (i=och->start, f=0; i<=och->end; i++, f++) {
if (och->ibufs_disp[f]) {
IMB_freeImBuf(och->ibufs_disp[f]);
}
@@ -1053,8 +1006,7 @@ void BKE_free_ocean_cache(struct OceanCache *och)
}
if (och->ibufs_foam) {
- for (i=och->start, f=0; i<=och->end; i++, f++)
- {
+ for (i=och->start, f=0; i<=och->end; i++, f++) {
if (och->ibufs_foam[f]) {
IMB_freeImBuf(och->ibufs_foam[f]);
}
@@ -1063,8 +1015,7 @@ void BKE_free_ocean_cache(struct OceanCache *och)
}
if (och->ibufs_norm) {
- for (i=och->start, f=0; i<=och->end; i++, f++)
- {
+ for (i=och->start, f=0; i<=och->end; i++, f++) {
if (och->ibufs_norm[f]) {
IMB_freeImBuf(och->ibufs_norm[f]);
}
@@ -1241,7 +1192,7 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
if (o->_do_jacobian) {
/* TODO, cleanup unused code - campbell */
- float /*r,*/ /* UNUSED */ pr=0.0f, foam_result;
+ float /*r, */ /* UNUSED */ pr=0.0f, foam_result;
float neg_disp, neg_eplus;
ocr.foam = BKE_ocean_jminus_to_foam(ocr.Jminus, och->foam_coverage);
@@ -1347,24 +1298,24 @@ float BKE_ocean_jminus_to_foam(float UNUSED(jminus), float UNUSED(coverage))
return 0.0f;
}
-void BKE_ocean_eval_uv(struct Ocean *UNUSED(oc), struct OceanResult *UNUSED(ocr), float UNUSED(u),float UNUSED(v))
+void BKE_ocean_eval_uv(struct Ocean *UNUSED(oc), struct OceanResult *UNUSED(ocr), float UNUSED(u), float UNUSED(v))
{
}
// use catmullrom interpolation rather than linear
-void BKE_ocean_eval_uv_catrom(struct Ocean *UNUSED(oc), struct OceanResult *UNUSED(ocr), float UNUSED(u),float UNUSED(v))
+void BKE_ocean_eval_uv_catrom(struct Ocean *UNUSED(oc), struct OceanResult *UNUSED(ocr), float UNUSED(u), float UNUSED(v))
{
}
-void BKE_ocean_eval_xz(struct Ocean *UNUSED(oc), struct OceanResult *UNUSED(ocr), float UNUSED(x),float UNUSED(z))
+void BKE_ocean_eval_xz(struct Ocean *UNUSED(oc), struct OceanResult *UNUSED(ocr), float UNUSED(x), float UNUSED(z))
{
}
-void BKE_ocean_eval_xz_catrom(struct Ocean *UNUSED(oc), struct OceanResult *UNUSED(ocr), float UNUSED(x),float UNUSED(z))
+void BKE_ocean_eval_xz_catrom(struct Ocean *UNUSED(oc), struct OceanResult *UNUSED(ocr), float UNUSED(x), float UNUSED(z))
{
}
-void BKE_ocean_eval_ij(struct Ocean *UNUSED(oc), struct OceanResult *UNUSED(ocr), int UNUSED(i),int UNUSED(j))
+void BKE_ocean_eval_ij(struct Ocean *UNUSED(oc), struct OceanResult *UNUSED(ocr), int UNUSED(i), int UNUSED(j))
{
}
@@ -1379,7 +1330,7 @@ struct Ocean *BKE_add_ocean(void)
return oc;
}
-void BKE_init_ocean(struct Ocean* UNUSED(o), int UNUSED(M),int UNUSED(N), float UNUSED(Lx), float UNUSED(Lz), float UNUSED(V), float UNUSED(l), float UNUSED(A), float UNUSED(w), float UNUSED(damp),
+void BKE_init_ocean(struct Ocean* UNUSED(o), int UNUSED(M), int UNUSED(N), float UNUSED(Lx), float UNUSED(Lz), float UNUSED(V), float UNUSED(l), float UNUSED(A), float UNUSED(w), float UNUSED(damp),
float UNUSED(alignment), float UNUSED(depth), float UNUSED(time), short UNUSED(do_height_field), short UNUSED(do_chop), short UNUSED(do_normals), short UNUSED(do_jacobian), int UNUSED(seed))
{
}
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index b55033b8493..3b5b4b766fb 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -72,7 +72,7 @@ int seekPackedFile(PackedFile *pf, int offset, int whence)
if (pf) {
oldseek = pf->seek;
- switch(whence) {
+ switch (whence) {
case SEEK_CUR:
seek = oldseek + offset;
break;
@@ -189,7 +189,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char
// open the file
// and create a PackedFile structure
- file= BLI_open(name, O_BINARY|O_RDONLY,0);
+ file= BLI_open(name, O_BINARY|O_RDONLY, 0);
if (file <= 0) {
BKE_reportf(reports, RPT_ERROR, "Unable to pack file, source path not found: \"%s\"", name);
}
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 27f5f7d9eb1..f417f9b79fb 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -59,7 +59,7 @@ Paint *paint_get_active(Scene *sce)
ToolSettings *ts = sce->toolsettings;
if (sce->basact && sce->basact->object) {
- switch(sce->basact->object->mode) {
+ switch (sce->basact->object->mode) {
case OB_MODE_SCULPT:
return &ts->sculpt->paint;
case OB_MODE_VERTEX_PAINT:
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index a154a1f8926..882d907059e 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -549,7 +549,7 @@ void psys_free(Object *ob, ParticleSystem * psys)
// check if we are last non-visible particle system
for (tpsys=ob->particlesystem.first; tpsys; tpsys=tpsys->next) {
if (tpsys->part) {
- if (ELEM(tpsys->part->ren_as,PART_DRAW_OB,PART_DRAW_GR)) {
+ if (ELEM(tpsys->part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
nr++;
break;
}
@@ -637,7 +637,7 @@ static float psys_render_projected_area(ParticleSystem *psys, const float center
/* compute two vectors orthogonal to view vector */
normalize_v3_v3(view, co);
- ortho_basis_v3v3_v3( ortho1, ortho2,view);
+ ortho_basis_v3v3_v3(ortho1, ortho2, view);
/* compute on screen minification */
w= co[2]*data->winmat[2][3] + data->winmat[3][3];
@@ -1024,7 +1024,7 @@ void psys_interpolate_particle(short type, ParticleKey keys[4], float dt, Partic
float t[4];
if (type<0) {
- interp_cubic_v3( result->co, result->vel,keys[1].co, keys[1].vel, keys[2].co, keys[2].vel, dt);
+ interp_cubic_v3(result->co, result->vel, keys[1].co, keys[1].vel, keys[2].co, keys[2].vel, dt);
}
else {
key_curve_position_weights(dt, t, type);
@@ -1357,13 +1357,13 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData
invdt = dfra * 0.04f * (psys ? psys->part->timetweak : 1.f);
mul_v3_fl(keys[1].vel, invdt);
mul_v3_fl(keys[2].vel, invdt);
- interp_qt_qtqt(result->rot,keys[1].rot,keys[2].rot,keytime);
+ interp_qt_qtqt(result->rot, keys[1].rot, keys[2].rot, keytime);
}
- /* now we should have in chronologiacl order k1<=k2<=t<=k3<=k4 with keytime between [0,1]->[k2,k3] (k1 & k4 used for cardinal & bspline interpolation)*/
+ /* now we should have in chronologiacl order k1<=k2<=t<=k3<=k4 with keytime between [0, 1]->[k2, k3] (k1 & k4 used for cardinal & bspline interpolation)*/
psys_interpolate_particle((pind->keyed || pind->cache || point_vel) ? -1 /* signal for cubic interpolation */
: (pind->bspline ? KEY_BSPLINE : KEY_CARDINAL)
- ,keys, keytime, result, 1);
+ , keys, keytime, result, 1);
/* the velocity needs to be converted back from cubic interpolation */
if (pind->keyed || pind->cache || point_vel)
@@ -1403,10 +1403,10 @@ static void interpolate_pathcache(ParticleCacheKey *first, float t, ParticleCach
/************************************************/
/* interpolate a location on a face based on face coordinates */
void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*orcodata)[3],
- float *w, float *vec, float *nor, float *utan, float *vtan, float *orco,float *ornor)
+ float *w, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor)
{
float *v1=0, *v2=0, *v3=0, *v4=0;
- float e1[3],e2[3],s1,s2,t1,t2;
+ float e1[3], e2[3], s1, s2, t1, t2;
float *uv1, *uv2, *uv3, *uv4;
float n1[3], n2[3], n3[3], n4[3];
float tuv[4][2];
@@ -1430,7 +1430,7 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
if (mface->flag & ME_SMOOTH)
interp_v3_v3v3v3v3(nor, n1, n2, n3, n4, w);
else
- normal_quad_v3(nor,v1,v2,v3,v4);
+ normal_quad_v3(nor, v1, v2, v3, v4);
}
}
else {
@@ -1440,7 +1440,7 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
if (mface->flag & ME_SMOOTH)
interp_v3_v3v3v3(nor, n1, n2, n3, w);
else
- normal_tri_v3(nor,v1,v2,v3);
+ normal_tri_v3(nor, v1, v2, v3);
}
}
@@ -1454,11 +1454,11 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
}
else {
uv1= tuv[0]; uv2= tuv[1]; uv3= tuv[2]; uv4= tuv[3];
- map_to_sphere( uv1, uv1+1,v1[0], v1[1], v1[2]);
- map_to_sphere( uv2, uv2+1,v2[0], v2[1], v2[2]);
- map_to_sphere( uv3, uv3+1,v3[0], v3[1], v3[2]);
+ map_to_sphere(uv1, uv1+1, v1[0], v1[1], v1[2]);
+ map_to_sphere(uv2, uv2+1, v2[0], v2[1], v2[2]);
+ map_to_sphere(uv3, uv3+1, v3[0], v3[1], v3[2]);
if (v4)
- map_to_sphere( uv4, uv4+1,v4[0], v4[1], v4[2]);
+ map_to_sphere(uv4, uv4+1, v4[0], v4[1], v4[2]);
}
if (v4) {
@@ -1503,13 +1503,13 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
interp_v3_v3v3v3v3(orco, o1, o2, o3, o4, w);
if (ornor)
- normal_quad_v3( ornor,o1, o2, o3, o4);
+ normal_quad_v3(ornor, o1, o2, o3, o4);
}
else {
interp_v3_v3v3v3(orco, o1, o2, o3, w);
if (ornor)
- normal_tri_v3( ornor,o1, o2, o3);
+ normal_tri_v3(ornor, o1, o2, o3);
}
}
else {
@@ -1527,7 +1527,7 @@ void psys_interpolate_uvs(const MTFace *tface, int quad, const float w[4], float
float v21= tface->uv[1][1];
float v30= tface->uv[2][0];
float v31= tface->uv[2][1];
- float v40,v41;
+ float v40, v41;
if (quad) {
v40= tface->uv[3][0];
@@ -1572,14 +1572,14 @@ static float psys_interpolate_value_from_verts(DerivedMesh *dm, short from, int
if (values==0 || index==-1)
return 0.0;
- switch(from) {
+ switch (from) {
case PART_FROM_VERT:
return values[index];
case PART_FROM_FACE:
case PART_FROM_VOLUME:
{
- MFace *mf=dm->getTessFaceData(dm,index,CD_MFACE);
- return interpolate_particle_value(values[mf->v1],values[mf->v2],values[mf->v3],values[mf->v4],fw,mf->v4);
+ MFace *mf=dm->getTessFaceData(dm, index, CD_MFACE);
+ return interpolate_particle_value(values[mf->v1], values[mf->v2], values[mf->v3], values[mf->v4], fw, mf->v4);
}
}
@@ -1766,10 +1766,10 @@ void psys_particle_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache
orcodata= dm->getVertDataArray(dm, CD_ORCO);
if (from == PART_FROM_VERT) {
- dm->getVertCo(dm,mapindex,vec);
+ dm->getVertCo(dm, mapindex, vec);
if (nor) {
- dm->getVertNo(dm,mapindex,nor);
+ dm->getVertNo(dm, mapindex, nor);
normalize_v3(nor);
}
@@ -1777,7 +1777,7 @@ void psys_particle_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache
copy_v3_v3(orco, orcodata[mapindex]);
if (ornor) {
- dm->getVertNo(dm,mapindex,nor);
+ dm->getVertNo(dm, mapindex, nor);
normalize_v3(nor);
}
@@ -1791,24 +1791,24 @@ void psys_particle_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache
MTFace *mtface;
MVert *mvert;
- mface=dm->getTessFaceData(dm,mapindex,CD_MFACE);
- mvert=dm->getVertDataArray(dm,CD_MVERT);
- mtface=CustomData_get_layer(&dm->faceData,CD_MTFACE);
+ mface=dm->getTessFaceData(dm, mapindex, CD_MFACE);
+ mvert=dm->getVertDataArray(dm, CD_MVERT);
+ mtface=CustomData_get_layer(&dm->faceData, CD_MTFACE);
if (mtface)
mtface += mapindex;
if (from==PART_FROM_VOLUME) {
- psys_interpolate_face(mvert,mface,mtface,orcodata,mapfw,vec,tmpnor,utan,vtan,orco,ornor);
+ psys_interpolate_face(mvert, mface, mtface, orcodata, mapfw, vec, tmpnor, utan, vtan, orco, ornor);
if (nor)
- copy_v3_v3(nor,tmpnor);
+ copy_v3_v3(nor, tmpnor);
normalize_v3(tmpnor);
- mul_v3_fl(tmpnor,-foffset);
+ mul_v3_fl(tmpnor, -foffset);
add_v3_v3(vec, tmpnor);
}
else
- psys_interpolate_face(mvert,mface,mtface,orcodata,mapfw,vec,nor,utan,vtan,orco,ornor);
+ psys_interpolate_face(mvert, mface, mtface, orcodata, mapfw, vec, nor, utan, vtan, orco, ornor);
}
}
@@ -1845,24 +1845,24 @@ ParticleSystemModifierData *psys_get_modifier(Object *ob, ParticleSystem *psys)
static void psys_particle_on_shape(int UNUSED(distr), int UNUSED(index), float *UNUSED(fuv), float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor)
{
/* TODO */
- float zerovec[3]={0.0f,0.0f,0.0f};
+ float zerovec[3]={0.0f, 0.0f, 0.0f};
if (vec) {
- copy_v3_v3(vec,zerovec);
+ copy_v3_v3(vec, zerovec);
}
if (nor) {
- copy_v3_v3(nor,zerovec);
+ copy_v3_v3(nor, zerovec);
}
if (utan) {
- copy_v3_v3(utan,zerovec);
+ copy_v3_v3(utan, zerovec);
}
if (vtan) {
- copy_v3_v3(vtan,zerovec);
+ copy_v3_v3(vtan, zerovec);
}
if (orco) {
- copy_v3_v3(orco,zerovec);
+ copy_v3_v3(orco, zerovec);
}
if (ornor) {
- copy_v3_v3(ornor,zerovec);
+ copy_v3_v3(ornor, zerovec);
}
}
/************************************************/
@@ -1873,17 +1873,17 @@ void psys_particle_on_emitter(ParticleSystemModifierData *psmd, int from, int in
if (psmd) {
if (psmd->psys->part->distr==PART_DISTR_GRID && psmd->psys->part->from != PART_FROM_VERT) {
if (vec)
- copy_v3_v3(vec,fuv);
+ copy_v3_v3(vec, fuv);
if (orco)
copy_v3_v3(orco, fuv);
return;
}
/* we cant use the num_dmcache */
- psys_particle_on_dm(psmd->dm,from,index,index_dmcache,fuv,foffset,vec,nor,utan,vtan,orco,ornor);
+ psys_particle_on_dm(psmd->dm, from, index, index_dmcache, fuv, foffset, vec, nor, utan, vtan, orco, ornor);
}
else
- psys_particle_on_shape(from,index,fuv,vec,nor,utan,vtan,orco,ornor);
+ psys_particle_on_shape(from, index, fuv, vec, nor, utan, vtan, orco, ornor);
}
/************************************************/
@@ -1892,7 +1892,7 @@ void psys_particle_on_emitter(ParticleSystemModifierData *psmd, int from, int in
static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float time, float freq, float shape, float amplitude, float flat, short type, short axis, float obmat[][4], int smooth_start)
{
- float kink[3]={1.f,0.f,0.f}, par_vec[3], q1[4]={1.f,0.f,0.f,0.f};
+ float kink[3]={1.f, 0.f, 0.f}, par_vec[3], q1[4]={1.f, 0.f, 0.f, 0.f};
float t, dt=1.f, result[3];
if (par == NULL || type == PART_KINK_NO)
@@ -1936,7 +1936,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
copy_v3_v3(result, state->co);
sub_v3_v3v3(par_vec, par->co, state->co);
- switch(type) {
+ switch (type) {
case PART_KINK_CURL:
{
negate_v3(par_vec);
@@ -1995,8 +1995,8 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
}
case PART_KINK_BRAID:
{
- float y_vec[3]={0.f,1.f,0.f};
- float z_vec[3]={0.f,0.f,1.f};
+ float y_vec[3]={0.f, 1.f, 0.f};
+ float z_vec[3]={0.f, 0.f, 1.f};
float vec_one[3], state_co[3];
float inp_y, inp_z, length;
@@ -2077,11 +2077,11 @@ static float do_clump(ParticleKey *state, ParticleKey *par, float time, float cl
cpow=1.0f+9.0f*clumppow;
if (clumpfac < 0.0f) /* clump roots instead of tips */
- clump = -clumpfac*pa_clump*(float)pow(1.0-(double)time,(double)cpow);
+ clump = -clumpfac*pa_clump*(float)pow(1.0-(double)time, (double)cpow);
else
- clump = clumpfac*pa_clump*(float)pow((double)time,(double)cpow);
+ clump = clumpfac*pa_clump*(float)pow((double)time, (double)cpow);
- interp_v3_v3v3(state->co,state->co,par->co,clump);
+ interp_v3_v3v3(state->co, state->co, par->co, clump);
}
return clump;
@@ -2101,7 +2101,7 @@ void precalc_guides(ParticleSimulationData *sim, ListBase *effectors)
return;
LOOP_PARTICLES {
- psys_particle_on_emitter(sim->psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,state.co,0,0,0,0,0);
+ psys_particle_on_emitter(sim->psmd, sim->psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, state.co, 0, 0, 0, 0, 0);
mul_m4_v3(sim->ob->obmat, state.co);
mul_mat3_m4_v3(sim->ob->obmat, state.vel);
@@ -2178,11 +2178,11 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time)
cross_v3_v3v3(temp, eff->guide_dir, guidedir);
angle = dot_v3v3(eff->guide_dir, guidedir)/(len_v3(eff->guide_dir));
angle = saacos(angle);
- axis_angle_to_quat( rot2,temp, angle);
+ axis_angle_to_quat(rot2, temp, angle);
mul_qt_v3(rot2, vec_to_point);
/* curve tilt */
- axis_angle_to_quat( rot2,guidedir, guidevec[3] - eff->guide_loc[3]);
+ axis_angle_to_quat(rot2, guidedir, guidevec[3] - eff->guide_loc[3]);
mul_qt_v3(rot2, vec_to_point);
}
@@ -2203,7 +2203,7 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time)
add_v3_v3(vec_to_point, guidevec);
- //sub_v3_v3v3(pa_loc,pa_loc,pa_zero);
+ //sub_v3_v3v3(pa_loc, pa_loc, pa_zero);
madd_v3_v3fl(effect, vec_to_point, data->strength);
madd_v3_v3fl(veffect, guidedir, data->strength);
totstrength += data->strength;
@@ -2216,7 +2216,7 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time)
if (totstrength > 1.0f)
mul_v3_fl(effect, 1.0f / totstrength);
CLAMP(totstrength, 0.0f, 1.0f);
- //add_v3_v3(effect,pa_zero);
+ //add_v3_v3(effect, pa_zero);
interp_v3_v3v3(state->co, state->co, effect, totstrength);
normalize_v3(veffect);
@@ -2234,11 +2234,11 @@ static void do_rough(float *loc, float mat[4][4], float t, float fac, float size
if (thres != 0.0f)
if ((float)fabs((float)(-1.5f+loc[0]+loc[1]+loc[2]))<1.5f*thres) return;
- copy_v3_v3(rco,loc);
- mul_v3_fl(rco,t);
- rough[0]=-1.0f+2.0f*BLI_gTurbulence(size, rco[0], rco[1], rco[2], 2,0,2);
- rough[1]=-1.0f+2.0f*BLI_gTurbulence(size, rco[1], rco[2], rco[0], 2,0,2);
- rough[2]=-1.0f+2.0f*BLI_gTurbulence(size, rco[2], rco[0], rco[1], 2,0,2);
+ copy_v3_v3(rco, loc);
+ mul_v3_fl(rco, t);
+ rough[0]=-1.0f+2.0f*BLI_gTurbulence(size, rco[0], rco[1], rco[2], 2, 0, 2);
+ rough[1]=-1.0f+2.0f*BLI_gTurbulence(size, rco[1], rco[2], rco[0], 2, 0, 2);
+ rough[2]=-1.0f+2.0f*BLI_gTurbulence(size, rco[2], rco[0], rco[1], 2, 0, 2);
madd_v3_v3fl(state->co, mat[0], fac * rough[0]);
madd_v3_v3fl(state->co, mat[1], fac * rough[1]);
@@ -2249,18 +2249,18 @@ static void do_rough_end(float *loc, float mat[4][4], float t, float fac, float
float rough[2];
float roughfac;
- roughfac=fac*(float)pow((double)t,shape);
- copy_v2_v2(rough,loc);
+ roughfac=fac*(float)pow((double)t, shape);
+ copy_v2_v2(rough, loc);
rough[0]=-1.0f+2.0f*rough[0];
rough[1]=-1.0f+2.0f*rough[1];
- mul_v2_fl(rough,roughfac);
+ mul_v2_fl(rough, roughfac);
madd_v3_v3fl(state->co, mat[0], rough[0]);
madd_v3_v3fl(state->co, mat[1], rough[1]);
}
static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheKey *ca, int k, int steps, float *UNUSED(rootco), float effector, float UNUSED(dfra), float UNUSED(cfra), float *length, float *vec)
{
- float force[3] = {0.0f,0.0f,0.0f};
+ float force[3] = {0.0f, 0.0f, 0.0f};
ParticleKey eff_key;
EffectedPoint epoint;
@@ -2268,9 +2268,9 @@ static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheK
if (sim->psys->flag & PSYS_HAIR_DYNAMICS)
return;
- copy_v3_v3(eff_key.co,(ca-1)->co);
- copy_v3_v3(eff_key.vel,(ca-1)->vel);
- copy_qt_qt(eff_key.rot,(ca-1)->rot);
+ copy_v3_v3(eff_key.co, (ca-1)->co);
+ copy_v3_v3(eff_key.vel, (ca-1)->vel);
+ copy_qt_qt(eff_key.rot, (ca-1)->rot);
pd_point_from_particle(sim, sim->psys->particles+i, &eff_key, &epoint);
pdDoEffectors(sim->psys->effectors, sim->colliders, sim->psys->part->effector_weights, &epoint, force, NULL);
@@ -2351,7 +2351,7 @@ void psys_find_parents(ParticleSimulationData *sim)
ParticleSettings *part=sim->psys->part;
KDTree *tree;
ChildParticle *cpa;
- int p, totparent,totchild=sim->psys->totchild;
+ int p, totparent, totchild=sim->psys->totchild;
float co[3], orco[3];
int from=PART_FROM_FACE;
totparent=(int)(totchild*part->parents*0.3f);
@@ -2361,15 +2361,15 @@ void psys_find_parents(ParticleSimulationData *sim)
tree=BLI_kdtree_new(totparent);
- for (p=0,cpa=sim->psys->child; p<totparent; p++,cpa++) {
- psys_particle_on_emitter(sim->psmd,from,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co,0,0,0,orco,0);
+ for (p=0, cpa=sim->psys->child; p<totparent; p++, cpa++) {
+ psys_particle_on_emitter(sim->psmd, from, cpa->num, DMCACHE_ISCHILD, cpa->fuv, cpa->foffset, co, 0, 0, 0, orco, 0);
BLI_kdtree_insert(tree, p, orco, NULL);
}
BLI_kdtree_balance(tree);
- for (; p<totchild; p++,cpa++) {
- psys_particle_on_emitter(sim->psmd,from,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co,0,0,0,orco,0);
+ for (; p<totchild; p++, cpa++) {
+ psys_particle_on_emitter(sim->psmd, from, cpa->num, DMCACHE_ISCHILD, cpa->fuv, cpa->foffset, co, 0, 0, 0, orco, 0);
cpa->parent=BLI_kdtree_find_nearest(tree, orco, NULL, NULL);
}
@@ -2441,10 +2441,10 @@ static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float c
}
if (psys->renderdata)
- steps=(int)pow(2.0,(double)part->ren_step);
+ steps=(int)pow(2.0, (double)part->ren_step);
else {
totchild=(int)((float)totchild*(float)part->disp/100.0f);
- totparent=MIN2(totparent,totchild);
+ totparent=MIN2(totparent, totchild);
}
if (totchild==0) return 0;
@@ -2472,14 +2472,14 @@ static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float c
psys->lattice = psys_get_lattice(&ctx->sim);
/* cache all relevant vertex groups if they exist */
- ctx->vg_length = psys_cache_vgroup(ctx->dm,psys,PSYS_VG_LENGTH);
- ctx->vg_clump = psys_cache_vgroup(ctx->dm,psys,PSYS_VG_CLUMP);
- ctx->vg_kink = psys_cache_vgroup(ctx->dm,psys,PSYS_VG_KINK);
- ctx->vg_rough1 = psys_cache_vgroup(ctx->dm,psys,PSYS_VG_ROUGH1);
- ctx->vg_rough2 = psys_cache_vgroup(ctx->dm,psys,PSYS_VG_ROUGH2);
- ctx->vg_roughe = psys_cache_vgroup(ctx->dm,psys,PSYS_VG_ROUGHE);
+ ctx->vg_length = psys_cache_vgroup(ctx->dm, psys, PSYS_VG_LENGTH);
+ ctx->vg_clump = psys_cache_vgroup(ctx->dm, psys, PSYS_VG_CLUMP);
+ ctx->vg_kink = psys_cache_vgroup(ctx->dm, psys, PSYS_VG_KINK);
+ ctx->vg_rough1 = psys_cache_vgroup(ctx->dm, psys, PSYS_VG_ROUGH1);
+ ctx->vg_rough2 = psys_cache_vgroup(ctx->dm, psys, PSYS_VG_ROUGH2);
+ ctx->vg_roughe = psys_cache_vgroup(ctx->dm, psys, PSYS_VG_ROUGHE);
if (psys->part->flag & PART_CHILD_EFFECT)
- ctx->vg_effector = psys_cache_vgroup(ctx->dm,psys,PSYS_VG_EFFECTOR);
+ ctx->vg_effector = psys_cache_vgroup(ctx->dm, psys, PSYS_VG_EFFECTOR);
/* set correct ipo timing */
#if 0 // XXX old animation system
@@ -2599,7 +2599,7 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
cpa_fuv = cpa->fuv;
cpa_from = PART_FROM_FACE;
- psys_particle_on_emitter(ctx->sim.psmd,cpa_from,cpa_num,DMCACHE_ISCHILD,cpa->fuv,foffset,co,ornor,0,0,orco,0);
+ psys_particle_on_emitter(ctx->sim.psmd, cpa_from, cpa_num, DMCACHE_ISCHILD, cpa->fuv, foffset, co, ornor, 0, 0, orco, 0);
mul_m4_v3(ob->obmat, co);
@@ -2626,7 +2626,7 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
cpa_num = pa->num;
cpa_fuv = pa->fuv;
- psys_particle_on_emitter(ctx->sim.psmd,cpa_from,cpa_num,DMCACHE_ISCHILD,cpa_fuv,pa->foffset,co,ornor,0,0,orco,0);
+ psys_particle_on_emitter(ctx->sim.psmd, cpa_from, cpa_num, DMCACHE_ISCHILD, cpa_fuv, pa->foffset, co, ornor, 0, 0, orco, 0);
psys_mat_hair_to_global(ob, ctx->sim.psmd->dm, psys->part->from, pa, hairmat);
}
@@ -2642,7 +2642,7 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
}
/* create the child path */
- for (k=0,child=child_keys; k<=ctx->steps; k++,child++) {
+ for (k=0, child=child_keys; k<=ctx->steps; k++, child++) {
if (ctx->between) {
int w=0;
@@ -2689,7 +2689,7 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
/* apply effectors */
if (part->flag & PART_CHILD_EFFECT) {
- for (k=0,child=child_keys; k<=ctx->steps; k++,child++) {
+ for (k=0, child=child_keys; k<=ctx->steps; k++, child++) {
if (k) {
do_path_effectors(&ctx->sim, cpa->pa[0], child, k, ctx->steps, child_keys->co, ptex.effector, 0.0f, ctx->cfra, &eff_length, eff_vec);
}
@@ -2700,7 +2700,7 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
}
}
- for (k=0,child=child_keys; k<=ctx->steps; k++,child++) {
+ for (k=0, child=child_keys; k<=ctx->steps; k++, child++) {
t = (float)k/(float)ctx->steps;
if (ctx->totparent)
@@ -2846,7 +2846,7 @@ static void cache_key_incremental_rotation(ParticleCacheKey *key0, ParticleCache
{
float cosangle, angle, tangent[3], normal[3], q[4];
- switch(i) {
+ switch (i) {
case 0:
/* start from second key */
break;
@@ -2871,7 +2871,7 @@ static void cache_key_incremental_rotation(ParticleCacheKey *key0, ParticleCache
else {
angle= saacos(cosangle);
cross_v3_v3v3(normal, prev_tangent, tangent);
- axis_angle_to_quat( q,normal, angle);
+ axis_angle_to_quat(q, normal, angle);
mul_qt_qtqt(key1->rot, q, key2->rot);
}
@@ -2954,7 +2954,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
psys_get_texture(sim, pa, &ptex, PAMAP_LENGTH, 0.f);
pa_length = ptex.length * (1.0f - part->randlength * PSYS_FRAND(psys->seed + p));
if (vg_length)
- pa_length *= psys_particle_value_from_verts(psmd->dm,part->from,pa,vg_length);
+ pa_length *= psys_particle_value_from_verts(psmd->dm, part->from, pa, vg_length);
}
pind.keyed = keyed;
@@ -3018,9 +3018,9 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
if ((psys->part->flag & PART_CHILD_EFFECT) == 0) {
float effector= 1.0f;
if (vg_effector)
- effector*= psys_particle_value_from_verts(psmd->dm,psys->part->from,pa,vg_effector);
+ effector*= psys_particle_value_from_verts(psmd->dm, psys->part->from, pa, vg_effector);
- sub_v3_v3v3(vec,(cache[p]+1)->co,cache[p]->co);
+ sub_v3_v3v3(vec, (cache[p]+1)->co, cache[p]->co);
length = len_v3(vec);
for (k=1, ca=cache[p]+1; k<=steps; k++, ca++)
@@ -3290,19 +3290,19 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
void copy_particle_key(ParticleKey *to, ParticleKey *from, int time)
{
if (time) {
- memcpy(to,from,sizeof(ParticleKey));
+ memcpy(to, from, sizeof(ParticleKey));
}
else {
float to_time=to->time;
- memcpy(to,from,sizeof(ParticleKey));
+ memcpy(to, from, sizeof(ParticleKey));
to->time=to_time;
}
}
void psys_get_from_key(ParticleKey *key, float *loc, float *vel, float *rot, float *time)
{
- if (loc) copy_v3_v3(loc,key->co);
- if (vel) copy_v3_v3(vel,key->vel);
- if (rot) copy_qt_qt(rot,key->rot);
+ if (loc) copy_v3_v3(loc, key->co);
+ if (vel) copy_v3_v3(vel, key->vel);
+ if (rot) copy_qt_qt(rot, key->rot);
if (time) *time=key->time;
}
/*-------changing particle keys from space to another-------*/
@@ -3313,12 +3313,12 @@ static void key_from_object(Object *ob, ParticleKey *key)
add_v3_v3(key->vel, key->co);
- mul_m4_v3(ob->obmat,key->co);
- mul_m4_v3(ob->obmat,key->vel);
- mat4_to_quat(q,ob->obmat);
+ mul_m4_v3(ob->obmat, key->co);
+ mul_m4_v3(ob->obmat, key->vel);
+ mat4_to_quat(q, ob->obmat);
- sub_v3_v3v3(key->vel,key->vel,key->co);
- mul_qt_qtqt(key->rot,q,key->rot);
+ sub_v3_v3v3(key->vel, key->vel, key->co);
+ mul_qt_qtqt(key->rot, q, key->rot);
}
#endif
@@ -3330,7 +3330,7 @@ static void triatomat(float *v1, float *v2, float *v3, float (*uv)[2], float mat
mat[3][3]= 1.0f;
/* first axis is the normal */
- normal_tri_v3( mat[2],v1, v2, v3);
+ normal_tri_v3(mat[2], v1, v2, v3);
/* second axis along (1, 0) in uv space */
if (uv) {
@@ -3374,8 +3374,8 @@ static void psys_face_mat(Object *ob, DerivedMesh *dm, ParticleData *pa, float m
if (i==-1 || i >= dm->getNumTessFaces(dm)) { unit_m4(mat); return; }
- mface=dm->getTessFaceData(dm,i,CD_MFACE);
- osface=dm->getTessFaceData(dm,i,CD_ORIGSPACE);
+ mface=dm->getTessFaceData(dm, i, CD_MFACE);
+ osface=dm->getTessFaceData(dm, i, CD_ORIGSPACE);
if (orco && (orcodata=dm->getVertDataArray(dm, CD_ORCO))) {
copy_v3_v3(v[0], orcodata[mface->v1]);
@@ -3388,9 +3388,9 @@ static void psys_face_mat(Object *ob, DerivedMesh *dm, ParticleData *pa, float m
transform_mesh_orco_verts(ob->data, v, 3, 1);
}
else {
- dm->getVertCo(dm,mface->v1,v[0]);
- dm->getVertCo(dm,mface->v2,v[1]);
- dm->getVertCo(dm,mface->v3,v[2]);
+ dm->getVertCo(dm, mface->v1, v[0]);
+ dm->getVertCo(dm, mface->v2, v[1]);
+ dm->getVertCo(dm, mface->v3, v[2]);
}
triatomat(v[0], v[1], v[2], (osface)? osface->uv: NULL, mat);
@@ -3402,7 +3402,7 @@ void psys_mat_hair_to_object(Object *UNUSED(ob), DerivedMesh *dm, short from, Pa
psys_face_mat(0, dm, pa, hairmat, 0);
psys_particle_on_dm(dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, vec, 0, 0, 0, 0, 0);
- copy_v3_v3(hairmat[3],vec);
+ copy_v3_v3(hairmat[3], vec);
}
void psys_mat_hair_to_orco(Object *ob, DerivedMesh *dm, short from, ParticleData *pa, float hairmat[][4])
@@ -3415,7 +3415,7 @@ void psys_mat_hair_to_orco(Object *ob, DerivedMesh *dm, short from, ParticleData
/* see psys_face_mat for why this function is called */
if (DM_get_vert_data_layer(dm, CD_ORIGINDEX))
transform_mesh_orco_verts(ob->data, &orco, 1, 1);
- copy_v3_v3(hairmat[3],orco);
+ copy_v3_v3(hairmat[3], orco);
}
void psys_vec_rot_to_face(DerivedMesh *dm, ParticleData *pa, float vec[3])
@@ -3513,7 +3513,7 @@ void object_remove_particle_system(Scene *scene, Object *ob)
/* clear particle system */
BLI_remlink(&ob->particlesystem, psys);
- psys_free(ob,psys);
+ psys_free(ob, psys);
if (ob->particlesystem.first)
((ParticleSystem *) ob->particlesystem.first)->flag |= PSYS_CURRENT;
@@ -3778,7 +3778,7 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
if (ELEM(texco, TEXCO_UV, TEXCO_ORCO) && (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME) == 0 || part->distr == PART_DISTR_GRID))
texco = TEXCO_GLOB;
- switch(texco) {
+ switch (texco) {
case TEXCO_GLOB:
copy_v3_v3(texvec, par->state.co);
break;
@@ -3795,7 +3795,7 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
copy_v3_v3(texvec, orco);
break;
case TEXCO_PARTICLE:
- /* texture coordinates in range [-1,1] */
+ /* texture coordinates in range [-1, 1] */
texvec[0] = 2.f * (cfra - par->time)/(par->dietime-par->time) - 1.f;
texvec[1] = 0.f;
texvec[2] = 0.f;
@@ -3805,7 +3805,7 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
externtex(mtex, texvec, &value, rgba, rgba+1, rgba+2, rgba+3, 0);
if ((event & mtex->mapto) & PAMAP_ROUGH)
- ptex->rough1= ptex->rough2= ptex->roughe= texture_value_blend(def,ptex->rough1,value,mtex->roughfac,blend);
+ ptex->rough1= ptex->rough2= ptex->roughe= texture_value_blend(def, ptex->rough1, value, mtex->roughfac, blend);
SET_PARTICLE_TEXTURE(PAMAP_LENGTH, ptex->length, mtex->lengthfac);
SET_PARTICLE_TEXTURE(PAMAP_CLUMP, ptex->clump, mtex->clumpfac);
@@ -3846,7 +3846,7 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
if (texco == TEXCO_UV && (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME) == 0 || part->distr == PART_DISTR_GRID))
texco = TEXCO_GLOB;
- switch(texco) {
+ switch (texco) {
case TEXCO_GLOB:
copy_v3_v3(texvec, pa->state.co);
break;
@@ -3860,10 +3860,10 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
break;
/* no break, failed to get uv's, so let's try orco's */
case TEXCO_ORCO:
- psys_particle_on_emitter(sim->psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,0,0,0,texvec, 0);
+ psys_particle_on_emitter(sim->psmd, sim->psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, 0, 0, 0, texvec, 0);
break;
case TEXCO_PARTICLE:
- /* texture coordinates in range [-1,1] */
+ /* texture coordinates in range [-1, 1] */
texvec[0] = 2.f * (cfra - pa->time)/(pa->dietime-pa->time) - 1.f;
texvec[1] = 0.f;
texvec[2] = 0.f;
@@ -3882,7 +3882,7 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
setvars |= MAP_PA_TIME;
}
else
- ptex->time= texture_value_blend(def,ptex->time,value,mtex->timefac,blend);
+ ptex->time= texture_value_blend(def, ptex->time, value, mtex->timefac, blend);
}
SET_PARTICLE_TEXTURE(PAMAP_LIFE, ptex->life, mtex->lifefac)
SET_PARTICLE_TEXTURE(PAMAP_DENS, ptex->exist, mtex->padensfac)
@@ -3970,19 +3970,19 @@ static void get_child_modifier_parameters(ParticleSettings *part, ParticleThread
return;
if (ctx->vg_length)
- ptex->length*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_length);
+ ptex->length*=psys_interpolate_value_from_verts(ctx->dm, cpa_from, cpa_num, cpa_fuv, ctx->vg_length);
if (ctx->vg_clump)
- ptex->clump*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_clump);
+ ptex->clump*=psys_interpolate_value_from_verts(ctx->dm, cpa_from, cpa_num, cpa_fuv, ctx->vg_clump);
if (ctx->vg_kink)
- ptex->kink*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_kink);
+ ptex->kink*=psys_interpolate_value_from_verts(ctx->dm, cpa_from, cpa_num, cpa_fuv, ctx->vg_kink);
if (ctx->vg_rough1)
- ptex->rough1*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_rough1);
+ ptex->rough1*=psys_interpolate_value_from_verts(ctx->dm, cpa_from, cpa_num, cpa_fuv, ctx->vg_rough1);
if (ctx->vg_rough2)
- ptex->rough2*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_rough2);
+ ptex->rough2*=psys_interpolate_value_from_verts(ctx->dm, cpa_from, cpa_num, cpa_fuv, ctx->vg_rough2);
if (ctx->vg_roughe)
- ptex->roughe*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_roughe);
+ ptex->roughe*=psys_interpolate_value_from_verts(ctx->dm, cpa_from, cpa_num, cpa_fuv, ctx->vg_roughe);
if (ctx->vg_effector)
- ptex->effector*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_effector);
+ ptex->effector*=psys_interpolate_value_from_verts(ctx->dm, cpa_from, cpa_num, cpa_fuv, ctx->vg_effector);
}
static void do_child_modifiers(ParticleSimulationData *sim, ParticleTexture *ptex, ParticleKey *par, float *par_rot, ChildParticle *cpa, float *orco, float mat[4][4], ParticleKey *state, float t)
{
@@ -4098,13 +4098,13 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
}
if (psys->lattice && edit==0)
- calc_latt_deform(psys->lattice, state->co,1.0f);
+ calc_latt_deform(psys->lattice, state->co, 1.0f);
}
}
}
}
else if (totchild) {
- //invert_m4_m4(imat,ob->obmat);
+ //invert_m4_m4(imat, ob->obmat);
/* interpolate childcache directly if it exists */
if (psys->childcache) {
@@ -4119,7 +4119,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
if (state->time < 0.0f)
t = psys_get_child_time(psys, cpa, -state->time, NULL, NULL);
-
+
if (totchild && part->childtype==PART_CHILD_FACES) {
/* part->parents could still be 0 so we can't test with totparent */
between=1;
@@ -4137,17 +4137,17 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
/* get the original coordinates (orco) for texture usage */
cpa_num=cpa->num;
-
+
foffset= cpa->foffset;
cpa_fuv = cpa->fuv;
cpa_from = PART_FROM_FACE;
- psys_particle_on_emitter(psmd,cpa_from,cpa_num,DMCACHE_ISCHILD,cpa->fuv,foffset,co,0,0,0,orco,0);
+ psys_particle_on_emitter(psmd, cpa_from, cpa_num, DMCACHE_ISCHILD, cpa->fuv, foffset, co, 0, 0, 0, orco, 0);
/* we need to save the actual root position of the child for positioning it accurately to the surface of the emitter */
- //copy_v3_v3(cpa_1st,co);
+ //copy_v3_v3(cpa_1st, co);
- //mul_m4_v3(ob->obmat,cpa_1st);
+ //mul_m4_v3(ob->obmat, cpa_1st);
pa = psys->particles + cpa->parent;
@@ -4158,38 +4158,38 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
pa=0;
}
- else {
- /* get the parent state */
- keys->time = state->time;
- psys_get_particle_on_path(sim, cpa->parent, keys,1);
+ else {
+ /* get the parent state */
+ keys->time = state->time;
+ psys_get_particle_on_path(sim, cpa->parent, keys, 1);
- /* get the original coordinates (orco) for texture usage */
- pa=psys->particles+cpa->parent;
+ /* get the original coordinates (orco) for texture usage */
+ pa=psys->particles+cpa->parent;
- cpa_from=part->from;
- cpa_num=pa->num;
- cpa_fuv=pa->fuv;
+ cpa_from=part->from;
+ cpa_num=pa->num;
+ cpa_fuv=pa->fuv;
-
- if (part->type == PART_HAIR) {
- psys_particle_on_emitter(psmd,cpa_from,cpa_num,DMCACHE_ISCHILD,cpa_fuv,pa->foffset,co,0,0,0,orco,0);
- psys_mat_hair_to_global(sim->ob, sim->psmd->dm, psys->part->from, pa, hairmat);
- }
- else {
- copy_v3_v3(orco, cpa->fuv);
- unit_m4(hairmat);
+
+ if (part->type == PART_HAIR) {
+ psys_particle_on_emitter(psmd, cpa_from, cpa_num, DMCACHE_ISCHILD, cpa_fuv, pa->foffset, co, 0, 0, 0, orco, 0);
+ psys_mat_hair_to_global(sim->ob, sim->psmd->dm, psys->part->from, pa, hairmat);
+ }
+ else {
+ copy_v3_v3(orco, cpa->fuv);
+ unit_m4(hairmat);
+ }
}
- }
/* correct child ipo timing */
- #if 0 // XXX old animation system
+#if 0 // XXX old animation system
if ((part->flag&PART_ABS_TIME)==0 && part->ipo) {
calc_ipo(part->ipo, 100.0f*t);
execute_ipo((ID *)part, part->ipo);
}
- #endif // XXX old animation system
-
+#endif // XXX old animation system
+
/* get different child parameters from textures & vgroups */
memset(&ctx, 0, sizeof(ParticleThreadContext));
ctx.sim = *sim;
@@ -4238,14 +4238,14 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
if (t>=0.001f) {
tstate.time=t-0.001f;
- psys_get_particle_on_path(sim,p,&tstate,0);
- sub_v3_v3v3(state->vel,state->co,tstate.co);
+ psys_get_particle_on_path(sim, p, &tstate, 0);
+ sub_v3_v3v3(state->vel, state->co, tstate.co);
normalize_v3(state->vel);
}
else {
tstate.time=t+0.001f;
- psys_get_particle_on_path(sim,p,&tstate,0);
- sub_v3_v3v3(state->vel,tstate.co,state->co);
+ psys_get_particle_on_path(sim, p, &tstate, 0);
+ sub_v3_v3v3(state->vel, tstate.co, state->co);
normalize_v3(state->vel);
}
@@ -4290,7 +4290,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
state->time= (cfra - (part->sta + (part->end - part->sta) * PSYS_FRAND(p + 23))) / (part->lifetime * PSYS_FRAND(p + 24));
- psys_get_particle_on_path(sim, p, state,1);
+ psys_get_particle_on_path(sim, p, state, 1);
return 1;
}
else {
@@ -4316,7 +4316,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
if (sim->psys->flag & PSYS_KEYED) {
state->time= -cfra;
- psys_get_particle_on_path(sim, p, state,1);
+ psys_get_particle_on_path(sim, p, state, 1);
return 1;
}
else {
@@ -4334,10 +4334,10 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
do_child_modifiers(sim, NULL, key1, key1->rot, cpa, cpa->fuv, mat, state, t);
if (psys->lattice)
- calc_latt_deform(sim->psys->lattice, state->co,1.0f);
+ calc_latt_deform(sim->psys->lattice, state->co, 1.0f);
}
else {
- if (pa->state.time==cfra || ELEM(part->phystype,PART_PHYS_NO,PART_PHYS_KEYED))
+ if (pa->state.time==cfra || ELEM(part->phystype, PART_PHYS_NO, PART_PHYS_KEYED))
copy_particle_key(state, &pa->state, 1);
else if (pa->prev_state.time==cfra)
copy_particle_key(state, &pa->prev_state, 1);
@@ -4393,7 +4393,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
}
if (sim->psys->lattice)
- calc_latt_deform(sim->psys->lattice, state->co,1.0f);
+ calc_latt_deform(sim->psys->lattice, state->co, 1.0f);
}
return 1;
@@ -4418,7 +4418,7 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, Partic
psys_interpolate_uvs(mtface, mface->v4, cpa->fuv, uv);
}
- psys_particle_on_emitter(psmd,PART_FROM_FACE,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,0,0,0,orco,0);
+ psys_particle_on_emitter(psmd, PART_FROM_FACE, cpa->num, DMCACHE_ISCHILD, cpa->fuv, cpa->foffset, loc, 0, 0, 0, orco, 0);
return;
}
else {
@@ -4446,7 +4446,7 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, Partic
}
}
- psys_particle_on_emitter(psmd,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,0,0,0,orco,0);
+ psys_particle_on_emitter(psmd, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, loc, 0, 0, 0, orco, 0);
}
void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa, ChildParticle *cpa, ParticleCacheKey *cache, float mat[][4], float *scale)
@@ -4464,9 +4464,9 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
pa = psys->particles + cpa->pa[0];
if (pa)
- psys_particle_on_emitter(psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0);
+ psys_particle_on_emitter(psmd, sim->psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, loc, nor, 0, 0, 0, 0);
else
- psys_particle_on_emitter(psmd,PART_FROM_FACE,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,nor,0,0,0,0);
+ psys_particle_on_emitter(psmd, PART_FROM_FACE, cpa->num, DMCACHE_ISCHILD, cpa->fuv, cpa->foffset, loc, nor, 0, 0, 0, 0);
if (psys->part->rotmode == PART_ROT_VEL) {
copy_m3_m4(nmat, ob->imat);
@@ -4475,8 +4475,8 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
normalize_v3(nor);
/* make sure that we get a proper side vector */
- if (fabs(dot_v3v3(nor,vec))>0.999999) {
- if (fabs(dot_v3v3(nor,xvec))>0.999999) {
+ if (fabs(dot_v3v3(nor, vec))>0.999999) {
+ if (fabs(dot_v3v3(nor, xvec))>0.999999) {
nor[0] = 0.0f;
nor[1] = 1.0f;
nor[2] = 0.0f;
@@ -4496,7 +4496,7 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
float phasefac = psys->part->phasefac;
if (psys->part->randphasefac != 0.0f)
phasefac += psys->part->randphasefac * PSYS_FRAND((pa-psys->particles) + 20);
- axis_angle_to_quat( q_phase, vec, phasefac*(float)M_PI);
+ axis_angle_to_quat(q_phase, vec, phasefac*(float)M_PI);
mul_qt_v3(q_phase, side);
}
@@ -4517,7 +4517,7 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3], float zvec[3], float center[3])
{
- float onevec[3] = {0.0f,0.0f,0.0f}, tvec[3], tvec2[3];
+ float onevec[3] = {0.0f, 0.0f, 0.0f}, tvec[3], tvec2[3];
xvec[0] = 1.0f; xvec[1] = 0.0f; xvec[2] = 0.0f;
yvec[0] = 0.0f; yvec[1] = 1.0f; yvec[2] = 0.0f;
@@ -4561,10 +4561,10 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3]
}
normalize_v3(zvec);
- cross_v3_v3v3(xvec,temp,zvec);
+ cross_v3_v3v3(xvec, temp, zvec);
normalize_v3(xvec);
- cross_v3_v3v3(yvec,zvec,xvec);
+ cross_v3_v3v3(yvec, zvec, xvec);
}
else {
sub_v3_v3v3(zvec, bb->ob->obmat[3], bb->vec);
@@ -4578,7 +4578,7 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3]
cross_v3_v3v3(xvec, bb->ob->obmat[1], zvec);
normalize_v3(xvec);
- cross_v3_v3v3(yvec,zvec,xvec);
+ cross_v3_v3v3(yvec, zvec, xvec);
}
copy_v3_v3(tvec, xvec);
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 4ce24953c89..daa7f847df6 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -241,10 +241,10 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart)
}
if (psys->particles) {
- totsaved=MIN2(psys->totpart,totpart);
+ totsaved=MIN2(psys->totpart, totpart);
/*save old pars*/
if (totsaved) {
- memcpy(newpars,psys->particles,totsaved*sizeof(ParticleData));
+ memcpy(newpars, psys->particles, totsaved*sizeof(ParticleData));
if (psys->particles->boid)
memcpy(newboids, psys->particles->boid, totsaved*sizeof(BoidParticle));
@@ -418,7 +418,7 @@ static void distribute_simple_children(Scene *scene, Object *ob, DerivedMesh *fi
cpa = psys->child;
for (i=0; i<child_nbr; i++) {
- for (p=0; p<psys->totpart; p++,cpa++) {
+ for (p=0; p<psys->totpart; p++, cpa++) {
float length=2.0;
cpa->parent=p;
@@ -440,7 +440,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
{
ParticleData *pa=NULL;
float min[3], max[3], delta[3], d;
- MVert *mv, *mvert = dm->getVertDataArray(dm,0);
+ MVert *mv, *mvert = dm->getVertDataArray(dm, 0);
int totvert=dm->getNumVerts(dm), from=psys->part->from;
int i, j, k, p, res=psys->part->grid_res, size[3], axis;
@@ -452,13 +452,13 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
mv++;
for (i=1; i<totvert; i++, mv++) {
- min[0]=MIN2(min[0],mv->co[0]);
- min[1]=MIN2(min[1],mv->co[1]);
- min[2]=MIN2(min[2],mv->co[2]);
+ min[0]=MIN2(min[0], mv->co[0]);
+ min[1]=MIN2(min[1], mv->co[1]);
+ min[2]=MIN2(min[2], mv->co[2]);
- max[0]=MAX2(max[0],mv->co[0]);
- max[1]=MAX2(max[1],mv->co[1]);
- max[2]=MAX2(max[2],mv->co[2]);
+ max[0]=MAX2(max[0], mv->co[0]);
+ max[1]=MAX2(max[1], mv->co[1]);
+ max[2]=MAX2(max[2], mv->co[2]);
}
sub_v3_v3v3(delta, max, min);
@@ -473,8 +473,8 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
size[(axis+2)%3] = (int)ceil(delta[(axis+2)%3]/d);
/* float errors grrr.. */
- size[(axis+1)%3] = MIN2(size[(axis+1)%3],res);
- size[(axis+2)%3] = MIN2(size[(axis+2)%3],res);
+ size[(axis+1)%3] = MIN2(size[(axis+1)%3], res);
+ size[(axis+2)%3] = MIN2(size[(axis+2)%3], res);
size[0] = MAX2(size[0], 1);
size[1] = MAX2(size[1], 1);
@@ -485,9 +485,9 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
min[1]+= d < delta[1] ? d/2.f : delta[1]/2.f;
min[2]+= d < delta[2] ? d/2.f : delta[2]/2.f;
- for (i=0,p=0,pa=psys->particles; i<res; i++) {
+ for (i=0, p=0, pa=psys->particles; i<res; i++) {
for (j=0; j<res; j++) {
- for (k=0; k<res; k++,p++,pa++) {
+ for (k=0; k<res; k++, p++, pa++) {
pa->fuv[0] = min[0] + (float)i*d;
pa->fuv[1] = min[1] + (float)j*d;
pa->fuv[2] = min[2] + (float)k*d;
@@ -507,8 +507,8 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
min[1] -= d/2.0f;
min[2] -= d/2.0f;
- for (i=0,mv=mvert; i<totvert; i++,mv++) {
- sub_v3_v3v3(vec,mv->co,min);
+ for (i=0, mv=mvert; i<totvert; i++, mv++) {
+ sub_v3_v3v3(vec, mv->co, min);
vec[0]/=delta[0];
vec[1]/=delta[1];
vec[2]/=delta[2];
@@ -517,7 +517,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
+(int)(vec[2]*(size[2]-1)))->flag &= ~PARS_UNEXIST;
}
}
- else if (ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
+ else if (ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME)) {
float co1[3], co2[3];
MFace *mface= NULL, *mface_array;
@@ -526,7 +526,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
int amax= from==PART_FROM_FACE ? 3 : 1;
totface=dm->getNumTessFaces(dm);
- mface=mface_array=dm->getTessFaceDataArray(dm,CD_MFACE);
+ mface=mface_array=dm->getTessFaceDataArray(dm, CD_MFACE);
for (a=0; a<amax; a++) {
if (a==0) { a0mul=res*res; a1mul=res; a2mul=1; }
@@ -545,7 +545,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
co1[a] -= 0.001f*d;
/* lets intersect the faces */
- for (i=0; i<totface; i++,mface++) {
+ for (i=0; i<totface; i++, mface++) {
copy_v3_v3(v1, mvert[mface->v1].co);
copy_v3_v3(v2, mvert[mface->v2].co);
copy_v3_v3(v3, mvert[mface->v3].co);
@@ -586,9 +586,9 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
}
if (psys->part->flag & PART_GRID_HEXAGONAL) {
- for (i=0,p=0,pa=psys->particles; i<res; i++) {
+ for (i=0, p=0, pa=psys->particles; i<res; i++) {
for (j=0; j<res; j++) {
- for (k=0; k<res; k++,p++,pa++) {
+ for (k=0; k<res; k++, p++, pa++) {
if (j%2)
pa->fuv[0] += d/2.f;
@@ -614,7 +614,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
if (psys->part->grid_rand > 0.f) {
float rfac = d * psys->part->grid_rand;
- for (p=0,pa=psys->particles; p<psys->totpart; p++,pa++) {
+ for (p=0, pa=psys->particles; p<psys->totpart; p++, pa++) {
if (pa->flag & PARS_UNEXIST)
continue;
@@ -708,10 +708,10 @@ static void psys_uv_to_w(float u, float v, int quad, float *w)
if (quad) {
vert[3][0]= 0.0f; vert[3][1]= 1.0f; vert[3][2]= 0.0f;
- interp_weights_poly_v3( w,vert, 4, co);
+ interp_weights_poly_v3(w, vert, 4, co);
}
else {
- interp_weights_poly_v3( w,vert, 3, co);
+ interp_weights_poly_v3(w, vert, 3, co);
w[3]= 0.0f;
}
}
@@ -771,9 +771,9 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
KDTreeNearest ptn[3];
int w, maxw;
- psys_particle_on_dm(ctx->dm,from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co1,0,0,0,orco1,0);
+ psys_particle_on_dm(ctx->dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co1, 0, 0, 0, orco1, 0);
transform_mesh_orco_verts((Mesh*)ob->data, &orco1, 1, 1);
- maxw = BLI_kdtree_find_n_nearest(ctx->tree,3,orco1,NULL,ptn);
+ maxw = BLI_kdtree_find_n_nearest(ctx->tree, 3, orco1, NULL, ptn);
for (w=0; w<maxw; w++) {
pa->verts[w]=ptn->num;
@@ -785,9 +785,9 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
MFace *mface;
pa->num = i = ctx->index[p];
- mface = dm->getTessFaceData(dm,i,CD_MFACE);
+ mface = dm->getTessFaceData(dm, i, CD_MFACE);
- switch(distr) {
+ switch (distr) {
case PART_DISTR_JIT:
if (ctx->jitlevel == 1) {
if (mface->v4)
@@ -796,7 +796,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
psys_uv_to_w(0.33333f, 0.33333f, mface->v4, pa->fuv);
}
else {
- ctx->jitoff[i] = fmod(ctx->jitoff[i],(float)ctx->jitlevel);
+ ctx->jitoff[i] = fmod(ctx->jitoff[i], (float)ctx->jitlevel);
psys_uv_to_w(ctx->jit[2*(int)ctx->jitoff[i]], ctx->jit[2*(int)ctx->jitoff[i]+1], mface->v4, pa->fuv);
ctx->jitoff[i]++;
}
@@ -813,21 +813,21 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
/* experimental */
if (from==PART_FROM_VOLUME) {
- MVert *mvert=dm->getVertDataArray(dm,CD_MVERT);
+ MVert *mvert=dm->getVertDataArray(dm, CD_MVERT);
tot=dm->getNumTessFaces(dm);
- psys_interpolate_face(mvert,mface,0,0,pa->fuv,co1,nor,0,0,0,0);
+ psys_interpolate_face(mvert, mface, 0, 0, pa->fuv, co1, nor, 0, 0, 0, 0);
normalize_v3(nor);
- mul_v3_fl(nor,-100.0);
+ mul_v3_fl(nor, -100.0);
- add_v3_v3v3(co2,co1,nor);
+ add_v3_v3v3(co2, co1, nor);
min_d=2.0;
intersect=0;
- for (i=0,mface=dm->getTessFaceDataArray(dm,CD_MFACE); i<tot; i++,mface++) {
+ for (i=0, mface=dm->getTessFaceDataArray(dm, CD_MFACE); i<tot; i++, mface++) {
if (i==pa->num) continue;
v1=mvert[mface->v1].co;
@@ -855,13 +855,15 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
}
if (intersect==0)
pa->foffset=0.0;
- else switch(distr) {
- case PART_DISTR_JIT:
- pa->foffset*= ctx->jit[p%(2*ctx->jitlevel)];
- break;
- case PART_DISTR_RAND:
- pa->foffset*=BLI_frand();
- break;
+ else {
+ switch (distr) {
+ case PART_DISTR_JIT:
+ pa->foffset *= ctx->jit[p % (2 * ctx->jitlevel)];
+ break;
+ case PART_DISTR_RAND:
+ pa->foffset *= BLI_frand();
+ break;
+ }
}
}
}
@@ -887,14 +889,14 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
if (ctx->tree) {
KDTreeNearest ptn[10];
- int w,maxw;//, do_seams;
- float maxd /*, mind,dd */, totw= 0.0f;
+ int w, maxw;//, do_seams;
+ float maxd /*, mind, dd */, totw= 0.0f;
int parent[10];
float pweight[10];
- psys_particle_on_dm(dm,cfrom,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co1,nor1,NULL,NULL,orco1,NULL);
+ psys_particle_on_dm(dm, cfrom, cpa->num, DMCACHE_ISCHILD, cpa->fuv, cpa->foffset, co1, nor1, NULL, NULL, orco1, NULL);
transform_mesh_orco_verts((Mesh*)ob->data, &orco1, 1, 1);
- maxw = BLI_kdtree_find_n_nearest(ctx->tree,4,orco1,NULL,ptn);
+ maxw = BLI_kdtree_find_n_nearest(ctx->tree, 4, orco1, NULL, ptn);
maxd=ptn[maxw-1].dist;
/* mind=ptn[0].dist; */ /* UNUSED */
@@ -902,14 +904,14 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
/* the weights here could be done better */
for (w=0; w<maxw; w++) {
parent[w]=ptn[w].index;
- pweight[w]=(float)pow(2.0,(double)(-6.0f*ptn[w].dist/maxd));
+ pweight[w]=(float)pow(2.0, (double)(-6.0f*ptn[w].dist/maxd));
}
for (;w<10; w++) {
parent[w]=-1;
pweight[w]=0.0f;
}
- for (w=0,i=0; w<maxw && i<4; w++) {
+ for (w=0, i=0; w<maxw && i<4; w++) {
if (parent[w]>=0) {
cpa->pa[i]=parent[w];
cpa->w[i]=pweight[w];
@@ -995,7 +997,7 @@ static void distribute_invalid(Scene *scene, ParticleSystem *psys, int from)
int p, totchild = get_psys_tot_child(scene, psys);
if (psys->child && totchild) {
- for (p=0,cpa=psys->child; p<totchild; p++,cpa++) {
+ for (p=0, cpa=psys->child; p<totchild; p++, cpa++) {
cpa->fuv[0]=cpa->fuv[1]=cpa->fuv[2]=cpa->fuv[3]= 0.0;
cpa->foffset= 0.0f;
cpa->parent=0;
@@ -1031,7 +1033,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
int cfrom=0;
int totelem=0, totpart, *particle_element=0, children=0, totseam=0;
int jitlevel= 1, distr;
- float *element_weight=NULL,*element_sum=NULL,*jitter_offset=NULL, *vweight=NULL;
+ float *element_weight=NULL, *element_sum=NULL, *jitter_offset=NULL, *vweight=NULL;
float cur, maxweight=0.0, tweight, totweight, inv_totweight, co[3], nor[3], orco[3], ornor[3];
if (ELEM3(NULL, ob, psys, psys->part))
@@ -1062,7 +1064,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
if (part->distr==PART_DISTR_GRID && from != PART_FROM_VERT) {
BLI_srandom(31415926 + psys->seed);
dm= CDDM_from_mesh((Mesh*)ob->data, ob);
- distribute_grid(dm,psys);
+ distribute_grid(dm, psys);
dm->release(dm);
return 0;
}
@@ -1081,8 +1083,8 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
tree=BLI_kdtree_new(totpart);
- for (p=0,pa=psys->particles; p<totpart; p++,pa++) {
- psys_particle_on_dm(dm,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,nor,0,0,orco,ornor);
+ for (p=0, pa=psys->particles; p<totpart; p++, pa++) {
+ psys_particle_on_dm(dm, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, nor, 0, 0, orco, ornor);
transform_mesh_orco_verts((Mesh*)ob->data, &orco, 1, 1);
BLI_kdtree_insert(tree, p, orco, ornor);
}
@@ -1115,12 +1117,12 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
for (p=0; p<totvert; p++) {
if (orcodata) {
- copy_v3_v3(co,orcodata[p]);
+ copy_v3_v3(co, orcodata[p]);
transform_mesh_orco_verts((Mesh*)ob->data, &co, 1, 1);
}
else
- copy_v3_v3(co,mv[p].co);
- BLI_kdtree_insert(tree,p,co,NULL);
+ copy_v3_v3(co, mv[p].co);
+ BLI_kdtree_insert(tree, p, co, NULL);
}
BLI_kdtree_balance(tree);
@@ -1134,7 +1136,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
distribute_invalid(scene, psys, children ? PART_FROM_CHILD : 0);
if (G.debug & G_DEBUG)
- fprintf(stderr,"Particle distribution error: Nothing to emit from!\n");
+ fprintf(stderr, "Particle distribution error: Nothing to emit from!\n");
if (dm != finaldm) dm->release(dm);
@@ -1157,7 +1159,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
orcodata= dm->getVertDataArray(dm, CD_ORCO);
for (i=0; i<totelem; i++) {
- MFace *mf=dm->getTessFaceData(dm,i,CD_MFACE);
+ MFace *mf=dm->getTessFaceData(dm, i, CD_MFACE);
if (orcodata) {
copy_v3_v3(co1, orcodata[mf->v1]);
@@ -1172,14 +1174,14 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
}
}
else {
- v1= (MVert*)dm->getVertData(dm,mf->v1,CD_MVERT);
- v2= (MVert*)dm->getVertData(dm,mf->v2,CD_MVERT);
- v3= (MVert*)dm->getVertData(dm,mf->v3,CD_MVERT);
+ v1= (MVert*)dm->getVertData(dm, mf->v1, CD_MVERT);
+ v2= (MVert*)dm->getVertData(dm, mf->v2, CD_MVERT);
+ v3= (MVert*)dm->getVertData(dm, mf->v3, CD_MVERT);
copy_v3_v3(co1, v1->co);
copy_v3_v3(co2, v2->co);
copy_v3_v3(co3, v3->co);
if (mf->v4) {
- v4= (MVert*)dm->getVertData(dm,mf->v4,CD_MVERT);
+ v4= (MVert*)dm->getVertData(dm, mf->v4, CD_MVERT);
copy_v3_v3(co4, v4->co);
}
}
@@ -1199,14 +1201,14 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
maxweight /= totarea;
}
else {
- float min=1.0f/(float)(MIN2(totelem,totpart));
+ float min=1.0f/(float)(MIN2(totelem, totpart));
for (i=0; i<totelem; i++)
element_weight[i]=min;
maxweight=min;
}
/* Calculate weights from vgroup */
- vweight = psys_cache_vgroup(dm,psys,PSYS_VG_DENSITY);
+ vweight = psys_cache_vgroup(dm, psys, PSYS_VG_DENSITY);
if (vweight) {
if (from==PART_FROM_VERT) {
@@ -1215,7 +1217,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
}
else { /* PART_FROM_FACE / PART_FROM_VOLUME */
for (i=0;i<totelem; i++) {
- MFace *mf=dm->getTessFaceData(dm,i,CD_MFACE);
+ MFace *mf=dm->getTessFaceData(dm, i, CD_MFACE);
tweight = vweight[mf->v1] + vweight[mf->v2] + vweight[mf->v3];
if (mf->v4) {
@@ -1300,7 +1302,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
}
/* Create jittering if needed */
- if (distr==PART_DISTR_JIT && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
+ if (distr==PART_DISTR_JIT && ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME)) {
jitlevel= part->userjit;
if (jitlevel == 0) {
@@ -1396,7 +1398,7 @@ static void distribute_particles_on_shape(ParticleSimulationData *sim, int UNUSE
{
distribute_invalid(sim->scene, sim->psys, 0);
- fprintf(stderr,"Shape emission not yet possible!\n");
+ fprintf(stderr, "Shape emission not yet possible!\n");
}
static void distribute_particles(ParticleSimulationData *sim, int from)
@@ -1416,7 +1418,7 @@ static void distribute_particles(ParticleSimulationData *sim, int from)
if (distr_error) {
distribute_invalid(sim->scene, sim->psys, from);
- fprintf(stderr,"Particle distribution error!\n");
+ fprintf(stderr, "Particle distribution error!\n");
}
}
@@ -1575,7 +1577,7 @@ static void initialize_all_particles(ParticleSimulationData *sim)
static void get_angular_velocity_vector(short avemode, ParticleKey *state, float *vec)
{
- switch(avemode) {
+ switch (avemode) {
case PART_AVE_VELOCITY:
copy_v3_v3(vec, state->vel);
break;
@@ -1617,18 +1619,18 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
ParticleSystem *psys = sim->psys;
ParticleSettings *part;
ParticleTexture ptex;
- float fac, phasefac, nor[3]={0,0,0},loc[3],vel[3]={0.0,0.0,0.0},rot[4],q2[4];
- float r_vel[3],r_ave[3],r_rot[4],vec[3],p_vel[3]={0.0,0.0,0.0};
- float x_vec[3]={1.0,0.0,0.0}, utan[3]={0.0,1.0,0.0}, vtan[3]={0.0,0.0,1.0}, rot_vec[3]={0.0,0.0,0.0};
+ float fac, phasefac, nor[3]={0, 0, 0}, loc[3], vel[3]={0.0, 0.0, 0.0}, rot[4], q2[4];
+ float r_vel[3], r_ave[3], r_rot[4], vec[3], p_vel[3]={0.0, 0.0, 0.0};
+ float x_vec[3]={1.0, 0.0, 0.0}, utan[3]={0.0, 1.0, 0.0}, vtan[3]={0.0, 0.0, 1.0}, rot_vec[3]={0.0, 0.0, 0.0};
float q_phase[4];
int p = pa - psys->particles;
part=psys->part;
/* get birth location from object */
if (part->tanfac != 0.f)
- psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,utan,vtan,0,0);
+ psys_particle_on_emitter(sim->psmd, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, loc, nor, utan, vtan, 0, 0);
else
- psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,0,0,0,0);
+ psys_particle_on_emitter(sim->psmd, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, loc, nor, 0, 0, 0, 0);
/* get possible textural influence */
psys_get_texture(sim, pa, &ptex, PAMAP_IVEL, cfra);
@@ -1644,16 +1646,16 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
/* -tangent */
if (part->tanfac!=0.0f) {
- //float phase=vg_rot?2.0f*(psys_particle_value_from_verts(sim->psmd->dm,part->from,pa,vg_rot)-0.5f):0.0f;
+ //float phase=vg_rot?2.0f*(psys_particle_value_from_verts(sim->psmd->dm, part->from, pa, vg_rot)-0.5f):0.0f;
float phase=0.0f;
- mul_v3_fl(vtan,-cosf((float)M_PI*(part->tanphase+phase)));
+ mul_v3_fl(vtan, -cosf((float)M_PI*(part->tanphase+phase)));
fac= -sinf((float)M_PI*(part->tanphase+phase));
madd_v3_v3fl(vtan, utan, fac);
- mul_mat3_m4_v3(ob->obmat,vtan);
+ mul_mat3_m4_v3(ob->obmat, vtan);
copy_v3_v3(utan, nor);
- mul_v3_fl(utan,dot_v3v3(vtan,nor));
+ mul_v3_fl(utan, dot_v3v3(vtan, nor));
sub_v3_v3(vtan, utan);
normalize_v3(vtan);
@@ -1676,7 +1678,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
r_ave[1] = 2.0f * (PSYS_FRAND(p + 14) - 0.5f);
r_ave[2] = 2.0f * (PSYS_FRAND(p + 15) - 0.5f);
- mul_mat3_m4_v3(ob->obmat,r_ave);
+ mul_mat3_m4_v3(ob->obmat, r_ave);
normalize_v3(r_ave);
}
@@ -1688,14 +1690,14 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
r_rot[3] = 2.0f * (PSYS_FRAND(p + 19) - 0.5f);
normalize_qt(r_rot);
- mat4_to_quat(rot,ob->obmat);
- mul_qt_qtqt(r_rot,r_rot,rot);
+ mat4_to_quat(rot, ob->obmat);
+ mul_qt_qtqt(r_rot, r_rot, rot);
}
if (part->phystype==PART_PHYS_BOIDS && pa->boid) {
float dvec[3], q[4], mat[3][3];
- copy_v3_v3(state->co,loc);
+ copy_v3_v3(state->co, loc);
/* boids don't get any initial velocity */
zero_v3(state->vel);
@@ -1718,7 +1720,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
cross_v3_v3v3(mat[1], mat[2], mat[0]);
/* apply rotation */
- mat3_to_quat_is_ok( q,mat);
+ mat3_to_quat_is_ok(q, mat);
copy_qt_qt(state->rot, q);
}
else {
@@ -1772,14 +1774,14 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
mul_v3_v3fl(state->vel, vel, ptex.ivel);
/* -location from emitter */
- copy_v3_v3(state->co,loc);
+ copy_v3_v3(state->co, loc);
/* -rotation */
unit_qt(state->rot);
if (part->rotmode) {
/* create vector into which rotation is aligned */
- switch(part->rotmode) {
+ switch (part->rotmode) {
case PART_ROT_NOR:
copy_v3_v3(rot_vec, nor);
break;
@@ -1800,19 +1802,19 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
/* create rotation quat */
negate_v3(rot_vec);
- vec_to_quat( q2,rot_vec, OB_POSX, OB_POSZ);
+ vec_to_quat(q2, rot_vec, OB_POSX, OB_POSZ);
/* randomize rotation quat */
if (part->randrotfac!=0.0f)
interp_qt_qtqt(rot, q2, r_rot, part->randrotfac);
else
- copy_qt_qt(rot,q2);
+ copy_qt_qt(rot, q2);
/* rotation phase */
phasefac = part->phasefac;
if (part->randphasefac != 0.0f)
phasefac += part->randphasefac * PSYS_FRAND(p + 20);
- axis_angle_to_quat( q_phase,x_vec, phasefac*(float)M_PI);
+ axis_angle_to_quat(q_phase, x_vec, phasefac*(float)M_PI);
/* combine base rotation & phase */
mul_qt_qtqt(state->rot, rot, q_phase);
@@ -2130,7 +2132,7 @@ static void psys_update_effectors(ParticleSimulationData *sim)
static void integrate_particle(ParticleSettings *part, ParticleData *pa, float dtime, float *external_acceleration, void (*force_func)(void *forcedata, ParticleKey *state, float *force, float *impulse), void *forcedata)
{
ParticleKey states[5];
- float force[3],acceleration[3],impulse[3],dx[4][3],dv[4][3],oldpos[3];
+ float force[3], acceleration[3], impulse[3], dx[4][3], dv[4][3], oldpos[3];
float pa_mass= (part->flag & PART_SIZEMASS ? part->mass * pa->size : part->mass);
int i, steps=1;
int integrator = part->integrator;
@@ -2141,7 +2143,7 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
if (pa->prev_state.time < 0.f && integrator == PART_INT_VERLET)
integrator = PART_INT_EULER;
- switch(integrator) {
+ switch (integrator) {
case PART_INT_EULER:
steps=1;
break;
@@ -2175,7 +2177,7 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
/* calculate next state */
add_v3_v3(states[i].vel, impulse);
- switch(integrator) {
+ switch (integrator) {
case PART_INT_EULER:
madd_v3_v3v3fl(pa->state.co, states->co, states->vel, dtime);
madd_v3_v3v3fl(pa->state.vel, states->vel, acceleration, dtime);
@@ -2193,7 +2195,7 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
}
break;
case PART_INT_RK4:
- switch(i) {
+ switch (i) {
case 0:
copy_v3_v3(dx[0], states->vel);
mul_v3_fl(dx[0], dtime);
@@ -2535,10 +2537,10 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa
u = dot_v3v3(vec, dv);
if (u < 0.f && visc > 0.f)
- madd_v3_v3fl(force, vec, 0.5f * q * visc * u );
+ madd_v3_v3fl(force, vec, 0.5f * q * visc * u);
if (u > 0.f && stiff_visc > 0.f)
- madd_v3_v3fl(force, vec, 0.5f * q * stiff_visc * u );
+ madd_v3_v3fl(force, vec, 0.5f * q * stiff_visc * u);
}
if (spring_constant > 0.f) {
@@ -2711,23 +2713,23 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa
time=(cfra-pa->time)/pa->lifetime;
CLAMP(time, 0.0f, 1.0f);
- copy_v3_v3(tkey.co,pa->state.co);
- copy_v3_v3(tkey.vel,pa->state.vel);
+ copy_v3_v3(tkey.co, pa->state.co);
+ copy_v3_v3(tkey.vel, pa->state.vel);
tkey.time=pa->state.time;
if (part->type != PART_HAIR) {
if (do_guides(sim->psys->effectors, &tkey, p, time)) {
- copy_v3_v3(pa->state.co,tkey.co);
+ copy_v3_v3(pa->state.co, tkey.co);
/* guides don't produce valid velocity */
sub_v3_v3v3(pa->state.vel, tkey.co, pa->prev_state.co);
- mul_v3_fl(pa->state.vel,1.0f/dtime);
+ mul_v3_fl(pa->state.vel, 1.0f/dtime);
pa->state.time=tkey.time;
}
}
}
static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, float timestep)
{
- float rotfac, rot1[4], rot2[4]={1.0,0.0,0.0,0.0}, dtime=dfra*timestep;
+ float rotfac, rot1[4], rot2[4]={1.0, 0.0, 0.0, 0.0}, dtime=dfra*timestep;
if ((part->flag & PART_ROTATIONS)==0) {
pa->state.rot[0]=1.0f;
@@ -2755,15 +2757,15 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f
}
rotfac = len_v3(pa->state.ave);
- if (rotfac == 0.0f) { /* unit_qt(in VecRotToQuat) doesn't give unit quat [1,0,0,0]?? */
+ if (rotfac == 0.0f) { /* unit_qt(in VecRotToQuat) doesn't give unit quat [1, 0, 0, 0]?? */
rot1[0]=1.0f;
rot1[1]=rot1[2]=rot1[3]=0;
}
else {
- axis_angle_to_quat(rot1,pa->state.ave,rotfac*dtime);
+ axis_angle_to_quat(rot1, pa->state.ave, rotfac*dtime);
}
- mul_qt_qtqt(pa->state.rot,rot1,pa->prev_state.rot);
- mul_qt_qtqt(pa->state.rot,rot2,pa->state.rot);
+ mul_qt_qtqt(pa->state.rot, rot1, pa->prev_state.rot);
+ mul_qt_qtqt(pa->state.rot, rot2, pa->state.rot);
/* keep rotation quat in good health */
normalize_qt(pa->state.rot);
@@ -2859,7 +2861,7 @@ static float collision_point_distance_with_normal(float p[3], ParticleCollisionE
if (fac >= 0.f)
collision_interpolate_element(pce, 0.f, fac, col);
- switch(pce->tot) {
+ switch (pce->tot) {
case 1:
{
sub_v3_v3v3(nor, p, pce->x0);
@@ -2884,7 +2886,7 @@ static void collision_point_on_surface(float p[3], ParticleCollisionElement *pce
{
collision_interpolate_element(pce, 0.f, fac, col);
- switch(pce->tot) {
+ switch (pce->tot) {
case 1:
{
sub_v3_v3v3(co, p, pce->x0);
@@ -3254,8 +3256,8 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
float frict = pd->pdef_frict + pd->pdef_rfrict * 2 * (BLI_frand() - 0.5f);
float distance, nor[3], dot;
- CLAMP(damp,0.0f, 1.0f);
- CLAMP(frict,0.0f, 1.0f);
+ CLAMP(damp, 0.0f, 1.0f);
+ CLAMP(frict, 0.0f, 1.0f);
/* get exact velocity right before collision */
madd_v3_v3v3fl(v0, col->ve1, col->acc, dt1);
@@ -3601,7 +3603,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
psys_mat_hair_to_object(sim->ob, sim->psmd->dm, psys->part->from, pa, hairmat);
- for (k=0, key=pa->hair; k<pa->totkey; k++,key++) {
+ for (k=0, key=pa->hair; k<pa->totkey; k++, key++) {
/* create fake root before actual root to resist bending */
if (k==0) {
@@ -3833,7 +3835,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
sim->colliders = get_collider_cache(sim->scene, sim->ob, NULL);
/* initialize physics type specific stuff */
- switch(part->phystype) {
+ switch (part->phystype) {
case PART_PHYS_BOIDS:
{
ParticleTarget *pt = psys->targets.first;
@@ -3867,7 +3869,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
}
/* initialize all particles for dynamics */
LOOP_SHOWN_PARTICLES {
- copy_particle_key(&pa->prev_state,&pa->state,1);
+ copy_particle_key(&pa->prev_state, &pa->state, 1);
psys_get_texture(sim, pa, &ptex, PAMAP_SIZE, cfra);
@@ -3908,7 +3910,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
pa->state.time = -1.f;
}
- switch(part->phystype) {
+ switch (part->phystype) {
case PART_PHYS_NEWTON:
{
LOOP_DYNAMIC_PARTICLES {
@@ -3946,7 +3948,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
SPHData sphdata;
sph_solver_init(sim, &sphdata);
- #pragma omp parallel for firstprivate (sphdata) private (pa) schedule(dynamic,5)
+ #pragma omp parallel for firstprivate (sphdata) private (pa) schedule(dynamic, 5)
LOOP_DYNAMIC_PARTICLES {
/* do global forces & effectors */
basic_integrate(sim, p, pa->state.time, cfra);
@@ -4083,7 +4085,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
gzf = BLI_gzopen(filename, "rb");
if (!gzf) {
- BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer),"readFsPartData::error - Unable to open file for reading '%s'\n", filename);
+ BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer), "readFsPartData::error - Unable to open file for reading '%s'\n", filename);
// XXX bad level call elbeemDebugOut(debugStrBuffer);
return;
}
@@ -4104,23 +4106,23 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
for (p=0, pa=psys->particles; p<totpart; p++, pa++) {
int ptype=0;
- gzread(gzf, &ptype, sizeof( ptype ));
+ gzread(gzf, &ptype, sizeof(ptype));
if (ptype&readMask) {
activeParts++;
- gzread(gzf, &(pa->size), sizeof( float ));
+ gzread(gzf, &(pa->size), sizeof(float));
pa->size /= 10.0f;
for (j=0; j<3; j++) {
float wrf;
- gzread(gzf, &wrf, sizeof( wrf ));
+ gzread(gzf, &wrf, sizeof(wrf));
pa->state.co[j] = wrf;
- //fprintf(stderr,"Rj%d ",j);
+ //fprintf(stderr, "Rj%d ", j);
}
for (j=0; j<3; j++) {
float wrf;
- gzread(gzf, &wrf, sizeof( wrf ));
+ gzread(gzf, &wrf, sizeof(wrf));
pa->state.vel[j] = wrf;
}
@@ -4132,7 +4134,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
pa->dietime = sim->scene->r.efra + 1;
pa->lifetime = sim->scene->r.efra;
pa->alive = PARS_ALIVE;
- //if (a < 25) fprintf(stderr,"FSPARTICLE debug set %s , a%d = %f,%f,%f , life=%f\n", filename, a, pa->co[0],pa->co[1],pa->co[2], pa->lifetime );
+ //if (a < 25) fprintf(stderr, "FSPARTICLE debug set %s, a%d = %f, %f, %f, life=%f\n", filename, a, pa->co[0], pa->co[1], pa->co[2], pa->lifetime );
}
else {
// skip...
@@ -4145,7 +4147,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
gzclose(gzf);
totpart = psys->totpart = activeParts;
- BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d\n", psys->totpart,activeParts,fileParts,readMask);
+ BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer), "readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d\n", psys->totpart, activeParts, fileParts, readMask);
// bad level call
// XXX elbeemDebugOut(debugStrBuffer);
@@ -4300,7 +4302,7 @@ static void system_step(ParticleSimulationData *sim, float cfra)
dynamics_step(sim, cfra+dframe+t_frac - 1.f);
psys->cfra = cfra+dframe+t_frac - 1.f;
#if 0
- printf("%f,%f,%f,%f\n", cfra+dframe+t_frac - 1.f, t_frac, dt_frac, sim->courant_num);
+ printf("%f, %f, %f, %f\n", cfra+dframe+t_frac - 1.f, t_frac, dt_frac, sim->courant_num);
#endif
if (part->time_flag & PART_TIME_AUTOSF)
dt_frac = update_timestep(psys, sim, t_frac);
@@ -4499,7 +4501,7 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
/* setup necessary physics type dependent additional data if it doesn't yet exist */
psys_prepare_physics(&sim);
- switch(part->type) {
+ switch (part->type) {
case PART_HAIR:
{
/* nothing to do so bail out early */
@@ -4551,7 +4553,7 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
}
default:
{
- switch(part->phystype) {
+ switch (part->phystype) {
case PART_PHYS_NO:
case PART_PHYS_KEYED:
{
@@ -4587,7 +4589,7 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
if (part->phystype == PART_PHYS_KEYED) {
psys_count_keyed_targets(&sim);
set_keyed_keys(&sim);
- psys_update_path_cache(&sim,(int)cfra);
+ psys_update_path_cache(&sim, (int)cfra);
}
break;
}
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 2812592c69a..1e80f1e6d1e 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -222,7 +222,7 @@ void BKE_ptcache_make_particle_key(ParticleKey *key, int index, void **data, flo
/* no rotation info, so make something nice up */
if (data[BPHYS_DATA_ROTATION]==NULL) {
- vec_to_quat( key->rot, key->vel, OB_NEGX, OB_POSZ);
+ vec_to_quat(key->rot, key->vel, OB_NEGX, OB_POSZ);
}
else {
PTCACHE_DATA_TO(data, BPHYS_DATA_ROTATION, index, key->rot);
@@ -366,7 +366,7 @@ static void ptcache_particle_interpolate(int index, void *psys_v, void **data, f
/* determine rotation from velocity */
if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_ROTATION]) {
- vec_to_quat( keys[2].rot,keys[2].vel, OB_NEGX, OB_POSZ);
+ vec_to_quat(keys[2].rot, keys[2].vel, OB_NEGX, OB_POSZ);
}
if (cfra > pa->time)
@@ -400,7 +400,7 @@ static int ptcache_particle_totwrite(void *psys_v, int cfra)
if (cfra == 0)
return psys->totpart;
- for (p=0; p<psys->totpart; p++,pa++)
+ for (p=0; p<psys->totpart; p++, pa++)
totwrite += (cfra >= pa->time - step && cfra <= pa->dietime + step);
return totwrite;
@@ -433,7 +433,7 @@ static void ptcache_particle_extra_read(void *psys_v, PTCacheMem *pm, float UNUS
PTCacheExtra *extra = pm->extradata.first;
for (; extra; extra=extra->next) {
- switch(extra->type) {
+ switch (extra->type) {
case BPHYS_EXTRA_FLUID_SPRINGS:
{
if (psys->fluid_springs)
@@ -690,14 +690,20 @@ static int ptcache_dynamicpaint_write(PTCacheFile *pf, void *dp_v)
/* cache type */
ptcache_file_write(pf, &surface->type, 1, sizeof(int));
- if (surface->type == MOD_DPAINT_SURFACE_T_PAINT)
- in_len = sizeof(PaintPoint)*total_points;
+ if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
+ in_len = sizeof(PaintPoint) * total_points;
+ }
else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE ||
- surface->type == MOD_DPAINT_SURFACE_T_WEIGHT)
- in_len = sizeof(float)*total_points;
- else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE)
- in_len = sizeof(PaintWavePoint)*total_points;
- else return 0;
+ surface->type == MOD_DPAINT_SURFACE_T_WEIGHT)
+ {
+ in_len = sizeof(float) * total_points;
+ }
+ else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
+ in_len = sizeof(PaintWavePoint) * total_points;
+ }
+ else {
+ return 0;
+ }
out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len), "pointcache_lzo_buffer");
@@ -714,7 +720,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v)
/* version header */
ptcache_file_read(pf, version, 1, sizeof(char)*4);
- if (strncmp(version, DPAINT_CACHE_VERSION,4)) {printf("Dynamic Paint: Invalid cache version: %s!\n",version); return 0;}
+ if (strncmp(version, DPAINT_CACHE_VERSION, 4)) {printf("Dynamic Paint: Invalid cache version: %s!\n", version); return 0;}
if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && surface->data) {
unsigned int data_len;
@@ -727,14 +733,20 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v)
return 0;
/* read surface data */
- if (surface->type == MOD_DPAINT_SURFACE_T_PAINT)
+ if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
data_len = sizeof(PaintPoint);
+ }
else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE ||
- surface->type == MOD_DPAINT_SURFACE_T_WEIGHT)
+ surface->type == MOD_DPAINT_SURFACE_T_WEIGHT)
+ {
data_len = sizeof(float);
- else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE)
+ }
+ else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
data_len = sizeof(PaintWavePoint);
- else return 0;
+ }
+ else {
+ return 0;
+ }
ptcache_file_compressed_read(pf, (unsigned char*)surface->data->type_data, data_len*surface->data->total_points);
@@ -989,8 +1001,7 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
}
else if (md->type == eModifierType_Smoke) {
SmokeModifierData *smd = (SmokeModifierData *)md;
- if (smd->type & MOD_SMOKE_TYPE_DOMAIN)
- {
+ if (smd->type & MOD_SMOKE_TYPE_DOMAIN) {
pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID");
BKE_ptcache_id_from_smoke(pid, ob, (SmokeModifierData*)md);
BLI_addtail(lb, pid);
@@ -998,8 +1009,7 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
}
else if (md->type == eModifierType_DynamicPaint) {
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
- if (pmd->canvas)
- {
+ if (pmd->canvas) {
DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
for (; surface; surface=surface->next) {
@@ -1205,8 +1215,7 @@ static int ptcache_file_compressed_read(PTCacheFile *pf, unsigned char *result,
r = lzo1x_decompress_safe(in, (lzo_uint)in_len, result, (lzo_uint *)&out_len, NULL);
#endif
#ifdef WITH_LZMA
- if (compressed == 2)
- {
+ if (compressed == 2) {
size_t sizeOfIt;
size_t leni = in_len, leno = len;
ptcache_file_read(pf, &size, 1, sizeof(unsigned int));
@@ -1251,7 +1260,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns
#ifdef WITH_LZMA
if (mode == 2) {
- r = LzmaCompress(out, &out_len, in, in_len,//assume sizeof(char)==1....
+ r = LzmaCompress(out, &out_len, in, in_len, //assume sizeof(char)==1....
props, &sizeOfIt, 5, 1 << 24, 3, 0, 2, 32, 2);
if (!(r == SZ_OK) || (out_len >= in_len))
@@ -1270,8 +1279,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns
else
ptcache_file_write(pf, in, in_len, sizeof(unsigned char));
- if (compressed == 2)
- {
+ if (compressed == 2) {
unsigned int size = sizeOfIt;
ptcache_file_write(pf, &sizeOfIt, 1, sizeof(unsigned int));
ptcache_file_write(pf, props, size, sizeof(unsigned char));
@@ -2505,16 +2513,14 @@ int BKE_ptcache_object_reset(Scene *scene, Object *ob, int mode)
}
if (md->type == eModifierType_Smoke) {
SmokeModifierData *smd = (SmokeModifierData *)md;
- if (smd->type & MOD_SMOKE_TYPE_DOMAIN)
- {
+ if (smd->type & MOD_SMOKE_TYPE_DOMAIN) {
BKE_ptcache_id_from_smoke(&pid, ob, (SmokeModifierData*)md);
reset |= BKE_ptcache_id_reset(scene, &pid, mode);
}
}
if (md->type == eModifierType_DynamicPaint) {
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
- if (pmd->canvas)
- {
+ if (pmd->canvas) {
DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
for (; surface; surface=surface->next) {
@@ -2813,8 +2819,7 @@ void BKE_ptcache_bake(PTCacheBaker* baker)
PTCacheID *pid2;
BKE_ptcache_ids_from_object(&pidlist2, pid->ob, scene, MAX_DUPLI_RECUR);
for (pid2=pidlist2.first; pid2; pid2=pid2->next) {
- if (pid2->type == PTCACHE_TYPE_SMOKE_DOMAIN)
- {
+ if (pid2->type == PTCACHE_TYPE_SMOKE_DOMAIN) {
if (pid2->cache && !(pid2->cache->flag & PTCACHE_BAKED)) {
if (bake || pid2->cache->flag & PTCACHE_REDO_NEEDED)
BKE_ptcache_id_clear(pid2, PTCACHE_CLEAR_ALL, 0);
@@ -3246,8 +3251,7 @@ void BKE_ptcache_update_info(PTCacheID *pid)
}
if (cache->flag & PTCACHE_DISK_CACHE) {
- if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
- {
+ if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN) {
int totpoint = pid->totpoint(pid->calldata, 0);
if (cache->totpoint > totpoint)
diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c
index 066de61575d..e7247be7f51 100644
--- a/source/blender/blenkernel/intern/property.c
+++ b/source/blender/blenkernel/intern/property.c
@@ -99,7 +99,7 @@ void init_property(bProperty *prop)
prop->data= 0;
- switch(prop->type) {
+ switch (prop->type) {
case GPROP_BOOL:
case GPROP_INT:
case GPROP_FLOAT:
@@ -206,7 +206,7 @@ int compare_property(bProperty *prop, const char *str)
// extern int Gdfra; /* sector.c */
float fvalue, ftest;
- switch(prop->type) {
+ switch (prop->type) {
case GPROP_BOOL:
if (BLI_strcasecmp(str, "true")==0) {
if (prop->data==1) return 0;
@@ -242,7 +242,7 @@ void set_property(bProperty *prop, const char *str)
{
// extern int Gdfra; /* sector.c */
- switch(prop->type) {
+ switch (prop->type) {
case GPROP_BOOL:
if (BLI_strcasecmp(str, "true")==0) prop->data= 1;
else if (BLI_strcasecmp(str, "false")==0) prop->data= 0;
@@ -266,7 +266,7 @@ void add_property(bProperty *prop, const char *str)
{
// extern int Gdfra; /* sector.c */
- switch(prop->type) {
+ switch (prop->type) {
case GPROP_BOOL:
case GPROP_INT:
prop->data+= atoi(str);
@@ -288,7 +288,7 @@ void set_property_valstr(bProperty *prop, char *str)
if (str == NULL) return;
- switch(prop->type) {
+ switch (prop->type) {
case GPROP_BOOL:
case GPROP_INT:
sprintf(str, "%d", prop->data);
diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c
index b3e288dfc74..a7df6b10f06 100644
--- a/source/blender/blenkernel/intern/report.c
+++ b/source/blender/blenkernel/intern/report.c
@@ -43,7 +43,7 @@
static const char *report_type_str(int type)
{
- switch(type) {
+ switch (type) {
case RPT_DEBUG: return "Debug";
case RPT_INFO: return "Info";
case RPT_OPERATOR: return "Operator";
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index 8123cbf3f0b..b5bb6b76c61 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -110,7 +110,7 @@ void init_sensor(bSensor *sens)
sens->data= NULL;
sens->pulse = 0;
- switch(sens->type) {
+ switch (sens->type) {
case SENS_ALWAYS:
sens->pulse = 0;
break;
@@ -272,7 +272,7 @@ void init_controller(bController *cont)
if (cont->data) MEM_freeN(cont->data);
cont->data= NULL;
- switch(cont->type) {
+ switch (cont->type) {
case CONT_EXPRESSION:
cont->data= MEM_callocN(sizeof(bExpressionCont), "expcont");
break;
@@ -400,7 +400,7 @@ void init_actuator(bActuator *act)
if (act->data) MEM_freeN(act->data);
act->data= NULL;
- switch(act->type) {
+ switch (act->type) {
case ACT_ACTION:
case ACT_SHAPEACTION:
act->data= MEM_callocN(sizeof(bActionActuator), "actionact");
@@ -647,7 +647,7 @@ void sca_remove_ob_poin(Object *obt, Object *ob)
sens= obt->sensors.first;
while (sens) {
- switch(sens->type) {
+ switch (sens->type) {
case SENS_MESSAGE:
ms= sens->data;
if (ms->fromObject==ob) ms->fromObject= NULL;
@@ -657,7 +657,7 @@ void sca_remove_ob_poin(Object *obt, Object *ob)
act= obt->actuators.first;
while (act) {
- switch(act->type) {
+ switch (act->type) {
case ACT_CAMERA:
ca= act->data;
if (ca->ob==ob) ca->ob= NULL;
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 01ab5745256..864260833a6 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -234,7 +234,7 @@ Scene *copy_scene(Scene *sce, int type)
}
if (sce->ed) {
- scen->ed= MEM_callocN( sizeof(Editing), "addseq");
+ scen->ed= MEM_callocN(sizeof(Editing), "addseq");
scen->ed->seqbasep= &scen->ed->seqbase;
seqbase_dupli_recursive(sce, scen, &scen->ed->seqbase, &sce->ed->seqbase, SEQ_DUPE_ALL);
}
@@ -408,7 +408,7 @@ Scene *add_scene(const char *name)
sce->r.border.xmax = 1.0f;
sce->r.border.ymax = 1.0f;
- sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings),"Tool Settings Struct");
+ sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings), "Tool Settings Struct");
sce->toolsettings->cornertype=1;
sce->toolsettings->degr = 90;
sce->toolsettings->step = 9;
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 8015e53e4c9..5983beac4ef 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -294,7 +294,7 @@ static struct ImBuf * do_plugin_effect(
* old plugins) do very bad stuff
* with imbuf-internals */
- struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
+ struct ImBuf * out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
int x = context.rectx;
int y = context.recty;
@@ -548,7 +548,7 @@ static struct ImBuf * do_alphaover_effect(
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
- struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
+ struct ImBuf * out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
do_alphaover_effect_float(
@@ -937,7 +937,7 @@ static float gammaCorrect(float c)
float res = 0.0;
i = floor(c * inv_color_step);
- /* Clip to range [0,1]: outside, just do the complete calculation. */
+ /* Clip to range [0, 1]: outside, just do the complete calculation. */
/* We may have some performance problems here. Stretching up the LUT */
/* may help solve that, by exchanging LUT size for the interpolation. */
/* Negative colors are explicitly handled. */
@@ -1121,7 +1121,7 @@ static struct ImBuf * do_gammacross_effect(
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
- struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
+ struct ImBuf * out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
build_gammatabs();
@@ -1240,7 +1240,7 @@ static struct ImBuf * do_add_effect(SeqRenderData context,
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
- struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
+ struct ImBuf * out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
do_add_effect_float(
@@ -1357,7 +1357,7 @@ static struct ImBuf * do_sub_effect(
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
- struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
+ struct ImBuf * out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
do_sub_effect_float(
@@ -1571,7 +1571,7 @@ static struct ImBuf * do_mul_effect(
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
- struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
+ struct ImBuf * out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
do_mul_effect_float(
@@ -1612,7 +1612,7 @@ static void precalc_wipe_zone(WipeZone *wipezone, WipeVars *wipe, int xo, int yo
}
// This function calculates the blur band for the wipe effects
-static float in_band(float width,float dist,int side,int dir)
+static float in_band(float width, float dist, int side, int dir)
{
float alpha;
@@ -1636,15 +1636,15 @@ static float in_band(float width,float dist,int side,int dir)
static float check_zone(WipeZone *wipezone, int x, int y,
Sequence *seq, float facf0)
{
- float posx, posy,hyp,hyp2,angle,hwidth,b1,b2,b3,pointdist;
+ float posx, posy, hyp, hyp2, angle, hwidth, b1, b2, b3, pointdist;
/* some future stuff */
- // float hyp3,hyp4,b4,b5
- float temp1,temp2,temp3,temp4; //some placeholder variables
+ // float hyp3, hyp4, b4, b5
+ float temp1, temp2, temp3, temp4; //some placeholder variables
int xo = wipezone->xo;
int yo = wipezone->yo;
float halfx = xo*0.5f;
float halfy = yo*0.5f;
- float widthf,output=0;
+ float widthf, output=0;
WipeVars *wipe = (WipeVars *)seq->effectdata;
int width;
@@ -1683,15 +1683,15 @@ static float check_zone(WipeZone *wipezone, int x, int y,
if (wipe->forward) {
if (b1 < b2)
- output = in_band(width,hyp,1,1);
+ output = in_band(width, hyp, 1, 1);
else
- output = in_band(width,hyp,0,1);
+ output = in_band(width, hyp, 0, 1);
}
else {
if (b1 < b2)
- output = in_band(width,hyp,0,1);
+ output = in_band(width, hyp, 0, 1);
else
- output = in_band(width,hyp,1,1);
+ output = in_band(width, hyp, 1, 1);
}
break;
@@ -1721,25 +1721,25 @@ static float check_zone(WipeZone *wipezone, int x, int y,
hwidth = minf(hwidth, fabsf(b3-b1)/2.0f);
if (b2 < b1 && b2 < b3 ) {
- output = in_band(hwidth,hyp,0,1);
+ output = in_band(hwidth, hyp, 0, 1);
}
else if (b2 > b1 && b2 > b3 ) {
- output = in_band(hwidth,hyp2,0,1);
+ output = in_band(hwidth, hyp2, 0, 1);
}
else {
if ( hyp < hwidth && hyp2 > hwidth )
- output = in_band(hwidth,hyp,1,1);
+ output = in_band(hwidth, hyp, 1, 1);
else if ( hyp > hwidth && hyp2 < hwidth )
- output = in_band(hwidth,hyp2,1,1);
+ output = in_band(hwidth, hyp2, 1, 1);
else
- output = in_band(hwidth,hyp2,1,1) * in_band(hwidth,hyp,1,1);
+ output = in_band(hwidth, hyp2, 1, 1) * in_band(hwidth, hyp, 1, 1);
}
if (!wipe->forward)output = 1-output;
break;
case DO_CLOCK_WIPE:
/*
* temp1: angle of effect center in rads
- * temp2: angle of line through (halfx,halfy) and (x,y) in rads
+ * temp2: angle of line through (halfx, halfy) and (x, y) in rads
* temp3: angle of low side of blur
* temp4: angle of high side of blur
*/
@@ -1801,19 +1801,19 @@ static float check_zone(WipeZone *wipezone, int x, int y,
if (b2 < b1 && b2 < b3 ) {
if (hwidth < pointdist)
- output = in_band(wipezone,hwidth,hyp,facf0,0,1);
+ output = in_band(wipezone, hwidth, hyp, facf0, 0, 1);
}
else if (b2 > b1 && b2 > b3 ) {
if (hwidth < pointdist)
- output = in_band(wipezone,hwidth,hyp2,facf0,0,1);
+ output = in_band(wipezone, hwidth, hyp2, facf0, 0, 1);
}
else {
if ( hyp < hwidth && hyp2 > hwidth )
- output = in_band(wipezone,hwidth,hyp,facf0,1,1);
+ output = in_band(wipezone, hwidth, hyp, facf0, 1, 1);
else if ( hyp > hwidth && hyp2 < hwidth )
- output = in_band(wipezone,hwidth,hyp2,facf0,1,1);
+ output = in_band(wipezone, hwidth, hyp2, facf0, 1, 1);
else
- output = in_band(wipezone,hwidth,hyp2,facf0,1,1) * in_band(wipezone,hwidth,hyp,facf0,1,1);
+ output = in_band(wipezone, hwidth, hyp2, facf0, 1, 1) * in_band(wipezone, hwidth, hyp, facf0, 1, 1);
}
if (invert)facf0 = 1-facf0;
@@ -1827,19 +1827,19 @@ static float check_zone(WipeZone *wipezone, int x, int y,
if (b2 < b1 && b2 < b3 ) {
if (hwidth < pointdist)
- output *= in_band(wipezone,hwidth,hyp,facf0,0,1);
+ output *= in_band(wipezone, hwidth, hyp, facf0, 0, 1);
}
else if (b2 > b1 && b2 > b3 ) {
if (hwidth < pointdist)
- output *= in_band(wipezone,hwidth,hyp2,facf0,0,1);
+ output *= in_band(wipezone, hwidth, hyp2, facf0, 0, 1);
}
else {
if ( hyp < hwidth && hyp2 > hwidth )
- output *= in_band(wipezone,hwidth,hyp,facf0,1,1);
+ output *= in_band(wipezone, hwidth, hyp, facf0, 1, 1);
else if ( hyp > hwidth && hyp2 < hwidth )
- output *= in_band(wipezone,hwidth,hyp2,facf0,1,1);
+ output *= in_band(wipezone, hwidth, hyp2, facf0, 1, 1);
else
- output *= in_band(wipezone,hwidth,hyp2,facf0,1,1) * in_band(wipezone,hwidth,hyp,facf0,1,1);
+ output *= in_band(wipezone, hwidth, hyp2, facf0, 1, 1) * in_band(wipezone, hwidth, hyp, facf0, 1, 1);
}
break;
@@ -1857,8 +1857,8 @@ static float check_zone(WipeZone *wipezone, int x, int y,
pointdist = sqrt(temp1*temp1 + temp1*temp1);
temp2 = sqrt((halfx-x)*(halfx-x) + (halfy-y)*(halfy-y));
- if (temp2 > pointdist) output = in_band(hwidth,fabs(temp2-pointdist),0,1);
- else output = in_band(hwidth,fabs(temp2-pointdist),1,1);
+ if (temp2 > pointdist) output = in_band(hwidth, fabs(temp2-pointdist), 0, 1);
+ else output = in_band(hwidth, fabs(temp2-pointdist), 1, 1);
if (!wipe->forward) output = 1-output;
@@ -1911,7 +1911,7 @@ static void do_wipe_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1),
yo = y;
for (y=0;y<yo;y++) {
for (x=0;x<xo;x++) {
- float check = check_zone(&wipezone,x,y,seq,facf0);
+ float check = check_zone(&wipezone, x, y, seq, facf0);
if (check) {
if (rt1) {
rt[0] = (int)(rt1[0]*check)+ (int)(rt2[0]*(1-check));
@@ -1972,7 +1972,7 @@ static void do_wipe_effect_float(Sequence *seq, float facf0, float UNUSED(facf1)
yo = y;
for (y=0;y<yo;y++) {
for (x=0;x<xo;x++) {
- float check = check_zone(&wipezone,x,y,seq,facf0);
+ float check = check_zone(&wipezone, x, y, seq, facf0);
if (check) {
if (rt1) {
rt[0] = rt1[0]*check+ rt2[0]*(1-check);
@@ -2019,7 +2019,7 @@ static struct ImBuf * do_wipe_effect(
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
- struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
+ struct ImBuf * out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
if (out->rect_float) {
do_wipe_effect_float(seq,
@@ -2083,7 +2083,7 @@ static void transform_image(int x, int y, struct ImBuf *ibuf1, struct ImBuf *out
{
int xo, yo, xi, yi;
float xt, yt, xr, yr;
- float s,c;
+ float s, c;
xo = x;
yo = y;
@@ -2112,15 +2112,15 @@ static void transform_image(int x, int y, struct ImBuf *ibuf1, struct ImBuf *out
yt += (yo / 2.0f);
//interpolate
- switch(interpolation) {
+ switch (interpolation) {
case 0:
- neareast_interpolation(ibuf1,out, xt,yt,xi,yi);
+ neareast_interpolation(ibuf1, out, xt, yt, xi, yi);
break;
case 1:
- bilinear_interpolation(ibuf1,out, xt,yt,xi,yi);
+ bilinear_interpolation(ibuf1, out, xt, yt, xi, yi);
break;
case 2:
- bicubic_interpolation(ibuf1,out, xt,yt,xi,yi);
+ bicubic_interpolation(ibuf1, out, xt, yt, xi, yi);
break;
}
}
@@ -2128,7 +2128,7 @@ static void transform_image(int x, int y, struct ImBuf *ibuf1, struct ImBuf *out
}
static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x, int y,
- struct ImBuf *ibuf1,struct ImBuf *out)
+ struct ImBuf *ibuf1, struct ImBuf *out)
{
TransformVars *transform = (TransformVars *)seq->effectdata;
float scale_x, scale_y, translate_x, translate_y, rotate_radians;
@@ -2157,17 +2157,17 @@ static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x
// Rotate
rotate_radians = DEG2RADF(transform->rotIni);
- transform_image(x,y, ibuf1, out, scale_x, scale_y, translate_x, translate_y, rotate_radians, transform->interpolation);
+ transform_image(x, y, ibuf1, out, scale_x, scale_y, translate_x, translate_y, rotate_radians, transform->interpolation);
}
static struct ImBuf * do_transform_effect(
- SeqRenderData context, Sequence *seq,float UNUSED(cfra),
+ SeqRenderData context, Sequence *seq, float UNUSED(cfra),
float facf0, float UNUSED(facf1),
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
- struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
+ struct ImBuf * out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
do_transform(context.scene, seq, facf0,
context.rectx, context.recty, ibuf1, out);
@@ -2180,9 +2180,9 @@ static struct ImBuf * do_transform_effect(
* GLOW
* ********************************************************************** */
-static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
- float blur,
- int quality)
+static void RVBlurBitmap2_byte(unsigned char* map, int width, int height,
+ float blur,
+ int quality)
/* MUUUCCH better than the previous blur. */
/* We do the blurring in two passes which is a whole lot faster. */
/* I changed the math arount to implement an actual Gaussian */
@@ -2192,9 +2192,9 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
/* a small bitmap. Avoid avoid avoid. */
/*=============================== */
{
- unsigned char* temp=NULL,*swap;
+ unsigned char* temp=NULL, *swap;
float *filter=NULL;
- int x,y,i,fx,fy;
+ int x, y, i, fx, fy;
int index, ix, halfWidth;
float fval, k, curColor[3], curColor2[3], weight=0;
@@ -2203,7 +2203,7 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
return;
/* Allocate memory for the tempmap and the blur filter matrix */
- temp= MEM_mallocN( (width*height*4), "blurbitmaptemp");
+ temp= MEM_mallocN((width*height*4), "blurbitmaptemp");
if (!temp)
return;
@@ -2349,7 +2349,7 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
MEM_freeN (temp);
}
-static void RVBlurBitmap2_float ( float* map, int width,int height,
+static void RVBlurBitmap2_float ( float* map, int width, int height,
float blur,
int quality)
/* MUUUCCH better than the previous blur. */
@@ -2361,9 +2361,9 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
/* a small bitmap. Avoid avoid avoid. */
/*=============================== */
{
- float* temp=NULL,*swap;
+ float* temp=NULL, *swap;
float *filter=NULL;
- int x,y,i,fx,fy;
+ int x, y, i, fx, fy;
int index, ix, halfWidth;
float fval, k, curColor[3], curColor2[3], weight=0;
@@ -2372,7 +2372,7 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
return;
/* Allocate memory for the tempmap and the blur filter matrix */
- temp= MEM_mallocN( (width*height*4*sizeof(float)), "blurbitmaptemp");
+ temp= MEM_mallocN((width*height*4*sizeof(float)), "blurbitmaptemp");
if (!temp)
return;
@@ -2526,15 +2526,15 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
/*=============================== */
static void RVAddBitmaps_byte (unsigned char* a, unsigned char* b, unsigned char* c, int width, int height)
{
- int x,y,index;
+ int x, y, index;
for (y=0;y<height;y++) {
for (x=0;x<width;x++) {
index=(x+y*width)*4;
- c[index+GlowR]=MIN2(255,a[index+GlowR]+b[index+GlowR]);
- c[index+GlowG]=MIN2(255,a[index+GlowG]+b[index+GlowG]);
- c[index+GlowB]=MIN2(255,a[index+GlowB]+b[index+GlowB]);
- c[index+GlowA]=MIN2(255,a[index+GlowA]+b[index+GlowA]);
+ c[index+GlowR]=MIN2(255, a[index+GlowR]+b[index+GlowR]);
+ c[index+GlowG]=MIN2(255, a[index+GlowG]+b[index+GlowG]);
+ c[index+GlowB]=MIN2(255, a[index+GlowB]+b[index+GlowB]);
+ c[index+GlowA]=MIN2(255, a[index+GlowA]+b[index+GlowA]);
}
}
}
@@ -2542,7 +2542,7 @@ static void RVAddBitmaps_byte (unsigned char* a, unsigned char* b, unsigned char
static void RVAddBitmaps_float (float* a, float* b, float* c,
int width, int height)
{
- int x,y,index;
+ int x, y, index;
for (y=0;y<height;y++) {
for (x=0;x<width;x++) {
@@ -2561,7 +2561,7 @@ static void RVIsolateHighlights_byte (unsigned char* in, unsigned char* out,
int width, int height, int threshold,
float boost, float clamp)
{
- int x,y,index;
+ int x, y, index;
int intensity;
@@ -2591,7 +2591,7 @@ static void RVIsolateHighlights_float (float* in, float* out,
int width, int height, float threshold,
float boost, float clamp)
{
- int x,y,index;
+ int x, y, index;
float intensity;
@@ -2658,10 +2658,10 @@ static void do_glow_effect_byte(Sequence *seq, int render_size, float facf0, flo
unsigned char *inbuf=(unsigned char *)rect1;
GlowVars *glow = (GlowVars *)seq->effectdata;
- RVIsolateHighlights_byte(inbuf, outbuf , x, y, glow->fMini*765, glow->fBoost * facf0, glow->fClamp);
- RVBlurBitmap2_byte (outbuf, x, y, glow->dDist * (render_size / 100.0f),glow->dQuality);
+ RVIsolateHighlights_byte(inbuf, outbuf, x, y, glow->fMini*765, glow->fBoost * facf0, glow->fClamp);
+ RVBlurBitmap2_byte (outbuf, x, y, glow->dDist * (render_size / 100.0f), glow->dQuality);
if (!glow->bNoComp)
- RVAddBitmaps_byte (inbuf , outbuf, outbuf, x, y);
+ RVAddBitmaps_byte (inbuf, outbuf, outbuf, x, y);
}
static void do_glow_effect_float(Sequence *seq, int render_size, float facf0, float UNUSED(facf1),
@@ -2672,10 +2672,10 @@ static void do_glow_effect_float(Sequence *seq, int render_size, float facf0, fl
float *inbuf = rect1;
GlowVars *glow = (GlowVars *)seq->effectdata;
- RVIsolateHighlights_float(inbuf, outbuf , x, y, glow->fMini*3.0f, glow->fBoost * facf0, glow->fClamp);
- RVBlurBitmap2_float (outbuf, x, y, glow->dDist * (render_size / 100.0f),glow->dQuality);
+ RVIsolateHighlights_float(inbuf, outbuf, x, y, glow->fMini*3.0f, glow->fBoost * facf0, glow->fClamp);
+ RVBlurBitmap2_float (outbuf, x, y, glow->dDist * (render_size / 100.0f), glow->dQuality);
if (!glow->bNoComp)
- RVAddBitmaps_float (inbuf , outbuf, outbuf, x, y);
+ RVAddBitmaps_float (inbuf, outbuf, outbuf, x, y);
}
static struct ImBuf * do_glow_effect(
@@ -2684,7 +2684,7 @@ static struct ImBuf * do_glow_effect(
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
- struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
+ struct ImBuf * out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
int render_size = 100*context.rectx/context.scene->r.xsch;
@@ -2749,7 +2749,7 @@ static struct ImBuf * do_solid_color(
struct ImBuf *ibuf1, struct ImBuf *ibuf2,
struct ImBuf *ibuf3)
{
- struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
+ struct ImBuf * out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
SolidColorVars *cv = (SolidColorVars *)seq->effectdata;
@@ -3234,7 +3234,7 @@ static struct ImBuf * do_overdrop_effect(SeqRenderData context,
struct ImBuf * ibuf2,
struct ImBuf * ibuf3)
{
- struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
+ struct ImBuf * out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3);
int x = context.rectx;
int y = context.recty;
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 2d4397d16cd..9291cb90dff 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -259,8 +259,7 @@ void seq_free_editing(Scene *scene)
if (ed == NULL)
return;
- SEQ_BEGIN(ed, seq)
- {
+ SEQ_BEGIN (ed, seq) {
seq_free_sequence(scene, seq);
}
SEQ_END
@@ -363,7 +362,7 @@ unsigned int seq_hash_render_data(const SeqRenderData *a)
/* ************************* iterator ************************** */
/* *************** (replaces old WHILE_SEQ) ********************* */
-/* **************** use now SEQ_BEGIN() SEQ_END ***************** */
+/* **************** use now SEQ_BEGIN () SEQ_END ***************** */
/* sequence strip iterator:
* - builds a full array, recursively into meta strips */
@@ -515,8 +514,17 @@ void build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int *totseq,
*seqar = tseqar;
}
+static int metaseq_start(Sequence *metaseq)
+{
+ return metaseq->start + metaseq->startofs;
+}
-static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq)
+static int metaseq_end(Sequence *metaseq)
+{
+ return metaseq->start + metaseq->len - metaseq->endofs;
+}
+
+static void seq_update_sound_bounds_recursive_rec(Scene *scene, Sequence *metaseq, int start, int end)
{
Sequence *seq;
@@ -524,23 +532,28 @@ static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq)
* since sound is played outside of evaluating the imbufs, */
for (seq = metaseq->seqbase.first; seq; seq = seq->next) {
if (seq->type == SEQ_META) {
- seq_update_sound_bounds_recursive(scene, seq);
+ seq_update_sound_bounds_recursive_rec(scene, seq, MAX2(start, metaseq_start(seq)), MIN2(end, metaseq_end(seq)));
}
else if (ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
if (seq->scene_sound) {
int startofs = seq->startofs;
int endofs = seq->endofs;
- if (seq->startofs + seq->start < metaseq->start + metaseq->startofs)
- startofs = metaseq->start + metaseq->startofs - seq->start;
+ if (seq->startofs + seq->start < start)
+ startofs = start - seq->start;
- if (seq->start + seq->len - seq->endofs > metaseq->start + metaseq->len - metaseq->endofs)
- endofs = seq->start + seq->len - metaseq->start - metaseq->len + metaseq->endofs;
+ if (seq->start + seq->len - seq->endofs > end)
+ endofs = seq->start + seq->len - end;
sound_move_scene_sound(scene, seq->scene_sound, seq->start + startofs, seq->start + seq->len - endofs, startofs);
}
}
}
}
+static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq)
+{
+ seq_update_sound_bounds_recursive_rec(scene, metaseq, metaseq_start(metaseq), metaseq_end(metaseq));
+}
+
void calc_sequence_disp(Scene *scene, Sequence *seq)
{
if (seq->startofs && seq->startstill) seq->startstill = 0;
@@ -3099,13 +3112,17 @@ int seqbase_isolated_sel_check(ListBase *seqbase)
if ( (seq->seq1 && (seq->seq1->flag & SELECT) == 0) ||
(seq->seq2 && (seq->seq2->flag & SELECT) == 0) ||
(seq->seq3 && (seq->seq3->flag & SELECT) == 0) )
+ {
return FALSE;
+ }
}
else {
if ( (seq->seq1 && (seq->seq1->flag & SELECT)) ||
(seq->seq2 && (seq->seq2->flag & SELECT)) ||
(seq->seq3 && (seq->seq3->flag & SELECT)) )
+ {
return FALSE;
+ }
}
}
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
index 4006837efd6..d6fea87397d 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -121,7 +121,7 @@ void space_transform_invert(const SpaceTransform *data, float *co)
static void space_transform_apply_normal(const SpaceTransform *data, float *no)
{
- mul_mat3_m4_v3( ((SpaceTransform*)data)->local2target, no);
+ mul_mat3_m4_v3(((SpaceTransform *)data)->local2target, no);
normalize_v3(no); // TODO: could we just determine de scale value from the matrix?
}
@@ -146,8 +146,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
BENCH(bvhtree_from_mesh_verts(&treeData, calc->target, 0.0, 2, 6));
- if (treeData.tree == NULL)
- {
+ if (treeData.tree == NULL) {
OUT_OF_MEMORY();
return;
}
@@ -158,8 +157,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
#ifndef __APPLE__
#pragma omp parallel for default(none) private(i) firstprivate(nearest) shared(treeData,calc) schedule(static)
#endif
- for (i = 0; i<calc->numVerts; ++i)
- {
+ for (i = 0; i<calc->numVerts; ++i) {
float *co = calc->vertexCos[i];
float tmp_co[3];
float weight = defvert_array_find_weight_safe(calc->dvert, i, calc->vgroup);
@@ -189,8 +187,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
//Found the nearest vertex
- if (nearest.index != -1)
- {
+ if (nearest.index != -1) {
//Adjusting the vertex weight, so that after interpolating it keeps a certain distance from the nearest position
float dist = sasqrt(nearest.dist);
if (dist > FLT_EPSILON) weight *= (dist - calc->keepDist)/dist;
@@ -221,20 +218,19 @@ int normal_projection_project_vertex(char options, const float *vert, const floa
BVHTreeRayHit hit_tmp;
//Copy from hit (we need to convert hit rays from one space coordinates to the other
- memcpy( &hit_tmp, hit, sizeof(hit_tmp) );
+ memcpy(&hit_tmp, hit, sizeof(hit_tmp));
//Apply space transform (TODO readjust dist)
- if (transf)
- {
- copy_v3_v3( tmp_co, vert );
- space_transform_apply( transf, tmp_co );
+ if (transf) {
+ copy_v3_v3(tmp_co, vert);
+ space_transform_apply(transf, tmp_co);
co = tmp_co;
- copy_v3_v3( tmp_no, dir );
- space_transform_apply_normal( transf, tmp_no );
+ copy_v3_v3(tmp_no, dir);
+ space_transform_apply_normal(transf, tmp_no);
no = tmp_no;
- hit_tmp.dist *= mat4_to_scale( ((SpaceTransform*)transf)->local2target );
+ hit_tmp.dist *= mat4_to_scale(((SpaceTransform*)transf)->local2target);
}
else {
co = vert;
@@ -267,7 +263,7 @@ int normal_projection_project_vertex(char options, const float *vert, const floa
hit_tmp.dist = len_v3v3((float *)vert, hit_tmp.co);
}
- memcpy(hit, &hit_tmp, sizeof(hit_tmp) );
+ memcpy(hit, &hit_tmp, sizeof(hit_tmp));
return TRUE;
}
return FALSE;
@@ -298,8 +294,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
//Prepare data to retrieve the direction in which we should project each vertex
- if (calc->smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL)
- {
+ if (calc->smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL) {
if (calc->vert == NULL) return;
}
else {
@@ -316,12 +311,11 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
return;
}
- if (calc->smd->auxTarget)
- {
+ if (calc->smd->auxTarget) {
auxMesh = object_get_derived_final(calc->smd->auxTarget);
if (!auxMesh)
return;
- space_transform_setup( &local2aux, calc->ob, calc->smd->auxTarget);
+ space_transform_setup(&local2aux, calc->ob, calc->smd->auxTarget);
}
//After sucessufuly build the trees, start projection vertexs
@@ -332,16 +326,14 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
#ifndef __APPLE__
#pragma omp parallel for private(i,hit) schedule(static)
#endif
- for (i = 0; i<calc->numVerts; ++i)
- {
+ for (i = 0; i<calc->numVerts; ++i) {
float *co = calc->vertexCos[i];
float tmp_co[3], tmp_no[3];
float weight = defvert_array_find_weight_safe(calc->dvert, i, calc->vgroup);
if (weight == 0.0f) continue;
- if (calc->vert)
- {
+ if (calc->vert) {
/* calc->vert contains verts from derivedMesh */
/* this coordinated are deformed by vertexCos only for normal projection (to get correct normals) */
/* for other cases calc->varts contains undeformed coordinates and vertexCos should be used */
@@ -364,8 +356,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
hit.dist = 10000.0f; //TODO: we should use FLT_MAX here, but sweepsphere code isn't prepared for that
//Project over positive direction of axis
- if (use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR)
- {
+ if (use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR) {
if (auxData.tree)
normal_projection_project_vertex(0, tmp_co, tmp_no, &local2aux, auxData.tree, &hit, auxData.raycast_callback, &auxData);
@@ -374,8 +365,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
}
//Project over negative direction of axis
- if (use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR && hit.index == -1)
- {
+ if (use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR && hit.index == -1) {
float inv_no[3];
negate_v3_v3(inv_no, tmp_no);
@@ -386,8 +376,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
}
- if (hit.index != -1)
- {
+ if (hit.index != -1) {
madd_v3_v3v3fl(hit.co, hit.co, tmp_no, calc->keepDist);
interp_v3_v3v3(co, co, hit.co, weight);
}
@@ -414,8 +403,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
//Create a bvh-tree of the given target
BENCH(bvhtree_from_mesh_faces( &treeData, calc->target, 0.0, 2, 6));
- if (treeData.tree == NULL)
- {
+ if (treeData.tree == NULL) {
OUT_OF_MEMORY();
return;
}
@@ -429,8 +417,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
#ifndef __APPLE__
#pragma omp parallel for default(none) private(i) firstprivate(nearest) shared(calc,treeData) schedule(static)
#endif
- for (i = 0; i<calc->numVerts; ++i)
- {
+ for (i = 0; i<calc->numVerts; ++i) {
float *co = calc->vertexCos[i];
float tmp_co[3];
float weight = defvert_array_find_weight_safe(calc->dvert, i, calc->vgroup);
@@ -458,10 +445,8 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
BLI_bvhtree_find_nearest(treeData.tree, tmp_co, &nearest, treeData.nearest_callback, &treeData);
//Found the nearest vertex
- if (nearest.index != -1)
- {
- if (calc->smd->shrinkOpts & MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE)
- {
+ if (nearest.index != -1) {
+ if (calc->smd->shrinkOpts & MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE) {
//Make the vertex stay on the front side of the face
madd_v3_v3v3fl(tmp_co, nearest.co, nearest.no, calc->keepDist);
}
@@ -471,7 +456,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
if (dist > FLT_EPSILON)
interp_v3_v3v3(tmp_co, tmp_co, nearest.co, (dist - calc->keepDist)/dist); //linear interpolation
else
- copy_v3_v3( tmp_co, nearest.co );
+ copy_v3_v3(tmp_co, nearest.co);
}
//Convert the coordinates back to mesh coordinates
@@ -511,8 +496,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
}
- if (smd->target)
- {
+ if (smd->target) {
calc.target = object_get_derived_final(smd->target);
//TODO there might be several "bugs" on non-uniform scales matrixs
@@ -528,28 +512,24 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
calc.vgroup = defgroup_name_index(calc.ob, smd->vgroup_name);
- if (dm != NULL && smd->shrinkType == MOD_SHRINKWRAP_PROJECT)
- {
+ if (dm != NULL && smd->shrinkType == MOD_SHRINKWRAP_PROJECT) {
//Setup arrays to get vertexs positions, normals and deform weights
calc.vert = dm->getVertDataArray(dm, CD_MVERT);
calc.dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
//Using vertexs positions/normals as if a subsurface was applied
- if (smd->subsurfLevels)
- {
+ if (smd->subsurfLevels) {
SubsurfModifierData ssmd= {{NULL}};
ssmd.subdivType = ME_CC_SUBSURF; //catmull clark
ssmd.levels = smd->subsurfLevels; //levels
ss_mesh = subsurf_make_derived_from_derived(dm, &ssmd, FALSE, NULL, 0, 0, (ob->mode & OB_MODE_EDIT));
- if (ss_mesh)
- {
+ if (ss_mesh) {
calc.vert = ss_mesh->getVertDataArray(ss_mesh, CD_MVERT);
- if (calc.vert)
- {
- //TRICKY: this code assumes subsurface will have the transformed original vertices
- //in their original order at the end of the vert array.
+ if (calc.vert) {
+ /* TRICKY: this code assumes subsurface will have the transformed original vertices
+ * in their original order at the end of the vert array. */
calc.vert = calc.vert + ss_mesh->getNumVerts(ss_mesh) - dm->getNumVerts(dm);
}
}
@@ -562,8 +542,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
//Projecting target defined - lets work!
if (calc.target) {
- switch(smd->shrinkType)
- {
+ switch (smd->shrinkType) {
case MOD_SHRINKWRAP_NEAREST_SURFACE:
BENCH(shrinkwrap_calc_nearest_surface_point(&calc));
break;
diff --git a/source/blender/blenkernel/intern/sketch.c b/source/blender/blenkernel/intern/sketch.c
index 71ea85de716..32681c3a041 100644
--- a/source/blender/blenkernel/intern/sketch.c
+++ b/source/blender/blenkernel/intern/sketch.c
@@ -44,8 +44,7 @@ void freeSketch(SK_Sketch *sketch)
{
SK_Stroke *stk, *next;
- for (stk = sketch->strokes.first; stk; stk = next)
- {
+ for (stk = sketch->strokes.first; stk; stk = next) {
next = stk->next;
sk_freeStroke(stk);
@@ -119,8 +118,7 @@ SK_Stroke* sk_createStroke(void)
void sk_shrinkStrokeBuffer(SK_Stroke *stk)
{
- if (stk->nb_points < stk->buf_size)
- {
+ if (stk->nb_points < stk->buf_size) {
SK_Point *old_points = stk->points;
stk->buf_size = stk->nb_points;
@@ -135,8 +133,7 @@ void sk_shrinkStrokeBuffer(SK_Stroke *stk)
void sk_growStrokeBuffer(SK_Stroke *stk)
{
- if (stk->nb_points == stk->buf_size)
- {
+ if (stk->nb_points == stk->buf_size) {
SK_Point *old_points = stk->points;
stk->buf_size *= 2;
@@ -151,12 +148,10 @@ void sk_growStrokeBuffer(SK_Stroke *stk)
void sk_growStrokeBufferN(SK_Stroke *stk, int n)
{
- if (stk->nb_points + n > stk->buf_size)
- {
+ if (stk->nb_points + n > stk->buf_size) {
SK_Point *old_points = stk->points;
- while (stk->nb_points + n > stk->buf_size)
- {
+ while (stk->nb_points + n > stk->buf_size) {
stk->buf_size *= 2;
}
@@ -202,8 +197,7 @@ void sk_insertStrokePoints(SK_Stroke *stk, SK_Point *pts, int len, int start, in
sk_growStrokeBufferN(stk, len - size);
- if (len != size)
- {
+ if (len != size) {
int tail_size = stk->nb_points - end + 1;
memmove(stk->points + start + len, stk->points + end + 1, tail_size * sizeof(SK_Point));
@@ -218,8 +212,7 @@ void sk_trimStroke(SK_Stroke *stk, int start, int end)
{
int size = end - start + 1;
- if (start > 0)
- {
+ if (start > 0) {
memmove(stk->points, stk->points + start, size * sizeof(SK_Point));
}
@@ -253,8 +246,7 @@ void sk_straightenStroke(SK_Stroke *stk, int start, int end, float p_start[3], f
sk_insertStrokePoint(stk, &pt1, start + 1); /* insert after start */
sk_insertStrokePoint(stk, &pt2, end + 1); /* insert before end (since end was pushed back already) */
- for (i = 1; i < total; i++)
- {
+ for (i = 1; i < total; i++) {
float delta = (float)i / (float)total;
float *p = stk->points[start + 1 + i].p;
@@ -269,30 +261,23 @@ void sk_polygonizeStroke(SK_Stroke *stk, int start, int end)
int i;
/* find first exact points outside of range */
- for (;start > 0; start--)
- {
- if (stk->points[start].type == PT_EXACT)
- {
+ for (;start > 0; start--) {
+ if (stk->points[start].type == PT_EXACT) {
break;
}
}
- for (;end < stk->nb_points - 1; end++)
- {
- if (stk->points[end].type == PT_EXACT)
- {
+ for (;end < stk->nb_points - 1; end++) {
+ if (stk->points[end].type == PT_EXACT) {
break;
}
}
offset = start + 1;
- for (i = start + 1; i < end; i++)
- {
- if (stk->points[i].type == PT_EXACT)
- {
- if (offset != i)
- {
+ for (i = start + 1; i < end; i++) {
+ if (stk->points[i].type == PT_EXACT) {
+ if (offset != i) {
memcpy(stk->points + offset, stk->points + i, sizeof(SK_Point));
}
@@ -301,8 +286,7 @@ void sk_polygonizeStroke(SK_Stroke *stk, int start, int end)
}
/* some points were removes, move end of array */
- if (offset < end)
- {
+ if (offset < end) {
int size = stk->nb_points - end;
memmove(stk->points + offset, stk->points + end, size * sizeof(SK_Point));
stk->nb_points = offset + size;
@@ -323,8 +307,7 @@ void sk_flattenStroke(SK_Stroke *stk, int start, int end)
project_v3_v3v3(normal, distance, normal);
limit = normalize_v3(normal);
- for (i = 1; i < total - 1; i++)
- {
+ for (i = 1; i < total - 1; i++) {
float d = limit * i / total;
float offset[3];
float *p = stk->points[start + i].p;
@@ -342,8 +325,7 @@ void sk_flattenStroke(SK_Stroke *stk, int start, int end)
void sk_removeStroke(SK_Sketch *sketch, SK_Stroke *stk)
{
- if (sketch->active_stroke == stk)
- {
+ if (sketch->active_stroke == stk) {
sketch->active_stroke = NULL;
}
@@ -358,8 +340,7 @@ void sk_reverseStroke(SK_Stroke *stk)
sk_allocStrokeBuffer(stk);
- for (i = 0; i < stk->nb_points; i++)
- {
+ for (i = 0; i < stk->nb_points; i++) {
sk_copyPoint(stk->points + i, old_points + stk->nb_points - 1 - i);
}
@@ -376,8 +357,7 @@ void sk_filterStroke(SK_Stroke *stk, int start, int end)
char work;
int i;
- if (start == -1)
- {
+ if (start == -1) {
start = 0;
end = stk->nb_points - 1;
}
@@ -386,8 +366,7 @@ void sk_filterStroke(SK_Stroke *stk, int start, int end)
stk->nb_points = 0;
/* adding points before range */
- for (i = 0; i < start; i++)
- {
+ for (i = 0; i < start; i++) {
sk_appendStrokePoint(stk, old_points + i);
}
@@ -398,8 +377,7 @@ void sk_filterStroke(SK_Stroke *stk, int start, int end)
work = 1;
/* while still reducing */
- while (work)
- {
+ while (work) {
int ls, le;
work = 0;
@@ -407,15 +385,13 @@ void sk_filterStroke(SK_Stroke *stk, int start, int end)
le = start+1;
/* while not over interval */
- while (ls < end)
- {
+ while (ls < end) {
int max_i = 0;
short v1[2];
float max_dist = 16; /* more than 4 pixels */
/* find the next marked point */
- while (marked[le] == 0)
- {
+ while (marked[le] == 0) {
le++;
}
@@ -424,8 +400,7 @@ void sk_filterStroke(SK_Stroke *stk, int start, int end)
v1[0] = old_points[ls].p2d[1] - old_points[le].p2d[1];
- for ( i = ls + 1; i < le; i++ )
- {
+ for ( i = ls + 1; i < le; i++ ) {
float mul;
float dist;
short v2[2];
@@ -433,8 +408,7 @@ void sk_filterStroke(SK_Stroke *stk, int start, int end)
v2[0] = old_points[i].p2d[0] - old_points[ls].p2d[0];
v2[1] = old_points[i].p2d[1] - old_points[ls].p2d[1];
- if (v2[0] == 0 && v2[1] == 0)
- {
+ if (v2[0] == 0 && v2[1] == 0) {
continue;
}
@@ -442,15 +416,13 @@ void sk_filterStroke(SK_Stroke *stk, int start, int end)
dist = mul * mul * (v2[0]*v2[0] + v2[1]*v2[1]);
- if (dist > max_dist)
- {
+ if (dist > max_dist) {
max_dist = dist;
max_i = i;
}
}
- if (max_i != 0)
- {
+ if (max_i != 0) {
work = 1;
marked[max_i] = 1;
}
@@ -462,10 +434,8 @@ void sk_filterStroke(SK_Stroke *stk, int start, int end)
/* adding points after range */
- for (i = start; i <= end; i++)
- {
- if (marked[i])
- {
+ for (i = start; i <= end; i++) {
+ if (marked[i]) {
sk_appendStrokePoint(stk, old_points + i);
}
}
@@ -473,8 +443,7 @@ void sk_filterStroke(SK_Stroke *stk, int start, int end)
MEM_freeN(marked);
/* adding points after range */
- for (i = end + 1; i < nb_points; i++)
- {
+ for (i = end + 1; i < nb_points; i++) {
sk_appendStrokePoint(stk, old_points + i);
}
@@ -490,13 +459,11 @@ void sk_filterLastContinuousStroke(SK_Stroke *stk)
end = stk->nb_points -1;
- for (start = end - 1; start > 0 && stk->points[start].type == PT_CONTINUOUS; start--)
- {
+ for (start = end - 1; start > 0 && stk->points[start].type == PT_CONTINUOUS; start--) {
/* nothing to do here*/
}
- if (end - start > 1)
- {
+ if (end - start > 1) {
sk_filterStroke(stk, start, end);
}
}
@@ -505,8 +472,7 @@ SK_Point *sk_lastStrokePoint(SK_Stroke *stk)
{
SK_Point *pt = NULL;
- if (stk->nb_points > 0)
- {
+ if (stk->nb_points > 0) {
pt = stk->points + (stk->nb_points - 1);
}
@@ -520,8 +486,7 @@ void sk_endContinuousStroke(SK_Stroke *stk)
void sk_updateNextPoint(SK_Sketch *sketch, SK_Stroke *stk)
{
- if (stk)
- {
+ if (stk) {
memcpy(&sketch->next_point, stk->points[stk->nb_points - 1].p, sizeof(SK_Point));
}
}
@@ -529,8 +494,7 @@ void sk_updateNextPoint(SK_Sketch *sketch, SK_Stroke *stk)
int sk_stroke_filtermval(SK_DrawData *dd)
{
int retval = 0;
- if (ABS(dd->mval[0] - dd->previous_mval[0]) + ABS(dd->mval[1] - dd->previous_mval[1]) > U.gp_manhattendist)
- {
+ if (ABS(dd->mval[0] - dd->previous_mval[0]) + ABS(dd->mval[1] - dd->previous_mval[1]) > U.gp_manhattendist) {
retval = 1;
}
@@ -551,12 +515,10 @@ void sk_deleteSelectedStrokes(SK_Sketch *sketch)
{
SK_Stroke *stk, *next;
- for (stk = sketch->strokes.first; stk; stk = next)
- {
+ for (stk = sketch->strokes.first; stk; stk = next) {
next = stk->next;
- if (stk->selected == 1)
- {
+ if (stk->selected == 1) {
sk_removeStroke(sketch, stk);
}
}
@@ -566,31 +528,26 @@ void sk_selectAllSketch(SK_Sketch *sketch, int mode)
{
SK_Stroke *stk = NULL;
- if (mode == -1)
- {
- for (stk = sketch->strokes.first; stk; stk = stk->next)
- {
+ if (mode == -1) {
+ for (stk = sketch->strokes.first; stk; stk = stk->next) {
stk->selected = 0;
}
}
else if (mode == 0) {
- for (stk = sketch->strokes.first; stk; stk = stk->next)
- {
+ for (stk = sketch->strokes.first; stk; stk = stk->next) {
stk->selected = 1;
}
}
else if (mode == 1) {
int selected = 1;
- for (stk = sketch->strokes.first; stk; stk = stk->next)
- {
+ for (stk = sketch->strokes.first; stk; stk = stk->next) {
selected &= stk->selected;
}
selected ^= 1;
- for (stk = sketch->strokes.first; stk; stk = stk->next)
- {
+ for (stk = sketch->strokes.first; stk; stk = stk->next) {
stk->selected = selected;
}
}
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 9d13397859d..f98b6366e97 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -21,6 +21,7 @@
* The Original Code is: all of this file.
*
* Contributor(s): Daniel Genrich
+ * Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -53,6 +54,7 @@
#include "BKE_bvhutils.h"
#include "BKE_cdderivedmesh.h"
+#include "BKE_collision.h"
#include "BKE_customdata.h"
#include "BKE_DerivedMesh.h"
#include "BKE_effect.h"
@@ -118,8 +120,7 @@ static void tend ( void )
gettimeofday ( &_tend,&tz );
}
-#if 0 // unused
-static double tval()
+static double tval( void )
{
double t1, t2;
t1 = ( double ) _tstart.tv_sec*1000 + ( double ) _tstart.tv_usec/ ( 1000 );
@@ -127,14 +128,16 @@ static double tval()
return t2-t1;
}
#endif
-#endif
struct Object;
struct Scene;
struct DerivedMesh;
struct SmokeModifierData;
-#define TRI_UVOFFSET (1.0 / 4.0)
+#define TRI_UVOFFSET (1./4.)
+
+// timestep default value for nice appearance 0.1f
+#define DT_DEFAULT 0.1f
/* forward declerations */
static void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *tris, int numfaces, int numtris, int **tridivs, float cell_len);
@@ -159,7 +162,7 @@ void smokeModifier_do(SmokeModifierData *UNUSED(smd), Scene *UNUSED(scene), Obje
static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, DerivedMesh *dm)
{
- if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain && !smd->domain->fluid)
+ if((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain && !smd->domain->fluid)
{
size_t i;
float min[3] = {FLT_MAX, FLT_MAX, FLT_MAX}, max[3] = {-FLT_MAX, -FLT_MAX, -FLT_MAX};
@@ -171,7 +174,7 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
res = smd->domain->maxres;
// get BB of domain
- for (i = 0; i < dm->getNumVerts(dm); i++)
+ for(i = 0; i < dm->getNumVerts(dm); i++)
{
float tmp[3];
@@ -198,32 +201,32 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
// printf("size: %f, %f, %f\n", size[0], size[1], size[2]);
// prevent crash when initializing a plane as domain
- if ((size[0] < FLT_EPSILON) || (size[1] < FLT_EPSILON) || (size[2] < FLT_EPSILON))
+ if((size[0] < FLT_EPSILON) || (size[1] < FLT_EPSILON) || (size[2] < FLT_EPSILON))
return 0;
- if (size[0] > size[1])
+ if(size[0] > size[1])
{
- if (size[0] > size[2])
+ if(size[0] > size[2])
{
scale = res / size[0];
- smd->domain->dx = size[0] / res;
+ smd->domain->dx = size[0] / res; // dx is in global coords
smd->domain->res[0] = res;
smd->domain->res[1] = (int)(size[1] * scale + 0.5);
smd->domain->res[2] = (int)(size[2] * scale + 0.5);
}
else {
scale = res / size[2];
- smd->domain->dx = size[2] / res;
+ smd->domain->dx = size[2] / res; // dx is in global coords
smd->domain->res[2] = res;
smd->domain->res[0] = (int)(size[0] * scale + 0.5);
smd->domain->res[1] = (int)(size[1] * scale + 0.5);
}
}
else {
- if (size[1] > size[2])
+ if(size[1] > size[2])
{
scale = res / size[1];
- smd->domain->dx = size[1] / res;
+ smd->domain->dx = size[1] / res; // dx is in global coords
smd->domain->res[1] = res;
smd->domain->res[0] = (int)(size[0] * scale + 0.5);
smd->domain->res[2] = (int)(size[2] * scale + 0.5);
@@ -243,10 +246,10 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
// printf("res[0]: %d, res[1]: %d, res[2]: %d\n", smd->domain->res[0], smd->domain->res[1], smd->domain->res[2]);
// dt max is 0.1
- smd->domain->fluid = smoke_init(smd->domain->res, smd->domain->p0);
+ smd->domain->fluid = smoke_init(smd->domain->res, smd->domain->p0, DT_DEFAULT);
smd->time = scene->r.cfra;
- if (smd->domain->flags & MOD_SMOKE_HIGHRES)
+ if(smd->domain->flags & MOD_SMOKE_HIGHRES)
{
smd->domain->wt = smoke_turbulence_init(smd->domain->res, smd->domain->amplify + 1, smd->domain->noise);
smd->domain->res_wt[0] = smd->domain->res[0] * (smd->domain->amplify + 1);
@@ -257,19 +260,19 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
// printf("(smd->domain->flags & MOD_SMOKE_HIGHRES)\n");
}
- if (!smd->domain->shadow)
+ if(!smd->domain->shadow)
smd->domain->shadow = MEM_callocN(sizeof(float) * smd->domain->res[0] * smd->domain->res[1] * smd->domain->res[2], "SmokeDomainShadow");
smoke_initBlenderRNA(smd->domain->fluid, &(smd->domain->alpha), &(smd->domain->beta), &(smd->domain->time_scale), &(smd->domain->vorticity), &(smd->domain->border_collisions));
- if (smd->domain->wt)
+ if(smd->domain->wt)
{
smoke_initWaveletBlenderRNA(smd->domain->wt, &(smd->domain->strength));
// printf("smoke_initWaveletBlenderRNA\n");
}
return 1;
}
- else if ((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow)
+ else if((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow)
{
// handle flow object here
// XXX TODO
@@ -288,7 +291,7 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
}
/*
- if (!smd->flow->bvh)
+ if(!smd->flow->bvh)
{
// smd->flow->bvh = MEM_callocN(sizeof(BVHTreeFromMesh), "smoke_bvhfromfaces");
// bvhtree_from_mesh_faces(smd->flow->bvh, dm, 0.0, 2, 6);
@@ -301,28 +304,33 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
return 1;
}
- else if ((smd->type & MOD_SMOKE_TYPE_COLL))
+ else if((smd->type & MOD_SMOKE_TYPE_COLL))
{
- smd->time = scene->r.cfra;
-
// todo: delete this when loading colls work -dg
- if (!smd->coll)
+
+ if(!smd->coll)
+ {
smokeModifier_createType(smd);
+ }
- if (!smd->coll->points)
+ if(!smd->coll->points)
{
// init collision points
SmokeCollSettings *scs = smd->coll;
+ smd->time = scene->r.cfra;
+
// copy obmat
copy_m4_m4(scs->mat, ob->obmat);
copy_m4_m4(scs->mat_old, ob->obmat);
DM_ensure_tessface(dm);
fill_scs_points(ob, dm, scs);
+
+ // DEBUG printf("scs->dx: %f\n", scs->dx);
}
- if (!smd->coll->bvhtree)
+ if(!smd->coll->bvhtree)
{
smd->coll->bvhtree = NULL; // bvhtree_build_from_smoke ( ob->obmat, dm->getTessFaceArray(dm), dm->getNumTessFaces(dm), dm->getVertArray(dm), dm->getNumVerts(dm), 0.0 );
}
@@ -337,50 +345,52 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
MVert *mvert = dm->getVertArray(dm);
MFace *mface = dm->getTessFaceArray(dm);
int i = 0, divs = 0;
- int *tridivs = NULL;
- float cell_len = 1.0 / 50.0; // for res = 50
+
+ // DG TODO: need to do this dynamically according to the domain object!
+ float cell_len = scs->dx;
int newdivs = 0;
int quads = 0, facecounter = 0;
// count quads
- for (i = 0; i < dm->getNumTessFaces(dm); i++)
+ for(i = 0; i < dm->getNumTessFaces(dm); i++)
{
- if (mface[i].v4)
+ if(mface[i].v4)
quads++;
}
- calcTriangleDivs(ob, mvert, dm->getNumVerts(dm), mface, dm->getNumTessFaces(dm), dm->getNumTessFaces(dm) + quads, &tridivs, cell_len);
+ scs->numtris = dm->getNumTessFaces(dm) + quads;
+ scs->tridivs = NULL;
+ calcTriangleDivs(ob, mvert, dm->getNumVerts(dm), mface, dm->getNumTessFaces(dm), scs->numtris, &(scs->tridivs), cell_len);
// count triangle divisions
- for (i = 0; i < dm->getNumTessFaces(dm) + quads; i++)
+ for(i = 0; i < dm->getNumTessFaces(dm) + quads; i++)
{
- divs += (tridivs[3 * i] + 1) * (tridivs[3 * i + 1] + 1) * (tridivs[3 * i + 2] + 1);
+ divs += (scs->tridivs[3 * i] + 1) * (scs->tridivs[3 * i + 1] + 1) * (scs->tridivs[3 * i + 2] + 1);
}
- // printf("divs: %d\n", divs);
-
scs->points = MEM_callocN(sizeof(float) * (dm->getNumVerts(dm) + divs) * 3, "SmokeCollPoints");
+ scs->points_old = MEM_callocN(sizeof(float) * (dm->getNumVerts(dm) + divs) * 3, "SmokeCollPointsOld");
- for (i = 0; i < dm->getNumVerts(dm); i++)
+ for(i = 0; i < dm->getNumVerts(dm); i++)
{
float tmpvec[3];
copy_v3_v3(tmpvec, mvert[i].co);
- mul_m4_v3(ob->obmat, tmpvec);
+ // mul_m4_v3(ob->obmat, tmpvec); // DG: use local coordinates, we save MAT anyway
copy_v3_v3(&scs->points[i * 3], tmpvec);
}
- for (i = 0, facecounter = 0; i < dm->getNumTessFaces(dm); i++)
+ for(i = 0, facecounter = 0; i < dm->getNumTessFaces(dm); i++)
{
int again = 0;
do
{
int j, k;
- int divs1 = tridivs[3 * facecounter + 0];
- int divs2 = tridivs[3 * facecounter + 1];
- //int divs3 = tridivs[3 * facecounter + 2];
+ int divs1 = scs->tridivs[3 * facecounter + 0];
+ int divs2 = scs->tridivs[3 * facecounter + 1];
+ //int divs3 = scs->tridivs[3 * facecounter + 2];
float side1[3], side2[3], trinormorg[3], trinorm[3];
- if (again == 1 && mface[i].v4)
+ if(again == 1 && mface[i].v4)
{
sub_v3_v3v3(side1, mvert[ mface[i].v3 ].co, mvert[ mface[i].v1 ].co);
sub_v3_v3v3(side2, mvert[ mface[i].v4 ].co, mvert[ mface[i].v1 ].co);
@@ -395,23 +405,23 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
copy_v3_v3(trinorm, trinormorg);
mul_v3_fl(trinorm, 0.25 * cell_len);
- for (j = 0; j <= divs1; j++)
+ for(j = 0; j <= divs1; j++)
{
- for (k = 0; k <= divs2; k++)
+ for(k = 0; k <= divs2; k++)
{
float p1[3], p2[3], p3[3], p[3]={0,0,0};
const float uf = (float)(j + TRI_UVOFFSET) / (float)(divs1 + 0.0);
const float vf = (float)(k + TRI_UVOFFSET) / (float)(divs2 + 0.0);
float tmpvec[3];
- if (uf+vf > 1.0)
+ if(uf+vf > 1.0)
{
// printf("bigger - divs1: %d, divs2: %d\n", divs1, divs2);
continue;
}
copy_v3_v3(p1, mvert[ mface[i].v1 ].co);
- if (again == 1 && mface[i].v4)
+ if(again == 1 && mface[i].v4)
{
copy_v3_v3(p2, mvert[ mface[i].v3 ].co);
copy_v3_v3(p3, mvert[ mface[i].v4 ].co);
@@ -428,40 +438,211 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
add_v3_v3v3(p, p1, p2);
add_v3_v3(p, p3);
- if (newdivs > divs)
+ if(newdivs > divs)
printf("mem problem\n");
// mMovPoints.push_back(p + trinorm);
add_v3_v3v3(tmpvec, p, trinorm);
- mul_m4_v3(ob->obmat, tmpvec);
+ // mul_m4_v3(ob->obmat, tmpvec); // DG: use local coordinates, we save MAT anyway
copy_v3_v3(&scs->points[3 * (dm->getNumVerts(dm) + newdivs)], tmpvec);
newdivs++;
- if (newdivs > divs)
+ if(newdivs > divs)
printf("mem problem\n");
// mMovPoints.push_back(p - trinorm);
copy_v3_v3(tmpvec, p);
sub_v3_v3(tmpvec, trinorm);
- mul_m4_v3(ob->obmat, tmpvec);
+ // mul_m4_v3(ob->obmat, tmpvec); // DG: use local coordinates, we save MAT anyway
copy_v3_v3(&scs->points[3 * (dm->getNumVerts(dm) + newdivs)], tmpvec);
newdivs++;
}
}
- if (again == 0 && mface[i].v4)
+ if(again == 0 && mface[i].v4)
again++;
else
again = 0;
facecounter++;
- } while (again!=0);
+ } while(again!=0);
}
+ scs->numverts = dm->getNumVerts(dm);
+ // DG TODO: also save triangle count?
+
scs->numpoints = dm->getNumVerts(dm) + newdivs;
- MEM_freeN(tridivs);
+ for(i = 0; i < scs->numpoints * 3; i++)
+ {
+ scs->points_old[i] = scs->points[i];
+ }
+}
+
+
+static void fill_scs_points_anim(Object *UNUSED(ob), DerivedMesh *dm, SmokeCollSettings *scs)
+{
+ MVert *mvert = dm->getVertArray(dm);
+ MFace *mface = dm->getTessFaceArray(dm);
+ int quads = 0, numtris = 0, facecounter = 0;
+ unsigned int i = 0;
+ int divs = 0, newdivs = 0;
+
+ // DG TODO: need to do this dynamically according to the domain object!
+ float cell_len = scs->dx;
+
+ // count quads
+ for(i = 0; i < dm->getNumTessFaces(dm); i++)
+ {
+ if(mface[i].v4)
+ quads++;
+ }
+
+ numtris = dm->getNumTessFaces(dm) + quads;
+
+ // check if mesh changed topology
+ if(scs->numtris != numtris)
+ return;
+ if(scs->numverts != dm->getNumVerts(dm))
+ return;
+
+ // update new positions
+ for(i = 0; i < dm->getNumVerts(dm); i++)
+ {
+ float tmpvec[3];
+ copy_v3_v3(tmpvec, mvert[i].co);
+ copy_v3_v3(&scs->points[i * 3], tmpvec);
+ }
+
+ // for every triangle // update div points
+ for(i = 0, facecounter = 0; i < dm->getNumTessFaces(dm); i++)
+ {
+ int again = 0;
+ do
+ {
+ int j, k;
+ int divs1 = scs->tridivs[3 * facecounter + 0];
+ int divs2 = scs->tridivs[3 * facecounter + 1];
+ float srcside1[3], srcside2[3], destside1[3], destside2[3], src_trinormorg[3], dest_trinormorg[3], src_trinorm[3], dest_trinorm[3];
+
+ if(again == 1 && mface[i].v4)
+ {
+ sub_v3_v3v3(srcside1, &scs->points_old[mface[i].v3 * 3], &scs->points_old[mface[i].v1 * 3]);
+ sub_v3_v3v3(destside1, &scs->points[mface[i].v3 * 3], &scs->points[mface[i].v1 * 3]);
+
+ sub_v3_v3v3(srcside2, &scs->points_old[mface[i].v4 * 3], &scs->points_old[mface[i].v1 * 3]);
+ sub_v3_v3v3(destside2, &scs->points[mface[i].v4 * 3], &scs->points[mface[i].v1 * 3]);
+ }
+ else {
+ sub_v3_v3v3(srcside1, &scs->points_old[mface[i].v2 * 3], &scs->points_old[mface[i].v1 * 3]);
+ sub_v3_v3v3(destside1, &scs->points[mface[i].v2 * 3], &scs->points[mface[i].v1 * 3]);
+
+ sub_v3_v3v3(srcside2, &scs->points_old[mface[i].v3 * 3], &scs->points_old[mface[i].v1 * 3]);
+ sub_v3_v3v3(destside2, &scs->points[mface[i].v3 * 3], &scs->points[mface[i].v1 * 3]);
+ }
+
+ cross_v3_v3v3(src_trinormorg, srcside1, srcside2);
+ cross_v3_v3v3(dest_trinormorg, destside1, destside2);
+
+ normalize_v3(src_trinormorg);
+ normalize_v3(dest_trinormorg);
+
+ copy_v3_v3(src_trinorm, src_trinormorg);
+ copy_v3_v3(dest_trinorm, dest_trinormorg);
+
+ mul_v3_fl(src_trinorm, 0.25 * cell_len);
+ mul_v3_fl(dest_trinorm, 0.25 * cell_len);
+
+ for(j = 0; j <= divs1; j++)
+ {
+ for(k = 0; k <= divs2; k++)
+ {
+ float src_p1[3], src_p2[3], src_p3[3], src_p[3]={0,0,0};
+ float dest_p1[3], dest_p2[3], dest_p3[3], dest_p[3]={0,0,0};
+ const float uf = (float)(j + TRI_UVOFFSET) / (float)(divs1 + 0.0);
+ const float vf = (float)(k + TRI_UVOFFSET) / (float)(divs2 + 0.0);
+ float src_tmpvec[3], dest_tmpvec[3];
+
+ if(uf+vf > 1.0)
+ {
+ // printf("bigger - divs1: %d, divs2: %d\n", divs1, divs2);
+ continue;
+ }
+
+ copy_v3_v3(src_p1, &scs->points_old[mface[i].v1 * 3]);
+ copy_v3_v3(dest_p1, &scs->points[mface[i].v1 * 3]);
+ if(again == 1 && mface[i].v4)
+ {
+ copy_v3_v3(src_p2, &scs->points_old[mface[i].v3 * 3]);
+ copy_v3_v3(dest_p2, &scs->points[mface[i].v3 * 3]);
+
+ copy_v3_v3(src_p3,&scs->points_old[mface[i].v4 * 3]);
+ copy_v3_v3(dest_p3, &scs->points[mface[i].v4 * 3]);
+ }
+ else {
+ copy_v3_v3(src_p2, &scs->points_old[mface[i].v2 * 3]);
+ copy_v3_v3(dest_p2, &scs->points[mface[i].v2 * 3]);
+ copy_v3_v3(src_p3, &scs->points_old[mface[i].v3 * 3]);
+ copy_v3_v3(dest_p3, &scs->points[mface[i].v3 * 3]);
+ }
+
+ mul_v3_fl(src_p1, (1.0-uf-vf));
+ mul_v3_fl(dest_p1, (1.0-uf-vf));
+
+ mul_v3_fl(src_p2, uf);
+ mul_v3_fl(dest_p2, uf);
+
+ mul_v3_fl(src_p3, vf);
+ mul_v3_fl(dest_p3, vf);
+
+ add_v3_v3v3(src_p, src_p1, src_p2);
+ add_v3_v3v3(dest_p, dest_p1, dest_p2);
+
+ add_v3_v3(src_p, src_p3);
+ add_v3_v3(dest_p, dest_p3);
+
+ if(newdivs > divs)
+ printf("mem problem\n");
+
+ // mMovPoints.push_back(p + trinorm);
+ add_v3_v3v3(src_tmpvec, src_p, src_trinorm);
+ add_v3_v3v3(dest_tmpvec, dest_p, dest_trinorm);
+
+ // mul_m4_v3(ob->obmat, tmpvec); // DG: use local coordinates, we save MAT anyway
+ copy_v3_v3(&scs->points_old[3 * (dm->getNumVerts(dm) + newdivs)], src_tmpvec);
+ copy_v3_v3(&scs->points[3 * (dm->getNumVerts(dm) + newdivs)], dest_tmpvec);
+ newdivs++;
+
+ if(newdivs > divs)
+ printf("mem problem\n");
+
+ // mMovPoints.push_back(p - trinorm);
+ copy_v3_v3(src_tmpvec, src_p);
+ copy_v3_v3(dest_tmpvec, dest_p);
+
+ sub_v3_v3(src_tmpvec, src_trinorm);
+ sub_v3_v3(dest_tmpvec, dest_trinorm);
+
+ // mul_m4_v3(ob->obmat, tmpvec); // DG: use local coordinates, we save MAT anyway
+ copy_v3_v3(&scs->points_old[3 * (dm->getNumVerts(dm) + newdivs)], src_tmpvec);
+ copy_v3_v3(&scs->points[3 * (dm->getNumVerts(dm) + newdivs)], dest_tmpvec);
+ newdivs++;
+ }
+ }
+
+ if(again == 0 && mface[i].v4)
+ again++;
+ else
+ again = 0;
+
+ facecounter++;
+
+ } while(again!=0);
+ }
+
+ // scs->numpoints = dm->getNumVerts(dm) + newdivs;
+
}
/*! init triangle divisions */
@@ -472,22 +653,22 @@ static void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFa
// mTriangleDivs3.resize( faces.size() );
size_t i = 0, facecounter = 0;
- float maxscale[3] = {1,1,1}; // = channelFindMaxVf(mcScale);
+ float maxscale[3] = {1,1,1}; // = channelFindMaxVf(mcScale); get max scale value
float maxpart = ABS(maxscale[0]);
float scaleFac = 0;
float fsTri = 0;
- if (ABS(maxscale[1])>maxpart) maxpart = ABS(maxscale[1]);
- if (ABS(maxscale[2])>maxpart) maxpart = ABS(maxscale[2]);
+ if(ABS(maxscale[1])>maxpart) maxpart = ABS(maxscale[1]);
+ if(ABS(maxscale[2])>maxpart) maxpart = ABS(maxscale[2]);
scaleFac = 1.0 / maxpart;
// featureSize = mLevel[mMaxRefine].nodeSize
- fsTri = cell_len * 0.5 * scaleFac;
+ fsTri = cell_len * 0.75 * scaleFac; // fsTri = cell_len * 0.9;
- if (*tridivs)
+ if(*tridivs)
MEM_freeN(*tridivs);
*tridivs = MEM_callocN(sizeof(int) * numtris * 3, "Smoke_Tridivs");
- for (i = 0, facecounter = 0; i < numfaces; i++)
+ for(i = 0, facecounter = 0; i < numfaces; i++)
{
float p0[3], p1[3], p2[3];
float side1[3];
@@ -506,21 +687,22 @@ static void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFa
sub_v3_v3v3(side2, p2, p0);
sub_v3_v3v3(side3, p1, p2);
- if (dot_v3v3(side1, side1) > fsTri*fsTri)
+ if(dot_v3v3(side1, side1) > fsTri*fsTri)
{
float tmp = normalize_v3(side1);
divs1 = (int)ceil(tmp/fsTri);
}
- if (dot_v3v3(side2, side2) > fsTri*fsTri)
+ if(dot_v3v3(side2, side2) > fsTri*fsTri)
{
float tmp = normalize_v3(side2);
divs2 = (int)ceil(tmp/fsTri);
- /*
+ /*
// debug
- if (i==0)
+ if(i==0)
printf("b tmp: %f, fsTri: %f, divs2: %d\n", tmp, fsTri, divs2);
*/
+
}
(*tridivs)[3 * facecounter + 0] = divs1;
@@ -528,7 +710,7 @@ static void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFa
(*tridivs)[3 * facecounter + 2] = divs3;
// TODO quad case
- if (faces[i].v4)
+ if(faces[i].v4)
{
divs1=0, divs2=0, divs3=0;
@@ -545,12 +727,12 @@ static void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFa
sub_v3_v3v3(side2, p2, p0);
sub_v3_v3v3(side3, p1, p2);
- if (dot_v3v3(side1, side1) > fsTri*fsTri)
+ if(dot_v3v3(side1, side1) > fsTri*fsTri)
{
float tmp = normalize_v3(side1);
divs1 = (int)ceil(tmp/fsTri);
}
- if (dot_v3v3(side2, side2) > fsTri*fsTri)
+ if(dot_v3v3(side2, side2) > fsTri*fsTri)
{
float tmp = normalize_v3(side2);
divs2 = (int)ceil(tmp/fsTri);
@@ -568,19 +750,19 @@ static void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFa
static void smokeModifier_freeDomain(SmokeModifierData *smd)
{
- if (smd->domain)
+ if(smd->domain)
{
- if (smd->domain->shadow)
+ if(smd->domain->shadow)
MEM_freeN(smd->domain->shadow);
smd->domain->shadow = NULL;
- if (smd->domain->fluid)
+ if(smd->domain->fluid)
smoke_free(smd->domain->fluid);
- if (smd->domain->wt)
+ if(smd->domain->wt)
smoke_turbulence_free(smd->domain->wt);
- if (smd->domain->effector_weights)
+ if(smd->domain->effector_weights)
MEM_freeN(smd->domain->effector_weights);
smd->domain->effector_weights = NULL;
@@ -594,10 +776,10 @@ static void smokeModifier_freeDomain(SmokeModifierData *smd)
static void smokeModifier_freeFlow(SmokeModifierData *smd)
{
- if (smd->flow)
+ if(smd->flow)
{
/*
- if (smd->flow->bvh)
+ if(smd->flow->bvh)
{
free_bvhtree_from_mesh(smd->flow->bvh);
MEM_freeN(smd->flow->bvh);
@@ -611,22 +793,37 @@ static void smokeModifier_freeFlow(SmokeModifierData *smd)
static void smokeModifier_freeCollision(SmokeModifierData *smd)
{
- if (smd->coll)
+ if(smd->coll)
{
- if (smd->coll->points)
+ SmokeCollSettings *scs = smd->coll;
+
+ if(scs->numpoints)
{
- MEM_freeN(smd->coll->points);
- smd->coll->points = NULL;
+ if(scs->points)
+ {
+ MEM_freeN(scs->points);
+ scs->points = NULL;
+ }
+ if(scs->points_old)
+ {
+ MEM_freeN(scs->points_old);
+ scs->points_old = NULL;
+ }
+ if(scs->tridivs)
+ {
+ MEM_freeN(scs->tridivs);
+ scs->tridivs = NULL;
+ }
}
- if (smd->coll->bvhtree)
+ if(scs->bvhtree)
{
- BLI_bvhtree_free(smd->coll->bvhtree);
- smd->coll->bvhtree = NULL;
+ BLI_bvhtree_free(scs->bvhtree);
+ scs->bvhtree = NULL;
}
#ifdef USE_SMOKE_COLLISION_DM
- if (smd->coll->dm)
+ if(smd->coll->dm)
smd->coll->dm->release(smd->coll->dm);
smd->coll->dm = NULL;
#endif
@@ -638,7 +835,7 @@ static void smokeModifier_freeCollision(SmokeModifierData *smd)
void smokeModifier_reset_turbulence(struct SmokeModifierData *smd)
{
- if (smd && smd->domain && smd->domain->wt)
+ if(smd && smd->domain && smd->domain->wt)
{
smoke_turbulence_free(smd->domain->wt);
smd->domain->wt = NULL;
@@ -647,15 +844,15 @@ void smokeModifier_reset_turbulence(struct SmokeModifierData *smd)
void smokeModifier_reset(struct SmokeModifierData *smd)
{
- if (smd)
+ if(smd)
{
- if (smd->domain)
+ if(smd->domain)
{
- if (smd->domain->shadow)
+ if(smd->domain->shadow)
MEM_freeN(smd->domain->shadow);
smd->domain->shadow = NULL;
- if (smd->domain->fluid)
+ if(smd->domain->fluid)
{
smoke_free(smd->domain->fluid);
smd->domain->fluid = NULL;
@@ -667,10 +864,10 @@ void smokeModifier_reset(struct SmokeModifierData *smd)
// printf("reset domain end\n");
}
- else if (smd->flow)
+ else if(smd->flow)
{
/*
- if (smd->flow->bvh)
+ if(smd->flow->bvh)
{
free_bvhtree_from_mesh(smd->flow->bvh);
MEM_freeN(smd->flow->bvh);
@@ -678,33 +875,33 @@ void smokeModifier_reset(struct SmokeModifierData *smd)
smd->flow->bvh = NULL;
*/
}
- else if (smd->coll)
+ else if(smd->coll)
{
- if (smd->coll->points)
- {
- MEM_freeN(smd->coll->points);
- smd->coll->points = NULL;
- }
+ SmokeCollSettings *scs = smd->coll;
- if (smd->coll->bvhtree)
+ if(scs->numpoints && scs->points)
{
- BLI_bvhtree_free(smd->coll->bvhtree);
- smd->coll->bvhtree = NULL;
+ MEM_freeN(scs->points);
+ scs->points = NULL;
+
+ if(scs->points_old)
+ {
+ MEM_freeN(scs->points_old);
+ scs->points_old = NULL;
+ }
+ if(scs->tridivs)
+ {
+ MEM_freeN(scs->tridivs);
+ scs->tridivs = NULL;
+ }
}
-
-#ifdef USE_SMOKE_COLLISION_DM
- if (smd->coll->dm)
- smd->coll->dm->release(smd->coll->dm);
- smd->coll->dm = NULL;
-#endif
-
}
}
}
-void smokeModifier_free (SmokeModifierData *smd)
+void smokeModifier_free(SmokeModifierData *smd)
{
- if (smd)
+ if(smd)
{
smokeModifier_freeDomain(smd);
smokeModifier_freeFlow(smd);
@@ -714,11 +911,11 @@ void smokeModifier_free (SmokeModifierData *smd)
void smokeModifier_createType(struct SmokeModifierData *smd)
{
- if (smd)
+ if(smd)
{
- if (smd->type & MOD_SMOKE_TYPE_DOMAIN)
+ if(smd->type & MOD_SMOKE_TYPE_DOMAIN)
{
- if (smd->domain)
+ if(smd->domain)
smokeModifier_freeDomain(smd);
smd->domain = MEM_callocN(sizeof(SmokeDomainSettings), "SmokeDomain");
@@ -745,7 +942,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
smd->domain->beta = 0.1;
smd->domain->time_scale = 1.0;
smd->domain->vorticity = 2.0;
- smd->domain->border_collisions = 1; // vertically non-colliding
+ smd->domain->border_collisions = SM_BORDER_OPEN; // open domain
smd->domain->flags = MOD_SMOKE_DISSOLVE_LOG | MOD_SMOKE_HIGH_SMOOTH;
smd->domain->strength = 2.0;
smd->domain->noise = MOD_SMOKE_NOISEWAVE;
@@ -755,9 +952,9 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
smd->domain->viewsettings = MOD_SMOKE_VIEW_SHOWBIG;
smd->domain->effector_weights = BKE_add_effector_weights(NULL);
}
- else if (smd->type & MOD_SMOKE_TYPE_FLOW)
+ else if(smd->type & MOD_SMOKE_TYPE_FLOW)
{
- if (smd->flow)
+ if(smd->flow)
smokeModifier_freeFlow(smd);
smd->flow = MEM_callocN(sizeof(SmokeFlowSettings), "SmokeFlow");
@@ -773,17 +970,23 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
smd->flow->psys = NULL;
}
- else if (smd->type & MOD_SMOKE_TYPE_COLL)
+ else if(smd->type & MOD_SMOKE_TYPE_COLL)
{
- if (smd->coll)
+ if(smd->coll)
smokeModifier_freeCollision(smd);
smd->coll = MEM_callocN(sizeof(SmokeCollSettings), "SmokeColl");
smd->coll->smd = smd;
smd->coll->points = NULL;
+ smd->coll->points_old = NULL;
+ smd->coll->tridivs = NULL;
+ smd->coll->vel = NULL;
smd->coll->numpoints = 0;
+ smd->coll->numtris = 0;
smd->coll->bvhtree = NULL;
+ smd->coll->type = 0; // static obstacle
+ smd->coll->dx = 1.0f / 50.0f;
#ifdef USE_SMOKE_COLLISION_DM
smd->coll->dm = NULL;
@@ -818,7 +1021,7 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData
MEM_freeN(tsmd->domain->effector_weights);
tsmd->domain->effector_weights = MEM_dupallocN(smd->domain->effector_weights);
- }
+ }
else if (tsmd->flow) {
tsmd->flow->density = smd->flow->density;
tsmd->flow->temp = smd->flow->temp;
@@ -845,15 +1048,15 @@ static int get_lamp(Scene *scene, float *light)
int found_lamp = 0;
// try to find a lamp, preferably local
- for (base_tmp = scene->base.first; base_tmp; base_tmp= base_tmp->next) {
- if (base_tmp->object->type == OB_LAMP) {
+ for(base_tmp = scene->base.first; base_tmp; base_tmp= base_tmp->next) {
+ if(base_tmp->object->type == OB_LAMP) {
Lamp *la = base_tmp->object->data;
- if (la->type == LA_LOCAL) {
+ if(la->type == LA_LOCAL) {
copy_v3_v3(light, base_tmp->object->obmat[3]);
return 1;
}
- else if (!found_lamp) {
+ else if(!found_lamp) {
copy_v3_v3(light, base_tmp->object->obmat[3]);
found_lamp = 1;
}
@@ -863,499 +1066,605 @@ static int get_lamp(Scene *scene, float *light)
return found_lamp;
}
-static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
+static void smoke_calc_domain(Scene *UNUSED(scene), Object *UNUSED(ob), SmokeModifierData *UNUSED(smd))
{
+#if 0
SmokeDomainSettings *sds = smd->domain;
GroupObject *go = NULL;
- Base *base = NULL;
+ Base *base = NULL;
- // do collisions, needs to be done before emission, so that smoke isn't emitted inside collision cells
- if (1)
+ /* do collisions, needs to be done before emission, so that smoke isn't emitted inside collision cells */
+ if(1)
{
- Object *otherobj = NULL;
- ModifierData *md = NULL;
-
- if (sds->coll_group) // we use groups since we have 2 domains
- go = sds->coll_group->gobject.first;
- else
- base = scene->base.first;
+ unsigned int i;
+ Object **collobjs = NULL;
+ unsigned int numcollobj = 0;
+ collobjs = get_collisionobjects(scene, ob, sds->coll_group, &numcollobj);
- while (base || go)
+ for(i = 0; i < numcollobj; i++)
{
- otherobj = NULL;
- if (sds->coll_group)
- {
- if (go->ob)
- otherobj = go->ob;
- }
- else
- otherobj = base->object;
- if (!otherobj)
- {
- if (sds->coll_group)
- go = go->next;
- else
- base= base->next;
- continue;
- }
- md = modifiers_findByType(otherobj, eModifierType_Smoke);
+ Object *collob= collobjs[i];
+ SmokeModifierData *smd2 = (SmokeModifierData*)modifiers_findByType(collob, eModifierType_Smoke);
// check for active smoke modifier
- if (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))
+ // if(md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))
+ // SmokeModifierData *smd2 = (SmokeModifierData *)md;
+
+ if((smd2->type & MOD_SMOKE_TYPE_COLL) && smd2->coll && smd2->coll->points && smd2->coll->points_old)
{
- SmokeModifierData *smd2 = (SmokeModifierData *)md;
+ // ??? anything to do here?
+
+ // TODO: only something to do for ANIMATED obstacles: need to update positions
+
+ }
+ }
+
+ if(collobjs)
+ MEM_freeN(collobjs);
+ }
+
+#endif
+}
+
+/* Animated obstacles: dx_step = ((x_new - x_old) / totalsteps) * substep */
+static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds, float dt, int substep, int totalsteps)
+{
+ Object **collobjs = NULL;
+ unsigned int numcollobj = 0;
+
+ unsigned int collIndex;
+ unsigned char *obstacles = smoke_get_obstacle(sds->fluid);
+ float *velx = NULL;
+ float *vely = NULL;
+ float *velz = NULL;
+ float *velxOrig = smoke_get_velocity_x(sds->fluid);
+ float *velyOrig = smoke_get_velocity_y(sds->fluid);
+ float *velzOrig = smoke_get_velocity_z(sds->fluid);
+ // float *density = smoke_get_density(sds->fluid);
+ unsigned int z;
+
+ smoke_get_ob_velocity(sds->fluid, &velx, &vely, &velz);
+
+ // TODO: delete old obstacle flags
+ for(z = 0; z < sds->res[0] * sds->res[1] * sds->res[2]; z++)
+ {
+ if(obstacles[z])
+ {
+ // density[z] = 0;
+
+ velxOrig[z] = 0;
+ velyOrig[z] = 0;
+ velzOrig[z] = 0;
+ }
+
+ if(obstacles[z] & 8) // Do not delete static obstacles
+ {
+ obstacles[z] = 0;
+ }
+
+ velx[z] = 0;
+ vely[z] = 0;
+ velz[z] = 0;
+ }
+
+ collobjs = get_collisionobjects(scene, ob, sds->coll_group, &numcollobj, eModifierType_Smoke);
+
+ // update obstacle tags in cells
+ for(collIndex = 0; collIndex < numcollobj; collIndex++)
+ {
+ Object *collob= collobjs[collIndex];
+ SmokeModifierData *smd2 = (SmokeModifierData*)modifiers_findByType(collob, eModifierType_Smoke);
+
+ // DG TODO: check if modifier is active?
+
+ if((smd2->type & MOD_SMOKE_TYPE_COLL) && smd2->coll && smd2->coll->points && smd2->coll->points_old)
+ {
+ SmokeCollSettings *scs = smd2->coll;
+ unsigned int i;
+
+ /*
+ // DG TODO: support static cobstacles, but basicly we could even support static + rigid with one set of code
+ if(scs->type > SM_COLL_STATIC)
+ */
- if ((smd2->type & MOD_SMOKE_TYPE_COLL) && smd2->coll && smd2->coll->points)
+ /* Handle collisions */
+ for(i = 0; i < scs->numpoints; i++)
+ {
+ // 1. get corresponding cell
+ int cell[3];
+ float pos[3], oldpos[3], vel[3];
+ float cPos[3], cOldpos[3]; /* current position in substeps */
+ int badcell = 0;
+ size_t index;
+ int j;
+
+ // translate local points into global positions
+ copy_v3_v3(cPos, &scs->points[3 * i]);
+ mul_m4_v3(scs->mat, cPos);
+ copy_v3_v3(pos, cPos);
+
+ copy_v3_v3(cOldpos, &scs->points_old[3 * i]);
+ mul_m4_v3(scs->mat_old, cOldpos);
+ copy_v3_v3(oldpos, cOldpos);
+
+ /* support for rigid bodies, armatures etc */
{
- // we got nice collision object
- SmokeCollSettings *scs = smd2->coll;
- size_t i, j;
- unsigned char *obstacles = smoke_get_obstacle(smd->domain->fluid);
+ float tmp[3];
- for (i = 0; i < scs->numpoints; i++)
- {
- int badcell = 0;
- size_t index = 0;
- int cell[3];
+ /* x_current = x_old + (x_new - x_old) * step_current / steps_total */
+ float mulStep = (float)(((float)substep) / ((float)totalsteps));
- // 1. get corresponding cell
- get_cell(smd->domain->p0, smd->domain->res, smd->domain->dx, &scs->points[3 * i], cell, 0);
-
- // check if cell is valid (in the domain boundary)
- for (j = 0; j < 3; j++)
- if ((cell[j] > sds->res[j] - 1) || (cell[j] < 0))
- {
- badcell = 1;
- break;
- }
-
- if (badcell)
- continue;
- // 2. set cell values (heat, density and velocity)
- index = smoke_get_index(cell[0], sds->res[0], cell[1], sds->res[1], cell[2]);
-
- // printf("cell[0]: %d, cell[1]: %d, cell[2]: %d\n", cell[0], cell[1], cell[2]);
- // printf("res[0]: %d, res[1]: %d, res[2]: %d, index: %d\n\n", sds->res[0], sds->res[1], sds->res[2], index);
- obstacles[index] = 1;
- // for moving gobstacles
- /*
- const LbmFloat maxVelVal = 0.1666;
- const LbmFloat maxusqr = maxVelVal*maxVelVal*3. *1.5;
-
- LbmVec objvel = vec2L((mMOIVertices[n]-mMOIVerticesOld[n]) /dvec);
- {
- const LbmFloat usqr = (objvel[0]*objvel[0]+objvel[1]*objvel[1]+objvel[2]*objvel[2])*1.5;
- USQRMAXCHECK(usqr, objvel[0],objvel[1],objvel[2], mMaxVlen, mMxvx,mMxvy,mMxvz);
- if (usqr>maxusqr) {
- // cutoff at maxVelVal
- for (int jj=0; jj<3; jj++) {
- if (objvel[jj] > 0.0) objvel[jj] = maxVelVal;
- if (objvel[jj] < 0.0) objvel[jj] = -maxVelVal;
- }
- }
- }
- const LbmFloat dp=dot(objvel, vec2L((*pNormals)[n]) );
- const LbmVec oldov=objvel; // debug
- objvel = vec2L((*pNormals)[n]) *dp;
- */
+ sub_v3_v3v3(tmp, cPos, cOldpos);
+ mul_v3_fl(tmp, mulStep);
+ add_v3_v3(cOldpos, tmp);
+ }
+
+ sub_v3_v3v3(vel, pos, oldpos);
+ /* Scale velocity to incorperate the object movement during this step */
+ mul_v3_fl(vel, 1.0 / (totalsteps * dt));
+ // mul_v3_fl(vel, 1.0 / dt);
+
+ // DG TODO: cap velocity to maxVelMag (or maxvel)
+
+ // oldpos + velocity * dt = newpos
+ get_cell(sds->p0, sds->res, sds->dx, cOldpos /* use current position here instead of "pos" */, cell, 0);
+
+ // check if cell is valid (in the domain boundary)
+ for(j = 0; j < 3; j++)
+ if((cell[j] > sds->res[j] - 1) || (cell[j] < 0))
+ {
+ badcell = 1;
+ break;
}
+
+ if(badcell)
+ continue;
+
+ // 2. set cell values (heat, density and velocity)
+ index = smoke_get_index(cell[0], sds->res[0], cell[1], sds->res[1], cell[2]);
+
+ // Don't overwrite existing obstacles
+ if(obstacles[index])
+ continue;
+
+ // printf("cell[0]: %d, cell[1]: %d, cell[2]: %d\n", cell[0], cell[1], cell[2]);
+ // printf("res[0]: %d, res[1]: %d, res[2]: %d, index: %d\n\n", sds->res[0], sds->res[1], sds->res[2], index);
+ obstacles[index] = 1 | 8 /* ANIMATED */;
+
+ if(len_v3(vel) > FLT_EPSILON)
+ {
+ // Collision object is moving
+
+ velx[index] = vel[0]; // use "+="?
+ vely[index] = vel[1];
+ velz[index] = vel[2];
}
}
-
- if (sds->coll_group)
- go = go->next;
- else
- base= base->next;
}
}
- // do flows and fluids
- if (1)
+ if(collobjs)
+ MEM_freeN(collobjs);
+}
+
+static void update_flowsfluids(Scene *scene, Object *ob, SmokeDomainSettings *sds, float time)
+{
+ Object **flowobjs = NULL;
+ unsigned int numflowobj = 0;
+ unsigned int flowIndex;
+
+ flowobjs = get_collisionobjects(scene, ob, sds->fluid_group, &numflowobj, eModifierType_Smoke);
+
+ // update obstacle tags in cells
+ for(flowIndex = 0; flowIndex < numflowobj; flowIndex++)
{
- Object *otherobj = NULL;
- ModifierData *md = NULL;
- if (sds->fluid_group) // we use groups since we have 2 domains
- go = sds->fluid_group->gobject.first;
- else
- base = scene->base.first;
- while (base || go)
- {
- otherobj = NULL;
- if (sds->fluid_group)
- {
- if (go->ob)
- otherobj = go->ob;
- }
- else
- otherobj = base->object;
- if (!otherobj)
- {
- if (sds->fluid_group)
- go = go->next;
- else
- base= base->next;
+ Object *collob= flowobjs[flowIndex];
+ SmokeModifierData *smd2 = (SmokeModifierData*)modifiers_findByType(collob, eModifierType_Smoke);
- continue;
- }
+ // check for initialized smoke object
+ if((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow)
+ {
+ // we got nice flow object
+ SmokeFlowSettings *sfs = smd2->flow;
- md = modifiers_findByType(otherobj, eModifierType_Smoke);
-
- // check for active smoke modifier
- if (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))
+ if(sfs && sfs->psys && sfs->psys->part && sfs->psys->part->type==PART_EMITTER) // is particle system selected
{
- SmokeModifierData *smd2 = (SmokeModifierData *)md;
-
- // check for initialized smoke object
- if ((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow)
+ ParticleSimulationData sim;
+ ParticleSystem *psys = sfs->psys;
+ int totpart=psys->totpart, totchild;
+ int p = 0;
+ float *density = smoke_get_density(sds->fluid);
+ float *bigdensity = smoke_turbulence_get_density(sds->wt);
+ float *heat = smoke_get_heat(sds->fluid);
+ float *velocity_x = smoke_get_velocity_x(sds->fluid);
+ float *velocity_y = smoke_get_velocity_y(sds->fluid);
+ float *velocity_z = smoke_get_velocity_z(sds->fluid);
+ unsigned char *obstacle = smoke_get_obstacle(sds->fluid);
+ // DG TODO UNUSED unsigned char *obstacleAnim = smoke_get_obstacle_anim(sds->fluid);
+ int bigres[3];
+ short absolute_flow = (sfs->flags & MOD_SMOKE_FLOW_ABSOLUTE);
+ short high_emission_smoothing = bigdensity ? (sds->flags & MOD_SMOKE_HIGH_SMOOTH) : 0;
+
+ /*
+ * A temporary volume map used to store whole emissive
+ * area to be added to smoke density and interpolated
+ * for high resolution smoke.
+ */
+ float *temp_emission_map = NULL;
+
+ sim.scene = scene;
+ sim.ob = collob;
+ sim.psys = psys;
+
+ // initialize temp emission map
+ if(!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW))
{
- // we got nice flow object
- SmokeFlowSettings *sfs = smd2->flow;
-
- if (sfs && sfs->psys && sfs->psys->part && sfs->psys->part->type==PART_EMITTER) // is particle system selected
+ int i;
+ temp_emission_map = MEM_callocN(sizeof(float) * sds->res[0]*sds->res[1]*sds->res[2], "SmokeTempEmission");
+ // set whole volume to 0.0f
+ for (i=0; i<sds->res[0]*sds->res[1]*sds->res[2]; i++) {
+ temp_emission_map[i] = 0.0f;
+ }
+ }
+
+ // mostly copied from particle code
+ if(psys->part->type==PART_HAIR)
+ {
+ /*
+ if(psys->childcache)
+ {
+ totchild = psys->totchildcache;
+ }
+ else
+ */
+
+ // TODO: PART_HAIR not supported whatsoever
+ totchild=0;
+ }
+ else
+ totchild=psys->totchild*psys->part->disp/100;
+
+ for(p=0; p<totpart+totchild; p++)
+ {
+ int cell[3];
+ size_t i = 0;
+ size_t index = 0;
+ int badcell = 0;
+ ParticleKey state;
+
+ if(p < totpart)
{
- ParticleSimulationData sim;
- ParticleSystem *psys = sfs->psys;
- int totpart=psys->totpart, totchild;
- int p = 0;
- float *density = smoke_get_density(sds->fluid);
- float *bigdensity = smoke_turbulence_get_density(sds->wt);
- float *heat = smoke_get_heat(sds->fluid);
- float *velocity_x = smoke_get_velocity_x(sds->fluid);
- float *velocity_y = smoke_get_velocity_y(sds->fluid);
- float *velocity_z = smoke_get_velocity_z(sds->fluid);
- unsigned char *obstacle = smoke_get_obstacle(sds->fluid);
- int bigres[3];
- short absolute_flow = (sfs->flags & MOD_SMOKE_FLOW_ABSOLUTE);
- short high_emission_smoothing = bigdensity ? (smd->domain->flags & MOD_SMOKE_HIGH_SMOOTH) : 0;
-
- /*
- * A temporary volume map used to store whole emissive
- * area to be added to smoke density and interpolated
- * for high resolution smoke.
- */
- float *temp_emission_map = NULL;
-
- sim.scene = scene;
- sim.ob = otherobj;
- sim.psys = psys;
-
- // initialize temp emission map
- if (!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW))
+ if(psys->particles[p].flag & (PARS_NO_DISP|PARS_UNEXIST))
+ continue;
+ }
+ else {
+ /* handle child particle */
+ ChildParticle *cpa = &psys->child[p - totpart];
+
+ if(psys->particles[cpa->parent].flag & (PARS_NO_DISP|PARS_UNEXIST))
+ continue;
+ }
+
+ state.time = time;
+ if(psys_get_particle_state(&sim, p, &state, 0) == 0)
+ continue;
+
+ // copy_v3_v3(pos, pa->state.co);
+ // mul_m4_v3(ob->imat, pos);
+ // 1. get corresponding cell
+ get_cell(sds->p0, sds->res, sds->dx, state.co, cell, 0);
+ // check if cell is valid (in the domain boundary)
+ for(i = 0; i < 3; i++)
+ {
+ if((cell[i] > sds->res[i] - 1) || (cell[i] < 0))
+ {
+ badcell = 1;
+ break;
+ }
+ }
+ if(badcell)
+ continue;
+ // 2. set cell values (heat, density and velocity)
+ index = smoke_get_index(cell[0], sds->res[0], cell[1], sds->res[1], cell[2]);
+ if(!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW) && !(obstacle[index])) // this is inflow
+ {
+ // heat[index] += sfs->temp * 0.1;
+ // density[index] += sfs->density * 0.1;
+ heat[index] = sfs->temp;
+
+ // Add emitter density to temp emission map
+ temp_emission_map[index] = sfs->density;
+
+ // Uses particle velocity as initial velocity for smoke
+ if(sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY && (psys->part->phystype != PART_PHYS_NO))
{
- int i;
- temp_emission_map = MEM_callocN(sizeof(float) * sds->res[0]*sds->res[1]*sds->res[2], "SmokeTempEmission");
- // set whole volume to 0.0f
- for (i=0; i<sds->res[0]*sds->res[1]*sds->res[2]; i++) {
- temp_emission_map[i] = 0.0f;
- }
- }
-
- // mostly copied from particle code
- if (psys->part->type==PART_HAIR)
+ velocity_x[index] = state.vel[0]*sfs->vel_multi;
+ velocity_y[index] = state.vel[1]*sfs->vel_multi;
+ velocity_z[index] = state.vel[2]*sfs->vel_multi;
+ }
+ }
+ else if(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW) // outflow
+ {
+ heat[index] = 0.f;
+ density[index] = 0.f;
+ velocity_x[index] = 0.f;
+ velocity_y[index] = 0.f;
+ velocity_z[index] = 0.f;
+ // we need different handling for the high-res feature
+ if(bigdensity)
{
- /*
- if (psys->childcache)
- {
- totchild = psys->totchildcache;
- }
- else
- */
-
- // TODO: PART_HAIR not supported whatsoever
- totchild=0;
+ // init all surrounding cells according to amplification, too
+ int i, j, k;
+ smoke_turbulence_get_res(sds->wt, bigres);
+
+ for(i = 0; i < sds->amplify + 1; i++)
+ for(j = 0; j < sds->amplify + 1; j++)
+ for(k = 0; k < sds->amplify + 1; k++)
+ {
+ index = smoke_get_index((sds->amplify + 1)* cell[0] + i, bigres[0], (sds->amplify + 1)* cell[1] + j, bigres[1], (sds->amplify + 1)* cell[2] + k);
+ bigdensity[index] = 0.f;
+ }
}
- else
- totchild=psys->totchild*psys->part->disp/100;
-
- for (p=0; p<totpart+totchild; p++)
- {
- int cell[3];
- size_t i = 0;
- size_t index = 0;
- int badcell = 0;
- ParticleKey state;
+ }
+ } // particles loop
+
+ // apply emission values
+ if(!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW))
+ {
+ // initialize variables
+ int ii, jj, kk, x, y, z, block_size;
+ size_t index, index_big;
- if (p < totpart)
+ smoke_turbulence_get_res(sds->wt, bigres);
+ block_size = sds->amplify + 1; // high res block size
+
+ // loop through every low res cell
+ for(x = 0; x < sds->res[0]; x++)
+ for(y = 0; y < sds->res[1]; y++)
+ for(z = 0; z < sds->res[2]; z++)
{
- if (psys->particles[p].flag & (PARS_NO_DISP|PARS_UNEXIST))
- continue;
- }
- else {
- /* handle child particle */
- ChildParticle *cpa = &psys->child[p - totpart];
-
- if (psys->particles[cpa->parent].flag & (PARS_NO_DISP|PARS_UNEXIST))
- continue;
- }
+ // neighbor cell emission densities (for high resolution smoke smooth interpolation)
+ float c000, c001, c010, c011, c100, c101, c110, c111;
- state.time = smd->time;
- if (psys_get_particle_state(&sim, p, &state, 0) == 0)
- continue;
-
- // copy_v3_v3(pos, pa->state.co);
- // mul_m4_v3(ob->imat, pos);
- // 1. get corresponding cell
- get_cell(smd->domain->p0, smd->domain->res, smd->domain->dx, state.co, cell, 0);
- // check if cell is valid (in the domain boundary)
- for (i = 0; i < 3; i++)
- {
- if ((cell[i] > sds->res[i] - 1) || (cell[i] < 0))
- {
- badcell = 1;
- break;
- }
- }
- if (badcell)
- continue;
- // 2. set cell values (heat, density and velocity)
- index = smoke_get_index(cell[0], sds->res[0], cell[1], sds->res[1], cell[2]);
- if (!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW) && !(obstacle[index])) // this is inflow
- {
- // heat[index] += sfs->temp * 0.1;
- // density[index] += sfs->density * 0.1;
- heat[index] = sfs->temp;
-
- // Add emitter density to temp emission map
- temp_emission_map[index] = sfs->density;
-
- // Uses particle velocity as initial velocity for smoke
- if (sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY && (psys->part->phystype != PART_PHYS_NO))
- {
- velocity_x[index] = state.vel[0]*sfs->vel_multi;
- velocity_y[index] = state.vel[1]*sfs->vel_multi;
- velocity_z[index] = state.vel[2]*sfs->vel_multi;
- }
- }
- else if (sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW) // outflow
- {
- heat[index] = 0.f;
- density[index] = 0.f;
- velocity_x[index] = 0.f;
- velocity_y[index] = 0.f;
- velocity_z[index] = 0.f;
- // we need different handling for the high-res feature
- if (bigdensity)
+ c000 = (x>0 && y>0 && z>0) ? temp_emission_map[smoke_get_index(x-1, sds->res[0], y-1, sds->res[1], z-1)] : 0;
+ c001 = (x>0 && y>0) ? temp_emission_map[smoke_get_index(x-1, sds->res[0], y-1, sds->res[1], z)] : 0;
+ c010 = (x>0 && z>0) ? temp_emission_map[smoke_get_index(x-1, sds->res[0], y, sds->res[1], z-1)] : 0;
+ c011 = (x>0) ? temp_emission_map[smoke_get_index(x-1, sds->res[0], y, sds->res[1], z)] : 0;
+
+ c100 = (y>0 && z>0) ? temp_emission_map[smoke_get_index(x, sds->res[0], y-1, sds->res[1], z-1)] : 0;
+ c101 = (y>0) ? temp_emission_map[smoke_get_index(x, sds->res[0], y-1, sds->res[1], z)] : 0;
+ c110 = (z>0) ? temp_emission_map[smoke_get_index(x, sds->res[0], y, sds->res[1], z-1)] : 0;
+ c111 = temp_emission_map[smoke_get_index(x, sds->res[0], y, sds->res[1], z)]; // this cell
+
+ // get cell index
+ index = smoke_get_index(x, sds->res[0], y, sds->res[1], z);
+
+ // add emission to low resolution density
+ if (absolute_flow)
{
- // init all surrounding cells according to amplification, too
- int i, j, k;
- smoke_turbulence_get_res(smd->domain->wt, bigres);
-
- for (i = 0; i < smd->domain->amplify + 1; i++)
- for (j = 0; j < smd->domain->amplify + 1; j++)
- for (k = 0; k < smd->domain->amplify + 1; k++)
- {
- index = smoke_get_index((smd->domain->amplify + 1)* cell[0] + i, bigres[0], (smd->domain->amplify + 1)* cell[1] + j, bigres[1], (smd->domain->amplify + 1)* cell[2] + k);
- bigdensity[index] = 0.f;
- }
+ if (temp_emission_map[index]>0)
+ density[index] = temp_emission_map[index];
}
- }
- } // particles loop
+ else
+ {
+ density[index] += temp_emission_map[index];
+ if (density[index]>1)
+ density[index]=1.0f;
+ }
- // apply emission values
- if (!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW)) {
+ smoke_turbulence_get_res(sds->wt, bigres);
- // initialize variables
- int ii, jj, kk, x, y, z, block_size;
- size_t index, index_big;
+ /* loop through high res blocks if high res enabled */
+ if (bigdensity)
+ for(ii = 0; ii < block_size; ii++)
+ for(jj = 0; jj < block_size; jj++)
+ for(kk = 0; kk < block_size; kk++)
+ {
- smoke_turbulence_get_res(smd->domain->wt, bigres);
- block_size = smd->domain->amplify + 1; // high res block size
+ float fx,fy,fz, interpolated_value;
+ int shift_x, shift_y, shift_z;
- // loop through every low res cell
- for (x = 0; x < sds->res[0]; x++)
- for (y = 0; y < sds->res[1]; y++)
- for (z = 0; z < sds->res[2]; z++)
- {
+ /*
+ * Do volume interpolation if emitter smoothing
+ * is enabled
+ */
+ if (high_emission_smoothing)
+ {
+ // convert block position to relative
+ // for interpolation smoothing
+ fx = (float)ii/block_size + 0.5f/block_size;
+ fy = (float)jj/block_size + 0.5f/block_size;
+ fz = (float)kk/block_size + 0.5f/block_size;
+
+ // calculate trilinear interpolation
+ interpolated_value = c000 * (1-fx) * (1-fy) * (1-fz) +
+ c100 * fx * (1-fy) * (1-fz) +
+ c010 * (1-fx) * fy * (1-fz) +
+ c001 * (1-fx) * (1-fy) * fz +
+ c101 * fx * (1-fy) * fz +
+ c011 * (1-fx) * fy * fz +
+ c110 * fx * fy * (1-fz) +
+ c111 * fx * fy * fz;
+
+
+ // add some contrast / sharpness
+ // depending on hi-res block size
+
+ interpolated_value = (interpolated_value-0.4f*sfs->density)*(block_size/2) + 0.4f*sfs->density;
+ if (interpolated_value<0.0f) interpolated_value = 0.0f;
+ if (interpolated_value>1.0f) interpolated_value = 1.0f;
+
+ // shift smoke block index
+ // (because pixel center is actually
+ // in halfway of the low res block)
+ shift_x = (x < 1) ? 0 : block_size/2;
+ shift_y = (y < 1) ? 0 : block_size/2;
+ shift_z = (z < 1) ? 0 : block_size/2;
+ }
+ else
+ {
+ // without interpolation use same low resolution
+ // block value for all hi-res blocks
+ interpolated_value = c111;
+ shift_x = 0;
+ shift_y = 0;
+ shift_z = 0;
+ }
- // neighbor cell emission densities (for high resolution smoke smooth interpolation)
- float c000, c001, c010, c011, c100, c101, c110, c111;
+ // get shifted index for current high resolution block
+ index_big = smoke_get_index(block_size * x + ii - shift_x, bigres[0], block_size * y + jj - shift_y, bigres[1], block_size * z + kk - shift_z);
- c000 = (x>0 && y>0 && z>0) ? temp_emission_map[smoke_get_index(x-1, sds->res[0], y-1, sds->res[1], z-1)] : 0;
- c001 = (x>0 && y>0) ? temp_emission_map[smoke_get_index(x-1, sds->res[0], y-1, sds->res[1], z)] : 0;
- c010 = (x>0 && z>0) ? temp_emission_map[smoke_get_index(x-1, sds->res[0], y, sds->res[1], z-1)] : 0;
- c011 = (x>0) ? temp_emission_map[smoke_get_index(x-1, sds->res[0], y, sds->res[1], z)] : 0;
+ // add emission data to high resolution density
+ if (absolute_flow)
+ {
+ if (interpolated_value > 0)
+ bigdensity[index_big] = interpolated_value;
+ }
+ else
+ {
+ bigdensity[index_big] += interpolated_value;
- c100 = (y>0 && z>0) ? temp_emission_map[smoke_get_index(x, sds->res[0], y-1, sds->res[1], z-1)] : 0;
- c101 = (y>0) ? temp_emission_map[smoke_get_index(x, sds->res[0], y-1, sds->res[1], z)] : 0;
- c110 = (z>0) ? temp_emission_map[smoke_get_index(x, sds->res[0], y, sds->res[1], z-1)] : 0;
- c111 = temp_emission_map[smoke_get_index(x, sds->res[0], y, sds->res[1], z)]; // this cell
+ if (bigdensity[index_big]>1)
+ bigdensity[index_big]=1.0f;
+ }
+ } // end of hires loop
+ } // end of low res loop
+ // free temporary emission map
+ if (temp_emission_map)
+ MEM_freeN(temp_emission_map);
- // get cell index
- index = smoke_get_index(x, sds->res[0], y, sds->res[1], z);
+ } // end emission
+ }
+ }
+ }
- // add emission to low resolution density
- if (absolute_flow) {if (temp_emission_map[index]>0) density[index] = temp_emission_map[index];}
- else {
- density[index] += temp_emission_map[index];
- if (density[index]>1) density[index]=1.0f;
- }
+ if(flowobjs)
+ MEM_freeN(flowobjs);
+}
- smoke_turbulence_get_res(smd->domain->wt, bigres);
+static void update_effectors(Scene *scene, Object *ob, SmokeDomainSettings *sds, float UNUSED(dt))
+{
+ ListBase *effectors = pdInitEffectors(scene, ob, NULL, sds->effector_weights);
+ if(effectors)
+ {
+ float *density = smoke_get_density(sds->fluid);
+ float *force_x = smoke_get_force_x(sds->fluid);
+ float *force_y = smoke_get_force_y(sds->fluid);
+ float *force_z = smoke_get_force_z(sds->fluid);
+ float *velocity_x = smoke_get_velocity_x(sds->fluid);
+ float *velocity_y = smoke_get_velocity_y(sds->fluid);
+ float *velocity_z = smoke_get_velocity_z(sds->fluid);
+ unsigned char *obstacle = smoke_get_obstacle(sds->fluid);
+ int x, y, z;
+
+ // precalculate wind forces
+ for(x = 0; x < sds->res[0]; x++)
+ for(y = 0; y < sds->res[1]; y++)
+ for(z = 0; z < sds->res[2]; z++)
+ {
+ EffectedPoint epoint;
+ float voxelCenter[3] = {0,0,0}, vel[3] = {0,0,0}, retvel[3] = {0,0,0};
+ unsigned int index = smoke_get_index(x, sds->res[0], y, sds->res[1], z);
+
+ if((density[index] < FLT_EPSILON) || obstacle[index])
+ continue;
+
+ vel[0] = velocity_x[index];
+ vel[1] = velocity_y[index];
+ vel[2] = velocity_z[index];
+
+ voxelCenter[0] = sds->p0[0] + sds->dx * x + sds->dx * 0.5;
+ voxelCenter[1] = sds->p0[1] + sds->dx * y + sds->dx * 0.5;
+ voxelCenter[2] = sds->p0[2] + sds->dx * z + sds->dx * 0.5;
+
+ pd_point_from_loc(scene, voxelCenter, vel, index, &epoint);
+ pdDoEffectors(effectors, NULL, sds->effector_weights, &epoint, retvel, NULL);
+
+ // TODO dg - do in force!
+ force_x[index] = MIN2(MAX2(-1.0, retvel[0] * 0.2), 1.0);
+ force_y[index] = MIN2(MAX2(-1.0, retvel[1] * 0.2), 1.0);
+ force_z[index] = MIN2(MAX2(-1.0, retvel[2] * 0.2), 1.0);
+ }
+ }
+ pdEndEffectors(&effectors);
+}
- /*
- loop through high res blocks if high res enabled
- */
- if (bigdensity)
- for (ii = 0; ii < block_size; ii++)
- for (jj = 0; jj < block_size; jj++)
- for (kk = 0; kk < block_size; kk++)
- {
-
- float fx,fy,fz, interpolated_value;
- int shift_x, shift_y, shift_z;
-
-
- /*
- * Do volume interpolation if emitter smoothing
- * is enabled
- */
- if (high_emission_smoothing) {
- // convert block position to relative
- // for interpolation smoothing
- fx = (float)ii/block_size + 0.5f/block_size;
- fy = (float)jj/block_size + 0.5f/block_size;
- fz = (float)kk/block_size + 0.5f/block_size;
-
- // calculate trilinear interpolation
- interpolated_value = c000 * (1-fx) * (1-fy) * (1-fz) +
- c100 * fx * (1-fy) * (1-fz) +
- c010 * (1-fx) * fy * (1-fz) +
- c001 * (1-fx) * (1-fy) * fz +
- c101 * fx * (1-fy) * fz +
- c011 * (1-fx) * fy * fz +
- c110 * fx * fy * (1-fz) +
- c111 * fx * fy * fz;
-
-
- // add some contrast / sharpness
- // depending on hi-res block size
-
- interpolated_value = (interpolated_value-0.4f*sfs->density)*(block_size/2) + 0.4f*sfs->density;
- if (interpolated_value<0.0f) interpolated_value = 0.0f;
- if (interpolated_value>1.0f) interpolated_value = 1.0f;
-
- // shift smoke block index
- // (because pixel center is actually
- // in halfway of the low res block)
- shift_x = (x < 1) ? 0 : block_size/2;
- shift_y = (y < 1) ? 0 : block_size/2;
- shift_z = (z < 1) ? 0 : block_size/2;
- }
- else {
- // without interpolation use same low resolution
- // block value for all hi-res blocks
- interpolated_value = c111;
- shift_x = 0;
- shift_y = 0;
- shift_z = 0;
- }
-
- // get shifted index for current high resolution block
- index_big = smoke_get_index(block_size * x + ii - shift_x, bigres[0], block_size * y + jj - shift_y, bigres[1], block_size * z + kk - shift_z);
-
- // add emission data to high resolution density
- if (absolute_flow) {if (interpolated_value > 0) bigdensity[index_big] = interpolated_value;}
- else {
- bigdensity[index_big] += interpolated_value;
- if (bigdensity[index_big]>1) bigdensity[index_big]=1.0f;
- }
+static void step(Scene *scene, Object *ob, SmokeModifierData *smd, float fps)
+{
+ /* stability values copied from wturbulence.cpp */
+ const int maxSubSteps = 25;
+ float maxVel;
+ // maxVel should be 1.5 (1.5 cell max movement) * dx (cell size)
- } // end of hires loop
+ float dt = DT_DEFAULT;
+ float maxVelMag = 0.0f;
+ int totalSubsteps;
+ int substep = 0;
+ float dtSubdiv;
- } // end of low res loop
+ SmokeDomainSettings *sds = smd->domain;
- // free temporary emission map
- if (temp_emission_map) MEM_freeN(temp_emission_map);
+ /* get max velocity and lower the dt value if it is too high */
+ size_t size= sds->res[0] * sds->res[1] * sds->res[2];
- } // end emission
+ float *velX = smoke_get_velocity_x(sds->fluid);
+ float *velY = smoke_get_velocity_y(sds->fluid);
+ float *velZ = smoke_get_velocity_z(sds->fluid);
+ size_t i;
+ /* adapt timestep for different framerates, dt = 0.1 is at 25fps */
+ dt *= (25.0f / fps);
-
- }
- else {
- /*
- for ()
- {
- // no psys
- BVHTreeNearest nearest;
- nearest.index = -1;
- nearest.dist = FLT_MAX;
+ // printf("test maxVel: %f\n", (sds->dx * 1.5) / dt); // gives 0.9
+ maxVel = (sds->dx * 1.5);
- BLI_bvhtree_find_nearest(sfs->bvh->tree, pco, &nearest, sfs->bvh->nearest_callback, sfs->bvh);
- }*/
- }
- }
- }
- if (sds->fluid_group)
- go = go->next;
- else
- base= base->next;
- }
+ for(i = 0; i < size; i++)
+ {
+ float vtemp = (velX[i]*velX[i]+velY[i]*velY[i]+velZ[i]*velZ[i]);
+ if(vtemp > maxVelMag)
+ maxVelMag = vtemp;
}
- // do effectors
+ maxVelMag = sqrt(maxVelMag) * dt * sds->time_scale;
+ totalSubsteps = (int)((maxVelMag / maxVel) + 1.0f); /* always round up */
+ totalSubsteps = (totalSubsteps < 1) ? 1 : totalSubsteps;
+ totalSubsteps = (totalSubsteps > maxSubSteps) ? maxSubSteps : totalSubsteps;
+
+ // totalSubsteps = 2.0f; // DEBUG
+
+ dtSubdiv = (float)dt / (float)totalSubsteps;
+
+ // printf("totalSubsteps: %d, maxVelMag: %f, dt: %f\n", totalSubsteps, maxVelMag, dt);
+
+ for(substep = 0; substep < totalSubsteps; substep++)
{
- ListBase *effectors = pdInitEffectors(scene, ob, NULL, sds->effector_weights);
+ // calc animated obstacle velocities
+ update_obstacles(scene, ob, sds, dtSubdiv, substep, totalSubsteps);
+ update_flowsfluids(scene, ob, sds, smd->time);
+ update_effectors(scene, ob, sds, dtSubdiv); // DG TODO? problem --> uses forces instead of velocity, need to check how they need to be changed with variable dt
- if (effectors)
- {
- float *density = smoke_get_density(sds->fluid);
- float *force_x = smoke_get_force_x(sds->fluid);
- float *force_y = smoke_get_force_y(sds->fluid);
- float *force_z = smoke_get_force_z(sds->fluid);
- float *velocity_x = smoke_get_velocity_x(sds->fluid);
- float *velocity_y = smoke_get_velocity_y(sds->fluid);
- float *velocity_z = smoke_get_velocity_z(sds->fluid);
- int x, y, z;
-
- // precalculate wind forces
- for (x = 0; x < sds->res[0]; x++)
- for (y = 0; y < sds->res[1]; y++)
- for (z = 0; z < sds->res[2]; z++)
- {
- EffectedPoint epoint;
- float voxelCenter[3] = {0,0,0} , vel[3] = {0,0,0} , retvel[3] = {0,0,0};
- unsigned int index = smoke_get_index(x, sds->res[0], y, sds->res[1], z);
-
- if (density[index] < FLT_EPSILON)
- continue;
-
- vel[0] = velocity_x[index];
- vel[1] = velocity_y[index];
- vel[2] = velocity_z[index];
-
- voxelCenter[0] = sds->p0[0] + sds->dx * x + sds->dx * 0.5;
- voxelCenter[1] = sds->p0[1] + sds->dx * y + sds->dx * 0.5;
- voxelCenter[2] = sds->p0[2] + sds->dx * z + sds->dx * 0.5;
-
- pd_point_from_loc(scene, voxelCenter, vel, index, &epoint);
- pdDoEffectors(effectors, NULL, sds->effector_weights, &epoint, retvel, NULL);
-
- // TODO dg - do in force!
- force_x[index] = MIN2(MAX2(-1.0, retvel[0] * 0.2), 1.0);
- force_y[index] = MIN2(MAX2(-1.0, retvel[1] * 0.2), 1.0);
- force_z[index] = MIN2(MAX2(-1.0, retvel[2] * 0.2), 1.0);
- }
- }
+ smoke_step(sds->fluid, dtSubdiv);
- pdEndEffectors(&effectors);
- }
+ // move animated obstacle: Done in update_obstacles() */
+ // where to delete old obstacles from array? Done in update_obstacles() */
+ }
}
+
void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm)
{
- if ((smd->type & MOD_SMOKE_TYPE_FLOW))
+ if((smd->type & MOD_SMOKE_TYPE_FLOW))
{
- if (scene->r.cfra >= smd->time)
+ if(scene->r.cfra >= smd->time)
smokeModifier_init(smd, ob, scene, dm);
- if (scene->r.cfra > smd->time)
+ if(scene->r.cfra > smd->time)
{
// XXX TODO
smd->time = scene->r.cfra;
@@ -1366,40 +1675,102 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
copy_m4_m4(smd->flow->mat, ob->obmat);
*/
}
- else if (scene->r.cfra < smd->time)
+ else if(scene->r.cfra < smd->time)
{
smd->time = scene->r.cfra;
smokeModifier_reset(smd);
}
}
- else if (smd->type & MOD_SMOKE_TYPE_COLL)
+ else if(smd->type & MOD_SMOKE_TYPE_COLL)
{
- if (scene->r.cfra >= smd->time)
+ /* Check if domain resolution changed */
+ /* DG TODO: can this be solved more elegant using dependancy graph? */
+ {
+ SmokeCollSettings *scs = smd->coll;
+ Base *base = scene->base.first;
+ int changed = 0;
+ float dx = FLT_MAX;
+ int haveDomain = 0;
+
+ for ( ; base; base = base->next)
+ {
+ SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(base->object, eModifierType_Smoke);
+
+ if (smd2 && (smd2->type & MOD_SMOKE_TYPE_DOMAIN) && smd2->domain)
+ {
+ SmokeDomainSettings *sds = smd2->domain;
+
+ if(sds->dx < dx)
+ {
+ dx = sds->dx;
+ changed = 1;
+ }
+
+ haveDomain = 1;
+ }
+ }
+
+ if(!haveDomain)
+ return;
+
+ if(changed)
+ {
+ if(dx != scs->dx)
+ {
+ scs->dx = dx;
+ smokeModifier_reset(smd);
+ }
+ }
+ }
+
+ if(scene->r.cfra >= smd->time)
smokeModifier_init(smd, ob, scene, dm);
- if (scene->r.cfra > smd->time)
+ if(scene->r.cfra > smd->time)
{
- // XXX TODO
+ unsigned int i;
+ SmokeCollSettings *scs = smd->coll;
+ float *points_old = scs->points_old;
+ float *points = scs->points;
+ unsigned int numpoints = scs->numpoints;
+
+ // XXX TODO <-- DG: what is TODO here?
smd->time = scene->r.cfra;
-#ifdef USE_SMOKE_COLLISION_DM
- if (smd->coll->dm)
- smd->coll->dm->release(smd->coll->dm);
+ // rigid movement support
+ copy_m4_m4(scs->mat_old, scs->mat);
+ copy_m4_m4(scs->mat, ob->obmat);
- smd->coll->dm = CDDM_copy_from_tessface(dm);
-#endif
+ if(scs->type != SM_COLL_ANIMATED) // if(not_animated)
+ {
+ // nothing to do, "mat" is already up to date
+ }
+ else
+ {
+ // XXX TODO: need to update positions + divs
- // rigid movement support
- copy_m4_m4(smd->coll->mat_old, smd->coll->mat);
- copy_m4_m4(smd->coll->mat, ob->obmat);
+ if(scs->numverts != dm->getNumVerts(dm))
+ {
+ // DG TODO: reset modifier?
+ return;
+ }
+
+ for(i = 0; i < numpoints * 3; i++)
+ {
+ points_old[i] = points[i];
+ }
+
+ DM_ensure_tessface(dm);
+ fill_scs_points_anim(ob, dm, scs);
+ }
}
- else if (scene->r.cfra < smd->time)
+ else if(scene->r.cfra < smd->time)
{
smd->time = scene->r.cfra;
smokeModifier_reset(smd);
}
}
- else if (smd->type & MOD_SMOKE_TYPE_DOMAIN)
+ else if(smd->type & MOD_SMOKE_TYPE_DOMAIN)
{
SmokeDomainSettings *sds = smd->domain;
float light[3];
@@ -1416,14 +1787,14 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
BKE_ptcache_id_from_smoke(&pid, ob, smd);
BKE_ptcache_id_time(&pid, scene, framenr, &startframe, &endframe, &timescale);
- if (!smd->domain->fluid || framenr == startframe)
+ if(!smd->domain->fluid || framenr == startframe)
{
BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
BKE_ptcache_validate(cache, framenr);
cache->flag &= ~PTCACHE_REDO_NEEDED;
}
- if (!smd->domain->fluid && (framenr != startframe) && (smd->domain->flags & MOD_SMOKE_FILE_LOAD)==0 && (cache->flag & PTCACHE_BAKED)==0)
+ if(!smd->domain->fluid && (framenr != startframe) && (smd->domain->flags & MOD_SMOKE_FILE_LOAD)==0 && (cache->flag & PTCACHE_BAKED)==0)
return;
smd->domain->flags &= ~MOD_SMOKE_FILE_LOAD;
@@ -1436,21 +1807,21 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
// printf("startframe: %d, framenr: %d\n", startframe, framenr);
- if (smokeModifier_init(smd, ob, scene, dm)==0)
+ if(smokeModifier_init(smd, ob, scene, dm)==0)
{
printf("bad smokeModifier_init\n");
return;
}
/* try to read from cache */
- if (BKE_ptcache_read(&pid, (float)framenr) == PTCACHE_READ_EXACT) {
+ if(BKE_ptcache_read(&pid, (float)framenr) == PTCACHE_READ_EXACT) {
BKE_ptcache_validate(cache, framenr);
smd->time = framenr;
return;
}
/* only calculate something when we advanced a single frame */
- if (framenr != (int)smd->time+1)
+ if(framenr != (int)smd->time+1)
return;
/* don't simulate if viewing start frame, but scene frame is not real start frame */
@@ -1462,14 +1833,14 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
smoke_calc_domain(scene, ob, smd);
/* if on second frame, write cache for first frame */
- if ((int)smd->time == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0)) {
+ if((int)smd->time == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0)) {
// create shadows straight after domain initialization so we get nice shadows for startframe, too
- if (get_lamp(scene, light))
+ if(get_lamp(scene, light))
smoke_calc_transparency(sds->shadow, smoke_get_density(sds->fluid), sds->p0, sds->p1, sds->res, sds->dx, light, calc_voxel_transp, -7.0*sds->dx);
- if (sds->wt)
+ if(sds->wt)
{
- if (sds->flags & MOD_SMOKE_DISSOLVE)
+ if(sds->flags & MOD_SMOKE_DISSOLVE)
smoke_dissolve_wavelet(sds->wt, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG);
smoke_turbulence_step(sds->wt, sds->fluid);
}
@@ -1486,30 +1857,31 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
// simulate the actual smoke (c++ code in intern/smoke)
// DG: interesting commenting this line + deactivating loading of noise files
- if (framenr!=startframe)
+ if(framenr!=startframe)
{
- if (sds->flags & MOD_SMOKE_DISSOLVE)
+ if(sds->flags & MOD_SMOKE_DISSOLVE)
smoke_dissolve(sds->fluid, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG);
- smoke_step(sds->fluid, smd->time, scene->r.frs_sec / scene->r.frs_sec_base);
+
+ step(scene, ob, smd, scene->r.frs_sec / scene->r.frs_sec_base);
}
// create shadows before writing cache so they get stored
- if (get_lamp(scene, light))
+ if(get_lamp(scene, light))
smoke_calc_transparency(sds->shadow, smoke_get_density(sds->fluid), sds->p0, sds->p1, sds->res, sds->dx, light, calc_voxel_transp, -7.0*sds->dx);
- if (sds->wt)
+ if(sds->wt)
{
- if (sds->flags & MOD_SMOKE_DISSOLVE)
+ if(sds->flags & MOD_SMOKE_DISSOLVE)
smoke_dissolve_wavelet(sds->wt, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG);
smoke_turbulence_step(sds->wt, sds->fluid);
}
BKE_ptcache_validate(cache, framenr);
- if (framenr != startframe)
+ if(framenr != startframe)
BKE_ptcache_write(&pid, framenr);
tend();
- //printf ( "Frame: %d, Time: %f\n", (int)smd->time, ( float ) tval() );
+ // printf ( "Frame: %d, Time: %f\n\n", (int)smd->time, ( float ) tval() );
}
}
@@ -1520,7 +1892,7 @@ static float calc_voxel_transp(float *result, float *input, int res[3], int *pix
// T_ray *= T_vox
*tRay *= exp(input[index]*correct);
- if (result[index] < 0.0f)
+ if(result[index] < 0.0f)
{
#pragma omp critical
result[index] = *tRay;
@@ -1574,7 +1946,7 @@ static void bresenham_linie_3D(int x1, int y1, int z1, int x2, int y2, int z2, f
err_1 = dy2 - l;
err_2 = dz2 - l;
for (i = 0; i < l; i++) {
- if (cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
+ if(cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
break;
if (err_1 > 0) {
pixel[1] += y_inc;
@@ -1588,12 +1960,12 @@ static void bresenham_linie_3D(int x1, int y1, int z1, int x2, int y2, int z2, f
err_2 += dz2;
pixel[0] += x_inc;
}
- }
+ }
else if ((m >= l) && (m >= n)) {
err_1 = dx2 - m;
err_2 = dz2 - m;
for (i = 0; i < m; i++) {
- if (cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
+ if(cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
break;
if (err_1 > 0) {
pixel[0] += x_inc;
@@ -1607,12 +1979,12 @@ static void bresenham_linie_3D(int x1, int y1, int z1, int x2, int y2, int z2, f
err_2 += dz2;
pixel[1] += y_inc;
}
- }
+ }
else {
err_1 = dy2 - n;
err_2 = dx2 - n;
for (i = 0; i < n; i++) {
- if (cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
+ if(cb(result, input, res, pixel, tRay, correct) <= FLT_EPSILON)
break;
if (err_1 > 0) {
pixel[1] += y_inc;
@@ -1654,7 +2026,7 @@ static void smoke_calc_transparency(float *result, float *input, float *p0, floa
float bv[6];
int a, z, slabsize=res[0]*res[1], size= res[0]*res[1]*res[2];
- for (a=0; a<size; a++)
+ for(a=0; a<size; a++)
result[a]= -1.0f;
bv[0] = p0[0];
@@ -1667,27 +2039,27 @@ static void smoke_calc_transparency(float *result, float *input, float *p0, floa
bv[5] = p1[2];
#pragma omp parallel for schedule(static,1)
- for (z = 0; z < res[2]; z++)
+ for(z = 0; z < res[2]; z++)
{
size_t index = z*slabsize;
int x,y;
- for (y = 0; y < res[1]; y++)
- for (x = 0; x < res[0]; x++, index++)
+ for(y = 0; y < res[1]; y++)
+ for(x = 0; x < res[0]; x++, index++)
{
float voxelCenter[3];
float pos[3];
int cell[3];
float tRay = 1.0;
- if (result[index] >= 0.0f)
+ if(result[index] >= 0.0f)
continue;
voxelCenter[0] = p0[0] + dx * x + dx * 0.5;
voxelCenter[1] = p0[1] + dx * y + dx * 0.5;
voxelCenter[2] = p0[2] + dx * z + dx * 0.5;
// get starting position (in voxel coords)
- if (BLI_bvhtree_bb_raycast(bv, light, voxelCenter, pos) > FLT_EPSILON)
+ if(BLI_bvhtree_bb_raycast(bv, light, voxelCenter, pos) > FLT_EPSILON)
{
// we're ouside
get_cell(p0, res, dx, pos, cell, 1);
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 01930cc28da..c41c8d1f50f 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -78,6 +78,7 @@ variables on the UI for now
#include "BKE_DerivedMesh.h"
#include "BKE_pointcache.h"
#include "BKE_deform.h"
+#include "BKE_mesh.h"
//XXX #include "BIF_editdeform.h"
//XXX #include "BIF_graphics.h"
#include "PIL_time.h"
@@ -89,18 +90,18 @@ static int (*SB_localInterruptCallBack)(void) = NULL;
/* ********** soft body engine ******* */
-typedef enum {SB_EDGE=1,SB_BEND=2,SB_STIFFQUAD=3,SB_HANDLE=4} type_spring;
+typedef enum {SB_EDGE=1, SB_BEND=2, SB_STIFFQUAD=3, SB_HANDLE=4} type_spring;
typedef struct BodySpring {
int v1, v2;
- float len,cf,load;
+ float len, cf, load;
float ext_force[3]; /* edges colliding and sailing */
type_spring springtype;
short flag;
} BodySpring;
typedef struct BodyFace {
- int v1, v2, v3 ,v4;
+ int v1, v2, v3, v4;
float ext_force[3]; /* faces colliding */
short flag;
} BodyFace;
@@ -123,7 +124,7 @@ typedef struct SBScratch {
short flag;
BodyFace *bodyface;
int totface;
- float aabbmin[3],aabbmax[3];
+ float aabbmin[3], aabbmax[3];
ReferenceState Ref;
} SBScratch;
@@ -222,8 +223,8 @@ static float sb_time_scale(Object *ob)
We DO linear interpolation for goals .. and i think we should do on animated properties as well
*/
-/* animate sb->maxgoal,sb->mingoal */
-static float _final_goal(Object *ob,BodyPoint *bp)/*jow_go_for2_5 */
+/* animate sb->maxgoal, sb->mingoal */
+static float _final_goal(Object *ob, BodyPoint *bp)/*jow_go_for2_5 */
{
float f = -1999.99f;
if (ob) {
@@ -236,11 +237,11 @@ static float _final_goal(Object *ob,BodyPoint *bp)/*jow_go_for2_5 */
return (f);
}
}
- printf("_final_goal failed! sb or bp ==NULL\n" );
+ printf("_final_goal failed! sb or bp ==NULL\n");
return f; /*using crude but spot able values some times helps debuggin */
}
-static float _final_mass(Object *ob,BodyPoint *bp)
+static float _final_mass(Object *ob, BodyPoint *bp)
{
if (ob) {
SoftBody *sb= ob->soft; /* is supposed to be there */
@@ -248,7 +249,7 @@ static float _final_mass(Object *ob,BodyPoint *bp)
return(bp->mass*sb->nodemass);
}
}
- printf("_final_mass failed! sb or bp ==NULL\n" );
+ printf("_final_mass failed! sb or bp ==NULL\n");
return 1.0f;
}
/* helper functions for everything is animateble jow_go_for2_5 ------*/
@@ -258,7 +259,7 @@ static float _final_mass(Object *ob,BodyPoint *bp)
/********************
for each target object/face the axis aligned bounding box (AABB) is stored
faces parallel to global axes
-so only simple "value" in [min,max] ckecks are used
+so only simple "value" in [min, max] ckecks are used
float operations still
*/
@@ -294,7 +295,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
ccd_Mesh *pccd_M = NULL;
ccdf_minmax *mima = NULL;
MFace *mface=NULL;
- float v[3],hull;
+ float v[3], hull;
int i;
cmd =(CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
@@ -303,7 +304,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
if (!cmd) return NULL;
if (!cmd->numverts || !cmd->numfaces) return NULL;
- pccd_M = MEM_mallocN(sizeof(ccd_Mesh),"ccd_Mesh");
+ pccd_M = MEM_mallocN(sizeof(ccd_Mesh), "ccd_Mesh");
pccd_M->totvert = cmd->numverts;
pccd_M->totface = cmd->numfaces;
pccd_M->savety = CCD_SAVETY;
@@ -313,7 +314,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
/* blow it up with forcefield ranges */
- hull = MAX2(ob->pd->pdef_sbift,ob->pd->pdef_sboft);
+ hull = MAX2(ob->pd->pdef_sbift, ob->pd->pdef_sboft);
/* alloc and copy verts*/
pccd_M->mvert = MEM_dupallocN(cmd->xnew);
@@ -321,21 +322,21 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
/* determine the ortho BB */
for (i=0; i < pccd_M->totvert; i++) {
/* evaluate limits */
- copy_v3_v3(v,pccd_M->mvert[i].co);
- pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
- pccd_M->bbmin[1] = MIN2(pccd_M->bbmin[1],v[1]-hull);
- pccd_M->bbmin[2] = MIN2(pccd_M->bbmin[2],v[2]-hull);
+ copy_v3_v3(v, pccd_M->mvert[i].co);
+ pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0], v[0]-hull);
+ pccd_M->bbmin[1] = MIN2(pccd_M->bbmin[1], v[1]-hull);
+ pccd_M->bbmin[2] = MIN2(pccd_M->bbmin[2], v[2]-hull);
- pccd_M->bbmax[0] = MAX2(pccd_M->bbmax[0],v[0]+hull);
- pccd_M->bbmax[1] = MAX2(pccd_M->bbmax[1],v[1]+hull);
- pccd_M->bbmax[2] = MAX2(pccd_M->bbmax[2],v[2]+hull);
+ pccd_M->bbmax[0] = MAX2(pccd_M->bbmax[0], v[0]+hull);
+ pccd_M->bbmax[1] = MAX2(pccd_M->bbmax[1], v[1]+hull);
+ pccd_M->bbmax[2] = MAX2(pccd_M->bbmax[2], v[2]+hull);
}
/* alloc and copy faces*/
pccd_M->mface = MEM_dupallocN(cmd->mfaces);
/* OBBs for idea1 */
- pccd_M->mima = MEM_mallocN(sizeof(ccdf_minmax)*pccd_M->totface,"ccd_Mesh_Faces_mima");
+ pccd_M->mima = MEM_mallocN(sizeof(ccdf_minmax)*pccd_M->totface, "ccd_Mesh_Faces_mima");
mima = pccd_M->mima;
mface = pccd_M->mface;
@@ -345,38 +346,38 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
mima->minx=mima->miny=mima->minz=1e30f;
mima->maxx=mima->maxy=mima->maxz=-1e30f;
- copy_v3_v3(v,pccd_M->mvert[mface->v1].co);
- mima->minx = MIN2(mima->minx,v[0]-hull);
- mima->miny = MIN2(mima->miny,v[1]-hull);
- mima->minz = MIN2(mima->minz,v[2]-hull);
- mima->maxx = MAX2(mima->maxx,v[0]+hull);
- mima->maxy = MAX2(mima->maxy,v[1]+hull);
- mima->maxz = MAX2(mima->maxz,v[2]+hull);
-
- copy_v3_v3(v,pccd_M->mvert[mface->v2].co);
- mima->minx = MIN2(mima->minx,v[0]-hull);
- mima->miny = MIN2(mima->miny,v[1]-hull);
- mima->minz = MIN2(mima->minz,v[2]-hull);
- mima->maxx = MAX2(mima->maxx,v[0]+hull);
- mima->maxy = MAX2(mima->maxy,v[1]+hull);
- mima->maxz = MAX2(mima->maxz,v[2]+hull);
-
- copy_v3_v3(v,pccd_M->mvert[mface->v3].co);
- mima->minx = MIN2(mima->minx,v[0]-hull);
- mima->miny = MIN2(mima->miny,v[1]-hull);
- mima->minz = MIN2(mima->minz,v[2]-hull);
- mima->maxx = MAX2(mima->maxx,v[0]+hull);
- mima->maxy = MAX2(mima->maxy,v[1]+hull);
- mima->maxz = MAX2(mima->maxz,v[2]+hull);
+ copy_v3_v3(v, pccd_M->mvert[mface->v1].co);
+ mima->minx = MIN2(mima->minx, v[0]-hull);
+ mima->miny = MIN2(mima->miny, v[1]-hull);
+ mima->minz = MIN2(mima->minz, v[2]-hull);
+ mima->maxx = MAX2(mima->maxx, v[0]+hull);
+ mima->maxy = MAX2(mima->maxy, v[1]+hull);
+ mima->maxz = MAX2(mima->maxz, v[2]+hull);
+
+ copy_v3_v3(v, pccd_M->mvert[mface->v2].co);
+ mima->minx = MIN2(mima->minx, v[0]-hull);
+ mima->miny = MIN2(mima->miny, v[1]-hull);
+ mima->minz = MIN2(mima->minz, v[2]-hull);
+ mima->maxx = MAX2(mima->maxx, v[0]+hull);
+ mima->maxy = MAX2(mima->maxy, v[1]+hull);
+ mima->maxz = MAX2(mima->maxz, v[2]+hull);
+
+ copy_v3_v3(v, pccd_M->mvert[mface->v3].co);
+ mima->minx = MIN2(mima->minx, v[0]-hull);
+ mima->miny = MIN2(mima->miny, v[1]-hull);
+ mima->minz = MIN2(mima->minz, v[2]-hull);
+ mima->maxx = MAX2(mima->maxx, v[0]+hull);
+ mima->maxy = MAX2(mima->maxy, v[1]+hull);
+ mima->maxz = MAX2(mima->maxz, v[2]+hull);
if (mface->v4) {
- copy_v3_v3(v,pccd_M->mvert[mface->v4].co);
- mima->minx = MIN2(mima->minx,v[0]-hull);
- mima->miny = MIN2(mima->miny,v[1]-hull);
- mima->minz = MIN2(mima->minz,v[2]-hull);
- mima->maxx = MAX2(mima->maxx,v[0]+hull);
- mima->maxy = MAX2(mima->maxy,v[1]+hull);
- mima->maxz = MAX2(mima->maxz,v[2]+hull);
+ copy_v3_v3(v, pccd_M->mvert[mface->v4].co);
+ mima->minx = MIN2(mima->minx, v[0]-hull);
+ mima->miny = MIN2(mima->miny, v[1]-hull);
+ mima->minz = MIN2(mima->minz, v[2]-hull);
+ mima->maxx = MAX2(mima->maxx, v[0]+hull);
+ mima->maxy = MAX2(mima->maxy, v[1]+hull);
+ mima->maxz = MAX2(mima->maxz, v[2]+hull);
}
@@ -386,12 +387,12 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
}
return pccd_M;
}
-static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
+static void ccd_mesh_update(Object *ob, ccd_Mesh *pccd_M)
{
CollisionModifierData *cmd;
ccdf_minmax *mima = NULL;
MFace *mface=NULL;
- float v[3],hull;
+ float v[3], hull;
int i;
cmd =(CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
@@ -401,14 +402,17 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
if (!cmd->numverts || !cmd->numfaces) return;
if ((pccd_M->totvert != cmd->numverts) ||
- (pccd_M->totface != cmd->numfaces)) return;
+ (pccd_M->totface != cmd->numfaces))
+ {
+ return;
+ }
pccd_M->bbmin[0]=pccd_M->bbmin[1]=pccd_M->bbmin[2]=1e30f;
pccd_M->bbmax[0]=pccd_M->bbmax[1]=pccd_M->bbmax[2]=-1e30f;
/* blow it up with forcefield ranges */
- hull = MAX2(ob->pd->pdef_sbift,ob->pd->pdef_sboft);
+ hull = MAX2(ob->pd->pdef_sbift, ob->pd->pdef_sboft);
/* rotate current to previous */
if (pccd_M->mprevvert) MEM_freeN(pccd_M->mprevvert);
@@ -419,24 +423,24 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
/* determine the ortho BB */
for (i=0; i < pccd_M->totvert; i++) {
/* evaluate limits */
- copy_v3_v3(v,pccd_M->mvert[i].co);
- pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
- pccd_M->bbmin[1] = MIN2(pccd_M->bbmin[1],v[1]-hull);
- pccd_M->bbmin[2] = MIN2(pccd_M->bbmin[2],v[2]-hull);
+ copy_v3_v3(v, pccd_M->mvert[i].co);
+ pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0], v[0]-hull);
+ pccd_M->bbmin[1] = MIN2(pccd_M->bbmin[1], v[1]-hull);
+ pccd_M->bbmin[2] = MIN2(pccd_M->bbmin[2], v[2]-hull);
- pccd_M->bbmax[0] = MAX2(pccd_M->bbmax[0],v[0]+hull);
- pccd_M->bbmax[1] = MAX2(pccd_M->bbmax[1],v[1]+hull);
- pccd_M->bbmax[2] = MAX2(pccd_M->bbmax[2],v[2]+hull);
+ pccd_M->bbmax[0] = MAX2(pccd_M->bbmax[0], v[0]+hull);
+ pccd_M->bbmax[1] = MAX2(pccd_M->bbmax[1], v[1]+hull);
+ pccd_M->bbmax[2] = MAX2(pccd_M->bbmax[2], v[2]+hull);
/* evaluate limits */
- copy_v3_v3(v,pccd_M->mprevvert[i].co);
- pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
- pccd_M->bbmin[1] = MIN2(pccd_M->bbmin[1],v[1]-hull);
- pccd_M->bbmin[2] = MIN2(pccd_M->bbmin[2],v[2]-hull);
+ copy_v3_v3(v, pccd_M->mprevvert[i].co);
+ pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0], v[0]-hull);
+ pccd_M->bbmin[1] = MIN2(pccd_M->bbmin[1], v[1]-hull);
+ pccd_M->bbmin[2] = MIN2(pccd_M->bbmin[2], v[2]-hull);
- pccd_M->bbmax[0] = MAX2(pccd_M->bbmax[0],v[0]+hull);
- pccd_M->bbmax[1] = MAX2(pccd_M->bbmax[1],v[1]+hull);
- pccd_M->bbmax[2] = MAX2(pccd_M->bbmax[2],v[2]+hull);
+ pccd_M->bbmax[0] = MAX2(pccd_M->bbmax[0], v[0]+hull);
+ pccd_M->bbmax[1] = MAX2(pccd_M->bbmax[1], v[1]+hull);
+ pccd_M->bbmax[2] = MAX2(pccd_M->bbmax[2], v[2]+hull);
}
@@ -449,73 +453,73 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
mima->minx=mima->miny=mima->minz=1e30f;
mima->maxx=mima->maxy=mima->maxz=-1e30f;
- copy_v3_v3(v,pccd_M->mvert[mface->v1].co);
- mima->minx = MIN2(mima->minx,v[0]-hull);
- mima->miny = MIN2(mima->miny,v[1]-hull);
- mima->minz = MIN2(mima->minz,v[2]-hull);
- mima->maxx = MAX2(mima->maxx,v[0]+hull);
- mima->maxy = MAX2(mima->maxy,v[1]+hull);
- mima->maxz = MAX2(mima->maxz,v[2]+hull);
-
- copy_v3_v3(v,pccd_M->mvert[mface->v2].co);
- mima->minx = MIN2(mima->minx,v[0]-hull);
- mima->miny = MIN2(mima->miny,v[1]-hull);
- mima->minz = MIN2(mima->minz,v[2]-hull);
- mima->maxx = MAX2(mima->maxx,v[0]+hull);
- mima->maxy = MAX2(mima->maxy,v[1]+hull);
- mima->maxz = MAX2(mima->maxz,v[2]+hull);
-
- copy_v3_v3(v,pccd_M->mvert[mface->v3].co);
- mima->minx = MIN2(mima->minx,v[0]-hull);
- mima->miny = MIN2(mima->miny,v[1]-hull);
- mima->minz = MIN2(mima->minz,v[2]-hull);
- mima->maxx = MAX2(mima->maxx,v[0]+hull);
- mima->maxy = MAX2(mima->maxy,v[1]+hull);
- mima->maxz = MAX2(mima->maxz,v[2]+hull);
+ copy_v3_v3(v, pccd_M->mvert[mface->v1].co);
+ mima->minx = MIN2(mima->minx, v[0]-hull);
+ mima->miny = MIN2(mima->miny, v[1]-hull);
+ mima->minz = MIN2(mima->minz, v[2]-hull);
+ mima->maxx = MAX2(mima->maxx, v[0]+hull);
+ mima->maxy = MAX2(mima->maxy, v[1]+hull);
+ mima->maxz = MAX2(mima->maxz, v[2]+hull);
+
+ copy_v3_v3(v, pccd_M->mvert[mface->v2].co);
+ mima->minx = MIN2(mima->minx, v[0]-hull);
+ mima->miny = MIN2(mima->miny, v[1]-hull);
+ mima->minz = MIN2(mima->minz, v[2]-hull);
+ mima->maxx = MAX2(mima->maxx, v[0]+hull);
+ mima->maxy = MAX2(mima->maxy, v[1]+hull);
+ mima->maxz = MAX2(mima->maxz, v[2]+hull);
+
+ copy_v3_v3(v, pccd_M->mvert[mface->v3].co);
+ mima->minx = MIN2(mima->minx, v[0]-hull);
+ mima->miny = MIN2(mima->miny, v[1]-hull);
+ mima->minz = MIN2(mima->minz, v[2]-hull);
+ mima->maxx = MAX2(mima->maxx, v[0]+hull);
+ mima->maxy = MAX2(mima->maxy, v[1]+hull);
+ mima->maxz = MAX2(mima->maxz, v[2]+hull);
if (mface->v4) {
- copy_v3_v3(v,pccd_M->mvert[mface->v4].co);
- mima->minx = MIN2(mima->minx,v[0]-hull);
- mima->miny = MIN2(mima->miny,v[1]-hull);
- mima->minz = MIN2(mima->minz,v[2]-hull);
- mima->maxx = MAX2(mima->maxx,v[0]+hull);
- mima->maxy = MAX2(mima->maxy,v[1]+hull);
- mima->maxz = MAX2(mima->maxz,v[2]+hull);
+ copy_v3_v3(v, pccd_M->mvert[mface->v4].co);
+ mima->minx = MIN2(mima->minx, v[0]-hull);
+ mima->miny = MIN2(mima->miny, v[1]-hull);
+ mima->minz = MIN2(mima->minz, v[2]-hull);
+ mima->maxx = MAX2(mima->maxx, v[0]+hull);
+ mima->maxy = MAX2(mima->maxy, v[1]+hull);
+ mima->maxz = MAX2(mima->maxz, v[2]+hull);
}
- copy_v3_v3(v,pccd_M->mprevvert[mface->v1].co);
- mima->minx = MIN2(mima->minx,v[0]-hull);
- mima->miny = MIN2(mima->miny,v[1]-hull);
- mima->minz = MIN2(mima->minz,v[2]-hull);
- mima->maxx = MAX2(mima->maxx,v[0]+hull);
- mima->maxy = MAX2(mima->maxy,v[1]+hull);
- mima->maxz = MAX2(mima->maxz,v[2]+hull);
-
- copy_v3_v3(v,pccd_M->mprevvert[mface->v2].co);
- mima->minx = MIN2(mima->minx,v[0]-hull);
- mima->miny = MIN2(mima->miny,v[1]-hull);
- mima->minz = MIN2(mima->minz,v[2]-hull);
- mima->maxx = MAX2(mima->maxx,v[0]+hull);
- mima->maxy = MAX2(mima->maxy,v[1]+hull);
- mima->maxz = MAX2(mima->maxz,v[2]+hull);
-
- copy_v3_v3(v,pccd_M->mprevvert[mface->v3].co);
- mima->minx = MIN2(mima->minx,v[0]-hull);
- mima->miny = MIN2(mima->miny,v[1]-hull);
- mima->minz = MIN2(mima->minz,v[2]-hull);
- mima->maxx = MAX2(mima->maxx,v[0]+hull);
- mima->maxy = MAX2(mima->maxy,v[1]+hull);
- mima->maxz = MAX2(mima->maxz,v[2]+hull);
+ copy_v3_v3(v, pccd_M->mprevvert[mface->v1].co);
+ mima->minx = MIN2(mima->minx, v[0]-hull);
+ mima->miny = MIN2(mima->miny, v[1]-hull);
+ mima->minz = MIN2(mima->minz, v[2]-hull);
+ mima->maxx = MAX2(mima->maxx, v[0]+hull);
+ mima->maxy = MAX2(mima->maxy, v[1]+hull);
+ mima->maxz = MAX2(mima->maxz, v[2]+hull);
+
+ copy_v3_v3(v, pccd_M->mprevvert[mface->v2].co);
+ mima->minx = MIN2(mima->minx, v[0]-hull);
+ mima->miny = MIN2(mima->miny, v[1]-hull);
+ mima->minz = MIN2(mima->minz, v[2]-hull);
+ mima->maxx = MAX2(mima->maxx, v[0]+hull);
+ mima->maxy = MAX2(mima->maxy, v[1]+hull);
+ mima->maxz = MAX2(mima->maxz, v[2]+hull);
+
+ copy_v3_v3(v, pccd_M->mprevvert[mface->v3].co);
+ mima->minx = MIN2(mima->minx, v[0]-hull);
+ mima->miny = MIN2(mima->miny, v[1]-hull);
+ mima->minz = MIN2(mima->minz, v[2]-hull);
+ mima->maxx = MAX2(mima->maxx, v[0]+hull);
+ mima->maxy = MAX2(mima->maxy, v[1]+hull);
+ mima->maxz = MAX2(mima->maxz, v[2]+hull);
if (mface->v4) {
- copy_v3_v3(v,pccd_M->mprevvert[mface->v4].co);
- mima->minx = MIN2(mima->minx,v[0]-hull);
- mima->miny = MIN2(mima->miny,v[1]-hull);
- mima->minz = MIN2(mima->minz,v[2]-hull);
- mima->maxx = MAX2(mima->maxx,v[0]+hull);
- mima->maxy = MAX2(mima->maxy,v[1]+hull);
- mima->maxz = MAX2(mima->maxz,v[2]+hull);
+ copy_v3_v3(v, pccd_M->mprevvert[mface->v4].co);
+ mima->minx = MIN2(mima->minx, v[0]-hull);
+ mima->miny = MIN2(mima->miny, v[1]-hull);
+ mima->minz = MIN2(mima->minz, v[2]-hull);
+ mima->maxx = MAX2(mima->maxx, v[0]+hull);
+ mima->maxy = MAX2(mima->maxy, v[1]+hull);
+ mima->maxz = MAX2(mima->maxz, v[2]+hull);
}
@@ -583,9 +587,9 @@ static void ccd_update_deflector_hash(Scene *scene, Object *vertexowner, GHash *
/*+++ only with deflecting set */
if (ob->pd && ob->pd->deflect) {
- ccd_Mesh *ccdmesh = BLI_ghash_lookup(hash,ob);
+ ccd_Mesh *ccdmesh = BLI_ghash_lookup(hash, ob);
if (ccdmesh)
- ccd_mesh_update(ob,ccdmesh);
+ ccd_mesh_update(ob, ccdmesh);
}/*--- only with deflecting set */
}/* mesh && layer*/
@@ -601,7 +605,7 @@ static void ccd_update_deflector_hash(Scene *scene, Object *vertexowner, GHash *
static int count_mesh_quads(Mesh *me)
{
- int a,result = 0;
+ int a, result = 0;
MFace *mface= me->mface;
if (mface) {
@@ -627,8 +631,8 @@ static void add_mesh_quad_diag_springs(Object *ob)
nofquads = count_mesh_quads(me);
if (nofquads) {
/* resize spring-array to hold additional quad springs */
- bs_new= MEM_callocN( (ob->soft->totspring + nofquads *2 )*sizeof(BodySpring), "bodyspring");
- memcpy(bs_new,ob->soft->bspring,(ob->soft->totspring )*sizeof(BodySpring));
+ bs_new= MEM_callocN((ob->soft->totspring + nofquads *2 )*sizeof(BodySpring), "bodyspring");
+ memcpy(bs_new, ob->soft->bspring, (ob->soft->totspring )*sizeof(BodySpring));
if (ob->soft->bspring)
MEM_freeN(ob->soft->bspring); /* do this before reassigning the pointer or have a 1st class memory leak */
@@ -660,13 +664,13 @@ static void add_mesh_quad_diag_springs(Object *ob)
}
}
-static void add_2nd_order_roller(Object *ob,float UNUSED(stiffness), int *counter, int addsprings)
+static void add_2nd_order_roller(Object *ob, float UNUSED(stiffness), int *counter, int addsprings)
{
/*assume we have a softbody*/
SoftBody *sb= ob->soft; /* is supposed to be there */
- BodyPoint *bp,*bpo;
- BodySpring *bs,*bs2,*bs3= NULL;
- int a,b,c,notthis= 0,v0;
+ BodyPoint *bp, *bpo;
+ BodySpring *bs, *bs2, *bs3= NULL;
+ int a, b, c, notthis= 0, v0;
if (!sb->bspring) {return;} /* we are 2nd order here so 1rst should have been build :) */
/* first run counting second run adding */
*counter = 0;
@@ -722,40 +726,40 @@ static void add_2nd_order_roller(Object *ob,float UNUSED(stiffness), int *counte
}
-static void add_2nd_order_springs(Object *ob,float stiffness)
+static void add_2nd_order_springs(Object *ob, float stiffness)
{
int counter = 0;
BodySpring *bs_new;
stiffness *=stiffness;
- add_2nd_order_roller(ob,stiffness,&counter,0); /* counting */
+ add_2nd_order_roller(ob, stiffness, &counter, 0); /* counting */
if (counter) {
/* resize spring-array to hold additional springs */
- bs_new= MEM_callocN( (ob->soft->totspring + counter )*sizeof(BodySpring), "bodyspring");
- memcpy(bs_new,ob->soft->bspring,(ob->soft->totspring )*sizeof(BodySpring));
+ bs_new= MEM_callocN((ob->soft->totspring + counter )*sizeof(BodySpring), "bodyspring");
+ memcpy(bs_new, ob->soft->bspring, (ob->soft->totspring )*sizeof(BodySpring));
if (ob->soft->bspring)
MEM_freeN(ob->soft->bspring);
ob->soft->bspring = bs_new;
- add_2nd_order_roller(ob,stiffness,&counter,1); /* adding */
+ add_2nd_order_roller(ob, stiffness, &counter, 1); /* adding */
ob->soft->totspring += counter;
}
}
-static void add_bp_springlist(BodyPoint *bp,int springID)
+static void add_bp_springlist(BodyPoint *bp, int springID)
{
int *newlist;
if (bp->springs == NULL) {
- bp->springs = MEM_callocN( sizeof(int), "bpsprings");
+ bp->springs = MEM_callocN(sizeof(int), "bpsprings");
bp->springs[0] = springID;
bp->nofsprings = 1;
}
else {
bp->nofsprings++;
newlist = MEM_callocN(bp->nofsprings * sizeof(int), "bpsprings");
- memcpy(newlist,bp->springs,(bp->nofsprings-1)* sizeof(int));
+ memcpy(newlist, bp->springs, (bp->nofsprings-1)* sizeof(int));
MEM_freeN(bp->springs);
bp->springs = newlist;
bp->springs[bp->nofsprings-1] = springID;
@@ -770,7 +774,7 @@ static void build_bps_springlist(Object *ob)
SoftBody *sb= ob->soft; /* is supposed to be there */
BodyPoint *bp;
BodySpring *bs;
- int a,b;
+ int a, b;
if (sb==NULL) return; /* paranoya check */
@@ -783,10 +787,10 @@ static void build_bps_springlist(Object *ob)
/* scan for attached inner springs */
for (b=sb->totspring, bs= sb->bspring; b>0; b--, bs++) {
if (( (sb->totpoint-a) == bs->v1) ) {
- add_bp_springlist(bp,sb->totspring -b);
+ add_bp_springlist(bp, sb->totspring -b);
}
if (( (sb->totpoint-a) == bs->v2) ) {
- add_bp_springlist(bp,sb->totspring -b);
+ add_bp_springlist(bp, sb->totspring -b);
}
}/*for springs*/
}/*for bp*/
@@ -797,8 +801,8 @@ static void calculate_collision_balls(Object *ob)
SoftBody *sb= ob->soft; /* is supposed to be there */
BodyPoint *bp;
BodySpring *bs;
- int a,b,akku_count;
- float min,max,akku;
+ int a, b, akku_count;
+ float min, max, akku;
if (sb==NULL) return; /* paranoya check */
@@ -814,8 +818,8 @@ static void calculate_collision_balls(Object *ob)
if (bs->springtype == SB_EDGE) {
akku += bs->len;
akku_count++,
- min = MIN2(bs->len,min);
- max = MAX2(bs->len,max);
+ min = MIN2(bs->len, min);
+ max = MAX2(bs->len, max);
}
}
@@ -856,9 +860,9 @@ static void renew_softbody(Scene *scene, Object *ob, int totpoint, int totspring
sb->totpoint= totpoint;
sb->totspring= totspring;
- sb->bpoint= MEM_mallocN( totpoint*sizeof(BodyPoint), "bodypoint");
+ sb->bpoint= MEM_mallocN(totpoint*sizeof(BodyPoint), "bodypoint");
if (totspring)
- sb->bspring= MEM_mallocN( totspring*sizeof(BodySpring), "bodyspring");
+ sb->bspring= MEM_mallocN(totspring*sizeof(BodySpring), "bodyspring");
/* initialize BodyPoint array */
for (i=0; i<totpoint; i++) {
@@ -1011,21 +1015,21 @@ static int query_external_colliders(Scene *scene, Object *me)
/* +++ the aabb "force" section*/
-static int sb_detect_aabb_collisionCached( float UNUSED(force[3]), unsigned int UNUSED(par_layer),struct Object *vertexowner,float UNUSED(time))
+static int sb_detect_aabb_collisionCached(float UNUSED(force[3]), unsigned int UNUSED(par_layer), struct Object *vertexowner, float UNUSED(time))
{
Object *ob;
SoftBody *sb=vertexowner->soft;
GHash *hash;
GHashIterator *ihash;
- float aabbmin[3],aabbmax[3];
+ float aabbmin[3], aabbmax[3];
int deflected=0;
#if 0
int a;
#endif
if ((sb == NULL) || (sb->scratch ==NULL)) return 0;
- copy_v3_v3(aabbmin,sb->scratch->aabbmin);
- copy_v3_v3(aabbmax,sb->scratch->aabbmax);
+ copy_v3_v3(aabbmin, sb->scratch->aabbmin);
+ copy_v3_v3(aabbmax, sb->scratch->aabbmax);
hash = vertexowner->soft->scratch->colliderhash;
ihash = BLI_ghashIterator_new(hash);
@@ -1081,22 +1085,22 @@ static int sb_detect_aabb_collisionCached( float UNUSED(force[3]), unsigned int
/* +++ the face external section*/
-static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float face_v3[3],float *damp,
- float force[3], unsigned int UNUSED(par_layer),struct Object *vertexowner,float time)
- {
+static int sb_detect_face_pointCached(float face_v1[3], float face_v2[3], float face_v3[3], float *damp,
+ float force[3], unsigned int UNUSED(par_layer), struct Object *vertexowner, float time)
+{
Object *ob;
GHash *hash;
GHashIterator *ihash;
- float nv1[3], edge1[3], edge2[3], d_nvect[3], aabbmin[3],aabbmax[3];
- float facedist,outerfacethickness,tune = 10.f;
+ float nv1[3], edge1[3], edge2[3], d_nvect[3], aabbmin[3], aabbmax[3];
+ float facedist, outerfacethickness, tune = 10.f;
int a, deflected=0;
- aabbmin[0] = MIN3(face_v1[0],face_v2[0],face_v3[0]);
- aabbmin[1] = MIN3(face_v1[1],face_v2[1],face_v3[1]);
- aabbmin[2] = MIN3(face_v1[2],face_v2[2],face_v3[2]);
- aabbmax[0] = MAX3(face_v1[0],face_v2[0],face_v3[0]);
- aabbmax[1] = MAX3(face_v1[1],face_v2[1],face_v3[1]);
- aabbmax[2] = MAX3(face_v1[2],face_v2[2],face_v3[2]);
+ aabbmin[0] = MIN3(face_v1[0], face_v2[0], face_v3[0]);
+ aabbmin[1] = MIN3(face_v1[1], face_v2[1], face_v3[1]);
+ aabbmin[2] = MIN3(face_v1[2], face_v2[2], face_v3[2]);
+ aabbmax[0] = MAX3(face_v1[0], face_v2[0], face_v3[0]);
+ aabbmax[1] = MAX3(face_v1[1], face_v2[1], face_v3[1]);
+ aabbmax[2] = MAX3(face_v1[2], face_v2[2], face_v3[2]);
/* calculate face normal once again SIGH */
sub_v3_v3v3(edge1, face_v1, face_v2);
@@ -1143,16 +1147,16 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa
/* use mesh*/
if (mvert) {
while (a) {
- copy_v3_v3(nv1,mvert[a-1].co);
+ copy_v3_v3(nv1, mvert[a-1].co);
if (mprevvert) {
- mul_v3_fl(nv1,time);
- Vec3PlusStVec(nv1,(1.0f-time),mprevvert[a-1].co);
+ mul_v3_fl(nv1, time);
+ Vec3PlusStVec(nv1, (1.0f-time), mprevvert[a-1].co);
}
/* origin to face_v2*/
sub_v3_v3(nv1, face_v2);
- facedist = dot_v3v3(nv1,d_nvect);
+ facedist = dot_v3v3(nv1, d_nvect);
if (ABS(facedist)<outerfacethickness) {
- if (isect_point_tri_prism_v3(nv1, face_v1,face_v2,face_v3) ) {
+ if (isect_point_tri_prism_v3(nv1, face_v1, face_v2, face_v3) ) {
float df;
if (facedist > 0) {
df = (outerfacethickness-facedist)/outerfacethickness;
@@ -1164,7 +1168,7 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa
*damp=df*tune*ob->pd->pdef_sbdamp;
df = 0.01f*exp(- 100.0f*df);
- Vec3PlusStVec(force,-df,d_nvect);
+ Vec3PlusStVec(force, -df, d_nvect);
deflected = 3;
}
}
@@ -1179,22 +1183,22 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa
}
-static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],float face_v3[3],float *damp,
- float force[3], unsigned int UNUSED(par_layer),struct Object *vertexowner,float time)
+static int sb_detect_face_collisionCached(float face_v1[3], float face_v2[3], float face_v3[3], float *damp,
+ float force[3], unsigned int UNUSED(par_layer), struct Object *vertexowner, float time)
{
Object *ob;
GHash *hash;
GHashIterator *ihash;
- float nv1[3], nv2[3], nv3[3], nv4[3], edge1[3], edge2[3], d_nvect[3], aabbmin[3],aabbmax[3];
- float t,tune = 10.0f;
+ float nv1[3], nv2[3], nv3[3], nv4[3], edge1[3], edge2[3], d_nvect[3], aabbmin[3], aabbmax[3];
+ float t, tune = 10.0f;
int a, deflected=0;
- aabbmin[0] = MIN3(face_v1[0],face_v2[0],face_v3[0]);
- aabbmin[1] = MIN3(face_v1[1],face_v2[1],face_v3[1]);
- aabbmin[2] = MIN3(face_v1[2],face_v2[2],face_v3[2]);
- aabbmax[0] = MAX3(face_v1[0],face_v2[0],face_v3[0]);
- aabbmax[1] = MAX3(face_v1[1],face_v2[1],face_v3[1]);
- aabbmax[2] = MAX3(face_v1[2],face_v2[2],face_v3[2]);
+ aabbmin[0] = MIN3(face_v1[0], face_v2[0], face_v3[0]);
+ aabbmin[1] = MIN3(face_v1[1], face_v2[1], face_v3[1]);
+ aabbmin[2] = MIN3(face_v1[2], face_v2[2], face_v3[2]);
+ aabbmax[0] = MAX3(face_v1[0], face_v2[0], face_v3[0]);
+ aabbmax[1] = MAX3(face_v1[1], face_v2[1], face_v3[1]);
+ aabbmax[2] = MAX3(face_v1[2], face_v2[2], face_v3[2]);
hash = vertexowner->soft->scratch->colliderhash;
ihash = BLI_ghashIterator_new(hash);
@@ -1253,25 +1257,25 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
if (mvert) {
- copy_v3_v3(nv1,mvert[mface->v1].co);
- copy_v3_v3(nv2,mvert[mface->v2].co);
- copy_v3_v3(nv3,mvert[mface->v3].co);
+ copy_v3_v3(nv1, mvert[mface->v1].co);
+ copy_v3_v3(nv2, mvert[mface->v2].co);
+ copy_v3_v3(nv3, mvert[mface->v3].co);
if (mface->v4) {
- copy_v3_v3(nv4,mvert[mface->v4].co);
+ copy_v3_v3(nv4, mvert[mface->v4].co);
}
if (mprevvert) {
- mul_v3_fl(nv1,time);
- Vec3PlusStVec(nv1,(1.0f-time),mprevvert[mface->v1].co);
+ mul_v3_fl(nv1, time);
+ Vec3PlusStVec(nv1, (1.0f-time), mprevvert[mface->v1].co);
- mul_v3_fl(nv2,time);
- Vec3PlusStVec(nv2,(1.0f-time),mprevvert[mface->v2].co);
+ mul_v3_fl(nv2, time);
+ Vec3PlusStVec(nv2, (1.0f-time), mprevvert[mface->v2].co);
- mul_v3_fl(nv3,time);
- Vec3PlusStVec(nv3,(1.0f-time),mprevvert[mface->v3].co);
+ mul_v3_fl(nv3, time);
+ Vec3PlusStVec(nv3, (1.0f-time), mprevvert[mface->v3].co);
if (mface->v4) {
- mul_v3_fl(nv4,time);
- Vec3PlusStVec(nv4,(1.0f-time),mprevvert[mface->v4].co);
+ mul_v3_fl(nv4, time);
+ Vec3PlusStVec(nv4, (1.0f-time), mprevvert[mface->v4].co);
}
}
}
@@ -1285,7 +1289,7 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
isect_line_tri_v3(nv1, nv2, face_v1, face_v2, face_v3, &t, NULL) ||
isect_line_tri_v3(nv2, nv3, face_v1, face_v2, face_v3, &t, NULL) ||
isect_line_tri_v3(nv3, nv1, face_v1, face_v2, face_v3, &t, NULL) ) {
- Vec3PlusStVec(force,-0.5f,d_nvect);
+ Vec3PlusStVec(force, -0.5f, d_nvect);
*damp=tune*ob->pd->pdef_sbdamp;
deflected = 2;
}
@@ -1300,7 +1304,7 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
we did that edge already */
isect_line_tri_v3(nv3, nv4, face_v1, face_v2, face_v3, &t, NULL) ||
isect_line_tri_v3(nv4, nv1, face_v1, face_v2, face_v3, &t, NULL) ) {
- Vec3PlusStVec(force,-0.5f,d_nvect);
+ Vec3PlusStVec(force, -0.5f, d_nvect);
*damp=tune*ob->pd->pdef_sbdamp;
deflected = 2;
}
@@ -1317,12 +1321,12 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
-static void scan_for_ext_face_forces(Object *ob,float timenow)
+static void scan_for_ext_face_forces(Object *ob, float timenow)
{
SoftBody *sb = ob->soft;
BodyFace *bf;
int a;
- float damp=0.0f,choke=1.0f;
+ float damp=0.0f, choke=1.0f;
float tune = -10.0f;
float feedback[3];
@@ -1335,25 +1339,25 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
/*+++edges intruding*/
bf->flag &= ~BFF_INTERSECT;
feedback[0]=feedback[1]=feedback[2]=0.0f;
- if (sb_detect_face_collisionCached(sb->bpoint[bf->v1].pos,sb->bpoint[bf->v2].pos, sb->bpoint[bf->v3].pos,
- &damp, feedback, ob->lay ,ob , timenow)) {
- Vec3PlusStVec(sb->bpoint[bf->v1].force,tune,feedback);
- Vec3PlusStVec(sb->bpoint[bf->v2].force,tune,feedback);
- Vec3PlusStVec(sb->bpoint[bf->v3].force,tune,feedback);
-// Vec3PlusStVec(bf->ext_force,tune,feedback);
+ if (sb_detect_face_collisionCached(sb->bpoint[bf->v1].pos, sb->bpoint[bf->v2].pos, sb->bpoint[bf->v3].pos,
+ &damp, feedback, ob->lay, ob, timenow)) {
+ Vec3PlusStVec(sb->bpoint[bf->v1].force, tune, feedback);
+ Vec3PlusStVec(sb->bpoint[bf->v2].force, tune, feedback);
+ Vec3PlusStVec(sb->bpoint[bf->v3].force, tune, feedback);
+// Vec3PlusStVec(bf->ext_force, tune, feedback);
bf->flag |= BFF_INTERSECT;
- choke = MIN2(MAX2(damp,choke),1.0f);
+ choke = MIN2(MAX2(damp, choke), 1.0f);
}
feedback[0]=feedback[1]=feedback[2]=0.0f;
- if ((bf->v4) && (sb_detect_face_collisionCached(sb->bpoint[bf->v1].pos,sb->bpoint[bf->v3].pos, sb->bpoint[bf->v4].pos,
- &damp, feedback, ob->lay ,ob , timenow))) {
- Vec3PlusStVec(sb->bpoint[bf->v1].force,tune,feedback);
- Vec3PlusStVec(sb->bpoint[bf->v3].force,tune,feedback);
- Vec3PlusStVec(sb->bpoint[bf->v4].force,tune,feedback);
-// Vec3PlusStVec(bf->ext_force,tune,feedback);
+ if ((bf->v4) && (sb_detect_face_collisionCached(sb->bpoint[bf->v1].pos, sb->bpoint[bf->v3].pos, sb->bpoint[bf->v4].pos,
+ &damp, feedback, ob->lay, ob, timenow))) {
+ Vec3PlusStVec(sb->bpoint[bf->v1].force, tune, feedback);
+ Vec3PlusStVec(sb->bpoint[bf->v3].force, tune, feedback);
+ Vec3PlusStVec(sb->bpoint[bf->v4].force, tune, feedback);
+// Vec3PlusStVec(bf->ext_force, tune, feedback);
bf->flag |= BFF_INTERSECT;
- choke = MIN2(MAX2(damp,choke),1.0f);
+ choke = MIN2(MAX2(damp, choke), 1.0f);
}
/*---edges intruding*/
@@ -1362,38 +1366,37 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
bf->flag &= ~BFF_CLOSEVERT;
tune = -1.0f;
feedback[0]=feedback[1]=feedback[2]=0.0f;
- if (sb_detect_face_pointCached(sb->bpoint[bf->v1].pos,sb->bpoint[bf->v2].pos, sb->bpoint[bf->v3].pos,
- &damp, feedback, ob->lay ,ob , timenow)) {
- Vec3PlusStVec(sb->bpoint[bf->v1].force,tune,feedback);
- Vec3PlusStVec(sb->bpoint[bf->v2].force,tune,feedback);
- Vec3PlusStVec(sb->bpoint[bf->v3].force,tune,feedback);
-// Vec3PlusStVec(bf->ext_force,tune,feedback);
+ if (sb_detect_face_pointCached(sb->bpoint[bf->v1].pos, sb->bpoint[bf->v2].pos, sb->bpoint[bf->v3].pos,
+ &damp, feedback, ob->lay, ob, timenow)) {
+ Vec3PlusStVec(sb->bpoint[bf->v1].force, tune, feedback);
+ Vec3PlusStVec(sb->bpoint[bf->v2].force, tune, feedback);
+ Vec3PlusStVec(sb->bpoint[bf->v3].force, tune, feedback);
+// Vec3PlusStVec(bf->ext_force, tune, feedback);
bf->flag |= BFF_CLOSEVERT;
- choke = MIN2(MAX2(damp,choke),1.0f);
+ choke = MIN2(MAX2(damp, choke), 1.0f);
}
feedback[0]=feedback[1]=feedback[2]=0.0f;
- if ((bf->v4) && (sb_detect_face_pointCached(sb->bpoint[bf->v1].pos,sb->bpoint[bf->v3].pos, sb->bpoint[bf->v4].pos,
- &damp, feedback, ob->lay ,ob , timenow))) {
- Vec3PlusStVec(sb->bpoint[bf->v1].force,tune,feedback);
- Vec3PlusStVec(sb->bpoint[bf->v3].force,tune,feedback);
- Vec3PlusStVec(sb->bpoint[bf->v4].force,tune,feedback);
-// Vec3PlusStVec(bf->ext_force,tune,feedback);
+ if ((bf->v4) && (sb_detect_face_pointCached(sb->bpoint[bf->v1].pos, sb->bpoint[bf->v3].pos, sb->bpoint[bf->v4].pos,
+ &damp, feedback, ob->lay, ob, timenow))) {
+ Vec3PlusStVec(sb->bpoint[bf->v1].force, tune, feedback);
+ Vec3PlusStVec(sb->bpoint[bf->v3].force, tune, feedback);
+ Vec3PlusStVec(sb->bpoint[bf->v4].force, tune, feedback);
+// Vec3PlusStVec(bf->ext_force, tune, feedback);
bf->flag |= BFF_CLOSEVERT;
- choke = MIN2(MAX2(damp,choke),1.0f);
+ choke = MIN2(MAX2(damp, choke), 1.0f);
}
}
/*--- close vertices*/
}
bf = sb->scratch->bodyface;
for (a=0; a<sb->scratch->totface; a++, bf++) {
- if (( bf->flag & BFF_INTERSECT) || ( bf->flag & BFF_CLOSEVERT))
- {
- sb->bpoint[bf->v1].choke2=MAX2(sb->bpoint[bf->v1].choke2,choke);
- sb->bpoint[bf->v2].choke2=MAX2(sb->bpoint[bf->v2].choke2,choke);
- sb->bpoint[bf->v3].choke2=MAX2(sb->bpoint[bf->v3].choke2,choke);
+ if (( bf->flag & BFF_INTERSECT) || ( bf->flag & BFF_CLOSEVERT)) {
+ sb->bpoint[bf->v1].choke2=MAX2(sb->bpoint[bf->v1].choke2, choke);
+ sb->bpoint[bf->v2].choke2=MAX2(sb->bpoint[bf->v2].choke2, choke);
+ sb->bpoint[bf->v3].choke2=MAX2(sb->bpoint[bf->v3].choke2, choke);
if (bf->v4) {
- sb->bpoint[bf->v2].choke2=MAX2(sb->bpoint[bf->v2].choke2,choke);
+ sb->bpoint[bf->v2].choke2=MAX2(sb->bpoint[bf->v2].choke2, choke);
}
}
}
@@ -1405,24 +1408,24 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
/* +++ the spring external section*/
-static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],float *damp,
- float force[3], unsigned int UNUSED(par_layer),struct Object *vertexowner,float time)
+static int sb_detect_edge_collisionCached(float edge_v1[3], float edge_v2[3], float *damp,
+ float force[3], unsigned int UNUSED(par_layer), struct Object *vertexowner, float time)
{
Object *ob;
GHash *hash;
GHashIterator *ihash;
- float nv1[3], nv2[3], nv3[3], nv4[3], edge1[3], edge2[3], d_nvect[3], aabbmin[3],aabbmax[3];
- float t,el;
+ float nv1[3], nv2[3], nv3[3], nv4[3], edge1[3], edge2[3], d_nvect[3], aabbmin[3], aabbmax[3];
+ float t, el;
int a, deflected=0;
- aabbmin[0] = MIN2(edge_v1[0],edge_v2[0]);
- aabbmin[1] = MIN2(edge_v1[1],edge_v2[1]);
- aabbmin[2] = MIN2(edge_v1[2],edge_v2[2]);
- aabbmax[0] = MAX2(edge_v1[0],edge_v2[0]);
- aabbmax[1] = MAX2(edge_v1[1],edge_v2[1]);
- aabbmax[2] = MAX2(edge_v1[2],edge_v2[2]);
+ aabbmin[0] = MIN2(edge_v1[0], edge_v2[0]);
+ aabbmin[1] = MIN2(edge_v1[1], edge_v2[1]);
+ aabbmin[2] = MIN2(edge_v1[2], edge_v2[2]);
+ aabbmax[0] = MAX2(edge_v1[0], edge_v2[0]);
+ aabbmax[1] = MAX2(edge_v1[1], edge_v2[1]);
+ aabbmax[2] = MAX2(edge_v1[2], edge_v2[2]);
- el = len_v3v3(edge_v1,edge_v2);
+ el = len_v3v3(edge_v1, edge_v2);
hash = vertexowner->soft->scratch->colliderhash;
ihash = BLI_ghashIterator_new(hash);
@@ -1481,25 +1484,25 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
if (mvert) {
- copy_v3_v3(nv1,mvert[mface->v1].co);
- copy_v3_v3(nv2,mvert[mface->v2].co);
- copy_v3_v3(nv3,mvert[mface->v3].co);
+ copy_v3_v3(nv1, mvert[mface->v1].co);
+ copy_v3_v3(nv2, mvert[mface->v2].co);
+ copy_v3_v3(nv3, mvert[mface->v3].co);
if (mface->v4) {
- copy_v3_v3(nv4,mvert[mface->v4].co);
+ copy_v3_v3(nv4, mvert[mface->v4].co);
}
if (mprevvert) {
- mul_v3_fl(nv1,time);
- Vec3PlusStVec(nv1,(1.0f-time),mprevvert[mface->v1].co);
+ mul_v3_fl(nv1, time);
+ Vec3PlusStVec(nv1, (1.0f-time), mprevvert[mface->v1].co);
- mul_v3_fl(nv2,time);
- Vec3PlusStVec(nv2,(1.0f-time),mprevvert[mface->v2].co);
+ mul_v3_fl(nv2, time);
+ Vec3PlusStVec(nv2, (1.0f-time), mprevvert[mface->v2].co);
- mul_v3_fl(nv3,time);
- Vec3PlusStVec(nv3,(1.0f-time),mprevvert[mface->v3].co);
+ mul_v3_fl(nv3, time);
+ Vec3PlusStVec(nv3, (1.0f-time), mprevvert[mface->v3].co);
if (mface->v4) {
- mul_v3_fl(nv4,time);
- Vec3PlusStVec(nv4,(1.0f-time),mprevvert[mface->v4].co);
+ mul_v3_fl(nv4, time);
+ Vec3PlusStVec(nv4, (1.0f-time), mprevvert[mface->v4].co);
}
}
}
@@ -1511,14 +1514,14 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
cross_v3_v3v3(d_nvect, edge2, edge1);
normalize_v3(d_nvect);
if ( isect_line_tri_v3(edge_v1, edge_v2, nv1, nv2, nv3, &t, NULL)) {
- float v1[3],v2[3];
- float intrusiondepth,i1,i2;
+ float v1[3], v2[3];
+ float intrusiondepth, i1, i2;
sub_v3_v3v3(v1, edge_v1, nv2);
sub_v3_v3v3(v2, edge_v2, nv2);
- i1 = dot_v3v3(v1,d_nvect);
- i2 = dot_v3v3(v2,d_nvect);
- intrusiondepth = -MIN2(i1,i2)/el;
- Vec3PlusStVec(force,intrusiondepth,d_nvect);
+ i1 = dot_v3v3(v1, d_nvect);
+ i2 = dot_v3v3(v2, d_nvect);
+ intrusiondepth = -MIN2(i1, i2)/el;
+ Vec3PlusStVec(force, intrusiondepth, d_nvect);
*damp=ob->pd->pdef_sbdamp;
deflected = 2;
}
@@ -1529,17 +1532,17 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
cross_v3_v3v3(d_nvect, edge2, edge1);
normalize_v3(d_nvect);
- if (isect_line_tri_v3( edge_v1, edge_v2,nv1, nv3, nv4, &t, NULL)) {
- float v1[3],v2[3];
- float intrusiondepth,i1,i2;
+ if (isect_line_tri_v3( edge_v1, edge_v2, nv1, nv3, nv4, &t, NULL)) {
+ float v1[3], v2[3];
+ float intrusiondepth, i1, i2;
sub_v3_v3v3(v1, edge_v1, nv4);
sub_v3_v3v3(v2, edge_v2, nv4);
- i1 = dot_v3v3(v1,d_nvect);
- i2 = dot_v3v3(v2,d_nvect);
- intrusiondepth = -MIN2(i1,i2)/el;
+ i1 = dot_v3v3(v1, d_nvect);
+ i2 = dot_v3v3(v2, d_nvect);
+ intrusiondepth = -MIN2(i1, i2)/el;
- Vec3PlusStVec(force,intrusiondepth,d_nvect);
+ Vec3PlusStVec(force, intrusiondepth, d_nvect);
*damp=ob->pd->pdef_sbdamp;
deflected = 2;
}
@@ -1571,8 +1574,8 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow,
if (bs->springtype == SB_EDGE) {
/* +++ springs colliding */
if (ob->softflag & OB_SB_EDGECOLL) {
- if ( sb_detect_edge_collisionCached (sb->bpoint[bs->v1].pos , sb->bpoint[bs->v2].pos,
- &damp,feedback,ob->lay,ob,timenow)) {
+ if ( sb_detect_edge_collisionCached (sb->bpoint[bs->v1].pos, sb->bpoint[bs->v2].pos,
+ &damp, feedback, ob->lay, ob, timenow)) {
add_v3_v3(bs->ext_force, feedback);
bs->flag |= BSF_INTERSECT;
//bs->cf=damp;
@@ -1585,40 +1588,40 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow,
/* +++ springs seeing wind ... n stuff depending on their orientation*/
/* note we don't use sb->mediafrict but use sb->aeroedge for magnitude of effect*/
if (sb->aeroedge) {
- float vel[3],sp[3],pr[3],force[3];
- float f,windfactor = 0.25f;
+ float vel[3], sp[3], pr[3], force[3];
+ float f, windfactor = 0.25f;
/*see if we have wind*/
if (do_effector) {
EffectedPoint epoint;
- float speed[3]={0.0f,0.0f,0.0f};
+ float speed[3]={0.0f, 0.0f, 0.0f};
float pos[3];
- mid_v3_v3v3(pos, sb->bpoint[bs->v1].pos , sb->bpoint[bs->v2].pos);
- mid_v3_v3v3(vel, sb->bpoint[bs->v1].vec , sb->bpoint[bs->v2].vec);
+ mid_v3_v3v3(pos, sb->bpoint[bs->v1].pos, sb->bpoint[bs->v2].pos);
+ mid_v3_v3v3(vel, sb->bpoint[bs->v1].vec, sb->bpoint[bs->v2].vec);
pd_point_from_soft(scene, pos, vel, -1, &epoint);
pdDoEffectors(do_effector, NULL, sb->effector_weights, &epoint, force, speed);
- mul_v3_fl(speed,windfactor);
+ mul_v3_fl(speed, windfactor);
add_v3_v3(vel, speed);
}
/* media in rest */
else {
- add_v3_v3v3(vel, sb->bpoint[bs->v1].vec , sb->bpoint[bs->v2].vec);
+ add_v3_v3v3(vel, sb->bpoint[bs->v1].vec, sb->bpoint[bs->v2].vec);
}
f = normalize_v3(vel);
f = -0.0001f*f*f*sb->aeroedge;
/* (todo) add a nice angle dependent function done for now BUT */
/* still there could be some nice drag/lift function, but who needs it */
- sub_v3_v3v3(sp, sb->bpoint[bs->v1].pos , sb->bpoint[bs->v2].pos);
- project_v3_v3v3(pr,vel,sp);
+ sub_v3_v3v3(sp, sb->bpoint[bs->v1].pos, sb->bpoint[bs->v2].pos);
+ project_v3_v3v3(pr, vel, sp);
sub_v3_v3(vel, pr);
normalize_v3(vel);
if (ob->softflag & OB_SB_AERO_ANGLE) {
normalize_v3(sp);
- Vec3PlusStVec(bs->ext_force,f*(1.0f-ABS(dot_v3v3(vel,sp))),vel);
+ Vec3PlusStVec(bs->ext_force, f*(1.0f-ABS(dot_v3v3(vel, sp))), vel);
}
else {
- Vec3PlusStVec(bs->ext_force,f,vel); // to keep compatible with 2.45 release files
+ Vec3PlusStVec(bs->ext_force, f, vel); // to keep compatible with 2.45 release files
}
}
/* --- springs seeing wind */
@@ -1645,12 +1648,12 @@ static void *exec_scan_for_ext_spring_forces(void *data)
return NULL;
}
-static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,int totsprings,int *UNUSED(ptr_to_break_func(void)))
+static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow, int totsprings, int *UNUSED(ptr_to_break_func(void)))
{
ListBase *do_effector = NULL;
ListBase threads;
SB_thread_context *sb_threads;
- int i, totthread,left,dec;
+ int i, totthread, left, dec;
int lowsprings =100; /* wild guess .. may increase with better thread management 'above' or even be UI option sb->spawn_cf_threads_nopts */
do_effector= pdInitEffectors(scene, ob, NULL, ob->soft->effector_weights);
@@ -1707,27 +1710,27 @@ static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,
/* --- the spring external section*/
-static int choose_winner(float*w, float* pos,float*a,float*b,float*c,float*ca,float*cb,float*cc)
+static int choose_winner(float*w, float* pos, float*a, float*b, float*c, float*ca, float*cb, float*cc)
{
- float mindist,cp;
+ float mindist, cp;
int winner =1;
- mindist = ABS(dot_v3v3(pos,a));
+ mindist = ABS(dot_v3v3(pos, a));
- cp = ABS(dot_v3v3(pos,b));
+ cp = ABS(dot_v3v3(pos, b));
if ( mindist < cp ) {
mindist = cp;
winner =2;
}
- cp = ABS(dot_v3v3(pos,c));
+ cp = ABS(dot_v3v3(pos, c));
if (mindist < cp ) {
mindist = cp;
winner =3;
}
switch (winner) {
- case 1: copy_v3_v3(w,ca); break;
- case 2: copy_v3_v3(w,cb); break;
- case 3: copy_v3_v3(w,cc);
+ case 1: copy_v3_v3(w, ca); break;
+ case 2: copy_v3_v3(w, cb); break;
+ case 3: copy_v3_v3(w, cc);
}
return(winner);
}
@@ -1736,12 +1739,12 @@ static int choose_winner(float*w, float* pos,float*a,float*b,float*c,float*ca,fl
static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3], float *damp,
float force[3], unsigned int UNUSED(par_layer), struct Object *vertexowner,
- float time,float vel[3], float *intrusion)
+ float time, float vel[3], float *intrusion)
{
Object *ob= NULL;
GHash *hash;
GHashIterator *ihash;
- float nv1[3], nv2[3], nv3[3], nv4[3], edge1[3], edge2[3],d_nvect[3], dv1[3],ve[3],avel[3]={0.0,0.0,0.0},
+ float nv1[3], nv2[3], nv3[3], nv4[3], edge1[3], edge2[3], d_nvect[3], dv1[3], ve[3], avel[3]={0.0, 0.0, 0.0},
vv1[3], vv2[3], vv3[3], vv4[3], coledge[3]={0.0f, 0.0f, 0.0f}, mindistedge = 1000.0f,
outerforceaccu[3], innerforceaccu[3],
facedist, /* n_mag, */ /* UNUSED */ force_mag_norm, minx, miny, minz, maxx, maxy, maxz,
@@ -1824,11 +1827,11 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
if (mvert) {
- copy_v3_v3(nv1,mvert[mface->v1].co);
- copy_v3_v3(nv2,mvert[mface->v2].co);
- copy_v3_v3(nv3,mvert[mface->v3].co);
+ copy_v3_v3(nv1, mvert[mface->v1].co);
+ copy_v3_v3(nv2, mvert[mface->v2].co);
+ copy_v3_v3(nv3, mvert[mface->v3].co);
if (mface->v4) {
- copy_v3_v3(nv4,mvert[mface->v4].co);
+ copy_v3_v3(nv4, mvert[mface->v4].co);
}
if (mprevvert) {
@@ -1838,25 +1841,25 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
since the AABB reduced propabitlty to get here drasticallly
it might be a nice tradeof CPU <--> memory
*/
- sub_v3_v3v3(vv1,nv1,mprevvert[mface->v1].co);
- sub_v3_v3v3(vv2,nv2,mprevvert[mface->v2].co);
- sub_v3_v3v3(vv3,nv3,mprevvert[mface->v3].co);
+ sub_v3_v3v3(vv1, nv1, mprevvert[mface->v1].co);
+ sub_v3_v3v3(vv2, nv2, mprevvert[mface->v2].co);
+ sub_v3_v3v3(vv3, nv3, mprevvert[mface->v3].co);
if (mface->v4) {
- sub_v3_v3v3(vv4,nv4,mprevvert[mface->v4].co);
+ sub_v3_v3v3(vv4, nv4, mprevvert[mface->v4].co);
}
- mul_v3_fl(nv1,time);
- Vec3PlusStVec(nv1,(1.0f-time),mprevvert[mface->v1].co);
+ mul_v3_fl(nv1, time);
+ Vec3PlusStVec(nv1, (1.0f-time), mprevvert[mface->v1].co);
- mul_v3_fl(nv2,time);
- Vec3PlusStVec(nv2,(1.0f-time),mprevvert[mface->v2].co);
+ mul_v3_fl(nv2, time);
+ Vec3PlusStVec(nv2, (1.0f-time), mprevvert[mface->v2].co);
- mul_v3_fl(nv3,time);
- Vec3PlusStVec(nv3,(1.0f-time),mprevvert[mface->v3].co);
+ mul_v3_fl(nv3, time);
+ Vec3PlusStVec(nv3, (1.0f-time), mprevvert[mface->v3].co);
if (mface->v4) {
- mul_v3_fl(nv4,time);
- Vec3PlusStVec(nv4,(1.0f-time),mprevvert[mface->v4].co);
+ mul_v3_fl(nv4, time);
+ Vec3PlusStVec(nv4, (1.0f-time), mprevvert[mface->v4].co);
}
}
}
@@ -1864,11 +1867,11 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
/* switch origin to be nv2*/
sub_v3_v3v3(edge1, nv1, nv2);
sub_v3_v3v3(edge2, nv3, nv2);
- sub_v3_v3v3(dv1,opco,nv2); /* abuse dv1 to have vertex in question at *origin* of triangle */
+ sub_v3_v3v3(dv1, opco, nv2); /* abuse dv1 to have vertex in question at *origin* of triangle */
cross_v3_v3v3(d_nvect, edge2, edge1);
/* n_mag = */ /* UNUSED */ normalize_v3(d_nvect);
- facedist = dot_v3v3(dv1,d_nvect);
+ facedist = dot_v3v3(dv1, d_nvect);
// so rules are
//
@@ -1880,16 +1883,16 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
*damp=ob->pd->pdef_sbdamp;
if (facedist > 0.0f) {
*damp *= (1.0f - facedist/outerfacethickness);
- Vec3PlusStVec(outerforceaccu,force_mag_norm,d_nvect);
+ Vec3PlusStVec(outerforceaccu, force_mag_norm, d_nvect);
deflected = 3;
}
else {
- Vec3PlusStVec(innerforceaccu,force_mag_norm,d_nvect);
+ Vec3PlusStVec(innerforceaccu, force_mag_norm, d_nvect);
if (deflected < 2) deflected = 2;
}
if ((mprevvert) && (*damp > 0.0f)) {
- choose_winner(ve,opco,nv1,nv2,nv3,vv1,vv2,vv3);
+ choose_winner(ve, opco, nv1, nv2, nv3, vv1, vv2, vv3);
add_v3_v3(avel, ve);
cavel ++;
}
@@ -1901,11 +1904,11 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
/* switch origin to be nv4 */
sub_v3_v3v3(edge1, nv3, nv4);
sub_v3_v3v3(edge2, nv1, nv4);
- sub_v3_v3v3(dv1,opco,nv4); /* abuse dv1 to have vertex in question at *origin* of triangle */
+ sub_v3_v3v3(dv1, opco, nv4); /* abuse dv1 to have vertex in question at *origin* of triangle */
cross_v3_v3v3(d_nvect, edge2, edge1);
/* n_mag = */ /* UNUSED */ normalize_v3(d_nvect);
- facedist = dot_v3v3(dv1,d_nvect);
+ facedist = dot_v3v3(dv1, d_nvect);
if ((facedist > innerfacethickness) && (facedist < outerfacethickness)) {
if (isect_point_tri_prism_v3(opco, nv1, nv3, nv4) ) {
@@ -1915,17 +1918,17 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
*damp=ob->pd->pdef_sbdamp;
if (facedist > 0.0f) {
*damp *= (1.0f - facedist/outerfacethickness);
- Vec3PlusStVec(outerforceaccu,force_mag_norm,d_nvect);
+ Vec3PlusStVec(outerforceaccu, force_mag_norm, d_nvect);
deflected = 3;
}
else {
- Vec3PlusStVec(innerforceaccu,force_mag_norm,d_nvect);
+ Vec3PlusStVec(innerforceaccu, force_mag_norm, d_nvect);
if (deflected < 2) deflected = 2;
}
if ((mprevvert) && (*damp > 0.0f)) {
- choose_winner(ve,opco,nv1,nv3,nv4,vv1,vv3,vv4);
+ choose_winner(ve, opco, nv1, nv3, nv4, vv1, vv3, vv4);
add_v3_v3(avel, ve);
cavel ++;
}
@@ -1934,51 +1937,51 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
}
}
- if ((deflected < 2)&& (G.rt != 444)) // we did not hit a face until now
- { // see if 'outer' hits an edge
+ if ((deflected < 2)&& (G.rt != 444)) { /* we did not hit a face until now */
+ /* see if 'outer' hits an edge */
float dist;
closest_to_line_segment_v3(ve, opco, nv1, nv2);
- sub_v3_v3v3(ve,opco,ve);
+ sub_v3_v3v3(ve, opco, ve);
dist = normalize_v3(ve);
if ((dist < outerfacethickness)&&(dist < mindistedge )) {
- copy_v3_v3(coledge,ve);
+ copy_v3_v3(coledge, ve);
mindistedge = dist,
deflected=1;
}
closest_to_line_segment_v3(ve, opco, nv2, nv3);
- sub_v3_v3v3(ve,opco,ve);
+ sub_v3_v3v3(ve, opco, ve);
dist = normalize_v3(ve);
if ((dist < outerfacethickness)&&(dist < mindistedge )) {
- copy_v3_v3(coledge,ve);
+ copy_v3_v3(coledge, ve);
mindistedge = dist,
deflected=1;
}
closest_to_line_segment_v3(ve, opco, nv3, nv1);
- sub_v3_v3v3(ve,opco,ve);
+ sub_v3_v3v3(ve, opco, ve);
dist = normalize_v3(ve);
if ((dist < outerfacethickness)&&(dist < mindistedge )) {
- copy_v3_v3(coledge,ve);
+ copy_v3_v3(coledge, ve);
mindistedge = dist,
deflected=1;
}
if (mface->v4) { /* quad */
closest_to_line_segment_v3(ve, opco, nv3, nv4);
- sub_v3_v3v3(ve,opco,ve);
+ sub_v3_v3v3(ve, opco, ve);
dist = normalize_v3(ve);
if ((dist < outerfacethickness)&&(dist < mindistedge )) {
- copy_v3_v3(coledge,ve);
+ copy_v3_v3(coledge, ve);
mindistedge = dist,
deflected=1;
}
closest_to_line_segment_v3(ve, opco, nv1, nv4);
- sub_v3_v3v3(ve,opco,ve);
+ sub_v3_v3v3(ve, opco, ve);
dist = normalize_v3(ve);
if ((dist < outerfacethickness)&&(dist < mindistedge )) {
- copy_v3_v3(coledge,ve);
+ copy_v3_v3(coledge, ve);
mindistedge = dist,
deflected=1;
}
@@ -1999,7 +2002,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
force_mag_norm =(float)exp(-ee*mindistedge);
if (mindistedge > outerfacethickness*ff)
force_mag_norm =(float)force_mag_norm*fa*(mindistedge - outerfacethickness)*(mindistedge - outerfacethickness);
- Vec3PlusStVec(force,force_mag_norm,coledge);
+ Vec3PlusStVec(force, force_mag_norm, coledge);
*damp=ob->pd->pdef_sbdamp;
if (mindistedge > 0.0f) {
*damp *= (1.0f - mindistedge/outerfacethickness);
@@ -2014,8 +2017,8 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
}
BLI_ghashIterator_free(ihash);
- if (cavel) mul_v3_fl(avel,1.0f/(float)cavel);
- copy_v3_v3(vel,avel);
+ if (cavel) mul_v3_fl(avel, 1.0f/(float)cavel);
+ copy_v3_v3(vel, avel);
if (ci) *intrusion /= ci;
if (deflected) {
normalize_v3_v3(facenormal, force);
@@ -2025,34 +2028,34 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
/* sandbox to plug in various deflection algos */
-static int sb_deflect_face(Object *ob,float *actpos,float *facenormal,float *force,float *cf,float time,float *vel,float *intrusion)
+static int sb_deflect_face(Object *ob, float *actpos, float *facenormal, float *force, float *cf, float time, float *vel, float *intrusion)
{
float s_actpos[3];
int deflected;
- copy_v3_v3(s_actpos,actpos);
- deflected= sb_detect_vertex_collisionCached(s_actpos, facenormal, cf, force , ob->lay, ob,time,vel,intrusion);
- //deflected= sb_detect_vertex_collisionCachedEx(s_actpos, facenormal, cf, force , ob->lay, ob,time,vel,intrusion);
+ copy_v3_v3(s_actpos, actpos);
+ deflected= sb_detect_vertex_collisionCached(s_actpos, facenormal, cf, force, ob->lay, ob, time, vel, intrusion);
+ //deflected= sb_detect_vertex_collisionCachedEx(s_actpos, facenormal, cf, force, ob->lay, ob, time, vel, intrusion);
return(deflected);
}
/* hiding this for now .. but the jacobian may pop up on other tasks .. so i'd like to keep it
-static void dfdx_spring(int ia, int ic, int op, float dir[3],float L,float len,float factor)
+static void dfdx_spring(int ia, int ic, int op, float dir[3], float L, float len, float factor)
{
- float m,delta_ij;
- int i ,j;
+ float m, delta_ij;
+ int i, j;
if (L < len) {
for (i=0;i<3;i++)
for (j=0;j<3;j++) {
delta_ij = (i==j ? (1.0f): (0.0f));
m=factor*(dir[i]*dir[j] + (1-L/len)*(delta_ij - dir[i]*dir[j]));
- nlMatrixAdd(ia+i,op+ic+j,m);
+ nlMatrixAdd(ia+i, op+ic+j, m);
}
}
else {
for (i=0;i<3;i++)
for (j=0;j<3;j++) {
m=factor*dir[i]*dir[j];
- nlMatrixAdd(ia+i,op+ic+j,m);
+ nlMatrixAdd(ia+i, op+ic+j, m);
}
}
}
@@ -2061,24 +2064,24 @@ static void dfdx_spring(int ia, int ic, int op, float dir[3],float L,float len,f
static void dfdx_goal(int ia, int ic, int op, float factor)
{
int i;
- for (i=0;i<3;i++) nlMatrixAdd(ia+i,op+ic+i,factor);
+ for (i=0;i<3;i++) nlMatrixAdd(ia+i, op+ic+i, factor);
}
-static void dfdv_goal(int ia, int ic,float factor)
+static void dfdv_goal(int ia, int ic, float factor)
{
int i;
- for (i=0;i<3;i++) nlMatrixAdd(ia+i,ic+i,factor);
+ for (i=0;i<3;i++) nlMatrixAdd(ia+i, ic+i, factor);
}
*/
-static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UNUSED(forcetime), int nl_flags)
+static void sb_spring_force(Object *ob, int bpi, BodySpring *bs, float iks, float UNUSED(forcetime), int nl_flags)
{
SoftBody *sb= ob->soft; /* is supposed to be there */
- BodyPoint *bp1,*bp2;
+ BodyPoint *bp1, *bp2;
- float dir[3],dvel[3];
- float distance,forcefactor,kd,absvel,projvel,kw;
+ float dir[3], dvel[3];
+ float distance, forcefactor, kd, absvel, projvel, kw;
#if 0 /* UNUSED */
- int ia,ic;
+ int ia, ic;
#endif
/* prepare depending on which side of the spring we are on */
if (bpi == bs->v1) {
@@ -2105,7 +2108,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
}
/* do bp1 <--> bp2 elastic */
- sub_v3_v3v3(dir,bp1->pos,bp2->pos);
+ sub_v3_v3v3(dir, bp1->pos, bp2->pos);
distance = normalize_v3(dir);
if (bs->len < distance)
iks = 1.0f/(1.0f-sb->inspring)-1.0f ;/* inner spring constants function */
@@ -2135,15 +2138,15 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
}
- Vec3PlusStVec(bp1->force,(bs->len - distance)*forcefactor,dir);
+ Vec3PlusStVec(bp1->force, (bs->len - distance)*forcefactor, dir);
/* do bp1 <--> bp2 viscous */
- sub_v3_v3v3(dvel,bp1->vec,bp2->vec);
+ sub_v3_v3v3(dvel, bp1->vec, bp2->vec);
kd = sb->infrict * sb_fric_force_scale(ob);
absvel = normalize_v3(dvel);
- projvel = dot_v3v3(dir,dvel);
+ projvel = dot_v3v3(dir, dvel);
kd *= absvel * projvel;
- Vec3PlusStVec(bp1->force,-kd,dir);
+ Vec3PlusStVec(bp1->force, -kd, dir);
/* do jacobian stuff if needed */
if (nl_flags & NLF_BUILD) {
@@ -2151,14 +2154,14 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
//float mvel = -forcetime*kd;
//float mpos = -forcetime*forcefactor;
/* depending on my pos */
- // dfdx_spring(ia,ia,op,dir,bs->len,distance,-mpos);
+ // dfdx_spring(ia, ia, op, dir, bs->len, distance, -mpos);
/* depending on my vel */
- // dfdv_goal(ia,ia,mvel); // well that ignores geometie
+ // dfdv_goal(ia, ia, mvel); // well that ignores geometie
if (bp2->goal < SOFTGOALSNAP) { /* ommit this bp when it snaps */
/* depending on other pos */
- // dfdx_spring(ia,ic,op,dir,bs->len,distance,mpos);
+ // dfdx_spring(ia, ic, op, dir, bs->len, distance, mpos);
/* depending on other vel */
- // dfdv_goal(ia,ia,-mvel); // well that ignores geometie
+ // dfdv_goal(ia, ia, -mvel); // well that ignores geometie
}
}
}
@@ -2167,10 +2170,10 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
/* since this is definitely the most CPU consuming task here .. try to spread it */
/* core function _softbody_calc_forces_slice_in_a_thread */
/* result is int to be able to flag user break */
-static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, float forcetime, float timenow,int ifirst,int ilast,int *UNUSED(ptr_to_break_func(void)),ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor)
+static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, float forcetime, float timenow, int ifirst, int ilast, int *UNUSED(ptr_to_break_func(void)), ListBase *do_effector, int do_deflector, float fieldfactor, float windfactor)
{
float iks;
- int bb,do_selfcollision,do_springcollision,do_aero;
+ int bb, do_selfcollision, do_springcollision, do_aero;
int number_of_points_here = ilast - ifirst;
SoftBody *sb= ob->soft; /* is supposed to be there */
BodyPoint *bp;
@@ -2207,8 +2210,8 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
int attached;
BodyPoint *obp;
BodySpring *bs;
- int c,b;
- float velcenter[3],dvel[3],def[3];
+ int c, b;
+ float velcenter[3], dvel[3], def[3];
float distance;
float compare;
float bstune = sb->ballstiff;
@@ -2233,42 +2236,42 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
float f = bstune / (distance) + bstune / (compare * compare) * distance - 2.0f * bstune / compare;
mid_v3_v3v3(velcenter, bp->vec, obp->vec);
- sub_v3_v3v3(dvel,velcenter,bp->vec);
- mul_v3_fl(dvel,_final_mass(ob,bp));
+ sub_v3_v3v3(dvel, velcenter, bp->vec);
+ mul_v3_fl(dvel, _final_mass(ob, bp));
- Vec3PlusStVec(bp->force,f*(1.0f-sb->balldamp),def);
- Vec3PlusStVec(bp->force,sb->balldamp,dvel);
+ Vec3PlusStVec(bp->force, f*(1.0f-sb->balldamp), def);
+ Vec3PlusStVec(bp->force, sb->balldamp, dvel);
- /* exploit force(a,b) == -force(b,a) part2/2 */
- sub_v3_v3v3(dvel,velcenter,obp->vec);
- mul_v3_fl(dvel,_final_mass(ob,bp));
+ /* exploit force(a, b) == -force(b, a) part2/2 */
+ sub_v3_v3v3(dvel, velcenter, obp->vec);
+ mul_v3_fl(dvel, _final_mass(ob, bp));
- Vec3PlusStVec(obp->force,sb->balldamp,dvel);
- Vec3PlusStVec(obp->force,-f*(1.0f-sb->balldamp),def);
+ Vec3PlusStVec(obp->force, sb->balldamp, dvel);
+ Vec3PlusStVec(obp->force, -f*(1.0f-sb->balldamp), def);
}
}
}
}
/* naive ball self collision done */
- if (_final_goal(ob,bp) < SOFTGOALSNAP) { /* ommit this bp when it snaps */
+ if (_final_goal(ob, bp) < SOFTGOALSNAP) { /* ommit this bp when it snaps */
float auxvect[3];
float velgoal[3];
/* do goal stuff */
if (ob->softflag & OB_SB_GOAL) {
/* true elastic goal */
- float ks,kd;
- sub_v3_v3v3(auxvect,bp->pos,bp->origT);
+ float ks, kd;
+ sub_v3_v3v3(auxvect, bp->pos, bp->origT);
ks = 1.0f / (1.0f - _final_goal(ob, bp) * sb->goalspring) - 1.0f;
bp->force[0]+= -ks*(auxvect[0]);
bp->force[1]+= -ks*(auxvect[1]);
bp->force[2]+= -ks*(auxvect[2]);
/* calulate damping forces generated by goals*/
- sub_v3_v3v3(velgoal,bp->origS, bp->origE);
+ sub_v3_v3v3(velgoal, bp->origS, bp->origE);
kd = sb->goalfrict * sb_fric_force_scale(ob);
- add_v3_v3v3(auxvect,velgoal,bp->vec);
+ add_v3_v3v3(auxvect, velgoal, bp->vec);
if (forcetime > 0.0f) { /* make sure friction does not become rocket motor on time reversal */
bp->force[0]-= kd * (auxvect[0]);
@@ -2287,7 +2290,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
if (sb && scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
float gravity[3];
copy_v3_v3(gravity, scene->physics_settings.gravity);
- mul_v3_fl(gravity, sb_grav_force_scale(ob)*_final_mass(ob,bp)*sb->effector_weights->global_gravity); /* individual mass of node here */
+ mul_v3_fl(gravity, sb_grav_force_scale(ob)*_final_mass(ob, bp)*sb->effector_weights->global_gravity); /* individual mass of node here */
add_v3_v3(bp->force, gravity);
}
@@ -2302,7 +2305,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
pdDoEffectors(do_effector, NULL, sb->effector_weights, &epoint, force, speed);
/* apply forcefield*/
- mul_v3_fl(force,fieldfactor* eval_sb_fric_force_scale);
+ mul_v3_fl(force, fieldfactor* eval_sb_fric_force_scale);
add_v3_v3(bp->force, force);
/* BP friction in moving media */
@@ -2327,20 +2330,20 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
bp->choke2 = 0.0f;
bp->loc_flag &= ~SBF_DOFUZZY;
if (do_deflector && !(bp->loc_flag & SBF_OUTOFCOLLISION) ) {
- float cfforce[3],defforce[3] ={0.0f,0.0f,0.0f}, vel[3] = {0.0f,0.0f,0.0f}, facenormal[3], cf = 1.0f,intrusion;
+ float cfforce[3], defforce[3] ={0.0f, 0.0f, 0.0f}, vel[3] = {0.0f, 0.0f, 0.0f}, facenormal[3], cf = 1.0f, intrusion;
float kd = 1.0f;
- if (sb_deflect_face(ob,bp->pos,facenormal,defforce,&cf,timenow,vel,&intrusion)) {
+ if (sb_deflect_face(ob, bp->pos, facenormal, defforce, &cf, timenow, vel, &intrusion)) {
if (intrusion < 0.0f) {
sb->scratch->flag |= SBF_DOFUZZY;
bp->loc_flag |= SBF_DOFUZZY;
bp->choke = sb->choke*0.01f;
}
- sub_v3_v3v3(cfforce,bp->vec,vel);
- Vec3PlusStVec(bp->force,-cf*50.0f,cfforce);
+ sub_v3_v3v3(cfforce, bp->vec, vel);
+ Vec3PlusStVec(bp->force, -cf*50.0f, cfforce);
- Vec3PlusStVec(bp->force,kd,defforce);
+ Vec3PlusStVec(bp->force, kd, defforce);
}
}
@@ -2360,8 +2363,8 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
bp->choke = bs->cf;
}
- // sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float forcetime,int nl_flags)
- sb_spring_force(ob,ilast-bb,bs,iks,forcetime,0);
+ // sb_spring_force(Object *ob, int bpi, BodySpring *bs, float iks, float forcetime, int nl_flags)
+ sb_spring_force(ob, ilast-bb, bs, iks, forcetime, 0);
}/* loop springs */
}/* existing spring list */
}/*any edges*/
@@ -2374,15 +2377,15 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
static void *exec_softbody_calc_forces(void *data)
{
SB_thread_context *pctx = (SB_thread_context*)data;
- _softbody_calc_forces_slice_in_a_thread(pctx->scene, pctx->ob, pctx->forcetime, pctx->timenow, pctx->ifirst, pctx->ilast, NULL, pctx->do_effector,pctx->do_deflector,pctx->fieldfactor,pctx->windfactor);
+ _softbody_calc_forces_slice_in_a_thread(pctx->scene, pctx->ob, pctx->forcetime, pctx->timenow, pctx->ifirst, pctx->ilast, NULL, pctx->do_effector, pctx->do_deflector, pctx->fieldfactor, pctx->windfactor);
return NULL;
}
-static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float timenow,int totpoint,int *UNUSED(ptr_to_break_func(void)),struct ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor)
+static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float timenow, int totpoint, int *UNUSED(ptr_to_break_func(void)), struct ListBase *do_effector, int do_deflector, float fieldfactor, float windfactor)
{
ListBase threads;
SB_thread_context *sb_threads;
- int i, totthread,left,dec;
+ int i, totthread, left, dec;
int lowpoints =100; /* wild guess .. may increase with better thread management 'above' or even be UI option sb->spawn_cf_threads_nopts */
/* figure the number of threads while preventing pretty pointless threading overhead */
@@ -2395,7 +2398,7 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t
totthread--;
}
- /* printf("sb_cf_threads_run spawning %d threads\n",totthread); */
+ /* printf("sb_cf_threads_run spawning %d threads\n", totthread); */
sb_threads= MEM_callocN(sizeof(SB_thread_context)*totthread, "SBThread");
memset(sb_threads, 0, sizeof(SB_thread_context)*totthread);
@@ -2447,7 +2450,7 @@ static void softbody_calc_forcesEx(Scene *scene, Object *ob, float forcetime, fl
/* float gravity; */ /* UNUSED */
/* float iks; */
float fieldfactor = -1.0f, windfactor = 0.25;
- int do_deflector /*,do_selfcollision*/ ,do_springcollision,do_aero;
+ int do_deflector /*, do_selfcollision*/, do_springcollision, do_aero;
/* gravity = sb->grav * sb_grav_force_scale(ob); */ /* UNUSED */
@@ -2461,20 +2464,20 @@ static void softbody_calc_forcesEx(Scene *scene, Object *ob, float forcetime, fl
/* bproot= sb->bpoint; */ /* need this for proper spring addressing */ /* UNUSED */
if (do_springcollision || do_aero)
- sb_sfesf_threads_run(scene, ob, timenow,sb->totspring,NULL);
+ sb_sfesf_threads_run(scene, ob, timenow, sb->totspring, NULL);
/* after spring scan because it uses Effoctors too */
do_effector= pdInitEffectors(scene, ob, NULL, sb->effector_weights);
if (do_deflector) {
float defforce[3];
- do_deflector = sb_detect_aabb_collisionCached(defforce,ob->lay,ob,timenow);
+ do_deflector = sb_detect_aabb_collisionCached(defforce, ob->lay, ob, timenow);
}
sb_cf_threads_run(scene, ob, forcetime, timenow, sb->totpoint, NULL, do_effector, do_deflector, fieldfactor, windfactor);
/* finally add forces caused by face collision */
- if (ob->softflag & OB_SB_FACECOLL) scan_for_ext_face_forces(ob,timenow);
+ if (ob->softflag & OB_SB_FACECOLL) scan_for_ext_face_forces(ob, timenow);
/* finish matrix and solve */
pdEndEffectors(&do_effector);
@@ -2507,10 +2510,10 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
/* BodyPoint *bproot; */ /* UNUSED */
BodySpring *bs;
ListBase *do_effector = NULL;
- float iks, ks, kd, gravity[3] = {0.0f,0.0f,0.0f};
+ float iks, ks, kd, gravity[3] = {0.0f, 0.0f, 0.0f};
float fieldfactor = -1.0f, windfactor = 0.25f;
float tune = sb->ballstiff;
- int a, b, do_deflector,do_selfcollision,do_springcollision,do_aero;
+ int a, b, do_deflector, do_selfcollision, do_springcollision, do_aero;
/* jacobian
@@ -2543,7 +2546,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
if (do_deflector) {
float defforce[3];
- do_deflector = sb_detect_aabb_collisionCached(defforce,ob->lay,ob,timenow);
+ do_deflector = sb_detect_aabb_collisionCached(defforce, ob->lay, ob, timenow);
}
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
@@ -2554,17 +2557,17 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
//int op =3*sb->totpoint;
/* dF/dV = v */
/* jacobioan
- nlMatrixAdd(op+ia,ia,-forcetime);
- nlMatrixAdd(op+ia+1,ia+1,-forcetime);
- nlMatrixAdd(op+ia+2,ia+2,-forcetime);
+ nlMatrixAdd(op+ia, ia, -forcetime);
+ nlMatrixAdd(op+ia+1, ia+1, -forcetime);
+ nlMatrixAdd(op+ia+2, ia+2, -forcetime);
- nlMatrixAdd(ia,ia,1);
- nlMatrixAdd(ia+1,ia+1,1);
- nlMatrixAdd(ia+2,ia+2,1);
+ nlMatrixAdd(ia, ia, 1);
+ nlMatrixAdd(ia+1, ia+1, 1);
+ nlMatrixAdd(ia+2, ia+2, 1);
- nlMatrixAdd(op+ia,op+ia,1);
- nlMatrixAdd(op+ia+1,op+ia+1,1);
- nlMatrixAdd(op+ia+2,op+ia+2,1);
+ nlMatrixAdd(op+ia, op+ia, 1);
+ nlMatrixAdd(op+ia+1, op+ia+1, 1);
+ nlMatrixAdd(op+ia+2, op+ia+2, 1);
*/
@@ -2575,8 +2578,8 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
if (do_selfcollision) {
int attached;
BodyPoint *obp;
- int c,b;
- float velcenter[3],dvel[3],def[3];
+ int c, b;
+ float velcenter[3], dvel[3], def[3];
float distance;
float compare;
@@ -2605,11 +2608,11 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
float f = tune / (distance) + tune / (compare * compare) * distance - 2.0f * tune/compare;
mid_v3_v3v3(velcenter, bp->vec, obp->vec);
- sub_v3_v3v3(dvel,velcenter,bp->vec);
- mul_v3_fl(dvel,_final_mass(ob,bp));
+ sub_v3_v3v3(dvel, velcenter, bp->vec);
+ mul_v3_fl(dvel, _final_mass(ob, bp));
- Vec3PlusStVec(bp->force,f*(1.0f-sb->balldamp),def);
- Vec3PlusStVec(bp->force,sb->balldamp,dvel);
+ Vec3PlusStVec(bp->force, f*(1.0f-sb->balldamp), def);
+ Vec3PlusStVec(bp->force, sb->balldamp, dvel);
if (nl_flags & NLF_BUILD) {
//int ia =3*(sb->totpoint-a);
@@ -2618,11 +2621,11 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
//float mvel = forcetime*sb->nodemass*sb->balldamp;
//float mpos = forcetime*tune*(1.0f-sb->balldamp);
/*some quick and dirty entries to the jacobian*/
- //dfdx_goal(ia,ia,op,mpos);
- //dfdv_goal(ia,ia,mvel);
- /* exploit force(a,b) == -force(b,a) part1/2 */
- //dfdx_goal(ic,ic,op,mpos);
- //dfdv_goal(ic,ic,mvel);
+ //dfdx_goal(ia, ia, op, mpos);
+ //dfdv_goal(ia, ia, mvel);
+ /* exploit force(a, b) == -force(b, a) part1/2 */
+ //dfdx_goal(ic, ic, op, mpos);
+ //dfdv_goal(ic, ic, mvel);
/*TODO sit down an X-out the true jacobian entries*/
@@ -2635,12 +2638,12 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
*/
}
- /* exploit force(a,b) == -force(b,a) part2/2 */
- sub_v3_v3v3(dvel,velcenter,obp->vec);
- mul_v3_fl(dvel,(_final_mass(ob,bp)+_final_mass(ob,obp))/2.0f);
+ /* exploit force(a, b) == -force(b, a) part2/2 */
+ sub_v3_v3v3(dvel, velcenter, obp->vec);
+ mul_v3_fl(dvel, (_final_mass(ob, bp)+_final_mass(ob, obp))/2.0f);
- Vec3PlusStVec(obp->force,sb->balldamp,dvel);
- Vec3PlusStVec(obp->force,-f*(1.0f-sb->balldamp),def);
+ Vec3PlusStVec(obp->force, sb->balldamp, dvel);
+ Vec3PlusStVec(obp->force, -f*(1.0f-sb->balldamp), def);
}
@@ -2649,14 +2652,14 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
}
/* naive ball self collision done */
- if (_final_goal(ob,bp) < SOFTGOALSNAP) { /* ommit this bp when it snaps */
+ if (_final_goal(ob, bp) < SOFTGOALSNAP) { /* ommit this bp when it snaps */
float auxvect[3];
float velgoal[3];
/* do goal stuff */
if (ob->softflag & OB_SB_GOAL) {
/* true elastic goal */
- sub_v3_v3v3(auxvect,bp->pos,bp->origT);
+ sub_v3_v3v3(auxvect, bp->pos, bp->origT);
ks = 1.0f / (1.0f- _final_goal(ob, bp) * sb->goalspring) - 1.0f;
bp->force[0]+= -ks*(auxvect[0]);
bp->force[1]+= -ks*(auxvect[1]);
@@ -2666,14 +2669,14 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
//int ia =3*(sb->totpoint-a);
//int op =3*(sb->totpoint);
/* depending on my pos */
- //dfdx_goal(ia,ia,op,ks*forcetime);
+ //dfdx_goal(ia, ia, op, ks*forcetime);
}
/* calulate damping forces generated by goals*/
- sub_v3_v3v3(velgoal,bp->origS, bp->origE);
+ sub_v3_v3v3(velgoal, bp->origS, bp->origE);
kd = sb->goalfrict * sb_fric_force_scale(ob);
- add_v3_v3v3(auxvect,velgoal,bp->vec);
+ add_v3_v3v3(auxvect, velgoal, bp->vec);
if (forcetime > 0.0f) { /* make sure friction does not become rocket motor on time reversal */
bp->force[0]-= kd * (auxvect[0]);
@@ -2683,7 +2686,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
//int ia =3*(sb->totpoint-a);
normalize_v3(auxvect);
/* depending on my vel */
- //dfdv_goal(ia,ia,kd*forcetime);
+ //dfdv_goal(ia, ia, kd*forcetime);
}
}
@@ -2697,7 +2700,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
/* gravitation */
- madd_v3_v3fl(bp->force, gravity, _final_mass(ob,bp)); /* individual mass of node here */
+ madd_v3_v3fl(bp->force, gravity, _final_mass(ob, bp)); /* individual mass of node here */
/* particle field & vortex */
@@ -2710,7 +2713,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
pdDoEffectors(do_effector, NULL, sb->effector_weights, &epoint, force, speed);
/* apply forcefield*/
- mul_v3_fl(force,fieldfactor* eval_sb_fric_force_scale);
+ mul_v3_fl(force, fieldfactor* eval_sb_fric_force_scale);
add_v3_v3(bp->force, force);
/* BP friction in moving media */
@@ -2733,9 +2736,9 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
//int ia =3*(sb->totpoint-a);
/* da/dv = */
- // nlMatrixAdd(ia,ia,forcetime*kd);
- // nlMatrixAdd(ia+1,ia+1,forcetime*kd);
- // nlMatrixAdd(ia+2,ia+2,forcetime*kd);
+ // nlMatrixAdd(ia, ia, forcetime*kd);
+ // nlMatrixAdd(ia+1, ia+1, forcetime*kd);
+ // nlMatrixAdd(ia+2, ia+2, forcetime*kd);
}
}
@@ -2744,10 +2747,10 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
bp->choke2 = 0.0f;
bp->loc_flag &= ~SBF_DOFUZZY;
if (do_deflector) {
- float cfforce[3],defforce[3] ={0.0f,0.0f,0.0f}, vel[3] = {0.0f,0.0f,0.0f}, facenormal[3], cf = 1.0f,intrusion;
+ float cfforce[3], defforce[3] ={0.0f, 0.0f, 0.0f}, vel[3] = {0.0f, 0.0f, 0.0f}, facenormal[3], cf = 1.0f, intrusion;
kd = 1.0f;
- if (sb_deflect_face(ob,bp->pos,facenormal,defforce,&cf,timenow,vel,&intrusion)) {
+ if (sb_deflect_face(ob, bp->pos, facenormal, defforce, &cf, timenow, vel, &intrusion)) {
if ((!nl_flags)&&(intrusion < 0.0f)) {
if (G.rt & 0x01) { // 17 we did check for bit 0x10 before
/*fixing bug [17428] this forces adaptive step size to tiny steps
@@ -2760,12 +2763,12 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
in heun step No1 and leave the heun step No2 adapt to it
so we kind of introduced a implicit solver for this case
*/
- Vec3PlusStVec(bp->pos,-intrusion,facenormal);
+ Vec3PlusStVec(bp->pos, -intrusion, facenormal);
}
else {
- sub_v3_v3v3(cfforce,bp->vec,vel);
- Vec3PlusStVec(bp->force,-cf*50.0f,cfforce);
+ sub_v3_v3v3(cfforce, bp->vec, vel);
+ Vec3PlusStVec(bp->force, -cf*50.0f, cfforce);
}
@@ -2774,15 +2777,15 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
bp->choke = sb->choke*0.01f;
}
else {
- sub_v3_v3v3(cfforce,bp->vec,vel);
- Vec3PlusStVec(bp->force,-cf*50.0f,cfforce);
+ sub_v3_v3v3(cfforce, bp->vec, vel);
+ Vec3PlusStVec(bp->force, -cf*50.0f, cfforce);
}
- Vec3PlusStVec(bp->force,kd,defforce);
+ Vec3PlusStVec(bp->force, kd, defforce);
if (nl_flags & NLF_BUILD) {
// int ia =3*(sb->totpoint-a);
// int op =3*sb->totpoint;
- //dfdx_goal(ia,ia,op,mpos); // don't do unless you know
- //dfdv_goal(ia,ia,-cf);
+ //dfdx_goal(ia, ia, op, mpos); // don't do unless you know
+ //dfdv_goal(ia, ia, -cf);
}
@@ -2802,9 +2805,9 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
bp->choke = bs->cf;
}
- // sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float forcetime,int nl_flags)
+ // sb_spring_force(Object *ob, int bpi, BodySpring *bs, float iks, float forcetime, int nl_flags)
// rather remove nl_falgs from code .. will make things a lot cleaner
- sb_spring_force(ob,sb->totpoint-a,bs,iks,forcetime,0);
+ sb_spring_force(ob, sb->totpoint-a, bs, iks, forcetime, 0);
}/* loop springs */
}/* existing spring list */
}/*any edges*/
@@ -2814,12 +2817,12 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
/* finally add forces caused by face collision */
- if (ob->softflag & OB_SB_FACECOLL) scan_for_ext_face_forces(ob,timenow);
+ if (ob->softflag & OB_SB_FACECOLL) scan_for_ext_face_forces(ob, timenow);
/* finish matrix and solve */
#if (0) // remove onl linking for now .. still i am not sure .. the jacobian can be useful .. so keep that BM
if (nl_flags & NLF_SOLVE) {
- //double sct,sst=PIL_check_seconds_timer();
+ //double sct, sst=PIL_check_seconds_timer();
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
int iv =3*(sb->totpoint-a);
int ip =3*(2*sb->totpoint-a);
@@ -2830,8 +2833,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
nlEnd(NL_MATRIX);
nlEnd(NL_SYSTEM);
- if ((G.rt == 32) && (nl_flags & NLF_BUILD))
- {
+ if ((G.rt == 32) && (nl_flags & NLF_BUILD)) {
printf("####MEE#####\n");
nlPrintMatrix();
}
@@ -2845,30 +2847,30 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
/* for debug purpose .. anyhow cropping B vector looks like working */
if (G.rt ==32)
for (a=2*sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
- f=nlGetVariable(0,index);
- printf("(%f ",f);index++;
- f=nlGetVariable(0,index);
- printf("%f ",f);index++;
- f=nlGetVariable(0,index);
- printf("%f)",f);index++;
+ f=nlGetVariable(0, index);
+ printf("(%f ", f);index++;
+ f=nlGetVariable(0, index);
+ printf("%f ", f);index++;
+ f=nlGetVariable(0, index);
+ printf("%f)", f);index++;
}
index =0;
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
- f=nlGetVariable(0,index);
+ f=nlGetVariable(0, index);
bp->impdv[0] = f; index++;
- f=nlGetVariable(0,index);
+ f=nlGetVariable(0, index);
bp->impdv[1] = f; index++;
- f=nlGetVariable(0,index);
+ f=nlGetVariable(0, index);
bp->impdv[2] = f; index++;
}
/*
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
- f=nlGetVariable(0,index);
+ f=nlGetVariable(0, index);
bp->impdx[0] = f; index++;
- f=nlGetVariable(0,index);
+ f=nlGetVariable(0, index);
bp->impdx[1] = f; index++;
- f=nlGetVariable(0,index);
+ f=nlGetVariable(0, index);
bp->impdx[2] = f; index++;
}
*/
@@ -2876,13 +2878,13 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
else {
printf("Matrix inversion failed\n");
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
- copy_v3_v3(bp->impdv,bp->force);
+ copy_v3_v3(bp->impdv, bp->force);
}
}
//sct=PIL_check_seconds_timer();
- //if (sct-sst > 0.01f) printf(" implicit solver time %f %s \r",sct-sst,ob->id.name);
+ //if (sct-sst > 0.01f) printf(" implicit solver time %f %s \r", sct-sst, ob->id.name);
}
/* cleanup */
#endif
@@ -2894,13 +2896,13 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
{
/* time evolution */
/* actually does an explicit euler step mode == 0 */
- /* or heun ~ 2nd order runge-kutta steps, mode 1,2 */
+ /* or heun ~ 2nd order runge-kutta steps, mode 1, 2 */
SoftBody *sb= ob->soft; /* is supposed to be there */
BodyPoint *bp;
- float dx[3]={0},dv[3],aabbmin[3],aabbmax[3],cm[3]={0.0f,0.0f,0.0f};
- float timeovermass/*,freezeloc=0.00001f,freezeforce=0.00000000001f*/;
- float maxerrpos= 0.0f,maxerrvel = 0.0f;
- int a,fuzzy=0;
+ float dx[3]={0}, dv[3], aabbmin[3], aabbmax[3], cm[3]={0.0f, 0.0f, 0.0f};
+ float timeovermass/*, freezeloc=0.00001f, freezeforce=0.00000000001f*/;
+ float maxerrpos= 0.0f, maxerrvel = 0.0f;
+ int a, fuzzy=0;
forcetime *= sb_time_scale(ob);
@@ -2917,21 +2919,21 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
/* now we have individual masses */
/* claim a minimum mass for vertex */
- if (_final_mass(ob,bp) > 0.009999f) timeovermass = forcetime/_final_mass(ob,bp);
+ if (_final_mass(ob, bp) > 0.009999f) timeovermass = forcetime/_final_mass(ob, bp);
else timeovermass = forcetime/0.009999f;
- if (_final_goal(ob,bp) < SOFTGOALSNAP) {
+ if (_final_goal(ob, bp) < SOFTGOALSNAP) {
/* this makes t~ = t */
- if (mid_flags & MID_PRESERVE) copy_v3_v3(dx,bp->vec);
+ if (mid_flags & MID_PRESERVE) copy_v3_v3(dx, bp->vec);
/* so here is (v)' = a(cceleration) = sum(F_springs)/m + gravitation + some friction forces + more forces*/
/* the ( ... )' operator denotes derivate respective time */
/* the euler step for velocity then becomes */
/* v(t + dt) = v(t) + a(t) * dt */
- mul_v3_fl(bp->force,timeovermass);/* individual mass of node here */
+ mul_v3_fl(bp->force, timeovermass);/* individual mass of node here */
/* some nasty if's to have heun in here too */
- copy_v3_v3(dv,bp->force);
+ copy_v3_v3(dv, bp->force);
if (mode == 1) {
copy_v3_v3(bp->prevvec, bp->vec);
@@ -2944,80 +2946,80 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
bp->vec[1] = bp->prevvec[1] + 0.5f * (dv[1] + bp->prevdv[1]);
bp->vec[2] = bp->prevvec[2] + 0.5f * (dv[2] + bp->prevdv[2]);
/* compare euler to heun to estimate error for step sizing */
- maxerrvel = MAX2(maxerrvel,ABS(dv[0] - bp->prevdv[0]));
- maxerrvel = MAX2(maxerrvel,ABS(dv[1] - bp->prevdv[1]));
- maxerrvel = MAX2(maxerrvel,ABS(dv[2] - bp->prevdv[2]));
+ maxerrvel = MAX2(maxerrvel, ABS(dv[0] - bp->prevdv[0]));
+ maxerrvel = MAX2(maxerrvel, ABS(dv[1] - bp->prevdv[1]));
+ maxerrvel = MAX2(maxerrvel, ABS(dv[2] - bp->prevdv[2]));
}
else { add_v3_v3(bp->vec, bp->force); }
/* this makes t~ = t+dt */
- if (!(mid_flags & MID_PRESERVE)) copy_v3_v3(dx,bp->vec);
+ if (!(mid_flags & MID_PRESERVE)) copy_v3_v3(dx, bp->vec);
/* so here is (x)'= v(elocity) */
/* the euler step for location then becomes */
/* x(t + dt) = x(t) + v(t~) * dt */
- mul_v3_fl(dx,forcetime);
+ mul_v3_fl(dx, forcetime);
/* the freezer coming sooner or later */
/*
- if ((dot_v3v3(dx,dx)<freezeloc )&&(dot_v3v3(bp->force,bp->force)<freezeforce )) {
+ if ((dot_v3v3(dx, dx)<freezeloc )&&(dot_v3v3(bp->force, bp->force)<freezeforce )) {
bp->frozen /=2;
}
else {
- bp->frozen = MIN2(bp->frozen*1.05f,1.0f);
+ bp->frozen = MIN2(bp->frozen*1.05f, 1.0f);
}
- mul_v3_fl(dx,bp->frozen);
+ mul_v3_fl(dx, bp->frozen);
*/
/* again some nasty if's to have heun in here too */
if (mode ==1) {
- copy_v3_v3(bp->prevpos,bp->pos);
- copy_v3_v3(bp->prevdx ,dx);
+ copy_v3_v3(bp->prevpos, bp->pos);
+ copy_v3_v3(bp->prevdx, dx);
}
if (mode ==2) {
bp->pos[0] = bp->prevpos[0] + 0.5f * ( dx[0] + bp->prevdx[0]);
bp->pos[1] = bp->prevpos[1] + 0.5f * ( dx[1] + bp->prevdx[1]);
bp->pos[2] = bp->prevpos[2] + 0.5f * ( dx[2] + bp->prevdx[2]);
- maxerrpos = MAX2(maxerrpos,ABS(dx[0] - bp->prevdx[0]));
- maxerrpos = MAX2(maxerrpos,ABS(dx[1] - bp->prevdx[1]));
- maxerrpos = MAX2(maxerrpos,ABS(dx[2] - bp->prevdx[2]));
+ maxerrpos = MAX2(maxerrpos, ABS(dx[0] - bp->prevdx[0]));
+ maxerrpos = MAX2(maxerrpos, ABS(dx[1] - bp->prevdx[1]));
+ maxerrpos = MAX2(maxerrpos, ABS(dx[2] - bp->prevdx[2]));
/* bp->choke is set when we need to pull a vertex or edge out of the collider.
the collider object signals to get out by pushing hard. on the other hand
we don't want to end up in deep space so we add some <viscosity>
to balance that out */
if (bp->choke2 > 0.0f) {
- mul_v3_fl(bp->vec,(1.0f - bp->choke2));
+ mul_v3_fl(bp->vec, (1.0f - bp->choke2));
}
if (bp->choke > 0.0f) {
- mul_v3_fl(bp->vec,(1.0f - bp->choke));
+ mul_v3_fl(bp->vec, (1.0f - bp->choke));
}
}
else { add_v3_v3(bp->pos, dx);}
}/*snap*/
/* so while we are looping BPs anyway do statistics on the fly */
- aabbmin[0] = MIN2(aabbmin[0],bp->pos[0]);
- aabbmin[1] = MIN2(aabbmin[1],bp->pos[1]);
- aabbmin[2] = MIN2(aabbmin[2],bp->pos[2]);
- aabbmax[0] = MAX2(aabbmax[0],bp->pos[0]);
- aabbmax[1] = MAX2(aabbmax[1],bp->pos[1]);
- aabbmax[2] = MAX2(aabbmax[2],bp->pos[2]);
+ aabbmin[0] = MIN2(aabbmin[0], bp->pos[0]);
+ aabbmin[1] = MIN2(aabbmin[1], bp->pos[1]);
+ aabbmin[2] = MIN2(aabbmin[2], bp->pos[2]);
+ aabbmax[0] = MAX2(aabbmax[0], bp->pos[0]);
+ aabbmax[1] = MAX2(aabbmax[1], bp->pos[1]);
+ aabbmax[2] = MAX2(aabbmax[2], bp->pos[2]);
if (bp->loc_flag & SBF_DOFUZZY) fuzzy =1;
} /*for*/
- if (sb->totpoint) mul_v3_fl(cm,1.0f/sb->totpoint);
+ if (sb->totpoint) mul_v3_fl(cm, 1.0f/sb->totpoint);
if (sb->scratch) {
- copy_v3_v3(sb->scratch->aabbmin,aabbmin);
- copy_v3_v3(sb->scratch->aabbmax,aabbmax);
+ copy_v3_v3(sb->scratch->aabbmin, aabbmin);
+ copy_v3_v3(sb->scratch->aabbmax, aabbmax);
}
if (err) { /* so step size will be controlled by biggest difference in slope */
if (sb->solverflags & SBSO_OLDERR)
- *err = MAX2(maxerrpos,maxerrvel);
+ *err = MAX2(maxerrpos, maxerrvel);
else
*err = maxerrpos;
- //printf("EP %f EV %f\n",maxerrpos,maxerrvel);
+ //printf("EP %f EV %f\n", maxerrpos, maxerrvel);
if (fuzzy) {
*err /= sb->fuzzyness;
}
@@ -3045,19 +3047,19 @@ static void softbody_store_step(Object *ob)
int a;
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
- copy_v3_v3(bp->prevvec,bp->vec);
- copy_v3_v3(bp->prevpos,bp->pos);
+ copy_v3_v3(bp->prevvec, bp->vec);
+ copy_v3_v3(bp->prevpos, bp->pos);
}
}
/* used by predictors and correctors */
-static void softbody_store_state(Object *ob,float *ppos,float *pvel)
+static void softbody_store_state(Object *ob, float *ppos, float *pvel)
{
SoftBody *sb= ob->soft; /* is supposed to be there*/
BodyPoint *bp;
int a;
- float *pp=ppos,*pv=pvel;
+ float *pp=ppos, *pv=pvel;
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
@@ -3070,42 +3072,42 @@ static void softbody_store_state(Object *ob,float *ppos,float *pvel)
}
/* used by predictors and correctors */
-static void softbody_retrieve_state(Object *ob,float *ppos,float *pvel)
+static void softbody_retrieve_state(Object *ob, float *ppos, float *pvel)
{
SoftBody *sb= ob->soft; /* is supposed to be there*/
BodyPoint *bp;
int a;
- float *pp=ppos,*pv=pvel;
+ float *pp=ppos, *pv=pvel;
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
- copy_v3_v3(bp->vec,pv);
+ copy_v3_v3(bp->vec, pv);
pv+=3;
- copy_v3_v3(bp->pos,pp);
+ copy_v3_v3(bp->pos, pp);
pp+=3;
}
}
/* used by predictors and correctors */
-static void softbody_swap_state(Object *ob,float *ppos,float *pvel)
+static void softbody_swap_state(Object *ob, float *ppos, float *pvel)
{
SoftBody *sb= ob->soft; /* is supposed to be there*/
BodyPoint *bp;
int a;
- float *pp=ppos,*pv=pvel;
+ float *pp=ppos, *pv=pvel;
float temp[3];
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
copy_v3_v3(temp, bp->vec);
- copy_v3_v3(bp->vec,pv);
- copy_v3_v3(pv,temp);
+ copy_v3_v3(bp->vec, pv);
+ copy_v3_v3(pv, temp);
pv+=3;
copy_v3_v3(temp, bp->pos);
- copy_v3_v3(bp->pos,pp);
- copy_v3_v3(pp,temp);
+ copy_v3_v3(bp->pos, pp);
+ copy_v3_v3(pp, temp);
pp+=3;
}
}
@@ -3125,9 +3127,9 @@ static void softbody_apply_goalsnap(Object *ob)
int a;
for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
- if (_final_goal(ob,bp) >= SOFTGOALSNAP) {
- copy_v3_v3(bp->prevpos,bp->pos);
- copy_v3_v3(bp->pos,bp->origT);
+ if (_final_goal(ob, bp) >= SOFTGOALSNAP) {
+ copy_v3_v3(bp->prevpos, bp->pos);
+ copy_v3_v3(bp->pos, bp->origT);
}
}
}
@@ -3139,7 +3141,7 @@ static void apply_spring_memory(Object *ob)
BodySpring *bs;
BodyPoint *bp1, *bp2;
int a;
- float b,l,r;
+ float b, l, r;
if (sb && sb->totspring) {
b = sb->plastic;
@@ -3147,7 +3149,7 @@ static void apply_spring_memory(Object *ob)
bs = &sb->bspring[a];
bp1 =&sb->bpoint[bs->v1];
bp2 =&sb->bpoint[bs->v2];
- l = len_v3v3(bp1->pos,bp2->pos);
+ l = len_v3v3(bp1->pos, bp2->pos);
r = bs->len/l;
if (( r > 1.05f) || (r < 0.95f)) {
bs->len = ((100.0f - b) * bs->len + b*l)/100.0f;
@@ -3170,7 +3172,7 @@ static void interpolate_exciter(Object *ob, int timescale, int time)
bp->origT[0] = bp->origS[0] + f*(bp->origE[0] - bp->origS[0]);
bp->origT[1] = bp->origS[1] + f*(bp->origE[1] - bp->origS[1]);
bp->origT[2] = bp->origS[2] + f*(bp->origE[2] - bp->origS[2]);
- if (_final_goal(ob,bp) >= SOFTGOALSNAP) {
+ if (_final_goal(ob, bp) >= SOFTGOALSNAP) {
bp->vec[0] = bp->origE[0] - bp->origS[0];
bp->vec[1] = bp->origE[1] - bp->origS[1];
bp->vec[2] = bp->origE[2] - bp->origS[2];
@@ -3229,8 +3231,7 @@ static void springs_from_mesh(Object *ob)
float scale =1.0f;
sb= ob->soft;
- if (me && sb)
- {
+ if (me && sb) {
/* using bp->origS as a container for spring calcualtions here
** will be overwritten sbObjectStep() to receive
** actual modifier stack positions
@@ -3267,6 +3268,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
BodyPoint *bp;
BodySpring *bs;
int a, totedge;
+ BKE_mesh_tessface_ensure(me);
if (ob->softflag & OB_SB_EDGES) totedge= me->totedge;
else totedge= 0;
@@ -3287,7 +3289,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
if ((ob->softflag & OB_SB_GOAL) && sb->vertgroup) { /* even this is a deprecated evil hack */
/* I'd like to have it .. if (sb->namedVG_Goal[0]) */
- get_scalar_from_vertexgroup(ob, a,(short) (sb->vertgroup-1), &bp->goal);
+ get_scalar_from_vertexgroup(ob, a, (short) (sb->vertgroup-1), &bp->goal);
/* do this always, regardless successfull read from vertex group */
/* this is where '2.5 every thing is animatable' goes wrong in the first place jow_go_for2_5 */
/* 1st coding action to take : move this to frame level */
@@ -3305,27 +3307,25 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
this enables per vertex *mass painting*
*/
- if (sb->namedVG_Mass[0])
- {
- int grp= defgroup_name_index (ob,sb->namedVG_Mass);
- /* printf("VGN %s %d\n",sb->namedVG_Mass,grp); */
+ if (sb->namedVG_Mass[0]) {
+ int grp= defgroup_name_index (ob, sb->namedVG_Mass);
+ /* printf("VGN %s %d\n", sb->namedVG_Mass, grp); */
if (grp > -1) {
- get_scalar_from_vertexgroup(ob, a,(short) (grp), &bp->mass);
+ get_scalar_from_vertexgroup(ob, a, (short) (grp), &bp->mass);
/* 2.5 bp->mass = bp->mass * sb->nodemass; */
- /* printf("bp->mass %f\n",bp->mass); */
+ /* printf("bp->mass %f\n", bp->mass); */
}
}
/* first set the default */
bp->springweight = 1.0f;
- if (sb->namedVG_Spring_K[0])
- {
- int grp= defgroup_name_index (ob,sb->namedVG_Spring_K);
- //printf("VGN %s %d\n",sb->namedVG_Spring_K,grp);
+ if (sb->namedVG_Spring_K[0]) {
+ int grp= defgroup_name_index (ob, sb->namedVG_Spring_K);
+ //printf("VGN %s %d\n", sb->namedVG_Spring_K, grp);
if (grp > -1) {
- get_scalar_from_vertexgroup(ob, a,(short) (grp), &bp->springweight);
- //printf("bp->springweight %f\n",bp->springweight);
+ get_scalar_from_vertexgroup(ob, a, (short) (grp), &bp->springweight);
+ //printf("bp->springweight %f\n", bp->springweight);
}
}
@@ -3352,7 +3352,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
build_bps_springlist(ob); /* scan for springs attached to bodypoints ONCE */
/* insert *other second order* springs if desired */
if (sb->secondspring > 0.0000001f) {
- add_2nd_order_springs(ob,sb->secondspring); /* exploits the the first run of build_bps_springlist(ob);*/
+ add_2nd_order_springs(ob, sb->secondspring); /* exploits the the first run of build_bps_springlist(ob);*/
build_bps_springlist(ob); /* yes we need to do it again*/
}
springs_from_mesh(ob); /* write the 'rest'-length of the springs */
@@ -3373,8 +3373,8 @@ static void mesh_faces_to_scratch(Object *ob)
int a;
/* alloc and copy faces*/
- bodyface = sb->scratch->bodyface = MEM_mallocN(sizeof(BodyFace)*me->totface,"SB_body_Faces");
- //memcpy(sb->scratch->mface,me->mface,sizeof(MFace)*me->totface);
+ bodyface = sb->scratch->bodyface = MEM_mallocN(sizeof(BodyFace)*me->totface, "SB_body_Faces");
+ //memcpy(sb->scratch->mface, me->mface, sizeof(MFace)*me->totface);
mface = me->mface;
for (a=0; a<me->totface; a++, mface++, bodyface++) {
bodyface->v1 = mface->v1;
@@ -3391,20 +3391,20 @@ static void reference_to_scratch(Object *ob)
SoftBody *sb= ob->soft;
ReferenceVert *rp;
BodyPoint *bp;
- float accu_pos[3] ={0.f,0.f,0.f};
+ float accu_pos[3] ={0.f, 0.f, 0.f};
float accu_mass = 0.f;
int a;
- sb->scratch->Ref.ivert = MEM_mallocN(sizeof(ReferenceVert)*sb->totpoint,"SB_Reference");
+ sb->scratch->Ref.ivert = MEM_mallocN(sizeof(ReferenceVert)*sb->totpoint, "SB_Reference");
bp= ob->soft->bpoint;
rp= sb->scratch->Ref.ivert;
for (a=0; a<sb->totpoint; a++, rp++, bp++) {
- copy_v3_v3(rp->pos,bp->pos);
+ copy_v3_v3(rp->pos, bp->pos);
add_v3_v3(accu_pos, bp->pos);
- accu_mass += _final_mass(ob,bp);
+ accu_mass += _final_mass(ob, bp);
}
- mul_v3_fl(accu_pos,1.0f/accu_mass);
- copy_v3_v3(sb->scratch->Ref.com,accu_pos);
+ mul_v3_fl(accu_pos, 1.0f/accu_mass);
+ copy_v3_v3(sb->scratch->Ref.com, accu_pos);
/* printf("reference_to_scratch\n"); */
}
@@ -3412,17 +3412,17 @@ static void reference_to_scratch(Object *ob)
helper function to get proper spring length
when object is rescaled
*/
-static float globallen(float *v1,float *v2,Object *ob)
+static float globallen(float *v1, float *v2, Object *ob)
{
- float p1[3],p2[3];
- copy_v3_v3(p1,v1);
+ float p1[3], p2[3];
+ copy_v3_v3(p1, v1);
mul_m4_v3(ob->obmat, p1);
- copy_v3_v3(p2,v2);
+ copy_v3_v3(p2, v2);
mul_m4_v3(ob->obmat, p2);
- return len_v3v3(p1,p2);
+ return len_v3v3(p1, p2);
}
-static void makelatticesprings(Lattice *lt, BodySpring *bs, int dostiff,Object *ob)
+static void makelatticesprings(Lattice *lt, BodySpring *bs, int dostiff, Object *ob)
{
BPoint *bp=lt->def, *bpu;
int u, v, w, dv, dw, bpc=0, bpuc;
@@ -3440,21 +3440,21 @@ static void makelatticesprings(Lattice *lt, BodySpring *bs, int dostiff,Object *
bs->v1 = bpc;
bs->v2 = bpc-dw;
bs->springtype=SB_EDGE;
- bs->len= globallen((bp-dw)->vec, bp->vec,ob);
+ bs->len= globallen((bp-dw)->vec, bp->vec, ob);
bs++;
}
if (v) {
bs->v1 = bpc;
bs->v2 = bpc-dv;
bs->springtype=SB_EDGE;
- bs->len= globallen((bp-dv)->vec, bp->vec,ob);
+ bs->len= globallen((bp-dv)->vec, bp->vec, ob);
bs++;
}
if (u) {
bs->v1 = bpuc;
bs->v2 = bpc;
bs->springtype=SB_EDGE;
- bs->len= globallen((bpu)->vec, bp->vec,ob);
+ bs->len= globallen((bpu)->vec, bp->vec, ob);
bs++;
}
@@ -3465,14 +3465,14 @@ static void makelatticesprings(Lattice *lt, BodySpring *bs, int dostiff,Object *
bs->v1 = bpc;
bs->v2 = bpc-dw-dv-1;
bs->springtype=SB_BEND;
- bs->len= globallen((bp-dw-dv-1)->vec, bp->vec,ob);
+ bs->len= globallen((bp-dw-dv-1)->vec, bp->vec, ob);
bs++;
}
if ( (v < lt->pntsv-1) && (u != 0) ) {
bs->v1 = bpc;
bs->v2 = bpc-dw+dv-1;
bs->springtype=SB_BEND;
- bs->len= globallen((bp-dw+dv-1)->vec, bp->vec,ob);
+ bs->len= globallen((bp-dw+dv-1)->vec, bp->vec, ob);
bs++;
}
}
@@ -3482,14 +3482,14 @@ static void makelatticesprings(Lattice *lt, BodySpring *bs, int dostiff,Object *
bs->v1 = bpc;
bs->v2 = bpc+dw-dv-1;
bs->springtype=SB_BEND;
- bs->len= globallen((bp+dw-dv-1)->vec, bp->vec,ob);
+ bs->len= globallen((bp+dw-dv-1)->vec, bp->vec, ob);
bs++;
}
if ( (v < lt->pntsv-1) && (u != 0) ) {
bs->v1 = bpc;
bs->v2 = bpc+dw+dv-1;
bs->springtype=SB_BEND;
- bs->len= globallen((bp+dw+dv-1)->vec, bp->vec,ob);
+ bs->len= globallen((bp+dw+dv-1)->vec, bp->vec, ob);
bs++;
}
}
@@ -3541,7 +3541,7 @@ static void lattice_to_softbody(Scene *scene, Object *ob)
/* create some helper edges to enable SB lattice to be useful at all */
if (ob->softflag & OB_SB_EDGES) {
- makelatticesprings(lt,ob->soft->bspring,ob->softflag & OB_SB_QUADS,ob);
+ makelatticesprings(lt, ob->soft->bspring, ob->softflag & OB_SB_QUADS, ob);
build_bps_springlist(ob); /* link bps to springs */
}
}
@@ -3559,7 +3559,7 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob)
int a, curindex=0;
int totvert, totspring = 0, setgoal=0;
- totvert= count_curveverts(&cu->nurb);
+ totvert= BKE_nurbList_verts_count(&cu->nurb);
if (ob->softflag & OB_SB_EDGES) {
if (ob->type==OB_CURVE) {
@@ -3604,19 +3604,19 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob)
bs->v1= curindex-3;
bs->v2= curindex;
bs->springtype=SB_HANDLE;
- bs->len= globallen( (bezt-1)->vec[0], bezt->vec[0], ob );
+ bs->len = globallen((bezt-1)->vec[0], bezt->vec[0], ob);
bs++;
}
bs->v1= curindex;
bs->v2= curindex+1;
bs->springtype=SB_HANDLE;
- bs->len= globallen(bezt->vec[0], bezt->vec[1], ob);
+ bs->len = globallen(bezt->vec[0], bezt->vec[1], ob);
bs++;
bs->v1= curindex+1;
bs->v2= curindex+2;
bs->springtype=SB_HANDLE;
- bs->len= globallen(bezt->vec[1], bezt->vec[2], ob);
+ bs->len = globallen(bezt->vec[1], bezt->vec[2], ob);
bs++;
}
}
@@ -3630,15 +3630,14 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob)
bs->v1= curindex-1;
bs->v2= curindex;
bs->springtype=SB_EDGE;
- bs->len= globallen( (bpnt-1)->vec, bpnt->vec , ob );
+ bs->len= globallen( (bpnt-1)->vec, bpnt->vec, ob );
bs++;
}
}
}
}
- if (totspring)
- {
+ if (totspring) {
build_bps_springlist(ob); /* link bps to springs */
if (ob->softflag & OB_SB_SELF) {calculate_collision_balls(ob);}
}
@@ -3651,7 +3650,7 @@ static void softbody_to_object(Object *ob, float (*vertexCos)[3], int numVerts,
if (sb) {
BodyPoint *bp= sb->bpoint;
int a;
- if (sb->solverflags & SBSO_ESTIMATEIPO) {SB_estimate_transform(ob,sb->lcom,sb->lrot,sb->lscale);}
+ if (sb->solverflags & SBSO_ESTIMATEIPO) {SB_estimate_transform(ob, sb->lcom, sb->lrot, sb->lscale);}
/* inverse matrix is not uptodate... */
invert_m4_m4(ob->imat, ob->obmat);
@@ -3668,7 +3667,7 @@ static void sb_new_scratch(SoftBody *sb)
{
if (!sb) return;
sb->scratch = MEM_callocN(sizeof(SBScratch), "SBScratch");
- sb->scratch->colliderhash = BLI_ghash_new(BLI_ghashutil_ptrhash,BLI_ghashutil_ptrcmp, "sb_new_scratch gh");
+ sb->scratch->colliderhash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "sb_new_scratch gh");
sb->scratch->bodyface = NULL;
sb->scratch->totface = 0;
sb->scratch->aabbmax[0]=sb->scratch->aabbmax[1]=sb->scratch->aabbmax[2] = 1.0e30f;
@@ -3784,7 +3783,7 @@ static void softbody_update_positions(Object *ob, SoftBody *sb, float (*vertexCo
if (!sb || !sb->bpoint)
return;
- for (a=0,bp=sb->bpoint; a<numVerts; a++, bp++) {
+ for (a=0, bp=sb->bpoint; a<numVerts; a++, bp++) {
/* store where goals are now */
copy_v3_v3(bp->origS, bp->origE);
/* copy the position of the goals at desired end time */
@@ -3799,47 +3798,47 @@ static void softbody_update_positions(Object *ob, SoftBody *sb, float (*vertexCo
/* void SB_estimate_transform */
-/* input Object *ob out (says any object that can do SB like mesh,lattice,curve )
- * output float lloc[3],float lrot[3][3],float lscale[3][3]
+/* input Object *ob out (says any object that can do SB like mesh, lattice, curve )
+ * output float lloc[3], float lrot[3][3], float lscale[3][3]
* that is:
* a precise position vector denoting the motion of the center of mass
* give a rotation/scale matrix using averaging method, that's why estimate and not calculate
* see: this is kind of reverse engeneering: having to states of a point cloud and recover what happend
* our advantage here we know the identity of the vertex
* there are others methods giving other results.
- * lloc,lrot,lscale are allowed to be NULL, just in case you don't need it.
+ * lloc, lrot, lscale are allowed to be NULL, just in case you don't need it.
* should be pretty useful for pythoneers :)
* not! velocity .. 2nd order stuff
* vcloud_estimate_transform see
*/
-void SB_estimate_transform(Object *ob,float lloc[3],float lrot[3][3],float lscale[3][3])
+void SB_estimate_transform(Object *ob, float lloc[3], float lrot[3][3], float lscale[3][3])
{
BodyPoint *bp;
ReferenceVert *rp;
SoftBody *sb = NULL;
float (*opos)[3];
float (*rpos)[3];
- float com[3],rcom[3];
+ float com[3], rcom[3];
int a;
if (!ob ||!ob->soft) return; /* why did we get here ? */
sb= ob->soft;
if (!sb || !sb->bpoint) return;
- opos= MEM_callocN( (sb->totpoint)*3*sizeof(float), "SB_OPOS");
- rpos= MEM_callocN( (sb->totpoint)*3*sizeof(float), "SB_RPOS");
+ opos= MEM_callocN((sb->totpoint)*3*sizeof(float), "SB_OPOS");
+ rpos= MEM_callocN((sb->totpoint)*3*sizeof(float), "SB_RPOS");
/* might filter vertex selection with a vertex group */
for (a=0, bp=sb->bpoint, rp=sb->scratch->Ref.ivert; a<sb->totpoint; a++, bp++, rp++) {
- copy_v3_v3(rpos[a],rp->pos);
- copy_v3_v3(opos[a],bp->pos);
+ copy_v3_v3(rpos[a], rp->pos);
+ copy_v3_v3(opos[a], bp->pos);
}
- vcloud_estimate_transform(sb->totpoint, opos, NULL, rpos, NULL, com, rcom,lrot,lscale);
- //sub_v3_v3(com,rcom);
- if (lloc) copy_v3_v3(lloc,com);
- copy_v3_v3(sb->lcom,com);
- if (lscale) copy_m3_m3(sb->lscale,lscale);
- if (lrot) copy_m3_m3(sb->lrot,lrot);
+ vcloud_estimate_transform(sb->totpoint, opos, NULL, rpos, NULL, com, rcom, lrot, lscale);
+ //sub_v3_v3(com, rcom);
+ if (lloc) copy_v3_v3(lloc, com);
+ copy_v3_v3(sb->lcom, com);
+ if (lscale) copy_m3_m3(sb->lscale, lscale);
+ if (lrot) copy_m3_m3(sb->lrot, lrot);
MEM_freeN(opos);
@@ -3851,7 +3850,7 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int
BodyPoint *bp;
int a;
- for (a=0,bp=sb->bpoint; a<numVerts; a++, bp++) {
+ for (a=0, bp=sb->bpoint; a<numVerts; a++, bp++) {
copy_v3_v3(bp->pos, vertexCos[a]);
mul_m4_v3(ob->obmat, bp->pos); /* yep, sofbody is global coords*/
copy_v3_v3(bp->origS, bp->pos);
@@ -3891,10 +3890,10 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int
/* we only need that if we want to reconstruct IPO */
if (1) {
reference_to_scratch(ob);
- SB_estimate_transform(ob,NULL,NULL,NULL);
- SB_estimate_transform(ob,NULL,NULL,NULL);
+ SB_estimate_transform(ob, NULL, NULL, NULL);
+ SB_estimate_transform(ob, NULL, NULL, NULL);
}
- switch(ob->type) {
+ switch (ob->type) {
case OB_MESH:
if (ob->softflag & OB_SB_FACECOLL) mesh_faces_to_scratch(ob);
break;
@@ -3912,7 +3911,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
{
/* the simulator */
float forcetime;
- double sct,sst;
+ double sct, sst;
sst=PIL_check_seconds_timer();
@@ -3950,29 +3949,28 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
if (sb->solver_ID>0) mid_flags |= MID_PRESERVE;
forcetime = forcetimemax; /* hope for integrating in one step */
- while ( (ABS(timedone) < ABS(dtime)) && (loops < 2000) )
- {
+ while ( (ABS(timedone) < ABS(dtime)) && (loops < 2000) ) {
/* set goals in time */
- interpolate_exciter(ob,200,(int)(200.0f*(timedone/dtime)));
+ interpolate_exciter(ob, 200, (int)(200.0f*(timedone/dtime)));
sb->scratch->flag &= ~SBF_DOFUZZY;
/* do predictive euler step */
- softbody_calc_forces(scene, ob, forcetime,timedone/dtime,0);
+ softbody_calc_forces(scene, ob, forcetime, timedone/dtime, 0);
- softbody_apply_forces(ob, forcetime, 1, NULL,mid_flags);
+ softbody_apply_forces(ob, forcetime, 1, NULL, mid_flags);
/* crop new slope values to do averaged slope step */
- softbody_calc_forces(scene, ob, forcetime,timedone/dtime,0);
+ softbody_calc_forces(scene, ob, forcetime, timedone/dtime, 0);
- softbody_apply_forces(ob, forcetime, 2, &err,mid_flags);
+ softbody_apply_forces(ob, forcetime, 2, &err, mid_flags);
softbody_apply_goalsnap(ob);
if (err > SoftHeunTol) { /* error needs to be scaled to some quantity */
if (forcetime > forcetimemin) {
- forcetime = MAX2(forcetime / 2.0f,forcetimemin);
+ forcetime = MAX2(forcetime / 2.0f, forcetimemin);
softbody_restore_prev_step(ob);
- //printf("down,");
+ //printf("down, ");
}
else {
timedone += forcetime;
@@ -3992,17 +3990,17 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
}
}
timedone += forcetime;
- newtime=MIN2(forcetimemax,MAX2(newtime,forcetimemin));
- //if (newtime > forcetime) printf("up,");
+ newtime=MIN2(forcetimemax, MAX2(newtime, forcetimemin));
+ //if (newtime > forcetime) printf("up, ");
if (forcetime > 0.0f)
- forcetime = MIN2(dtime - timedone,newtime);
+ forcetime = MIN2(dtime - timedone, newtime);
else
- forcetime = MAX2(dtime - timedone,newtime);
+ forcetime = MAX2(dtime - timedone, newtime);
}
loops++;
if (sb->solverflags & SBSO_MONITOR ) {
sct=PIL_check_seconds_timer();
- if (sct-sst > 0.5f) printf("%3.0f%% \r",100.0f*timedone/dtime);
+ if (sct-sst > 0.5f) printf("%3.0f%% \r", 100.0f*timedone/dtime);
}
/* ask for user break */
if (SB_localInterruptCallBack && SB_localInterruptCallBack()) break;
@@ -4015,16 +4013,15 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
// if (G.debug & G_DEBUG) {
if (sb->solverflags & SBSO_MONITOR ) {
if (loops > HEUNWARNLIMIT) /* monitor high loop counts */
- printf("\r needed %d steps/frame",loops);
+ printf("\r needed %d steps/frame", loops);
}
}
- else if (sb->solver_ID == 2)
- {/* do semi "fake" implicit euler */
+ else if (sb->solver_ID == 2) {
+ /* do semi "fake" implicit euler */
//removed
}/*SOLVER SELECT*/
- else if (sb->solver_ID == 4)
- {
+ else if (sb->solver_ID == 4) {
/* do semi "fake" implicit euler */
}/*SOLVER SELECT*/
else if (sb->solver_ID == 3) {
@@ -4039,7 +4036,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
if (sb->solverflags & SBSO_MONITOR ) {
sct=PIL_check_seconds_timer();
- if ((sct-sst > 0.5f) || (G.debug & G_DEBUG)) printf(" solver time %f sec %s\n",sct-sst,ob->id.name);
+ if ((sct-sst > 0.5f) || (G.debug & G_DEBUG)) printf(" solver time %f sec %s\n", sct-sst, ob->id.name);
}
}
@@ -4081,7 +4078,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i
if (sb->bpoint == NULL ||
((ob->softflag & OB_SB_EDGES) && !ob->soft->bspring && object_has_edges(ob))) {
- switch(ob->type) {
+ switch (ob->type) {
case OB_MESH:
mesh_to_softbody(scene, ob);
break;
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index c2dbb518837..28ce95ea8d1 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -95,8 +95,7 @@ struct bSound* sound_new_file(struct Main *bmain, const char *filename)
sound_load(bmain, sound);
- if (!sound->playback_handle)
- {
+ if (!sound->playback_handle) {
free_libblock(&bmain->sound, sound);
sound = NULL;
}
@@ -106,22 +105,19 @@ struct bSound* sound_new_file(struct Main *bmain, const char *filename)
void sound_free(struct bSound* sound)
{
- if (sound->packedfile)
- {
+ if (sound->packedfile) {
freePackedFile(sound->packedfile);
sound->packedfile = NULL;
}
#ifdef WITH_AUDASPACE
- if (sound->handle)
- {
+ if (sound->handle) {
AUD_unload(sound->handle);
sound->handle = NULL;
sound->playback_handle = NULL;
}
- if (sound->cache)
- {
+ if (sound->cache) {
AUD_unload(sound->cache);
sound->cache = NULL;
}
@@ -141,10 +137,8 @@ static void sound_sync_callback(void* data, int mode, float time)
struct Scene* scene;
scene = bmain->scene.first;
- while (scene)
- {
- if (scene->audio.flag & AUDIO_SYNC)
- {
+ while (scene) {
+ if (scene->audio.flag & AUDIO_SYNC) {
if (mode)
sound_play_scene(scene);
else
@@ -282,8 +276,7 @@ struct bSound* sound_new_limiter(struct Main *bmain, struct bSound *source, floa
void sound_delete(struct Main *bmain, struct bSound* sound)
{
- if (sound)
- {
+ if (sound) {
sound_free(sound);
free_libblock(&bmain->sound, sound);
@@ -312,8 +305,7 @@ void sound_cache_notifying(struct Main* main, struct bSound* sound)
void sound_delete_cache(struct bSound* sound)
{
sound->flags &= ~SOUND_FLAGS_CACHING;
- if (sound->cache)
- {
+ if (sound->cache) {
AUD_unload(sound->cache);
sound->cache = NULL;
sound->playback_handle = sound->handle;
@@ -322,16 +314,13 @@ void sound_delete_cache(struct bSound* sound)
void sound_load(struct Main *bmain, struct bSound* sound)
{
- if (sound)
- {
- if (sound->cache)
- {
+ if (sound) {
+ if (sound->cache) {
AUD_unload(sound->cache);
sound->cache = NULL;
}
- if (sound->handle)
- {
+ if (sound->handle) {
AUD_unload(sound->handle);
sound->handle = NULL;
sound->playback_handle = NULL;
@@ -341,7 +330,7 @@ void sound_load(struct Main *bmain, struct bSound* sound)
// XXX unused currently
#if 0
- switch(sound->type)
+ switch (sound->type)
{
case SOUND_TYPE_FILE:
#endif
@@ -376,15 +365,13 @@ void sound_load(struct Main *bmain, struct bSound* sound)
break;
}
#endif
- if (sound->flags & SOUND_FLAGS_MONO)
- {
+ if (sound->flags & SOUND_FLAGS_MONO) {
void* handle = AUD_monoSound(sound->handle);
AUD_unload(sound->handle);
sound->handle = handle;
}
- if (sound->flags & SOUND_FLAGS_CACHING)
- {
+ if (sound->flags & SOUND_FLAGS_CACHING) {
sound->cache = AUD_bufferSound(sound->handle);
}
@@ -557,14 +544,12 @@ void sound_play_scene(struct Scene *scene)
if (status == AUD_STATUS_INVALID)
sound_start_play_scene(scene);
- if (!scene->sound_scene_handle)
- {
+ if (!scene->sound_scene_handle) {
AUD_unlock();
return;
}
- if (status != AUD_STATUS_PLAYING)
- {
+ if (status != AUD_STATUS_PLAYING) {
AUD_seek(scene->sound_scene_handle, CFRA / FPS);
AUD_resume(scene->sound_scene_handle);
}
@@ -577,8 +562,7 @@ void sound_play_scene(struct Scene *scene)
void sound_stop_scene(struct Scene *scene)
{
- if (scene->sound_scene_handle)
- {
+ if (scene->sound_scene_handle) {
AUD_pause(scene->sound_scene_handle);
if (scene->audio.flag & AUDIO_SYNC)
@@ -596,12 +580,10 @@ void sound_seek_scene(struct Main *bmain, struct Scene *scene)
status = scene->sound_scene_handle ? AUD_getStatus(scene->sound_scene_handle) : AUD_STATUS_INVALID;
- if (status == AUD_STATUS_INVALID)
- {
+ if (status == AUD_STATUS_INVALID) {
sound_start_play_scene(scene);
- if (!scene->sound_scene_handle)
- {
+ if (!scene->sound_scene_handle) {
AUD_unlock();
return;
}
@@ -616,10 +598,8 @@ void sound_seek_scene(struct Main *bmain, struct Scene *scene)
}
}
- if (scene->audio.flag & AUDIO_SCRUB && !animation_playing)
- {
- if (scene->audio.flag & AUDIO_SYNC)
- {
+ if (scene->audio.flag & AUDIO_SCRUB && !animation_playing) {
+ if (scene->audio.flag & AUDIO_SYNC) {
AUD_seek(scene->sound_scene_handle, CFRA / FPS);
AUD_seekSequencer(scene->sound_scene_handle, CFRA / FPS);
}
@@ -648,8 +628,7 @@ void sound_seek_scene(struct Main *bmain, struct Scene *scene)
float sound_sync_scene(struct Scene *scene)
{
- if (scene->sound_scene_handle)
- {
+ if (scene->sound_scene_handle) {
if (scene->audio.flag & AUDIO_SYNC)
return AUD_getSequencerPosition(scene->sound_scene_handle);
else
@@ -668,8 +647,7 @@ int sound_scene_playing(struct Scene *scene)
void sound_free_waveform(struct bSound* sound)
{
- if (sound->waveform)
- {
+ if (sound->waveform) {
MEM_freeN(((SoundWaveform*)sound->waveform)->data);
MEM_freeN(sound->waveform);
}
@@ -683,8 +661,7 @@ void sound_read_waveform(struct bSound* sound)
info = AUD_getInfo(sound->playback_handle);
- if (info.length > 0)
- {
+ if (info.length > 0) {
SoundWaveform* waveform = MEM_mallocN(sizeof(SoundWaveform), "SoundWaveform");
int length = info.length * SOUND_WAVE_SAMPLES_PER_SECOND;
@@ -709,23 +686,16 @@ void sound_update_scene(struct Scene* scene)
void* handle;
float quat[4];
- for (SETLOOPER(scene, sce_it, base))
- {
+ for (SETLOOPER(scene, sce_it, base)) {
ob = base->object;
- if (ob->type == OB_SPEAKER)
- {
- if (ob->adt)
- {
- for (track = ob->adt->nla_tracks.first; track; track = track->next)
- {
- for (strip = track->strips.first; strip; strip = strip->next)
- {
- if (strip->type == NLASTRIP_TYPE_SOUND)
- {
+ if (ob->type == OB_SPEAKER) {
+ if (ob->adt) {
+ for (track = ob->adt->nla_tracks.first; track; track = track->next) {
+ for (strip = track->strips.first; strip; strip = strip->next) {
+ if (strip->type == NLASTRIP_TYPE_SOUND) {
speaker = (Speaker*)ob->data;
- if (AUD_removeSet(scene->speaker_handles, strip->speaker_handle))
- {
+ if (AUD_removeSet(scene->speaker_handles, strip->speaker_handle)) {
if (speaker->sound)
AUD_moveSequence(strip->speaker_handle, strip->start / FPS, -1, 0);
else {
@@ -734,15 +704,13 @@ void sound_update_scene(struct Scene* scene)
}
}
else {
- if (speaker->sound)
- {
+ if (speaker->sound) {
strip->speaker_handle = AUD_addSequence(scene->sound_scene, speaker->sound->playback_handle, strip->start / FPS, -1, 0);
AUD_setRelativeSequence(strip->speaker_handle, 0);
}
}
- if (strip->speaker_handle)
- {
+ if (strip->speaker_handle) {
AUD_addSet(new_set, strip->speaker_handle);
AUD_updateSequenceData(strip->speaker_handle, speaker->volume_max,
speaker->volume_min, speaker->distance_max,
@@ -765,13 +733,11 @@ void sound_update_scene(struct Scene* scene)
}
}
- while ((handle = AUD_getSet(scene->speaker_handles)))
- {
+ while ((handle = AUD_getSet(scene->speaker_handles))) {
AUD_removeSequence(scene->sound_scene, handle);
}
- if (scene->camera)
- {
+ if (scene->camera) {
mat4_to_quat(quat, scene->camera->obmat);
AUD_setSequencerAnimData(scene->sound_scene, AUD_AP_LOCATION, CFRA, scene->camera->obmat[3], 1);
AUD_setSequencerAnimData(scene->sound_scene, AUD_AP_ORIENTATION, CFRA, quat, 1);
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 83a24f6afdc..129d3a3f698 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -314,7 +314,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
MLoop *ml = mloop + mp->loopstart;
BLI_array_empty(fverts);
- BLI_array_growitems(fverts, nverts);
+ BLI_array_grow_items(fverts, nverts);
get_face_uv_map_vert(vmap, mpoly, ml, i, fverts);
@@ -350,7 +350,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
CCGFace *f;
BLI_array_empty(fverts);
- BLI_array_growitems(fverts, nverts);
+ BLI_array_grow_items(fverts, nverts);
get_face_uv_map_vert(vmap, mpoly, ml, i, fverts);
ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), nverts, fverts, &f);
@@ -583,7 +583,7 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
CCGFace *f;
BLI_array_empty(fVerts);
- BLI_array_growitems(fVerts, mp->totloop);
+ BLI_array_grow_items(fVerts, mp->totloop);
ml = mloop + mp->loopstart;
for (j = 0; j < mp->totloop; j++, ml++) {
@@ -2423,7 +2423,9 @@ static void ccgDM_release(DerivedMesh *dm)
/* Check that mmd still exists */
if (!ccgdm->multires.local_mmd &&
BLI_findindex(&ccgdm->multires.ob->modifiers, ccgdm->multires.mmd) < 0)
+ {
ccgdm->multires.mmd = NULL;
+ }
if (ccgdm->multires.mmd) {
if (ccgdm->multires.modified_flags & MULTIRES_COORDS_MODIFIED)
@@ -3148,13 +3150,13 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
*((int *)ccgSubSurf_getFaceUserData(ss, f)) = vertNum;
BLI_array_empty(loopidx);
- BLI_array_growitems(loopidx, numVerts);
+ BLI_array_grow_items(loopidx, numVerts);
for (s = 0; s < numVerts; s++) {
loopidx[s] = loopindex++;
}
BLI_array_empty(vertidx);
- BLI_array_growitems(vertidx, numVerts);
+ BLI_array_grow_items(vertidx, numVerts);
for (s = 0; s < numVerts; s++) {
CCGVert *v = ccgSubSurf_getFaceVert(f, s);
vertidx[s] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 1197ec23907..31278ab53aa 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -598,8 +598,8 @@ void clear_text(Text *text) /* called directly from rna */
int oldstate;
oldstate = txt_get_undostate( );
- txt_set_undostate( 1 );
- txt_sel_all( text );
+ txt_set_undostate(1);
+ txt_sel_all(text);
txt_delete_sel(text);
txt_set_undostate(oldstate);
@@ -666,7 +666,7 @@ static TextLine *txt_new_linen(const char *str, int n)
return tmp;
}
-void txt_clean_text (Text *text)
+void txt_clean_text(Text *text)
{
TextLine **top, **bot;
@@ -697,7 +697,7 @@ void txt_clean_text (Text *text)
}
}
-int txt_get_span (TextLine *from, TextLine *to)
+int txt_get_span(TextLine *from, TextLine *to)
{
int ret=0;
TextLine *tmp= from;
@@ -1022,7 +1022,7 @@ void txt_jump_right(Text *text, short sel)
if (!undoing) txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, txt_get_span(text->lines.first, oldl), oldc, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
}
-void txt_move_bol (Text *text, short sel)
+void txt_move_bol(Text *text, short sel)
{
TextLine **linep;
int *charp, old;
@@ -1039,7 +1039,7 @@ void txt_move_bol (Text *text, short sel)
if (!undoing) txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, txt_get_span(text->lines.first, *linep), old, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
}
-void txt_move_eol (Text *text, short sel)
+void txt_move_eol(Text *text, short sel)
{
TextLine **linep;
int *charp, old;
@@ -1056,7 +1056,7 @@ void txt_move_eol (Text *text, short sel)
if (!undoing) txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, txt_get_span(text->lines.first, *linep), old, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
}
-void txt_move_bof (Text *text, short sel)
+void txt_move_bof(Text *text, short sel)
{
TextLine **linep;
int *charp, old;
@@ -1074,7 +1074,7 @@ void txt_move_bof (Text *text, short sel)
if (!undoing) txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, txt_get_span(text->lines.first, *linep), old, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
}
-void txt_move_eof (Text *text, short sel)
+void txt_move_eof(Text *text, short sel)
{
TextLine **linep;
int *charp, old;
@@ -1092,13 +1092,13 @@ void txt_move_eof (Text *text, short sel)
if (!undoing) txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, txt_get_span(text->lines.first, *linep), old, txt_get_span(text->lines.first, *linep), (unsigned short)*charp);
}
-void txt_move_toline (Text *text, unsigned int line, short sel)
+void txt_move_toline(Text *text, unsigned int line, short sel)
{
txt_move_to(text, line, 0, sel);
}
/* Moves to a certain byte in a line, not a certain utf8-character! */
-void txt_move_to (Text *text, unsigned int line, unsigned int ch, short sel)
+void txt_move_to(Text *text, unsigned int line, unsigned int ch, short sel)
{
TextLine **linep, *oldl;
int *charp, oldc;
@@ -1180,7 +1180,7 @@ static void txt_pop_last (Text *text)
/* never used: CVS 1.19 */
/* static void txt_pop_selr (Text *text) */
-void txt_pop_sel (Text *text)
+void txt_pop_sel(Text *text)
{
text->sell= text->curl;
text->selc= text->curc;
@@ -1193,9 +1193,11 @@ void txt_order_cursors(Text *text)
if (!text->sell) return;
/* Flip so text->curl is before text->sell */
- if (txt_get_span(text->curl, text->sell)<0 ||
- (text->curl==text->sell && text->curc>text->selc))
+ if ((txt_get_span(text->curl, text->sell) < 0) ||
+ (text->curl == text->sell && text->curc > text->selc))
+ {
txt_curs_swap(text);
+ }
}
int txt_has_sel(Text *text)
@@ -1266,7 +1268,7 @@ static void txt_delete_sel (Text *text)
text->selc= text->curc;
}
-void txt_sel_all (Text *text)
+void txt_sel_all(Text *text)
{
if (!text) return;
@@ -1277,7 +1279,7 @@ void txt_sel_all (Text *text)
text->selc= text->sell->len;
}
-void txt_sel_line (Text *text)
+void txt_sel_line(Text *text)
{
if (!text) return;
if (!text->curl) return;
@@ -2018,7 +2020,7 @@ void txt_do_undo(Text *text)
undoing= 1;
- switch(op) {
+ switch (op) {
case UNDO_CLEFT:
txt_move_right(text, 0);
break;
@@ -2205,6 +2207,9 @@ void txt_do_undo(Text *text)
text->undo_pos--;
break;
+ case UNDO_DUPLICATE:
+ txt_delete_line(text, text->curl->next);
+ break;
default:
//XXX error("Undo buffer error - resetting");
text->undo_pos= -1;
@@ -2245,7 +2250,7 @@ void txt_do_redo(Text *text)
undoing= 1;
- switch(op) {
+ switch (op) {
case UNDO_CLEFT:
txt_move_left(text, 0);
break;
@@ -2402,6 +2407,9 @@ void txt_do_redo(Text *text)
txt_uncomment(text);
}
break;
+ case UNDO_DUPLICATE:
+ txt_duplicate_line(text);
+ break;
default:
//XXX error("Undo buffer error - resetting");
text->undo_pos= -1;
@@ -2416,7 +2424,7 @@ void txt_do_redo(Text *text)
/* Line editing functions */
/**************************/
-void txt_split_curline (Text *text)
+void txt_split_curline(Text *text)
{
TextLine *ins;
TextMarker *mrk;
@@ -2543,6 +2551,23 @@ static void txt_combine_lines (Text *text, TextLine *linea, TextLine *lineb)
txt_clean_text(text);
}
+void txt_duplicate_line(Text *text)
+{
+ TextLine *textline;
+
+ if (!text || !text->curl) return;
+
+ if (text->curl == text->sell) {
+ textline = txt_new_line(text->curl->line);
+ BLI_insertlinkafter(&text->lines, text->curl, textline);
+
+ txt_make_dirty(text);
+ txt_clean_text(text);
+
+ if (!undoing) txt_undo_add_op(text, UNDO_DUPLICATE);
+ }
+}
+
void txt_delete_char(Text *text)
{
unsigned int c='\n';
@@ -2600,13 +2625,13 @@ void txt_delete_char(Text *text)
if (!undoing) txt_undo_add_charop(text, UNDO_DEL_1, c);
}
-void txt_delete_word (Text *text)
+void txt_delete_word(Text *text)
{
txt_jump_right(text, 1);
txt_delete_sel(text);
}
-void txt_backspace_char (Text *text)
+void txt_backspace_char(Text *text)
{
unsigned int c='\n';
@@ -2669,7 +2694,7 @@ void txt_backspace_char (Text *text)
if (!undoing) txt_undo_add_charop(text, UNDO_BS_1, c);
}
-void txt_backspace_word (Text *text)
+void txt_backspace_word(Text *text)
{
txt_jump_left(text, 1);
txt_delete_sel(text);
@@ -2743,12 +2768,12 @@ static int txt_add_char_intern (Text *text, unsigned int add, int replace_tabs)
return 1;
}
-int txt_add_char (Text *text, unsigned int add)
+int txt_add_char(Text *text, unsigned int add)
{
return txt_add_char_intern(text, add, text->flags & TXT_TABSTOSPACES);
}
-int txt_add_raw_char (Text *text, unsigned int add)
+int txt_add_raw_char(Text *text, unsigned int add)
{
return txt_add_char_intern(text, add, 0);
}
@@ -2759,7 +2784,7 @@ void txt_delete_selected(Text *text)
txt_make_dirty(text);
}
-int txt_replace_char (Text *text, unsigned int add)
+int txt_replace_char(Text *text, unsigned int add)
{
unsigned int del;
size_t del_size = 0, add_size;
@@ -2832,8 +2857,7 @@ void txt_indent(Text *text)
}
num = 0;
- while (TRUE)
- {
+ while (TRUE) {
tmp= MEM_mallocN(text->curl->len+indentlen+1, "textline_string");
text->curc = 0;
@@ -2851,8 +2875,7 @@ void txt_indent(Text *text)
txt_make_dirty(text);
txt_clean_text(text);
- if (text->curl == text->sell)
- {
+ if (text->curl == text->sell) {
text->selc = text->sell->len;
break;
}
@@ -2862,14 +2885,12 @@ void txt_indent(Text *text)
}
}
text->curc = 0;
- while ( num > 0 )
- {
+ while ( num > 0 ) {
text->curl = text->curl->prev;
num--;
}
- if (!undoing)
- {
+ if (!undoing) {
txt_undo_add_toop(text, UNDO_INDENT, txt_get_span(text->lines.first, text->curl), text->curc, txt_get_span(text->lines.first, text->sell), text->selc);
}
}
@@ -2893,12 +2914,10 @@ void txt_unindent(Text *text)
indent = spaceslen;
}
- while (TRUE)
- {
+ while (TRUE) {
int i = 0;
- if (BLI_strncasecmp(text->curl->line, remove, indent) == 0)
- {
+ if (BLI_strncasecmp(text->curl->line, remove, indent) == 0) {
while (i< text->curl->len) {
text->curl->line[i]= text->curl->line[i+indent];
i++;
@@ -2909,8 +2928,7 @@ void txt_unindent(Text *text)
txt_make_dirty(text);
txt_clean_text(text);
- if (text->curl == text->sell)
- {
+ if (text->curl == text->sell) {
text->selc = text->sell->len;
break;
}
@@ -2921,14 +2939,12 @@ void txt_unindent(Text *text)
}
text->curc = 0;
- while ( num > 0 )
- {
+ while ( num > 0 ) {
text->curl = text->curl->prev;
num--;
}
- if (!undoing)
- {
+ if (!undoing) {
txt_undo_add_toop(text, UNDO_UNINDENT, txt_get_span(text->lines.first, text->curl), text->curc, txt_get_span(text->lines.first, text->sell), text->selc);
}
}
@@ -2944,8 +2960,7 @@ void txt_comment(Text *text)
if (!text->sell) return;// Need to change this need to check if only one line is selected to more then one
num = 0;
- while (TRUE)
- {
+ while (TRUE) {
tmp= MEM_mallocN(text->curl->len+2, "textline_string");
text->curc = 0;
@@ -2963,8 +2978,7 @@ void txt_comment(Text *text)
txt_make_dirty(text);
txt_clean_text(text);
- if (text->curl == text->sell)
- {
+ if (text->curl == text->sell) {
text->selc = text->sell->len;
break;
}
@@ -2974,14 +2988,12 @@ void txt_comment(Text *text)
}
}
text->curc = 0;
- while ( num > 0 )
- {
+ while ( num > 0 ) {
text->curl = text->curl->prev;
num--;
}
- if (!undoing)
- {
+ if (!undoing) {
txt_undo_add_toop(text, UNDO_COMMENT, txt_get_span(text->lines.first, text->curl), text->curc, txt_get_span(text->lines.first, text->sell), text->selc);
}
}
@@ -2995,12 +3007,10 @@ void txt_uncomment(Text *text)
if (!text->curl) return;
if (!text->sell) return;
- while (TRUE)
- {
+ while (TRUE) {
int i = 0;
- if (text->curl->line[i] == remove)
- {
+ if (text->curl->line[i] == remove) {
while (i< text->curl->len) {
text->curl->line[i]= text->curl->line[i+1];
i++;
@@ -3012,8 +3022,7 @@ void txt_uncomment(Text *text)
txt_make_dirty(text);
txt_clean_text(text);
- if (text->curl == text->sell)
- {
+ if (text->curl == text->sell) {
text->selc = text->sell->len;
break;
}
@@ -3024,19 +3033,17 @@ void txt_uncomment(Text *text)
}
text->curc = 0;
- while ( num > 0 )
- {
+ while ( num > 0 ) {
text->curl = text->curl->prev;
num--;
}
- if (!undoing)
- {
+ if (!undoing) {
txt_undo_add_toop(text, UNDO_UNCOMMENT, txt_get_span(text->lines.first, text->curl), text->curc, txt_get_span(text->lines.first, text->sell), text->selc);
}
}
-int setcurr_tab_spaces (Text *text, int space)
+int setcurr_tab_spaces(Text *text, int space)
{
int i = 0;
int test = 0;
@@ -3047,27 +3054,23 @@ int setcurr_tab_spaces (Text *text, int space)
if (!text) return 0;
if (!text->curl) return 0;
- while (text->curl->line[i] == indent)
- {
+ while (text->curl->line[i] == indent) {
//we only count those tabs/spaces that are before any text or before the curs;
- if (i == text->curc)
- {
+ if (i == text->curc) {
return i;
}
else {
i++;
}
}
- if (strstr(text->curl->line, word))
- {
+ if (strstr(text->curl->line, word)) {
/* if we find a ':' on this line, then add a tab but not if it is:
* 1) in a comment
* 2) within an identifier
* 3) after the cursor (text->curc), i.e. when creating space before a function def [#25414]
*/
int a, is_indent = 0;
- for (a=0; (a < text->curc) && (text->curl->line[a] != '\0'); a++)
- {
+ for (a=0; (a < text->curc) && (text->curl->line[a] != '\0'); a++) {
char ch= text->curl->line[a];
if (ch=='#') {
break;
@@ -3084,13 +3087,10 @@ int setcurr_tab_spaces (Text *text, int space)
}
}
- for (test=0; back_words[test]; test++)
- {
+ for (test=0; back_words[test]; test++) {
/* if there are these key words then remove a tab because we are done with the block */
- if (strstr(text->curl->line, back_words[test]) && i > 0)
- {
- if (strcspn(text->curl->line, back_words[test]) < strcspn(text->curl->line, comm))
- {
+ if (strstr(text->curl->line, back_words[test]) && i > 0) {
+ if (strcspn(text->curl->line, back_words[test]) < strcspn(text->curl->line, comm)) {
i -= space;
}
}
@@ -3139,14 +3139,16 @@ TextMarker *txt_find_marker_region(Text *text, TextLine *line, int start, int en
for (marker=text->markers.first; marker; marker=next) {
next= marker->next;
- if (group && marker->group != group) continue;
+ if (group && marker->group != group) continue;
else if ((marker->flags & flags) != flags) continue;
- else if (marker->lineno < lineno) continue;
+ else if (marker->lineno < lineno) continue;
else if (marker->lineno > lineno) break;
if ((marker->start==marker->end && start<=marker->start && marker->start<=end) ||
- (marker->start<end && marker->end>start))
+ (marker->start<end && marker->end>start))
+ {
return marker;
+ }
}
return NULL;
}
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 23d818369a2..9200b1dca18 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -342,7 +342,7 @@ ColorBand *add_colorband(int rangetype)
{
ColorBand *coba;
- coba= MEM_callocN( sizeof(ColorBand), "colorband");
+ coba= MEM_callocN(sizeof(ColorBand), "colorband");
init_colorband(coba, rangetype);
return coba;
@@ -663,7 +663,7 @@ void default_tex(Tex *tex)
void tex_set_type(Tex *tex, int type)
{
- switch(type) {
+ switch (type) {
case TEX_VOXELDATA:
if (tex->vd == NULL)
@@ -1056,8 +1056,8 @@ void make_local_texture(Tex *tex)
void autotexname(Tex *tex)
{
Main *bmain= G.main;
- char texstr[20][15]= {"None" , "Clouds" , "Wood", "Marble", "Magic" , "Blend",
- "Stucci", "Noise" , "Image", "Plugin", "EnvMap" , "Musgrave",
+ char texstr[20][15]= {"None", "Clouds", "Wood", "Marble", "Magic", "Blend",
+ "Stucci", "Noise", "Image", "Plugin", "EnvMap", "Musgrave",
"Voronoi", "DistNoise", "Point Density", "Voxel Data", "Ocean", "", "", ""};
Image *ima;
char di[FILE_MAXDIR], fi[FILE_MAXFILE];
@@ -1180,7 +1180,7 @@ Tex *give_current_material_texture(Material *ma)
int give_active_mtex(ID *id, MTex ***mtex_ar, short *act)
{
- switch(GS(id->name)) {
+ switch (GS(id->name)) {
case ID_MA:
*mtex_ar= ((Material *)id)->mtex;
if (act) *act= (((Material *)id)->texact);
@@ -1211,7 +1211,7 @@ void set_active_mtex(ID *id, short act)
if (act<0) act= 0;
else if (act>=MAX_MTEX) act= MAX_MTEX-1;
- switch(GS(id->name)) {
+ switch (GS(id->name)) {
case ID_MA:
((Material *)id)->texact= act;
break;
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 7654c361d14..e511cd362de 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -1523,6 +1523,7 @@ typedef struct MovieReconstructContext {
#endif
char object_name[MAX_NAME];
int is_camera;
+ short motion_flag;
float focal_length;
float principal_point[2];
@@ -1752,7 +1753,11 @@ int BKE_tracking_can_reconstruct(MovieTracking *tracking, MovieTrackingObject *o
#if WITH_LIBMV
ListBase *tracksbase = BKE_tracking_object_tracks(tracking, object);
- if (count_tracks_on_both_keyframes(tracking, tracksbase)<8) {
+ if (tracking->settings.motion_flag & TRACKING_MOTION_MODAL) {
+ /* TODO: check for number of tracks? */
+ return TRUE;
+ }
+ else if (count_tracks_on_both_keyframes(tracking, tracksbase) < 8) {
BLI_strncpy(error_msg, "At least 8 common tracks on both of keyframes are needed for reconstruction", error_size);
return FALSE;
@@ -1781,7 +1786,8 @@ MovieReconstructContext* BKE_tracking_reconstruction_context_new(MovieTracking *
MovieTrackingTrack *track;
BLI_strncpy(context->object_name, object->name, sizeof(context->object_name));
- context->is_camera = object->flag&TRACKING_OBJECT_CAMERA;
+ context->is_camera = object->flag & TRACKING_OBJECT_CAMERA;
+ context->motion_flag = tracking->settings.motion_flag;
context->tracks_map = tracks_map_new(context->object_name, context->is_camera, num_tracks, 0);
@@ -1894,13 +1900,22 @@ void BKE_tracking_solve_reconstruction(MovieReconstructContext *context, short *
progressdata.stats_message = stats_message;
progressdata.message_size = message_size;
- context->reconstruction = libmv_solveReconstruction(context->tracks,
- context->keyframe1, context->keyframe2,
- context->refine_flags,
- context->focal_length,
- context->principal_point[0], context->principal_point[1],
- context->k1, context->k2, context->k3,
- solve_reconstruction_update_cb, &progressdata);
+ if (context->motion_flag & TRACKING_MOTION_MODAL) {
+ context->reconstruction = libmv_solveModal(context->tracks,
+ context->focal_length,
+ context->principal_point[0], context->principal_point[1],
+ context->k1, context->k2, context->k3,
+ solve_reconstruction_update_cb, &progressdata);
+ }
+ else {
+ context->reconstruction = libmv_solveReconstruction(context->tracks,
+ context->keyframe1, context->keyframe2,
+ context->refine_flags,
+ context->focal_length,
+ context->principal_point[0], context->principal_point[1],
+ context->k1, context->k2, context->k3,
+ solve_reconstruction_update_cb, &progressdata);
+ }
error = libmv_reprojectionError(context->reconstruction);
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index 48e939be7e9..03afc97f324 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -251,7 +251,7 @@ static struct bUnitDef buNaturalTimeDef[] = {
{"hour", "hours", "hr", "h", "Hours", 3600.0, 0.0, B_UNIT_DEF_NONE},
{"minute", "minutes", "min", "m", "Minutes", 60.0, 0.0, B_UNIT_DEF_NONE},
{"second", "seconds", "sec", "s", "Seconds", 1.0, 0.0, B_UNIT_DEF_NONE}, /* base unit */
- {"millisecond", "milliseconds", "ms", NULL, "Milliseconds", 0.001, 0.0 , B_UNIT_DEF_NONE},
+ {"millisecond", "milliseconds", "ms", NULL, "Milliseconds", 0.001, 0.0, B_UNIT_DEF_NONE},
{"microsecond", "microseconds", "µs", "us", "Microseconds", 0.000001, 0.0, B_UNIT_DEF_NONE},
{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
};
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 59c38117858..079bde0afec 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -120,19 +120,17 @@ static int write_audio_frame(void)
audio_time += (double) audio_input_samples / (double) c->sample_rate;
pkt.size = avcodec_encode_audio(c, audio_output_buffer,
- audio_outbuf_size,
- (short*) audio_input_buffer);
+ audio_outbuf_size,
+ (short *)audio_input_buffer);
- if (pkt.size < 0)
- {
+ if (pkt.size < 0) {
// XXX error("Error writing audio packet");
return -1;
}
pkt.data = audio_output_buffer;
- if (c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE)
- {
+ if (c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE) {
pkt.pts = av_rescale_q(c->coded_frame->pts,
c->time_base, audio_stream->time_base);
fprintf(stderr, "Audio Frame PTS: %d\n", (int)pkt.pts);
@@ -175,7 +173,7 @@ static AVFrame* alloc_picture(int pix_fmt, int width, int height)
* first is always desired guess_format parameter */
static const char** get_file_extensions(int format)
{
- switch(format) {
+ switch (format) {
case FFMPEG_DV: {
static const char * rv[] = { ".dv", NULL };
return rv;
@@ -372,7 +370,7 @@ static void set_ffmpeg_property_option(AVCodecContext* c, IDProperty * prop)
*param++ = 0;
}
- switch(prop->type) {
+ switch (prop->type) {
case IDP_STRING:
fprintf(stderr, "%s.\n", IDP_String(prop));
av_set_string3(c, prop->name, IDP_String(prop), 1, &rv);
@@ -717,7 +715,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
BLI_snprintf(of->filename, sizeof(of->filename), "%s", name);
/* set the codec to the user's selection */
- switch(ffmpeg_type) {
+ switch (ffmpeg_type) {
case FFMPEG_AVI:
case FFMPEG_MOV:
case FFMPEG_MKV:
@@ -929,8 +927,7 @@ int start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty, Repo
success = start_ffmpeg_impl(rd, rectx, recty, reports);
#ifdef WITH_AUDASPACE
- if (audio_stream)
- {
+ if (audio_stream) {
AVCodecContext* c = audio_stream->codec;
AUD_DeviceSpecs specs;
specs.channels = c->channels;
@@ -974,8 +971,7 @@ int append_ffmpeg(RenderData *rd, int start_frame, int frame, int *pixels, int r
// why is this done before writing the video frame and again at end_ffmpeg?
// write_audio_frames(frame / (((double)rd->frs_sec) / rd->frs_sec_base));
- if (video_stream)
- {
+ if (video_stream) {
avframe= generate_video_frame((unsigned char*) pixels, reports);
success= (avframe && write_video_frame(rd, frame - start_frame, avframe, reports));
@@ -1172,10 +1168,12 @@ static const AVOption *my_av_find_opt(void *v, const char *name,
const AVOption *o= c->option;
for (;o && o->name; o++) {
- if (!strcmp(o->name, name) &&
- (!unit || (o->unit && !strcmp(o->unit, unit))) &&
- (o->flags & mask) == flags )
+ if (!strcmp(o->name, name) &&
+ (!unit || (o->unit && !strcmp(o->unit, unit))) &&
+ (o->flags & mask) == flags)
+ {
return o;
+ }
}
return NULL;
}
diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c
index 62e921f3311..6c818965e9a 100644
--- a/source/blender/blenkernel/intern/writeframeserver.c
+++ b/source/blender/blenkernel/intern/writeframeserver.c
@@ -70,7 +70,7 @@ static int render_height;
static int startup_socket_system(void)
{
WSADATA wsa;
- return (WSAStartup(MAKEWORD(2,0),&wsa) == 0);
+ return (WSAStartup(MAKEWORD(2, 0), &wsa) == 0);
}
static void shutdown_socket_system(void)
diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h
index dac0143b5b6..7069732eeb6 100644
--- a/source/blender/blenlib/BLI_array.h
+++ b/source/blender/blenlib/BLI_array.h
@@ -44,7 +44,7 @@
* int i;
*
* for (i=0; i<10; i++) {
- * BLI_array_growone(arr);
+ * BLI_array_grow_one(arr);
* arr[i] = something;
* }
* BLI_array_free(arr);
@@ -116,32 +116,32 @@
)
/* grow an array by a specified number of items */
-#define BLI_array_growitems(arr, num) ( \
+#define BLI_array_grow_items(arr, num) ( \
((void *)(arr) == NULL && (void *)(_##arr##_static) != NULL) ? \
((arr = (void*)_##arr##_static), (_##arr##_count += num)) : \
_bli_array_grow_items(arr, num) \
)
/* returns length of array */
-#define BLI_array_growone(arr) BLI_array_growitems(arr, 1)
+#define BLI_array_grow_one(arr) BLI_array_grow_items(arr, 1)
/* appends an item to the array. */
#define BLI_array_append(arr, item) ( \
- (void) BLI_array_growone(arr), \
+ (void) BLI_array_grow_one(arr), \
(void) (arr[_##arr##_count - 1] = item) \
)
/* appends an item to the array and returns a pointer to the item in the array.
* item is not a pointer, but actual data value.*/
#define BLI_array_append_r(arr, item) ( \
- (void) BLI_array_growone(arr), \
+ (void) BLI_array_grow_one(arr), \
(void) (arr[_##arr##_count - 1] = item), \
(&arr[_##arr##_count - 1]) \
)
#define BLI_array_reserve(arr, num) \
- BLI_array_growitems(arr, num), (void)(_##arr##_count -= (num))
+ BLI_array_grow_items(arr, num), (void)(_##arr##_count -= (num))
#define BLI_array_free(arr) \
@@ -163,7 +163,7 @@
/* set the count of the array, doesn't actually increase the allocated array
* size. don't use this unless you know what you're doing. */
-#define BLI_array_set_length(arr, count) \
+#define BLI_array_length_set(arr, count) \
_##arr##_count = (count)
/* only to prevent unused warnings */
diff --git a/source/blender/blenlib/BLI_editVert.h b/source/blender/blenlib/BLI_editVert.h
deleted file mode 100644
index 0f754d5fc98..00000000000
--- a/source/blender/blenlib/BLI_editVert.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * ***** 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 __BLI_EDITVERT_H__
-#define __BLI_EDITVERT_H__
-
-/** \file BLI_editVert.h
- * \ingroup bli
- * \since March 2001
- * \author nzc
- * \brief Some editing types needed in the lib (unfortunately) for
- * scanfill.c
- */
-
-#include "DNA_customdata_types.h"
-#include "DNA_mesh_types.h"
-
-#include "BLO_sys_types.h" // for intptr_t support
-
-struct DerivedMesh;
-
-/* note; changing this also might affect the undo copy in editmesh.c */
-typedef struct EditVert
-{
- struct EditVert *next, *prev;
- union {
- /* some lean storage for temporary usage
- * in editmesh routines
- */
- struct EditVert *v;
- struct EditEdge *e;
- struct EditFace *f;
- void *p;
- intptr_t l;
- float fp;
- int t;
- } tmp;
- float no[3]; /*vertex normal */
- float co[3]; /*vertex location */
- short xs, ys; /* used to store a screenspace 2d projection of the verts */
-
- /* f stores selection eg. if (eve->f & SELECT) {...
- * h for hidden. if (!eve->h) {...
- * f1 and f2 can be used for temp data, clear them first*/
- unsigned char f, h, f1, f2;
- float bweight;
- short fast; /* only 0 or 1, for editmesh_fastmalloc, do not store temp data here! */
- int hash; /* internal editmesh.c use only, don't touch! */
- int keyindex; /* original index #, for restoring key information */
-
- void *data; /* custom vertex data */
-} EditVert;
-
-struct EditEdge;
-
-typedef struct HashEdge {
- struct EditEdge *eed;
- struct HashEdge *next;
-} HashEdge;
-
-/* note; changing this also might affect the undo copy in editmesh.c */
-typedef struct EditEdge
-{
- struct EditEdge *next, *prev;
- struct EditVert *v1, *v2;
- union {
- /* some lean storage for temporary usage
- * in editmesh routines
- */
- struct EditVert *v;
- struct EditEdge *e;
- struct EditFace *f;
- void *p;
- intptr_t l;
- float fp;
- } tmp;
- short f1, f2; /* short, f1 is (ab)used in subdiv */
- unsigned char f, h, dir, seam, sharp;
- float crease;
- float bweight;
- short fast; /* only 0 or 1, for editmesh_fastmalloc */
- short fgoni; /* index for fgon, for search */
- HashEdge hash;
- void *data; /*custom edge data*/
-} EditEdge;
-
-/* note; changing this also might affect the undo copy in editmesh.c */
-typedef struct EditFace
-{
- struct EditFace *next, *prev;
- struct EditVert *v1, *v2, *v3, *v4;
- struct EditEdge *e1, *e2, *e3, *e4;
- union {
- /* some lean storage for temporary usage
- * in editmesh routines
- */
- struct EditVert *v;
- struct EditEdge *e;
- struct EditFace *f;
- void *p;
- intptr_t l;
- float fp;
- } tmp;
- float n[3], cent[3];
- unsigned char flag;
- unsigned char f, f1, h;
- unsigned char fast; /* only 0 or 1, for editmesh_fastmalloc */
- unsigned char fgonf; /* flag for fgon options */
- short mat_nr;
- void *data; /* custom face data */
-} EditFace;
-
-
-/*selection types*/
-#define EDITVERT 0
-#define EDITEDGE 1
-#define EDITFACE 2
-
-typedef struct EditSelection
-{
- struct EditSelection *next, *prev;
- short type;
- void *data;
-} EditSelection;
-
-
-typedef struct EditMesh
-{
- ListBase verts, edges, faces;
- ListBase selected; /*EditSelections. Used to store the order in which things are selected.*/
- HashEdge *hashedgetab;
-
- /* this is for the editmesh_fastmalloc */
- EditVert *allverts, *curvert;
- EditEdge *alledges, *curedge;
- EditFace *allfaces, *curface;
- /* DerivedMesh caches... note that derived cage can be equivalent
- * to derived final, care should be taken on release.
- */
-
- /* used for keeping track of the last clicked on face - so the space image
- * when using the last selected face - (EditSelection) the space image flickered too much
- *
- * never access this directly, use EM_set_actFace and EM_get_actFace */
- EditFace *act_face;
-
- /* copy from scene */
- short selectmode;
- /* copy from object actcol */
- short mat_nr;
- /* stats */
- int totvert, totedge, totface, totvertsel, totedgesel, totfacesel;
- /* shape key being edited */
- int shapenr;
-
- struct DerivedMesh *derivedCage, *derivedFinal;
- /* the custom data layer mask that was last used to calculate
- * derivedCage and derivedFinal
- */
- int lastDataMask;
-
- CustomData vdata, edata, fdata;
-
-} EditMesh;
-
-#endif
-
diff --git a/source/blender/blenlib/BLI_fileops_types.h b/source/blender/blenlib/BLI_fileops_types.h
index 8e4b5b3e411..d9f8549e8f5 100644
--- a/source/blender/blenlib/BLI_fileops_types.h
+++ b/source/blender/blenlib/BLI_fileops_types.h
@@ -70,7 +70,7 @@ struct direntry{
struct dirlink
{
- struct dirlink *next,*prev;
+ struct dirlink *next, *prev;
char *name;
};
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h
index 457f098bff7..eaf4d442000 100644
--- a/source/blender/blenlib/BLI_ghash.h
+++ b/source/blender/blenlib/BLI_ghash.h
@@ -131,6 +131,11 @@ void BLI_ghashIterator_step (GHashIterator *ghi);
*/
int BLI_ghashIterator_isDone (GHashIterator *ghi);
+#define GHASH_ITER(gh_iter_, ghash_) \
+ for (BLI_ghashIterator_init(&gh_iter_, ghash_); \
+ !BLI_ghashIterator_isDone(&gh_iter_); \
+ BLI_ghashIterator_step(&gh_iter_))
+
/* *** */
unsigned int BLI_ghashutil_ptrhash (const void *key);
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 9b5e3638609..85129d5b68d 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -244,14 +244,14 @@ void tangent_from_uv(float uv1[2], float uv2[2], float uv3[2],
void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,
float (*rpos)[3], float *rweight,
- float lloc[3],float rloc[3],float lrot[3][3],float lscale[3][3]);
+ float lloc[3], float rloc[3], float lrot[3][3], float lscale[3][3]);
/****************************** Spherical Harmonics *************************/
/* Uses 2nd order SH => 9 coefficients, stored in this order:
- * 0 = (0,0),
- * 1 = (1,-1), 2 = (1,0), 3 = (1,1),
- * 4 = (2,-2), 5 = (2,-1), 6 = (2,0), 7 = (2,1), 8 = (2,2) */
+ * 0 = (0, 0),
+ * 1 = (1, -1), 2 = (1, 0), 3 = (1, 1),
+ * 4 = (2, -2), 5 = (2, -1), 6 = (2, 0), 7 = (2, 1), 8 = (2, 2) */
MINLINE void zero_sh(float r[9]);
MINLINE void copy_sh_sh(float r[9], const float a[9]);
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index af3df9c9ed2..249f2265440 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -126,7 +126,7 @@ MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3]);
MINLINE void add_newell_cross_v3_v3v3(float n[3], const float v_prev[3], const float v_curr[3]);
-MINLINE void star_m3_v3(float rmat[3][3],float a[3]);
+MINLINE void star_m3_v3(float rmat[3][3], float a[3]);
/*********************************** Length **********************************/
@@ -186,6 +186,7 @@ float angle_normalized_v2v2(const float a[2], const float b[2]);
float angle_v3v3(const float a[3], const float b[3]);
float angle_v3v3v3(const float a[3], const float b[3], const float c[3]);
float angle_normalized_v3v3(const float v1[3], const float v2[3]);
+float angle_on_axis_v3v3v3_v3(const float v1[3], const float v2[3], const float v3[3], const float axis[3]);
void angle_tri_v3(float angles[3], const float v1[3], const float v2[3], const float v3[3]);
void angle_quad_v3(float angles[4], const float v1[3], const float v2[3], const float v3[3], const float v4[3]);
void angle_poly_v3(float* angles, const float* verts[3], int len);
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index e02b48feda7..1d085a46a19 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -109,7 +109,7 @@ void BLI_newname(char * name, int add);
int BLI_stringdec(const char *string, char *head, char *start, unsigned short *numlen);
void BLI_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic);
int BLI_split_name_num(char *left, int *nr, const char *name, const char delim);
-void BLI_splitdirstring(char *di,char *fi);
+void BLI_splitdirstring(char *di, char *fi);
/* make sure path separators conform to system one */
void BLI_clean(char *path);
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index 3a533f73d9d..18c2aa3313c 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -79,36 +79,36 @@
#define MAX4(x,y,z,a) MAX2( MAX2((x),(y)) , MAX2((z),(a)) )
#define INIT_MINMAX(min, max) { \
- (min)[0]= (min)[1]= (min)[2]= 1.0e30f; \
- (max)[0]= (max)[1]= (max)[2]= -1.0e30f; \
+ (min)[0] = (min)[1] = (min)[2] = 1.0e30f; \
+ (max)[0] = (max)[1] = (max)[2] = -1.0e30f; \
}
#define INIT_MINMAX2(min, max) { \
- (min)[0]= (min)[1]= 1.0e30f; \
- (max)[0]= (max)[1]= -1.0e30f; \
+ (min)[0] = (min)[1] = 1.0e30f; \
+ (max)[0] = (max)[1] = -1.0e30f; \
} (void)0
#define DO_MIN(vec, min) { \
- if( (min)[0]>(vec)[0] ) (min)[0]= (vec)[0]; \
- if( (min)[1]>(vec)[1] ) (min)[1]= (vec)[1]; \
- if( (min)[2]>(vec)[2] ) (min)[2]= (vec)[2]; \
+ if ((min)[0] > (vec)[0]) (min)[0] = (vec)[0]; \
+ if ((min)[1] > (vec)[1]) (min)[1] = (vec)[1]; \
+ if ((min)[2] > (vec)[2]) (min)[2] = (vec)[2]; \
} (void)0
#define DO_MAX(vec, max) { \
- if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0]; \
- if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1]; \
- if( (max)[2]<(vec)[2] ) (max)[2]= (vec)[2]; \
+ if ((max)[0] < (vec)[0]) (max)[0] = (vec)[0]; \
+ if ((max)[1] < (vec)[1]) (max)[1] = (vec)[1]; \
+ if ((max)[2] < (vec)[2]) (max)[2] = (vec)[2]; \
} (void)0
#define DO_MINMAX(vec, min, max) { \
- if( (min)[0]>(vec)[0] ) (min)[0]= (vec)[0]; \
- if( (min)[1]>(vec)[1] ) (min)[1]= (vec)[1]; \
- if( (min)[2]>(vec)[2] ) (min)[2]= (vec)[2]; \
- if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0]; \
- if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1]; \
- if( (max)[2]<(vec)[2] ) (max)[2]= (vec)[2]; \
+ if ((min)[0] > (vec)[0] ) (min)[0] = (vec)[0]; \
+ if ((min)[1] > (vec)[1] ) (min)[1] = (vec)[1]; \
+ if ((min)[2] > (vec)[2] ) (min)[2] = (vec)[2]; \
+ if ((max)[0] < (vec)[0] ) (max)[0] = (vec)[0]; \
+ if ((max)[1] < (vec)[1] ) (max)[1] = (vec)[1]; \
+ if ((max)[2] < (vec)[2] ) (max)[2] = (vec)[2]; \
} (void)0
#define DO_MINMAX2(vec, min, max) { \
- if( (min)[0]>(vec)[0] ) (min)[0]= (vec)[0]; \
- if( (min)[1]>(vec)[1] ) (min)[1]= (vec)[1]; \
- if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0]; \
- if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1]; \
+ if ((min)[0] > (vec)[0] ) (min)[0] = (vec)[0]; \
+ if ((min)[1] > (vec)[1] ) (min)[1] = (vec)[1]; \
+ if ((max)[0] < (vec)[0] ) (max)[0] = (vec)[0]; \
+ if ((max)[1] < (vec)[1] ) (max)[1] = (vec)[1]; \
} (void)0
/* some math and copy defines */
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index c06a1240729..d4b9bc3d2bc 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -61,6 +61,7 @@ set(SRC
intern/graph.c
intern/gsqueue.c
intern/jitter.c
+ intern/lasso.c
intern/listbase.c
intern/math_base.c
intern/math_base_inline.c
@@ -90,10 +91,9 @@ set(SRC
intern/voxel.c
intern/winstuff.c
+ BLI_args.h
BLI_array.h
BLI_bitmap.h
- BLI_smallhash.h
- BLI_args.h
BLI_blenlib.h
BLI_boxpack2d.h
BLI_bpath.h
@@ -103,7 +103,6 @@ set(SRC
BLI_dynlib.h
BLI_dynstr.h
BLI_edgehash.h
- BLI_editVert.h
BLI_fileops.h
BLI_fileops_types.h
BLI_fnmatch.h
@@ -114,6 +113,7 @@ set(SRC
BLI_jitter.h
BLI_kdopbvh.h
BLI_kdtree.h
+ BLI_lasso.h
BLI_linklist.h
BLI_listbase.h
BLI_math.h
@@ -133,6 +133,7 @@ set(SRC
BLI_rand.h
BLI_rect.h
BLI_scanfill.h
+ BLI_smallhash.h
BLI_string.h
BLI_string_cursor_utf8.h
BLI_string_utf8.h
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 2cc67b3f0aa..8662406b0e9 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -129,7 +129,7 @@ static float KDOP_AXES[13][3] =
/*
* Generic push and pop heap
*/
-#define PUSH_HEAP_BODY(HEAP_TYPE,PRIORITY,heap,heap_size) \
+#define PUSH_HEAP_BODY(HEAP_TYPE, PRIORITY, heap, heap_size) \
{ \
HEAP_TYPE element = heap[heap_size-1]; \
int child = heap_size-1; \
@@ -146,7 +146,7 @@ static float KDOP_AXES[13][3] =
heap[child] = element; \
}
-#define POP_HEAP_BODY(HEAP_TYPE, PRIORITY,heap,heap_size) \
+#define POP_HEAP_BODY(HEAP_TYPE, PRIORITY, heap, heap_size) \
{ \
HEAP_TYPE element = heap[heap_size-1]; \
int parent = 0; \
@@ -177,7 +177,7 @@ static int ADJUST_MEMORY(void *local_memblock, void **memblock, int new_size, in
if (*memblock == local_memblock)
{
new_memblock = malloc( size_per_item * new_max_size );
- memcpy( new_memblock, *memblock, size_per_item * *max_size );
+ memcpy(new_memblock, *memblock, size_per_item * *max_size);
}
else
new_memblock = realloc(*memblock, size_per_item * new_max_size );
@@ -215,14 +215,12 @@ static int floor_lg(int a)
*/
static void bvh_insertionsort(BVHNode **a, int lo, int hi, int axis)
{
- int i,j;
+ int i, j;
BVHNode *t;
- for (i=lo; i < hi; i++)
- {
+ for (i=lo; i < hi; i++) {
j=i;
t = a[i];
- while ((j!=lo) && (t->bv[axis] < (a[j-1])->bv[axis]))
- {
+ while ((j!=lo) && (t->bv[axis] < (a[j-1])->bv[axis])) {
a[j] = a[j-1];
j--;
}
@@ -233,14 +231,13 @@ static void bvh_insertionsort(BVHNode **a, int lo, int hi, int axis)
static int bvh_partition(BVHNode **a, int lo, int hi, BVHNode * x, int axis)
{
int i=lo, j=hi;
- while (1)
- {
+ while (1) {
while ((a[i])->bv[axis] < x->bv[axis]) i++;
j--;
while (x->bv[axis] < (a[j])->bv[axis]) j--;
if (!(i < j))
return i;
- SWAP( BVHNode* , a[i], a[j]);
+ SWAP(BVHNode *, a[i], a[j]);
i++;
}
}
@@ -272,34 +269,30 @@ static void bvh_heapsort(BVHNode **a, int lo, int hi, int axis)
int n = hi-lo, i;
for (i=n/2; i>=1; i=i-1)
{
- bvh_downheap(a, i,n,lo, axis);
+ bvh_downheap(a, i, n, lo, axis);
}
for (i=n; i>1; i=i-1)
{
- SWAP(BVHNode*, a[lo],a[lo+i-1]);
- bvh_downheap(a, 1,i-1,lo, axis);
+ SWAP(BVHNode*, a[lo], a[lo+i-1]);
+ bvh_downheap(a, 1, i-1, lo, axis);
}
}
#endif
static BVHNode *bvh_medianof3(BVHNode **a, int lo, int mid, int hi, int axis) // returns Sortable
{
- if ((a[mid])->bv[axis] < (a[lo])->bv[axis])
- {
+ if ((a[mid])->bv[axis] < (a[lo])->bv[axis]) {
if ((a[hi])->bv[axis] < (a[mid])->bv[axis])
return a[mid];
- else
- {
+ else {
if ((a[hi])->bv[axis] < (a[lo])->bv[axis])
return a[hi];
else
return a[lo];
}
}
- else
- {
- if ((a[hi])->bv[axis] < (a[mid])->bv[axis])
- {
+ else {
+ if ((a[hi])->bv[axis] < (a[mid])->bv[axis]) {
if ((a[hi])->bv[axis] < (a[lo])->bv[axis])
return a[lo];
else
@@ -354,8 +347,7 @@ static void sort_along_axis(BVHTree *tree, int start, int end, int axis)
static int partition_nth_element(BVHNode **a, int _begin, int _end, int n, int axis)
{
int begin = _begin, end = _end, cut;
- while (end-begin > 3)
- {
+ while (end-begin > 3) {
cut = bvh_partition(a, begin, end, bvh_medianof3(a, begin, (begin+end)/2, end-1, axis), axis );
if (cut <= n)
begin = cut;
@@ -375,12 +367,11 @@ static void build_skip_links(BVHTree *tree, BVHNode *node, BVHNode *left, BVHNod
node->skip[0] = left;
node->skip[1] = right;
- for (i = 0; i < node->totnode; i++)
- {
+ for (i = 0; i < node->totnode; i++) {
if (i+1 < node->totnode)
- build_skip_links(tree, node->children[i], left, node->children[i+1] );
+ build_skip_links(tree, node->children[i], left, node->children[i + 1]);
else
- build_skip_links(tree, node->children[i], left, right );
+ build_skip_links(tree, node->children[i], left, right);
left = node->children[i];
}
@@ -396,20 +387,16 @@ static void create_kdop_hull(BVHTree *tree, BVHNode *node, const float *co, int
int i, k;
// don't init boudings for the moving case
- if (!moving)
- {
- for (i = tree->start_axis; i < tree->stop_axis; i++)
- {
- bv[2*i] = FLT_MAX;
- bv[2*i + 1] = -FLT_MAX;
+ if (!moving) {
+ for (i = tree->start_axis; i < tree->stop_axis; i++) {
+ bv[2 * i] = FLT_MAX;
+ bv[2 * i + 1] = -FLT_MAX;
}
}
- for (k = 0; k < numpoints; k++)
- {
- // for all Axes.
- for (i = tree->start_axis; i < tree->stop_axis; i++)
- {
+ for (k = 0; k < numpoints; k++) {
+ /* for all Axes. */
+ for (i = tree->start_axis; i < tree->stop_axis; i++) {
newminmax = dot_v3v3(&co[k * 3], KDOP_AXES[i]);
if (newminmax < bv[2 * i])
bv[2 * i] = newminmax;
@@ -422,22 +409,19 @@ static void create_kdop_hull(BVHTree *tree, BVHNode *node, const float *co, int
// depends on the fact that the BVH's for each face is already build
static void refit_kdop_hull(BVHTree *tree, BVHNode *node, int start, int end)
{
- float newmin,newmax;
+ float newmin, newmax;
int i, j;
float *bv = node->bv;
- for (i = tree->start_axis; i < tree->stop_axis; i++)
- {
+ for (i = tree->start_axis; i < tree->stop_axis; i++) {
bv[2*i] = FLT_MAX;
bv[2*i + 1] = -FLT_MAX;
}
- for (j = start; j < end; j++)
- {
-// for all Axes.
- for (i = tree->start_axis; i < tree->stop_axis; i++)
- {
+ for (j = start; j < end; j++) {
+ /* for all Axes. */
+ for (i = tree->start_axis; i < tree->stop_axis; i++) {
newmin = tree->nodes[j]->bv[(2 * i)];
if ((newmin < bv[(2 * i)]))
bv[(2 * i)] = newmin;
@@ -459,15 +443,13 @@ static char get_largest_axis(float *bv)
middle_point[0] = (bv[1]) - (bv[0]); // x axis
middle_point[1] = (bv[3]) - (bv[2]); // y axis
middle_point[2] = (bv[5]) - (bv[4]); // z axis
- if (middle_point[0] > middle_point[1])
- {
+ if (middle_point[0] > middle_point[1]) {
if (middle_point[0] > middle_point[2])
return 1; // max x axis
else
return 5; // max z axis
}
- else
- {
+ else {
if (middle_point[1] > middle_point[2])
return 3; // max y axis
else
@@ -481,18 +463,14 @@ static void node_join(BVHTree *tree, BVHNode *node)
{
int i, j;
- for (i = tree->start_axis; i < tree->stop_axis; i++)
- {
+ for (i = tree->start_axis; i < tree->stop_axis; i++) {
node->bv[2*i] = FLT_MAX;
node->bv[2*i + 1] = -FLT_MAX;
}
- for (i = 0; i < tree->tree_type; i++)
- {
- if (node->children[i])
- {
- for (j = tree->start_axis; j < tree->stop_axis; j++)
- {
+ for (i = 0; i < tree->tree_type; i++) {
+ if (node->children[i]) {
+ for (j = tree->start_axis; j < tree->stop_axis; j++) {
// update minimum
if (node->children[i]->bv[(2 * j)] < node->bv[(2 * j)])
node->bv[(2 * j)] = node->children[i]->bv[(2 * j)];
@@ -619,17 +597,17 @@ static void build_implicit_tree_helper(BVHTree *tree, BVHBuildHelper *data)
data->tree_type= tree->tree_type;
//Calculate the smallest tree_type^n such that tree_type^n >= num_leafs
- for (
- data->leafs_per_child[0] = 1;
- data->leafs_per_child[0] < data->totleafs;
- data->leafs_per_child[0] *= data->tree_type
- );
+ for (data->leafs_per_child[0] = 1;
+ data->leafs_per_child[0] < data->totleafs;
+ data->leafs_per_child[0] *= data->tree_type)
+ {
+ /* pass */
+ }
data->branches_on_level[0] = 1;
//We could stop the loop first (but I am lazy to find out when)
- for (depth = 1; depth < 32; depth++)
- {
+ for (depth = 1; depth < 32; depth++) {
data->branches_on_level[depth] = data->branches_on_level[depth-1] * data->tree_type;
data->leafs_per_child [depth] = data->leafs_per_child [depth-1] / data->tree_type;
}
@@ -693,15 +671,14 @@ static int implicit_needed_branches(int tree_type, int leafs)
* - if all elements are different all partition will get the same subset of elements
* as if the array was sorted.
*
- * partition P is described as the elements in the range ( nth[P] , nth[P+1] ]
+ * partition P is described as the elements in the range ( nth[P], nth[P+1] ]
*
* TODO: This can be optimized a bit by doing a specialized nth_element instead of K nth_elements
*/
static void split_leafs(BVHNode **leafs_array, int *nth, int partitions, int split_axis)
{
int i;
- for (i=0; i < partitions-1; i++)
- {
+ for (i=0; i < partitions-1; i++) {
if (nth[i] >= nth[partitions])
break;
@@ -742,8 +719,7 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
//Most of bvhtree code relies on 1-leaf trees having at least one branch
//We handle that special case here
- if (num_leafs == 1)
- {
+ if (num_leafs == 1) {
BVHNode *root = branches_array+0;
refit_kdop_hull(tree, root, 0, num_leafs);
root->main_axis = get_largest_axis(root->bv) / 2;
@@ -758,8 +734,7 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
build_implicit_tree_helper(tree, &data);
//Loop tree levels (log N) loops
- for (i=1, depth = 1; i <= num_branches; i = i*tree_type + tree_offset, depth++)
- {
+ for (i=1, depth = 1; i <= num_branches; i = i*tree_type + tree_offset, depth++) {
const int first_of_next_level = i*tree_type + tree_offset;
const int end_j = MIN2(first_of_next_level, num_branches + 1); //index of last branch on this level
int j;
@@ -885,22 +860,19 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
tree->nodes = (BVHNode **)MEM_callocN(sizeof(BVHNode *)*numnodes, "BVHNodes");
- if (!tree->nodes)
- {
+ if (!tree->nodes) {
MEM_freeN(tree);
return NULL;
}
tree->nodebv = (float*)MEM_callocN(sizeof(float)* axis * numnodes, "BVHNodeBV");
- if (!tree->nodebv)
- {
+ if (!tree->nodebv) {
MEM_freeN(tree->nodes);
MEM_freeN(tree);
}
tree->nodechild = (BVHNode**)MEM_callocN(sizeof(BVHNode*) * tree_type * numnodes, "BVHNodeBV");
- if (!tree->nodechild)
- {
+ if (!tree->nodechild) {
MEM_freeN(tree->nodebv);
MEM_freeN(tree->nodes);
MEM_freeN(tree);
@@ -908,8 +880,7 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
tree->nodearray = (BVHNode *)MEM_callocN(sizeof(BVHNode)* numnodes, "BVHNodeArray");
- if (!tree->nodearray)
- {
+ if (!tree->nodearray) {
MEM_freeN(tree->nodechild);
MEM_freeN(tree->nodebv);
MEM_freeN(tree->nodes);
@@ -918,8 +889,7 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
}
//link the dynamic bv and child links
- for (i=0; i< numnodes; i++)
- {
+ for (i=0; i< numnodes; i++) {
tree->nodearray[i].bv = tree->nodebv + i * axis;
tree->nodearray[i].children = tree->nodechild + i * tree_type;
}
@@ -931,8 +901,7 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
void BLI_bvhtree_free(BVHTree *tree)
{
- if (tree)
- {
+ if (tree) {
MEM_freeN(tree->nodes);
MEM_freeN(tree->nodearray);
MEM_freeN(tree->nodebv);
@@ -985,8 +954,7 @@ int BLI_bvhtree_insert(BVHTree *tree, int index, const float *co, int numpoints)
node->index= index;
// inflate the bv with some epsilon
- for (i = tree->start_axis; i < tree->stop_axis; i++)
- {
+ for (i = tree->start_axis; i < tree->stop_axis; i++) {
node->bv[(2 * i)] -= tree->epsilon; // minimum
node->bv[(2 * i) + 1] += tree->epsilon; // maximum
}
@@ -1013,8 +981,7 @@ int BLI_bvhtree_update_node(BVHTree *tree, int index, const float *co, const flo
create_kdop_hull(tree, node, co_moving, numpoints, 1);
// inflate the bv with some epsilon
- for (i = tree->start_axis; i < tree->stop_axis; i++)
- {
+ for (i = tree->start_axis; i < tree->stop_axis; i++) {
node->bv[(2 * i)] -= tree->epsilon; // minimum
node->bv[(2 * i) + 1] += tree->epsilon; // maximum
}
@@ -1057,8 +1024,7 @@ static int tree_overlap(BVHNode *node1, BVHNode *node2, int start_axis, int stop
bv2 += start_axis<<1;
// test all axis if min + max overlap
- for (; bv1 != bv1_end; bv1+=2, bv2+=2)
- {
+ for (; bv1 != bv1_end; bv1+=2, bv2+=2) {
if ((*(bv1) > *(bv2 + 1)) || (*(bv2) > *(bv1 + 1)))
return 0;
}
@@ -1070,27 +1036,21 @@ static void traverse(BVHOverlapData *data, BVHNode *node1, BVHNode *node2)
{
int j;
- if (tree_overlap(node1, node2, data->start_axis, data->stop_axis))
- {
+ if (tree_overlap(node1, node2, data->start_axis, data->stop_axis)) {
// check if node1 is a leaf
- if (!node1->totnode)
- {
+ if (!node1->totnode) {
// check if node2 is a leaf
- if (!node2->totnode)
- {
+ if (!node2->totnode) {
- if (node1 == node2)
- {
+ if (node1 == node2) {
return;
}
- if (data->i >= data->max_overlap)
- {
+ if (data->i >= data->max_overlap) {
// try to make alloc'ed memory bigger
data->overlap = realloc(data->overlap, sizeof(BVHTreeOverlap)*data->max_overlap*2);
- if (!data->overlap)
- {
+ if (!data->overlap) {
printf("Out of Memory in traverse\n");
return;
}
@@ -1103,20 +1063,15 @@ static void traverse(BVHOverlapData *data, BVHNode *node1, BVHNode *node2)
data->i++;
}
- else
- {
- for (j = 0; j < data->tree2->tree_type; j++)
- {
+ else {
+ for (j = 0; j < data->tree2->tree_type; j++) {
if (node2->children[j])
traverse(data, node1, node2->children[j]);
}
}
}
- else
- {
-
- for (j = 0; j < data->tree2->tree_type; j++)
- {
+ else {
+ for (j = 0; j < data->tree2->tree_type; j++) {
if (node1->children[j])
traverse(data, node1->children[j], node2);
}
@@ -1142,8 +1097,7 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int
data = MEM_callocN(sizeof(BVHOverlapData *)* tree1->tree_type, "BVHOverlapData_star");
- for (j = 0; j < tree1->tree_type; j++)
- {
+ for (j = 0; j < tree1->tree_type; j++) {
data[j] = (BVHOverlapData *)MEM_callocN(sizeof(BVHOverlapData), "BVHOverlapData");
// init BVHOverlapData
@@ -1157,8 +1111,7 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int
}
#pragma omp parallel for private(j) schedule(static)
- for (j = 0; j < MIN2(tree1->tree_type, tree1->nodes[tree1->totleaf]->totnode); j++)
- {
+ for (j = 0; j < MIN2(tree1->tree_type, tree1->nodes[tree1->totleaf]->totnode); j++) {
traverse(data[j], tree1->nodes[tree1->totleaf]->children[j], tree2->nodes[tree2->totleaf]);
}
@@ -1167,14 +1120,12 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int
to = overlap = (BVHTreeOverlap *)MEM_callocN(sizeof(BVHTreeOverlap)*total, "BVHTreeOverlap");
- for (j = 0; j < tree1->tree_type; j++)
- {
+ for (j = 0; j < tree1->tree_type; j++) {
memcpy(to, data[j]->overlap, data[j]->i*sizeof(BVHTreeOverlap));
to+=data[j]->i;
}
- for (j = 0; j < tree1->tree_type; j++)
- {
+ for (j = 0; j < tree1->tree_type; j++) {
free(data[j]->overlap);
MEM_freeN(data[j]);
}
@@ -1191,8 +1142,7 @@ static float calc_nearest_point(const float proj[3], BVHNode *node, float *neare
const float *bv = node->bv;
//nearest on AABB hull
- for (i=0; i != 3; i++, bv += 2)
- {
+ for (i=0; i != 3; i++, bv += 2) {
if (bv[0] > proj[i])
nearest[i] = bv[0];
else if (bv[1] < proj[i])
@@ -1230,40 +1180,33 @@ typedef struct NodeDistance
} NodeDistance;
-#define NodeDistance_priority(a,b) ( (a).dist < (b).dist )
+#define NodeDistance_priority(a, b) ( (a).dist < (b).dist )
// TODO: use a priority queue to reduce the number of nodes looked on
static void dfs_find_nearest_dfs(BVHNearestData *data, BVHNode *node)
{
- if (node->totnode == 0)
- {
+ if (node->totnode == 0) {
if (data->callback)
- data->callback(data->userdata , node->index, data->co, &data->nearest);
- else
- {
+ data->callback(data->userdata, node->index, data->co, &data->nearest);
+ else {
data->nearest.index = node->index;
data->nearest.dist = calc_nearest_point(data->proj, node, data->nearest.co);
}
}
- else
- {
+ else {
//Better heuristic to pick the closest node to dive on
int i;
float nearest[3];
- if (data->proj[ node->main_axis ] <= node->children[0]->bv[node->main_axis*2+1])
- {
+ if (data->proj[ node->main_axis ] <= node->children[0]->bv[node->main_axis*2+1]) {
- for (i=0; i != node->totnode; i++)
- {
+ for (i=0; i != node->totnode; i++) {
if ( calc_nearest_point(data->proj, node->children[i], nearest) >= data->nearest.dist) continue;
dfs_find_nearest_dfs(data, node->children[i]);
}
}
- else
- {
- for (i=node->totnode-1; i >= 0 ; i--)
- {
+ else {
+ for (i=node->totnode-1; i >= 0 ; i--) {
if ( calc_nearest_point(data->proj, node->children[i], nearest) >= data->nearest.dist) continue;
dfs_find_nearest_dfs(data, node->children[i]);
}
@@ -1381,17 +1324,14 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *n
data.callback = callback;
data.userdata = userdata;
- for (i = data.tree->start_axis; i != data.tree->stop_axis; i++)
- {
+ for (i = data.tree->start_axis; i != data.tree->stop_axis; i++) {
data.proj[i] = dot_v3v3(data.co, KDOP_AXES[i]);
}
- if (nearest)
- {
- memcpy( &data.nearest , nearest, sizeof(*nearest) );
+ if (nearest) {
+ memcpy(&data.nearest, nearest, sizeof(*nearest));
}
- else
- {
+ else {
data.nearest.index = -1;
data.nearest.dist = FLT_MAX;
}
@@ -1401,8 +1341,7 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *n
dfs_find_nearest_begin(&data, root);
//copy back results
- if (nearest)
- {
+ if (nearest) {
memcpy(nearest, &data.nearest, sizeof(*nearest));
}
@@ -1424,10 +1363,8 @@ static float ray_nearest_hit(BVHRayCastData *data, float *bv)
float low = 0, upper = data->hit.dist;
- for (i=0; i != 3; i++, bv += 2)
- {
- if (data->ray_dot_axis[i] == 0.0f)
- {
+ for (i=0; i != 3; i++, bv += 2) {
+ if (data->ray_dot_axis[i] == 0.0f) {
//axis aligned ray
if (data->ray.origin[i] < bv[0] - data->ray.radius ||
data->ray.origin[i] > bv[1] + data->ray.radius)
@@ -1435,18 +1372,15 @@ static float ray_nearest_hit(BVHRayCastData *data, float *bv)
return FLT_MAX;
}
}
- else
- {
+ else {
float ll = (bv[0] - data->ray.radius - data->ray.origin[i]) / data->ray_dot_axis[i];
float lu = (bv[1] + data->ray.radius - data->ray.origin[i]) / data->ray_dot_axis[i];
- if (data->ray_dot_axis[i] > 0.0f)
- {
+ if (data->ray_dot_axis[i] > 0.0f) {
if (ll > low) low = ll;
if (lu < upper) upper = lu;
}
- else
- {
+ else {
if (lu > low) low = lu;
if (ll < upper) upper = ll;
}
@@ -1494,31 +1428,25 @@ static void dfs_raycast(BVHRayCastData *data, BVHNode *node)
float dist = (data->ray.radius > 0.0f) ? ray_nearest_hit(data, node->bv) : fast_ray_nearest_hit(data, node);
if (dist >= data->hit.dist) return;
- if (node->totnode == 0)
- {
- if (data->callback)
+ if (node->totnode == 0) {
+ if (data->callback) {
data->callback(data->userdata, node->index, &data->ray, &data->hit);
- else
- {
+ }
+ else {
data->hit.index = node->index;
data->hit.dist = dist;
madd_v3_v3v3fl(data->hit.co, data->ray.origin, data->ray.direction, dist);
}
}
- else
- {
+ else {
//pick loop direction to dive into the tree (based on ray direction and split axis)
- if (data->ray_dot_axis[ (int)node->main_axis ] > 0.0f)
- {
- for (i=0; i != node->totnode; i++)
- {
+ if (data->ray_dot_axis[ (int)node->main_axis ] > 0.0f) {
+ for (i=0; i != node->totnode; i++) {
dfs_raycast(data, node->children[i]);
}
}
- else
- {
- for (i=node->totnode-1; i >= 0; i--)
- {
+ else {
+ for (i=node->totnode-1; i >= 0; i--) {
dfs_raycast(data, node->children[i]);
}
}
@@ -1575,13 +1503,11 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], f
normalize_v3(data.ray.direction);
- for (i=0; i<3; i++)
- {
+ for (i=0; i<3; i++) {
data.ray_dot_axis[i] = dot_v3v3(data.ray.direction, KDOP_AXES[i]);
data.idot_axis[i] = 1.0f / data.ray_dot_axis[i];
- if (fabsf(data.ray_dot_axis[i]) < FLT_EPSILON)
- {
+ if (fabsf(data.ray_dot_axis[i]) < FLT_EPSILON) {
data.ray_dot_axis[i] = 0.0;
}
data.index[2*i] = data.idot_axis[i] < 0.0f ? 1 : 0;
@@ -1592,22 +1518,20 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], f
if (hit)
- memcpy( &data.hit, hit, sizeof(*hit) );
- else
- {
+ memcpy(&data.hit, hit, sizeof(*hit));
+ else {
data.hit.index = -1;
data.hit.dist = FLT_MAX;
}
- if (root)
- {
+ if (root) {
dfs_raycast(&data, root);
// iterative_raycast(&data, root);
}
if (hit)
- memcpy( hit, &data.hit, sizeof(*hit) );
+ memcpy(hit, &data.hit, sizeof(*hit));
return data.hit.index;
}
@@ -1635,8 +1559,7 @@ float BLI_bvhtree_bb_raycast(float *bv, const float light_start[3], const float
dist = ray_nearest_hit(&data, bv);
- if (dist > 0.0f)
- {
+ if (dist > 0.0f) {
madd_v3_v3v3fl(pos, light_start, data.ray.direction, dist);
}
return dist;
@@ -1666,8 +1589,7 @@ typedef struct RangeQueryData
static void dfs_range_query(RangeQueryData *data, BVHNode *node)
{
- if (node->totnode == 0)
- {
+ if (node->totnode == 0) {
#if 0 /*UNUSED*/
//Calculate the node min-coords (if the node was a point then this is the point coordinates)
float co[3];
@@ -1676,23 +1598,19 @@ static void dfs_range_query(RangeQueryData *data, BVHNode *node)
co[2] = node->bv[4];
#endif
}
- else
- {
+ else {
int i;
- for (i=0; i != node->totnode; i++)
- {
+ for (i=0; i != node->totnode; i++) {
float nearest[3];
float dist = calc_nearest_point(data->center, node->children[i], nearest);
- if (dist < data->radius)
- {
+ if (dist < data->radius) {
//Its a leaf.. call the callback
- if (node->children[i]->totnode == 0)
- {
+ if (node->children[i]->totnode == 0) {
data->hits++;
data->callback(data->userdata, node->children[i]->index, dist);
}
else
- dfs_range_query( data, node->children[i] );
+ dfs_range_query(data, node->children[i]);
}
}
}
@@ -1711,20 +1629,17 @@ int BLI_bvhtree_range_query(BVHTree *tree, const float co[3], float radius, BVHT
data.callback = callback;
data.userdata = userdata;
- if (root != NULL)
- {
+ if (root != NULL) {
float nearest[3];
float dist = calc_nearest_point(data.center, root, nearest);
- if (dist < data.radius)
- {
- //Its a leaf.. call the callback
- if (root->totnode == 0)
- {
+ if (dist < data.radius) {
+ /* Its a leaf.. call the callback */
+ if (root->totnode == 0) {
data.hits++;
data.callback(data.userdata, root->index, dist);
}
else
- dfs_range_query( &data, root );
+ dfs_range_query(&data, root);
}
}
diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c
index ee06f32a934..a518d1445e3 100644
--- a/source/blender/blenlib/intern/BLI_kdtree.c
+++ b/source/blender/blenlib/intern/BLI_kdtree.c
@@ -167,7 +167,7 @@ int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest *
root= tree->root;
min_node= root;
- min_dist= squared_distance(root->co,co,root->nor,nor);
+ min_dist= squared_distance(root->co, co, root->nor, nor);
if (co[root->d] < root->co[root->d]) {
if (root->right)
@@ -191,7 +191,7 @@ int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest *
cur_dist= -cur_dist*cur_dist;
if (-cur_dist<min_dist) {
- cur_dist=squared_distance(node->co,co,node->nor,nor);
+ cur_dist=squared_distance(node->co, co, node->nor, nor);
if (cur_dist<min_dist) {
min_dist=cur_dist;
min_node=node;
@@ -206,7 +206,7 @@ int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest *
cur_dist= cur_dist*cur_dist;
if (cur_dist<min_dist) {
- cur_dist=squared_distance(node->co,co,node->nor,nor);
+ cur_dist=squared_distance(node->co, co, node->nor, nor);
if (cur_dist<min_dist) {
min_dist=cur_dist;
min_node=node;
@@ -219,7 +219,7 @@ int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest *
}
if (cur+3 > totstack) {
KDTreeNode **temp=MEM_callocN((totstack+100)*sizeof(KDTreeNode*), "psys_treestack");
- memcpy(temp,stack,totstack*sizeof(KDTreeNode*));
+ memcpy(temp, stack, totstack*sizeof(KDTreeNode*));
if (stack != defaultstack)
MEM_freeN(stack);
stack=temp;
@@ -273,8 +273,8 @@ int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTree
root= tree->root;
- cur_dist= squared_distance(root->co,co,root->nor,nor);
- add_nearest(nearest,&found,n,root->index,cur_dist,root->co);
+ cur_dist= squared_distance(root->co, co, root->nor, nor);
+ add_nearest(nearest, &found, n, root->index, cur_dist, root->co);
if (co[root->d] < root->co[root->d]) {
if (root->right)
@@ -298,10 +298,10 @@ int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTree
cur_dist= -cur_dist*cur_dist;
if (found<n || -cur_dist<nearest[found-1].dist) {
- cur_dist=squared_distance(node->co,co,node->nor,nor);
+ cur_dist=squared_distance(node->co, co, node->nor, nor);
if (found<n || cur_dist<nearest[found-1].dist)
- add_nearest(nearest,&found,n,node->index,cur_dist,node->co);
+ add_nearest(nearest, &found, n, node->index, cur_dist, node->co);
if (node->left)
stack[cur++]=node->left;
@@ -313,9 +313,9 @@ int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTree
cur_dist= cur_dist*cur_dist;
if (found<n || cur_dist<nearest[found-1].dist) {
- cur_dist=squared_distance(node->co,co,node->nor,nor);
+ cur_dist=squared_distance(node->co, co, node->nor, nor);
if (found<n || cur_dist<nearest[found-1].dist)
- add_nearest(nearest,&found,n,node->index,cur_dist,node->co);
+ add_nearest(nearest, &found, n, node->index, cur_dist, node->co);
if (node->right)
stack[cur++]=node->right;
@@ -325,7 +325,7 @@ int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTree
}
if (cur+3 > totstack) {
KDTreeNode **temp=MEM_callocN((totstack+100)*sizeof(KDTreeNode*), "psys_treestack");
- memcpy(temp,stack,totstack*sizeof(KDTreeNode*));
+ memcpy(temp, stack, totstack * sizeof(KDTreeNode*));
if (stack != defaultstack)
MEM_freeN(stack);
stack=temp;
@@ -432,7 +432,7 @@ int BLI_kdtree_range_search(KDTree *tree, float range, float *co, float *nor, KD
if (cur+3 > totstack) {
KDTreeNode **temp=MEM_callocN((totstack+100)*sizeof(KDTreeNode*), "psys_treestack");
- memcpy(temp,stack,totstack*sizeof(KDTreeNode*));
+ memcpy(temp, stack, totstack*sizeof(KDTreeNode*));
if (stack != defaultstack)
MEM_freeN(stack);
stack=temp;
diff --git a/source/blender/blenlib/intern/DLRB_tree.c b/source/blender/blenlib/intern/DLRB_tree.c
index 0e90042a35f..6398bd863db 100644
--- a/source/blender/blenlib/intern/DLRB_tree.c
+++ b/source/blender/blenlib/intern/DLRB_tree.c
@@ -44,7 +44,7 @@ DLRBT_Tree *BLI_dlrbTree_new (void)
}
/* Just zero out the pointers used */
-void BLI_dlrbTree_init (DLRBT_Tree *tree)
+void BLI_dlrbTree_init(DLRBT_Tree *tree)
{
if (tree == NULL)
return;
@@ -68,7 +68,7 @@ static void recursive_tree_free_nodes (DLRBT_Node *node)
}
/* Free the given tree's data but not the tree itself */
-void BLI_dlrbTree_free (DLRBT_Tree *tree)
+void BLI_dlrbTree_free(DLRBT_Tree *tree)
{
if (tree == NULL)
return;
@@ -113,7 +113,7 @@ static void linkedlist_sync_add_node (DLRBT_Tree *tree, DLRBT_Node *node)
}
/* Make sure the tree's Double-Linked list representation is valid */
-void BLI_dlrbTree_linkedlist_sync (DLRBT_Tree *tree)
+void BLI_dlrbTree_linkedlist_sync(DLRBT_Tree *tree)
{
/* sanity checks */
if (tree == NULL)
@@ -141,8 +141,7 @@ DLRBT_Node *BLI_dlrbTree_search (DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb, v
return NULL;
/* iteratively perform this search */
- while (node && found==0)
- {
+ while (node && found == 0) {
/* check if traverse further or not
* NOTE: it is assumed that the values will be unit values only
*/
@@ -183,8 +182,7 @@ DLRBT_Node *BLI_dlrbTree_search_exact (DLRBT_Tree *tree, DLRBT_Comparator_FP cmp
return NULL;
/* iteratively perform this search */
- while (node && found==0)
- {
+ while (node && found==0) {
/* check if traverse further or not
* NOTE: it is assumed that the values will be unit values only
*/
@@ -488,7 +486,7 @@ static void insert_check_3 (DLRBT_Tree *tree, DLRBT_Node *node)
/* Balance the tree after the given element has been added to it
* (using custom code, in the Binary Tree way).
*/
-void BLI_dlrbTree_insert (DLRBT_Tree *tree, DLRBT_Node *node)
+void BLI_dlrbTree_insert(DLRBT_Tree *tree, DLRBT_Node *node)
{
/* sanity checks */
if ((tree == NULL) || (node == NULL))
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c
index 0504ac5be60..8534621ccf1 100644
--- a/source/blender/blenlib/intern/bpath.c
+++ b/source/blender/blenlib/intern/bpath.c
@@ -387,7 +387,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
return;
}
- switch(GS(id->name)) {
+ switch (GS(id->name)) {
case ID_IM:
ima= (Image *)id;
if (ima->packedfile == NULL || (flag & BPATH_TRAVERSE_SKIP_PACKED) == 0) {
@@ -510,7 +510,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
if (scene->ed) {
Sequence *seq;
- SEQ_BEGIN(scene->ed, seq) {
+ SEQ_BEGIN (scene->ed, seq) {
if (SEQ_HAS_PATH(seq)) {
if (ELEM(seq->type, SEQ_MOVIE, SEQ_SOUND)) {
rewrite_path_fixed_dirfile(seq->strip->dir, seq->strip->stripdata->name,
diff --git a/source/blender/blenlib/intern/dynlib.c b/source/blender/blenlib/intern/dynlib.c
index e300d09ffbc..c80f3e08e3b 100644
--- a/source/blender/blenlib/intern/dynlib.c
+++ b/source/blender/blenlib/intern/dynlib.c
@@ -85,7 +85,9 @@ char *BLI_dynlib_get_error_as_string(DynamicLibrary *lib)
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
buf, sizeof(buf), NULL))
+ {
return buf;
+ }
}
return NULL;
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index 8990f0f79d3..0a5e4d9fd48 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -82,7 +82,7 @@ int BLI_file_gzip(const char *from, const char *to)
gzfile = BLI_gzopen(to, "wb1");
if (gzfile == NULL)
return -1;
- file = BLI_open(from, O_BINARY|O_RDONLY,0);
+ file = BLI_open(from, O_BINARY|O_RDONLY, 0);
if (file < 0)
return -2;
@@ -223,17 +223,17 @@ void *BLI_gzopen(const char *filename, const char *mode)
/* xxx Creates file before transcribing the path */
if (mode[0] == 'w')
- fclose(ufopen(filename,"a"));
+ fclose(ufopen(filename, "a"));
UTF16_ENCODE(filename);
- GetShortPathNameW(filename_16,short_name_16, 256);
+ GetShortPathNameW(filename_16, short_name_16, 256);
for (i = 0; i < 256; i++) {
short_name[i] = (char)short_name_16[i];
}
- gzfile = gzopen(short_name,mode);
+ gzfile = gzopen(short_name, mode);
UTF16_UN_ENCODE(filename);
}
@@ -367,7 +367,7 @@ void BLI_dir_create_recursive(const char *dirname)
if (dirname[0]) /* patch, this recursive loop tries to create a nameless directory */
if (umkdir(dirname)==-1)
- printf("Unable to create directory %s\n",dirname);
+ printf("Unable to create directory %s\n", dirname);
}
int BLI_rename(const char *from, const char *to)
diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c
index a9a1f2bc57e..c9f7b7c7e64 100644
--- a/source/blender/blenlib/intern/freetypefont.c
+++ b/source/blender/blenlib/intern/freetypefont.c
@@ -82,7 +82,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
FT_Outline ftoutline;
float scale, height;
float dx, dy;
- int j,k,l,m=0;
+ int j, k, l, m=0;
// adjust font size
height= ((double) face->bbox.yMax - (double) face->bbox.yMin);
@@ -116,8 +116,8 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
che->width= glyph->advance.x * scale;
// Start converting the FT data
- npoints = (int *)MEM_callocN((ftoutline.n_contours) * sizeof(int),"endpoints");
- onpoints = (int *)MEM_callocN((ftoutline.n_contours) * sizeof(int),"onpoints");
+ npoints = (int *)MEM_callocN((ftoutline.n_contours) * sizeof(int), "endpoints");
+ onpoints = (int *)MEM_callocN((ftoutline.n_contours) * sizeof(int), "onpoints");
// calculate total points of each contour
for (j = 0; j < ftoutline.n_contours; j++) {
@@ -127,17 +127,21 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
npoints[j] = ftoutline.contours[j] - ftoutline.contours[j - 1];
}
- // get number of on-curve points for beziertriples (including conic virtual on-points)
+ // get number of on-curve points for beziertriples (including conic virtual on-points)
for (j = 0; j < ftoutline.n_contours; j++) {
for (k = 0; k < npoints[j]; k++) {
- if (j > 0) l = k + ftoutline.contours[j - 1] + 1; else l = k;
- if (ftoutline.tags[l] == FT_Curve_Tag_On)
- onpoints[j]++;
+ l = (j > 0) ? (k + ftoutline.contours[j - 1] + 1) : k;
+
+ if (ftoutline.tags[l] == FT_Curve_Tag_On)
+ onpoints[j]++;
- if (k < npoints[j] - 1 )
+ if (k < npoints[j] - 1 ) {
if ( ftoutline.tags[l] == FT_Curve_Tag_Conic &&
- ftoutline.tags[l+1] == FT_Curve_Tag_Conic)
+ ftoutline.tags[l+1] == FT_Curve_Tag_Conic)
+ {
onpoints[j]++;
+ }
+ }
}
}
@@ -267,7 +271,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
// len_squared_v2v2, see if there's a distance between the three points
// len_squared_v2v2 again, to check the angle between the handles
// finally, check if one of them is a vector handle
- if ((dist_to_line_v2(bezt->vec[0],bezt->vec[1],bezt->vec[2]) < 0.001f) &&
+ if ((dist_to_line_v2(bezt->vec[0], bezt->vec[1], bezt->vec[2]) < 0.001f) &&
(len_squared_v2v2(bezt->vec[0], bezt->vec[1]) > 0.0001f*0.0001f) &&
(len_squared_v2v2(bezt->vec[1], bezt->vec[2]) > 0.0001f*0.0001f) &&
(len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > 0.0002f*0.0001f) &&
@@ -300,7 +304,7 @@ static int objchr_to_ftvfontdata(VFont *vfont, FT_ULong charcode)
// Load the font to memory
if (tf->pf) {
- err= FT_New_Memory_Face( library,
+ err= FT_New_Memory_Face(library,
tf->pf->data,
tf->pf->size,
0,
@@ -338,7 +342,7 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf)
#endif
// load the freetype font
- err = FT_New_Memory_Face( library,
+ err = FT_New_Memory_Face(library,
pf->data,
pf->size,
0,
@@ -347,10 +351,10 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf)
if (err) return NULL;
#if 0
- for ( n = 0; n < face->num_charmaps; n++ )
+ for (n = 0; n < face->num_charmaps; n++)
{
charmap = face->charmaps[n];
- if ( charmap->platform_id == my_platform_id &&
+ if (charmap->platform_id == my_platform_id &&
charmap->encoding_id == my_encoding_id )
{
found = charmap;
@@ -358,11 +362,11 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf)
}
}
- if ( !found ) { return NULL; }
+ if (!found ) { return NULL; }
// now, select the charmap for the face object
- err = FT_Set_Charmap( face, found );
- if ( err ) { return NULL; }
+ err = FT_Set_Charmap(face, found);
+ if (err) { return NULL; }
#endif
// allocate blender font
@@ -389,7 +393,7 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf)
}
}
- err = FT_Set_Charmap( face, found );
+ err = FT_Set_Charmap(face, found);
if ( err )
return NULL;
@@ -398,8 +402,7 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf)
}
// Load characters
- while (charcode < 256)
- {
+ while (charcode < 256) {
// Generate the font data
freetypechar_to_vchar(face, charcode, vfd);
@@ -495,7 +498,7 @@ VFontData *BLI_vfontdata_from_freetypefont(PackedFile *pf)
}
//free Freetype
- FT_Done_FreeType( library);
+ FT_Done_FreeType(library);
return vfd;
}
@@ -617,7 +620,7 @@ font driver produces such outlines.
Each glyph's original outline points are located on a grid of indivisible units. The points are stored
-in the font file as 16-bit integer grid coordinates, with the grid origin's being at (0,0); they thus
+in the font file as 16-bit integer grid coordinates, with the grid origin's being at (0, 0); they thus
range from -16384 to 16383.
Convert conic to bezier arcs:
diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c
index 75131f81ade..432a74a5890 100644
--- a/source/blender/blenlib/intern/graph.c
+++ b/source/blender/blenlib/intern/graph.c
@@ -46,13 +46,11 @@ static void flagAxialSymmetry(BNode *root_node, BNode *end_node, BArc *arc, int
void BLI_freeNode(BGraph *graph, BNode *node)
{
- if (node->arcs)
- {
+ if (node->arcs) {
MEM_freeN(node->arcs);
}
- if (graph->free_node)
- {
+ if (graph->free_node) {
graph->free_node(node);
}
}
@@ -70,8 +68,7 @@ BNode *BLI_otherNode(BArc *arc, BNode *node)
void BLI_removeArc(BGraph *graph, BArc *arc)
{
- if (graph->free_arc)
- {
+ if (graph->free_arc) {
graph->free_arc(arc);
}
@@ -82,8 +79,7 @@ void BLI_flagNodes(BGraph *graph, int flag)
{
BNode *node;
- for (node = graph->nodes.first; node; node = node->next)
- {
+ for (node = graph->nodes.first; node; node = node->next) {
node->flag = flag;
}
}
@@ -92,8 +88,7 @@ void BLI_flagArcs(BGraph *graph, int flag)
{
BArc *arc;
- for (arc = graph->arcs.first; arc; arc = arc->next)
- {
+ for (arc = graph->arcs.first; arc; arc = arc->next) {
arc->flag = flag;
}
}
@@ -109,10 +104,8 @@ void BLI_buildAdjacencyList(BGraph *graph)
BNode *node;
BArc *arc;
- for (node = graph->nodes.first; node; node = node->next)
- {
- if (node->arcs != NULL)
- {
+ for (node = graph->nodes.first; node; node = node->next) {
+ if (node->arcs != NULL) {
MEM_freeN(node->arcs);
}
@@ -122,16 +115,13 @@ void BLI_buildAdjacencyList(BGraph *graph)
node->flag = 0;
}
- for (arc = graph->arcs.first; arc; arc= arc->next)
- {
+ for (arc = graph->arcs.first; arc; arc= arc->next) {
addArcToNodeAdjacencyList(arc->head, arc);
addArcToNodeAdjacencyList(arc->tail, arc);
}
- for (node = graph->nodes.first; node; node = node->next)
- {
- if (node->degree != node->flag)
- {
+ for (node = graph->nodes.first; node; node = node->next) {
+ if (node->degree != node->flag) {
printf("error in node [%p]. Added only %i arcs out of %i\n", (void *)node, node->flag, node->degree);
}
}
@@ -141,8 +131,7 @@ void BLI_rebuildAdjacencyListForNode(BGraph* graph, BNode *node)
{
BArc *arc;
- if (node->arcs != NULL)
- {
+ if (node->arcs != NULL) {
MEM_freeN(node->arcs);
}
@@ -151,20 +140,16 @@ void BLI_rebuildAdjacencyListForNode(BGraph* graph, BNode *node)
/* temporary use to indicate the first index available in the lists */
node->flag = 0;
- for (arc = graph->arcs.first; arc; arc= arc->next)
- {
- if (arc->head == node)
- {
+ for (arc = graph->arcs.first; arc; arc= arc->next) {
+ if (arc->head == node) {
addArcToNodeAdjacencyList(arc->head, arc);
}
- else if (arc->tail == node)
- {
+ else if (arc->tail == node) {
addArcToNodeAdjacencyList(arc->tail, arc);
}
}
- if (node->degree != node->flag)
- {
+ if (node->degree != node->flag) {
printf("error in node [%p]. Added only %i arcs out of %i\n", (void *)node, node->flag, node->degree);
}
}
@@ -173,10 +158,8 @@ void BLI_freeAdjacencyList(BGraph *graph)
{
BNode *node;
- for (node = graph->nodes.first; node; node = node->next)
- {
- if (node->arcs != NULL)
- {
+ for (node = graph->nodes.first; node; node = node->next) {
+ if (node->arcs != NULL) {
MEM_freeN(node->arcs);
node->arcs = NULL;
}
@@ -187,10 +170,8 @@ int BLI_hasAdjacencyList(BGraph *graph)
{
BNode *node;
- for (node = graph->nodes.first; node; node = node->next)
- {
- if (node->arcs == NULL)
- {
+ for (node = graph->nodes.first; node; node = node->next) {
+ if (node->arcs == NULL) {
return 0;
}
}
@@ -200,28 +181,24 @@ int BLI_hasAdjacencyList(BGraph *graph)
void BLI_replaceNodeInArc(BGraph *graph, BArc *arc, BNode *node_src, BNode *node_replaced)
{
- if (arc->head == node_replaced)
- {
+ if (arc->head == node_replaced) {
arc->head = node_src;
node_src->degree++;
}
- if (arc->tail == node_replaced)
- {
+ if (arc->tail == node_replaced) {
arc->tail = node_src;
node_src->degree++;
}
- if (arc->head == arc->tail)
- {
+ if (arc->head == arc->tail) {
node_src->degree -= 2;
graph->free_arc(arc);
BLI_freelinkN(&graph->arcs, arc);
}
- if (node_replaced->degree == 0)
- {
+ if (node_replaced->degree == 0) {
BLI_removeNode(graph, node_replaced);
}
}
@@ -230,26 +207,22 @@ void BLI_replaceNode(BGraph *graph, BNode *node_src, BNode *node_replaced)
{
BArc *arc, *next_arc;
- for (arc = graph->arcs.first; arc; arc = next_arc)
- {
+ for (arc = graph->arcs.first; arc; arc = next_arc) {
next_arc = arc->next;
- if (arc->head == node_replaced)
- {
+ if (arc->head == node_replaced) {
arc->head = node_src;
node_replaced->degree--;
node_src->degree++;
}
- if (arc->tail == node_replaced)
- {
+ if (arc->tail == node_replaced) {
arc->tail = node_src;
node_replaced->degree--;
node_src->degree++;
}
- if (arc->head == arc->tail)
- {
+ if (arc->head == arc->tail) {
node_src->degree -= 2;
graph->free_arc(arc);
@@ -257,8 +230,7 @@ void BLI_replaceNode(BGraph *graph, BNode *node_src, BNode *node_replaced)
}
}
- if (node_replaced->degree == 0)
- {
+ if (node_replaced->degree == 0) {
BLI_removeNode(graph, node_replaced);
}
}
@@ -267,12 +239,9 @@ void BLI_removeDoubleNodes(BGraph *graph, float limit)
{
BNode *node_src, *node_replaced;
- for (node_src = graph->nodes.first; node_src; node_src = node_src->next)
- {
- for (node_replaced = graph->nodes.first; node_replaced; node_replaced = node_replaced->next)
- {
- if (node_replaced != node_src && len_v3v3(node_replaced->p, node_src->p) <= limit)
- {
+ for (node_src = graph->nodes.first; node_src; node_src = node_src->next) {
+ for (node_replaced = graph->nodes.first; node_replaced; node_replaced = node_replaced->next) {
+ if (node_replaced != node_src && len_v3v3(node_replaced->p, node_src->p) <= limit) {
BLI_replaceNode(graph, node_src, node_replaced);
}
}
@@ -285,11 +254,9 @@ BNode * BLI_FindNodeByPosition(BGraph *graph, float *p, float limit)
BNode *closest_node = NULL, *node;
float min_distance = 0.0f;
- for (node = graph->nodes.first; node; node = node->next)
- {
+ for (node = graph->nodes.first; node; node = node->next) {
float distance = len_v3v3(p, node->p);
- if (distance <= limit && (closest_node == NULL || distance < min_distance))
- {
+ if (distance <= limit && (closest_node == NULL || distance < min_distance)) {
closest_node = node;
min_distance = distance;
}
@@ -301,15 +268,13 @@ BNode * BLI_FindNodeByPosition(BGraph *graph, float *p, float limit)
static void flagSubgraph(BNode *node, int subgraph)
{
- if (node->subgraph_index == 0)
- {
+ if (node->subgraph_index == 0) {
BArc *arc;
int i;
node->subgraph_index = subgraph;
- for (i = 0; i < node->degree; i++)
- {
+ for (i = 0; i < node->degree; i++) {
arc = node->arcs[i];
flagSubgraph(BLI_otherNode(arc, node), subgraph);
}
@@ -321,20 +286,16 @@ int BLI_FlagSubgraphs(BGraph *graph)
BNode *node;
int subgraph = 0;
- if (BLI_hasAdjacencyList(graph) == 0)
- {
+ if (BLI_hasAdjacencyList(graph) == 0) {
BLI_buildAdjacencyList(graph);
}
- for (node = graph->nodes.first; node; node = node->next)
- {
+ for (node = graph->nodes.first; node; node = node->next) {
node->subgraph_index = 0;
}
- for (node = graph->nodes.first; node; node = node->next)
- {
- if (node->subgraph_index == 0)
- {
+ for (node = graph->nodes.first; node; node = node->next) {
+ if (node->subgraph_index == 0) {
subgraph++;
flagSubgraph(node, subgraph);
}
@@ -347,10 +308,8 @@ void BLI_ReflagSubgraph(BGraph *graph, int old_subgraph, int new_subgraph)
{
BNode *node;
- for (node = graph->nodes.first; node; node = node->next)
- {
- if (node->flag == old_subgraph)
- {
+ for (node = graph->nodes.first; node; node = node->next) {
+ if (node->flag == old_subgraph) {
node->flag = new_subgraph;
}
}
@@ -362,26 +321,22 @@ static int detectCycle(BNode *node, BArc *src_arc)
{
int value = 0;
- if (node->flag == 0)
- {
+ if (node->flag == 0) {
int i;
/* mark node as visited */
node->flag = 1;
- for (i = 0; i < node->degree && value == 0; i++)
- {
+ for (i = 0; i < node->degree && value == 0; i++) {
BArc *arc = node->arcs[i];
/* don't go back on the source arc */
- if (arc != src_arc)
- {
+ if (arc != src_arc) {
value = detectCycle(BLI_otherNode(arc, node), arc);
}
}
}
- else
- {
+ else {
value = 1;
}
@@ -399,11 +354,9 @@ int BLI_isGraphCyclic(BGraph *graph)
BLI_flagNodes(graph, 0);
/* detectCycles in subgraphs */
- for (node = graph->nodes.first; node && value == 0; node = node->next)
- {
+ for (node = graph->nodes.first; node && value == 0; node = node->next) {
/* only for nodes in subgraphs that haven't been visited yet */
- if (node->flag == 0)
- {
+ if (node->flag == 0) {
value = value || detectCycle(node, NULL);
}
}
@@ -415,10 +368,8 @@ BArc * BLI_findConnectedArc(BGraph *graph, BArc *arc, BNode *v)
{
BArc *nextArc;
- for (nextArc = graph->arcs.first; nextArc; nextArc = nextArc->next)
- {
- if (arc != nextArc && (nextArc->head == v || nextArc->tail == v))
- {
+ for (nextArc = graph->arcs.first; nextArc; nextArc = nextArc->next) {
+ if (arc != nextArc && (nextArc->head == v || nextArc->tail == v)) {
break;
}
}
@@ -434,30 +385,24 @@ static int subtreeShape(BNode *node, BArc *rootArc, int include_root)
node->flag = 1;
- if (include_root)
- {
+ if (include_root) {
BNode *newNode = BLI_otherNode(rootArc, node);
return subtreeShape(newNode, rootArc, 0);
}
- else
- {
+ else {
/* Base case, no arcs leading away */
- if (node->arcs == NULL || *(node->arcs) == NULL)
- {
+ if (node->arcs == NULL || *(node->arcs) == NULL) {
return 0;
}
- else
- {
+ else {
int i;
- for (i = 0; i < node->degree; i++)
- {
+ for (i = 0; i < node->degree; i++) {
BArc *arc = node->arcs[i];
BNode *newNode = BLI_otherNode(arc, node);
/* stop immediate and cyclic backtracking */
- if (arc != rootArc && newNode->flag == 0)
- {
+ if (arc != rootArc && newNode->flag == 0) {
depth += subtreeShape(newNode, arc, 0);
}
}
@@ -480,13 +425,11 @@ float BLI_subtreeLength(BNode *node)
node->flag = 0; /* flag node as visited */
- for (i = 0; i < node->degree; i++)
- {
+ for (i = 0; i < node->degree; i++) {
BArc *arc = node->arcs[i];
BNode *other_node = BLI_otherNode(arc, node);
- if (other_node->flag != 0)
- {
+ if (other_node->flag != 0) {
float subgraph_length = arc->length + BLI_subtreeLength(other_node);
length = MAX2(length, subgraph_length);
}
@@ -503,15 +446,12 @@ void BLI_calcGraphLength(BGraph *graph)
nb_subgraphs = BLI_FlagSubgraphs(graph);
- for (i = 1; i <= nb_subgraphs; i++)
- {
+ for (i = 1; i <= nb_subgraphs; i++) {
BNode *node;
- for (node = graph->nodes.first; node; node = node->next)
- {
+ for (node = graph->nodes.first; node; node = node->next) {
/* start on an external node of the subgraph */
- if (node->subgraph_index == i && node->degree == 1)
- {
+ if (node->subgraph_index == i && node->degree == 1) {
float subgraph_length = BLI_subtreeLength(node);
length = MAX2(length, subgraph_length);
break;
@@ -542,32 +482,27 @@ static void testRadialSymmetry(BGraph *graph, BNode* root_node, RadialArc* ring,
int i;
/* sort ring by angle */
- for (i = 0; i < total - 1; i++)
- {
+ for (i = 0; i < total - 1; i++) {
float minAngle = FLT_MAX;
int minIndex = -1;
int j;
- for (j = i + 1; j < total; j++)
- {
+ for (j = i + 1; j < total; j++) {
float angle = dot_v3v3(ring[i].n, ring[j].n);
/* map negative values to 1..2 */
- if (angle < 0)
- {
+ if (angle < 0) {
angle = 1 - angle;
}
- if (angle < minAngle)
- {
+ if (angle < minAngle) {
minIndex = j;
minAngle = angle;
}
}
/* swap if needed */
- if (minIndex != i + 1)
- {
+ if (minIndex != i + 1) {
RadialArc tmp;
tmp = ring[i + 1];
ring[i + 1] = ring[minIndex];
@@ -575,8 +510,7 @@ static void testRadialSymmetry(BGraph *graph, BNode* root_node, RadialArc* ring,
}
}
- for (i = 0; i < total && symmetric; i++)
- {
+ for (i = 0; i < total && symmetric; i++) {
BNode *node1, *node2;
float tangent[3];
float normal[3];
@@ -593,29 +527,25 @@ static void testRadialSymmetry(BGraph *graph, BNode* root_node, RadialArc* ring,
BLI_mirrorAlongAxis(p, root_node->p, normal);
/* check if it's within limit before continuing */
- if (len_v3v3(node1->p, p) > limit)
- {
+ if (len_v3v3(node1->p, p) > limit) {
symmetric = 0;
}
}
- if (symmetric)
- {
+ if (symmetric) {
/* mark node as symmetric physically */
copy_v3_v3(root_node->symmetry_axis, axis);
root_node->symmetry_flag |= SYM_PHYSICAL;
root_node->symmetry_flag |= SYM_RADIAL;
/* FLAG SYMMETRY GROUP */
- for (i = 0; i < total; i++)
- {
+ for (i = 0; i < total; i++) {
ring[i].arc->symmetry_group = group;
ring[i].arc->symmetry_flag = SYM_SIDE_RADIAL + i;
}
- if (graph->radial_symmetry)
- {
+ if (graph->radial_symmetry) {
graph->radial_symmetry(root_node, ring, total);
}
}
@@ -634,13 +564,11 @@ static void handleRadialSymmetry(BGraph *graph, BNode *root_node, int depth, flo
root_node->symmetry_flag |= SYM_TOPOLOGICAL;
/* total the number of arcs in the symmetry ring */
- for (i = 0; i < root_node->degree; i++)
- {
+ for (i = 0; i < root_node->degree; i++) {
BArc *connectedArc = root_node->arcs[i];
/* depth is store as a negative in flag. symmetry level is positive */
- if (connectedArc->symmetry_level == -depth)
- {
+ if (connectedArc->symmetry_level == -depth) {
total++;
}
}
@@ -649,13 +577,11 @@ static void handleRadialSymmetry(BGraph *graph, BNode *root_node, int depth, flo
unit = ring;
/* fill in the ring */
- for (unit = ring, i = 0; i < root_node->degree; i++)
- {
+ for (unit = ring, i = 0; i < root_node->degree; i++) {
BArc *connectedArc = root_node->arcs[i];
/* depth is store as a negative in flag. symmetry level is positive */
- if (connectedArc->symmetry_level == -depth)
- {
+ if (connectedArc->symmetry_level == -depth) {
BNode *otherNode = BLI_otherNode(connectedArc, root_node);
float vec[3];
@@ -676,19 +602,16 @@ static void handleRadialSymmetry(BGraph *graph, BNode *root_node, int depth, flo
* using a rather bogus insertion sort
* butrings will never get too big to matter
* */
- for (i = 0; i < total; i++)
- {
+ for (i = 0; i < total; i++) {
int j;
- for (j = i - 1; j >= 0; j--)
- {
+ for (j = i - 1; j >= 0; j--) {
BArc *arc1, *arc2;
arc1 = ring[j].arc;
arc2 = ring[j + 1].arc;
- if (arc1->length > arc2->length)
- {
+ if (arc1->length > arc2->length) {
/* swap with smaller */
RadialArc tmp;
@@ -696,8 +619,7 @@ static void handleRadialSymmetry(BGraph *graph, BNode *root_node, int depth, flo
ring[j + 1] = ring[j];
ring[j] = tmp;
}
- else
- {
+ else {
break;
}
}
@@ -707,38 +629,32 @@ static void handleRadialSymmetry(BGraph *graph, BNode *root_node, int depth, flo
first = 0;
group = 0;
- for (i = 1; i < total; i++)
- {
+ for (i = 1; i < total; i++) {
int dispatch = 0;
int last = i - 1;
- if (fabsf(ring[first].arc->length - ring[i].arc->length) > limit)
- {
+ if (fabsf(ring[first].arc->length - ring[i].arc->length) > limit) {
dispatch = 1;
}
/* if not dispatching already and on last arc
* Dispatch using current arc as last
* */
- if (dispatch == 0 && i == total - 1)
- {
+ if (dispatch == 0 && i == total - 1) {
last = i;
dispatch = 1;
}
- if (dispatch)
- {
+ if (dispatch) {
int sub_total = last - first + 1;
group += 1;
- if (sub_total == 1)
- {
+ if (sub_total == 1) {
group -= 1; /* not really a group so decrement */
/* NOTHING TO DO */
}
- else if (sub_total == 2)
- {
+ else if (sub_total == 2) {
BArc *arc1, *arc2;
BNode *node1, *node2;
@@ -750,14 +666,12 @@ static void handleRadialSymmetry(BGraph *graph, BNode *root_node, int depth, flo
testAxialSymmetry(graph, root_node, node1, node2, arc1, arc2, axis, limit, group);
}
- else if (sub_total != total) /* allocate a new sub ring if needed */
- {
+ else if (sub_total != total) /* allocate a new sub ring if needed */ {
RadialArc *sub_ring = MEM_callocN(sizeof(RadialArc) * sub_total, "radial symmetry ring");
int sub_i;
/* fill in the sub ring */
- for (sub_i = 0; sub_i < sub_total; sub_i++)
- {
+ for (sub_i = 0; sub_i < sub_total; sub_i++) {
sub_ring[sub_i] = ring[first + sub_i];
}
@@ -765,8 +679,7 @@ static void handleRadialSymmetry(BGraph *graph, BNode *root_node, int depth, flo
MEM_freeN(sub_ring);
}
- else if (sub_total == total)
- {
+ else if (sub_total == total) {
testRadialSymmetry(graph, root_node, ring, total, axis, limit, group);
}
@@ -786,12 +699,10 @@ static void flagAxialSymmetry(BNode *root_node, BNode *end_node, BArc *arc, int
sub_v3_v3v3(vec, end_node->p, root_node->p);
- if (dot_v3v3(vec, root_node->symmetry_axis) < 0)
- {
+ if (dot_v3v3(vec, root_node->symmetry_axis) < 0) {
arc->symmetry_flag |= SYM_SIDE_NEGATIVE;
}
- else
- {
+ else {
arc->symmetry_flag |= SYM_SIDE_POSITIVE;
}
}
@@ -809,16 +720,13 @@ static void testAxialSymmetry(BGraph *graph, BNode* root_node, BNode* node1, BNo
cross_v3_v3v3(nor, vec, axis);
- if (abs(nor[0]) > abs(nor[1]) && abs(nor[0]) > abs(nor[2]) && nor[0] < 0)
- {
+ if (abs(nor[0]) > abs(nor[1]) && abs(nor[0]) > abs(nor[2]) && nor[0] < 0) {
negate_v3(nor);
}
- else if (abs(nor[1]) > abs(nor[0]) && abs(nor[1]) > abs(nor[2]) && nor[1] < 0)
- {
+ else if (abs(nor[1]) > abs(nor[0]) && abs(nor[1]) > abs(nor[2]) && nor[1] < 0) {
negate_v3(nor);
}
- else if (abs(nor[2]) > abs(nor[1]) && abs(nor[2]) > abs(nor[0]) && nor[2] < 0)
- {
+ else if (abs(nor[2]) > abs(nor[1]) && abs(nor[2]) > abs(nor[0]) && nor[2] < 0) {
negate_v3(nor);
}
@@ -827,8 +735,7 @@ static void testAxialSymmetry(BGraph *graph, BNode* root_node, BNode* node1, BNo
BLI_mirrorAlongAxis(p, root_node->p, nor);
/* check if it's within limit before continuing */
- if (len_v3v3(node1->p, p) <= limit)
- {
+ if (len_v3v3(node1->p, p) <= limit) {
/* mark node as symmetric physically */
copy_v3_v3(root_node->symmetry_axis, nor);
root_node->symmetry_flag |= SYM_PHYSICAL;
@@ -838,13 +745,11 @@ static void testAxialSymmetry(BGraph *graph, BNode* root_node, BNode* node1, BNo
flagAxialSymmetry(root_node, node1, arc1, group);
flagAxialSymmetry(root_node, node2, arc2, group);
- if (graph->axial_symmetry)
- {
+ if (graph->axial_symmetry) {
graph->axial_symmetry(root_node, node1, node2, arc1, arc2);
}
}
- else
- {
+ else {
/* NOT SYMMETRIC */
}
}
@@ -858,20 +763,16 @@ static void handleAxialSymmetry(BGraph *graph, BNode *root_node, int depth, floa
/* mark topological symmetry */
root_node->symmetry_flag |= SYM_TOPOLOGICAL;
- for (i = 0; i < root_node->degree; i++)
- {
+ for (i = 0; i < root_node->degree; i++) {
BArc *connectedArc = root_node->arcs[i];
/* depth is store as a negative in flag. symmetry level is positive */
- if (connectedArc->symmetry_level == -depth)
- {
- if (arc1 == NULL)
- {
+ if (connectedArc->symmetry_level == -depth) {
+ if (arc1 == NULL) {
arc1 = connectedArc;
node1 = BLI_otherNode(arc1, root_node);
}
- else
- {
+ else {
arc2 = connectedArc;
node2 = BLI_otherNode(arc2, root_node);
break; /* Can stop now, the two arcs have been found */
@@ -880,8 +781,7 @@ static void handleAxialSymmetry(BGraph *graph, BNode *root_node, int depth, floa
}
/* shouldn't happen, but just to be sure */
- if (node1 == NULL || node2 == NULL)
- {
+ if (node1 == NULL || node2 == NULL) {
return;
}
@@ -897,18 +797,15 @@ static void markdownSecondarySymmetry(BGraph *graph, BNode *node, int depth, int
/* count the number of branches in this symmetry group
* and determinate the axis of symmetry
* */
- for (i = 0; i < node->degree; i++)
- {
+ for (i = 0; i < node->degree; i++) {
BArc *connectedArc = node->arcs[i];
/* depth is store as a negative in flag. symmetry level is positive */
- if (connectedArc->symmetry_level == -depth)
- {
+ if (connectedArc->symmetry_level == -depth) {
count++;
}
/* If arc is on the axis */
- else if (connectedArc->symmetry_level == level)
- {
+ else if (connectedArc->symmetry_level == level) {
add_v3_v3(axis, connectedArc->head->p);
sub_v3_v3v3(axis, axis, connectedArc->tail->p);
}
@@ -917,22 +814,18 @@ static void markdownSecondarySymmetry(BGraph *graph, BNode *node, int depth, int
normalize_v3(axis);
/* Split between axial and radial symmetry */
- if (count == 2)
- {
+ if (count == 2) {
handleAxialSymmetry(graph, node, depth, axis, limit);
}
- else
- {
+ else {
handleRadialSymmetry(graph, node, depth, axis, limit);
}
/* markdown secondary symetries */
- for (i = 0; i < node->degree; i++)
- {
+ for (i = 0; i < node->degree; i++) {
BArc *connectedArc = node->arcs[i];
- if (connectedArc->symmetry_level == -depth)
- {
+ if (connectedArc->symmetry_level == -depth) {
/* markdown symmetry for branches corresponding to the depth */
markdownSymmetryArc(graph, connectedArc, node, level + 1, limit);
}
@@ -944,19 +837,16 @@ static void markdownSymmetryArc(BGraph *graph, BArc *arc, BNode *node, int level
int i;
/* if arc is null, we start straight from a node */
- if (arc)
- {
+ if (arc) {
arc->symmetry_level = level;
node = BLI_otherNode(arc, node);
}
- for (i = 0; i < node->degree; i++)
- {
+ for (i = 0; i < node->degree; i++) {
BArc *connectedArc = node->arcs[i];
- if (connectedArc != arc)
- {
+ if (connectedArc != arc) {
BNode *connectedNode = BLI_otherNode(connectedArc, node);
/* symmetry level is positive value, negative values is subtree depth */
@@ -966,26 +856,22 @@ static void markdownSymmetryArc(BGraph *graph, BArc *arc, BNode *node, int level
arc = NULL;
- for (i = 0; i < node->degree; i++)
- {
+ for (i = 0; i < node->degree; i++) {
int issymmetryAxis = 0;
BArc *connectedArc = node->arcs[i];
/* only arcs not already marked as symetric */
- if (connectedArc->symmetry_level < 0)
- {
+ if (connectedArc->symmetry_level < 0) {
int j;
/* true by default */
issymmetryAxis = 1;
- for (j = 0; j < node->degree; j++)
- {
+ for (j = 0; j < node->degree; j++) {
BArc *otherArc = node->arcs[j];
/* different arc, same depth */
- if (otherArc != connectedArc && otherArc->symmetry_level == connectedArc->symmetry_level)
- {
+ if (otherArc != connectedArc && otherArc->symmetry_level == connectedArc->symmetry_level) {
/* not on the symmetry axis */
issymmetryAxis = 0;
break;
@@ -994,15 +880,12 @@ static void markdownSymmetryArc(BGraph *graph, BArc *arc, BNode *node, int level
}
/* arc could be on the symmetry axis */
- if (issymmetryAxis == 1)
- {
+ if (issymmetryAxis == 1) {
/* no arc as been marked previously, keep this one */
- if (arc == NULL)
- {
+ if (arc == NULL) {
arc = connectedArc;
}
- else if (connectedArc->symmetry_level < arc->symmetry_level)
- {
+ else if (connectedArc->symmetry_level < arc->symmetry_level) {
/* go with more complex subtree as symmetry arc */
arc = connectedArc;
}
@@ -1010,20 +893,17 @@ static void markdownSymmetryArc(BGraph *graph, BArc *arc, BNode *node, int level
}
/* go down the arc continuing the symmetry axis */
- if (arc)
- {
+ if (arc) {
markdownSymmetryArc(graph, arc, node, level, limit);
}
/* secondary symmetry */
- for (i = 0; i < node->degree; i++)
- {
+ for (i = 0; i < node->degree; i++) {
BArc *connectedArc = node->arcs[i];
/* only arcs not already marked as symetric and is not the next arc on the symmetry axis */
- if (connectedArc->symmetry_level < 0)
- {
+ if (connectedArc->symmetry_level < 0) {
/* subtree depth is store as a negative value in the symmetry */
markdownSecondarySymmetry(graph, node, -connectedArc->symmetry_level, level, limit);
}
@@ -1035,13 +915,11 @@ void BLI_markdownSymmetry(BGraph *graph, BNode *root_node, float limit)
BNode *node;
BArc *arc;
- if (root_node == NULL)
- {
+ if (root_node == NULL) {
return;
}
- if (BLI_isGraphCyclic(graph))
- {
+ if (BLI_isGraphCyclic(graph)) {
return;
}
@@ -1054,37 +932,29 @@ void BLI_markdownSymmetry(BGraph *graph, BNode *root_node, float limit)
node = root_node;
/* sanity check REMOVE ME */
- if (node->degree > 0)
- {
+ if (node->degree > 0) {
arc = node->arcs[0];
- if (node->degree == 1)
- {
+ if (node->degree == 1) {
markdownSymmetryArc(graph, arc, node, 1, limit);
}
- else
- {
+ else {
markdownSymmetryArc(graph, NULL, node, 1, limit);
}
/* mark down non-symetric arcs */
- for (arc = graph->arcs.first; arc; arc = arc->next)
- {
- if (arc->symmetry_level < 0)
- {
+ for (arc = graph->arcs.first; arc; arc = arc->next) {
+ if (arc->symmetry_level < 0) {
arc->symmetry_level = 0;
}
- else
- {
+ else {
/* mark down nodes with the lowest level symmetry axis */
- if (arc->head->symmetry_level == 0 || arc->head->symmetry_level > arc->symmetry_level)
- {
+ if (arc->head->symmetry_level == 0 || arc->head->symmetry_level > arc->symmetry_level) {
arc->head->symmetry_level = arc->symmetry_level;
}
- if (arc->tail->symmetry_level == 0 || arc->tail->symmetry_level > arc->symmetry_level)
- {
+ if (arc->tail->symmetry_level == 0 || arc->tail->symmetry_level > arc->symmetry_level) {
arc->tail->symmetry_level = arc->symmetry_level;
}
}
@@ -1108,16 +978,13 @@ void* IT_peek(void* arg, int n)
{
BArcIterator *iter = (BArcIterator*)arg;
- if (iter->index + n < 0)
- {
+ if (iter->index + n < 0) {
return iter->head(iter);
}
- else if (iter->index + n >= iter->length)
- {
+ else if (iter->index + n >= iter->length) {
return iter->tail(iter);
}
- else
- {
+ else {
return iter->peek(iter, n);
}
}
diff --git a/source/blender/blenlib/intern/jitter.c b/source/blender/blenlib/intern/jitter.c
index fbdf698cc87..35651323ac4 100644
--- a/source/blender/blenlib/intern/jitter.c
+++ b/source/blender/blenlib/intern/jitter.c
@@ -43,7 +43,7 @@
void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
{
- int i , j , k;
+ int i, j, k;
float vecx, vecy, dvecx, dvecy, x, y, len;
for (i = 2*num-2; i>=0 ; i-=2) {
@@ -96,7 +96,7 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
jit2[i] = x;
jit2[i+1] = y;
}
- memcpy(jit1,jit2,2 * num * sizeof(float));
+ memcpy(jit1, jit2, 2 * num * sizeof(float));
}
void BLI_jitterate2(float *jit1, float *jit2, int num, float rad2)
@@ -135,7 +135,7 @@ void BLI_jitterate2(float *jit1, float *jit2, int num, float rad2)
jit2[i] = x;
jit2[i+1] = y;
}
- memcpy(jit1,jit2,2 * num * sizeof(float));
+ memcpy(jit1, jit2, 2 * num * sizeof(float));
}
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index fecaa507b5c..19cae7456c9 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -1,9 +1,4 @@
-/* util.c
- *
- * various string, file, list operations.
- *
- *
- *
+/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -131,7 +126,7 @@ void BLI_freelinkN(ListBase *listbase, void *vlink)
if (link == NULL) return;
if (listbase == NULL) return;
- BLI_remlink(listbase,link);
+ BLI_remlink(listbase, link);
MEM_freeN(link);
}
@@ -189,8 +184,7 @@ void BLI_sortlist(ListBase *listbase, int (*cmp)(void *, void *))
BLI_remlink(listbase, current);
- while (previous && cmp(previous, current) == 1)
- {
+ while (previous && cmp(previous, current) == 1) {
previous = previous->prev;
}
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 76b986d7346..bb0b8897b15 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -1674,8 +1674,8 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
// Calculate the shift.
float scale = maxf(maxf(maxf(maxf(
- fabsf(s[p - 1]),fabsf(s[p - 2])),fabsf(e[p - 2])),
- fabsf(s[k])),fabsf(e[k]));
+ fabsf(s[p - 1]), fabsf(s[p - 2])), fabsf(e[p - 2])),
+ fabsf(s[k])), fabsf(e[k]));
float invscale = 1.0f / scale;
float sp = s[p - 1] * invscale;
float spm1 = s[p - 2] * invscale;
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index ec5fd39cd87..37402f9391c 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -78,7 +78,23 @@ void mul_qt_qtqt(float q[4], const float q1[4], const float q2[4])
q[2] = t2;
}
-/* Assumes a unit quaternion */
+/**
+ * \note:
+ * Assumes a unit quaternion?
+ *
+ * infact not, but you may wan't to use a unit quat, read on...
+ *
+ * Shortcut for 'q v q*' when \a v is actually a quaternion.
+ * This removes the need for converting a vector to a quaternion,
+ * calculating q's conjugate and converting back to a vector.
+ * It also happens to be faster (17+,24* vs * 24+,32*).
+ * If \a q is not a unit quaternion, then \a v will be both rotated by
+ * the same amount as if q was a unit quaternion, and scaled by the square of
+ * the length of q.
+ *
+ * For people used to python mathutils, its like:
+ * def mul_qt_v3(q, v): (q * Quaternion((0.0, v[0], v[1], v[2])) * q.conjugated())[1:]
+ */
void mul_qt_v3(const float q[4], float v[3])
{
float t0, t1, t2;
@@ -1615,7 +1631,7 @@ void normalize_dq(DualQuat *dq, float totweight)
}
}
-void mul_v3m3_dq(float *co, float mat[][3], DualQuat *dq)
+void mul_v3m3_dq(float co[3], float mat[][3], DualQuat *dq)
{
float M[3][3], t[3], scalemat[3][3], len2;
float w = dq->quat[0], x = dq->quat[1], y = dq->quat[2], z = dq->quat[3];
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index f734e01943f..90e6a4cb945 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -217,6 +217,25 @@ float angle_normalized_v2v2(const float v1[2], const float v2[2])
return 2.0f * (float)saasin(len_v2v2(v2, v1) / 2.0f);
}
+/**
+ * angle between 2 vectors defined by 3 coords, about an axis. */
+float angle_on_axis_v3v3v3_v3(const float v1[3], const float v2[3], const float v3[3], const float axis[3])
+{
+ float v1_proj[3], v2_proj[3], tproj[3];
+
+ sub_v3_v3v3(v1_proj, v1, v2);
+ sub_v3_v3v3(v2_proj, v3, v2);
+
+ /* project the vectors onto the axis */
+ project_v3_v3v3(tproj, v1_proj, axis);
+ sub_v3_v3(v1_proj, tproj);
+
+ project_v3_v3v3(tproj, v2_proj, axis);
+ sub_v3_v3(v2_proj, tproj);
+
+ return angle_v3v3(v1_proj, v2_proj);
+}
+
void angle_tri_v3(float angles[3], const float v1[3], const float v2[3], const float v3[3])
{
float ed1[3], ed2[3], ed3[3];
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c
index 5db42c35f5c..5b669c4ff1c 100644
--- a/source/blender/blenlib/intern/noise.c
+++ b/source/blender/blenlib/intern/noise.c
@@ -375,7 +375,7 @@ float BLI_turbulence1(float noisesize, float x, float y, float z, int nr)
{
float s, d= 0.5, div=1.0;
- s= fabsf( (-1.0f+2.0f*BLI_hnoise(noisesize, x, y, z)));
+ s= fabsf((-1.0f + 2.0f * BLI_hnoise(noisesize, x, y, z)));
while (nr>0) {
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 3c59ca8d52b..9f775028c1a 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -135,7 +135,7 @@ int BLI_stringdec(const char *string, char *head, char *tail, unsigned short *nu
if (found) {
if (tail) strcpy(tail, &string[nume+1]);
if (head) {
- strcpy(head,string);
+ strcpy(head, string);
head[nums]=0;
}
if (numlen) *numlen = nume-nums+1;
@@ -364,12 +364,12 @@ void BLI_cleanup_path(const char *relabase, char *dir)
}
}
- while ( (start = strstr(dir,"\\.\\")) ) {
+ while ( (start = strstr(dir, "\\.\\")) ) {
eind = start + strlen("\\.\\") - 1;
memmove(start, eind, strlen(eind) + 1);
}
- while ( (start = strstr(dir,"\\\\" )) ) {
+ while ( (start = strstr(dir, "\\\\" )) ) {
eind = start + strlen("\\\\") - 1;
memmove(start, eind, strlen(eind) + 1);
}
@@ -402,12 +402,12 @@ void BLI_cleanup_path(const char *relabase, char *dir)
}
}
- while ( (start = strstr(dir,"/./")) ) {
+ while ( (start = strstr(dir, "/./")) ) {
eind = start + (3 - 1) /* strlen("/./") - 1 */;
memmove(start, eind, strlen(eind) + 1);
}
- while ( (start = strstr(dir,"//" )) ) {
+ while ( (start = strstr(dir, "//" )) ) {
eind = start + (2 - 1) /* strlen("//") - 1 */;
memmove(start, eind, strlen(eind) + 1);
}
@@ -758,7 +758,7 @@ int BLI_path_cwd(char *path)
BLI_current_working_dir(cwd, sizeof(cwd)); /* in case the full path to the blend isn't used */
if (cwd[0] == '\0') {
- printf( "Could not get the current working directory - $PWD for an unknown reason.");
+ printf("Could not get the current working directory - $PWD for an unknown reason.\n");
}
else {
/* uses the blend path relative to cwd important for loading relative linked files.
@@ -835,7 +835,7 @@ const char *BLI_getDefaultDocumentFolder(void)
HRESULT hResult;
/* Check for %HOME% env var */
- if (uput_getenv("HOME",documentfolder,MAXPATHLEN)) {
+ if (uput_getenv("HOME", documentfolder, MAXPATHLEN)) {
if (BLI_is_dir(documentfolder)) return documentfolder;
}
@@ -1156,7 +1156,7 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check)
{
static char path[FILE_MAX] = "";
int ok;
- switch(id) {
+ switch (id) {
case BLENDER_RESOURCE_PATH_USER:
ok= get_path_user(path, NULL, NULL, NULL, ver);
break;
@@ -1265,7 +1265,7 @@ void BLI_make_exist(char *dir)
#ifdef WIN32
get_default_root(dir);
#else
- strcpy(dir,"/");
+ strcpy(dir, "/");
#endif
break;
}
@@ -1787,7 +1787,7 @@ static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name
#ifdef WITH_BINRELOC
/* linux uses binreloc since argv[0] is not reliable, call br_init( NULL ) first */
- path = br_find_exe( NULL );
+ path = br_find_exe(NULL);
if (path) {
BLI_strncpy(fullname, path, maxlen);
free((void *)path);
@@ -1798,7 +1798,7 @@ static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name
#ifdef _WIN32
wchar_t * fullname_16 = MEM_mallocN(maxlen*sizeof(wchar_t), "ProgramPath");
if (GetModuleFileNameW(0, fullname_16, maxlen)) {
- conv_utf_16_to_8(fullname_16,fullname, maxlen);
+ conv_utf_16_to_8(fullname_16, fullname, maxlen);
if (!BLI_exists(fullname)) {
printf("path can't be found: \"%.*s\"\n", maxlen, fullname);
MessageBox(NULL, "path contains invalid characters or is too long (see console)", "Error", MB_OK);
diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c
index 7a955cf6ed9..f4481c37f2d 100644
--- a/source/blender/blenlib/intern/pbvh.c
+++ b/source/blender/blenlib/intern/pbvh.c
@@ -1151,7 +1151,7 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
}
if (node->flag & PBVH_UpdateDrawBuffers) {
- switch(bvh->type) {
+ switch (bvh->type) {
case PBVH_GRIDS:
GPU_update_grid_buffers(node->draw_buffers,
bvh->grids,
@@ -1290,7 +1290,9 @@ void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *tot
for (hiter = BLI_ghashIterator_new(map), i = 0;
!BLI_ghashIterator_isDone(hiter);
BLI_ghashIterator_step(hiter), ++i)
+ {
faces[i]= BLI_ghashIterator_getKey(hiter);
+ }
BLI_ghashIterator_free(hiter);
@@ -1345,7 +1347,7 @@ void BLI_pbvh_node_num_verts(PBVH *bvh, PBVHNode *node, int *uniquevert, int *to
{
int tot;
- switch(bvh->type) {
+ switch (bvh->type) {
case PBVH_GRIDS:
tot= node->totprim*bvh->gridsize*bvh->gridsize;
if (totvert) *totvert= tot;
@@ -1360,7 +1362,7 @@ void BLI_pbvh_node_num_verts(PBVH *bvh, PBVHNode *node, int *uniquevert, int *to
void BLI_pbvh_node_get_grids(PBVH *bvh, PBVHNode *node, int **grid_indices, int *totgrid, int *maxgrid, int *gridsize, DMGridData ***griddata, DMGridAdjacency **gridadj)
{
- switch(bvh->type) {
+ switch (bvh->type) {
case PBVH_GRIDS:
if (grid_indices) *grid_indices= node->prim_indices;
if (totgrid) *totgrid= node->totprim;
@@ -1504,7 +1506,7 @@ int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3],
if (node->flag & PBVH_FullyHidden)
return 0;
- switch(bvh->type) {
+ switch (bvh->type) {
case PBVH_FACES:
vert = bvh->verts;
faces= node->prim_indices;
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 1c55d5b5a39..0245a9c90af 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -95,7 +95,7 @@
#include "BKE_utildefines.h"
/* vars: */
-static int totnum,actnum;
+static int totnum, actnum;
static struct direntry *files;
static struct ListBase dirbase_={NULL, NULL};
@@ -139,7 +139,7 @@ static int bli_compare(struct direntry *entry1, struct direntry *entry2)
if ( strcmp(entry1->relname, "..")==0 ) return (-1);
if ( strcmp(entry2->relname, "..")==0 ) return (1);
- return (BLI_natstrcmp(entry1->relname,entry2->relname));
+ return (BLI_natstrcmp(entry1->relname, entry2->relname));
}
@@ -161,7 +161,7 @@ double BLI_dir_free_space(const char *dir)
tmp[3]=0;
}
- GetDiskFreeSpace(tmp,&sectorspc, &bytesps, &freec, &clusters);
+ GetDiskFreeSpace(tmp, &sectorspc, &bytesps, &freec, &clusters);
return (double) (freec*bytesps*sectorspc);
#else
@@ -171,19 +171,19 @@ double BLI_dir_free_space(const char *dir)
#else
struct statfs disk;
#endif
- char name[FILE_MAXDIR],*slash;
+ char name[FILE_MAXDIR], *slash;
int len = strlen(dir);
if (len >= FILE_MAXDIR) /* path too long */
return -1;
- strcpy(name,dir);
+ strcpy(name, dir);
if (len) {
- slash = strrchr(name,'/');
+ slash = strrchr(name, '/');
if (slash) slash[1] = 0;
}
- else strcpy(name,"/");
+ else strcpy(name, "/");
#if defined (__FreeBSD__) || defined (linux) || defined (__OpenBSD__) || defined (__APPLE__) || defined(__GNU__) || defined(__GLIBC__)
if (statfs(name, &disk)) return(-1);
@@ -234,9 +234,9 @@ static void bli_builddir(const char *dirname, const char *relname)
while ((fname = (struct dirent*) readdir(dir)) != NULL) {
dlink = (struct dirlink *)malloc(sizeof(struct dirlink));
if (dlink) {
- BLI_strncpy(buf + rellen ,fname->d_name, sizeof(buf) - rellen);
+ BLI_strncpy(buf + rellen, fname->d_name, sizeof(buf) - rellen);
dlink->name = BLI_strdup(buf);
- BLI_addhead(dirbase,dlink);
+ BLI_addhead(dirbase, dlink);
newnum++;
}
}
@@ -260,22 +260,22 @@ static void bli_builddir(const char *dirname, const char *relname)
if (files) {
dlink = (struct dirlink *) dirbase->first;
while (dlink) {
- memset(&files[actnum], 0 , sizeof(struct direntry));
+ memset(&files[actnum], 0, sizeof(struct direntry));
files[actnum].relname = dlink->name;
files[actnum].path = BLI_strdupcat(dirname, dlink->name);
// use 64 bit file size, only needed for WIN32 and WIN64.
// Excluding other than current MSVC compiler until able to test
#ifdef WIN32
- {wchar_t * name_16 = alloc_utf16_from_8(dlink->name,0);
+ {wchar_t * name_16 = alloc_utf16_from_8(dlink->name, 0);
#if (defined(WIN32) || defined(WIN64)) && (_MSC_VER>=1500)
- _wstat64(name_16,&files[actnum].s);
+ _wstat64(name_16, &files[actnum].s);
#elif defined(__MINGW32__)
- _stati64(dlink->name,&files[actnum].s);
+ _stati64(dlink->name, &files[actnum].s);
#endif
free(name_16);};
#else
- stat(dlink->name,&files[actnum].s);
+ stat(dlink->name, &files[actnum].s);
#endif
files[actnum].type=files[actnum].s.st_mode;
files[actnum].flags = 0;
@@ -290,16 +290,16 @@ static void bli_builddir(const char *dirname, const char *relname)
}
BLI_freelist(dirbase);
- if (files) qsort(files, actnum, sizeof(struct direntry), (int (*)(const void *,const void*))bli_compare);
+ if (files) qsort(files, actnum, sizeof(struct direntry), (int (*)(const void *, const void*))bli_compare);
}
else {
- printf("%s empty directory\n",dirname);
+ printf("%s empty directory\n", dirname);
}
closedir(dir);
}
else {
- printf("%s non-existant directory\n",dirname);
+ printf("%s non-existant directory\n", dirname);
}
}
@@ -349,7 +349,7 @@ static void bli_adddirstrings(void)
#endif
#ifdef WIN32
- strcpy(file->owner,"user");
+ strcpy(file->owner, "user");
#else
{
struct passwd *pwuser;
@@ -426,7 +426,7 @@ unsigned int BLI_dir_contents(const char *dirname, struct direntry **filelist)
actnum = totnum = 0;
files = NULL;
- bli_builddir(dirname,"");
+ bli_builddir(dirname, "");
bli_adddirstrings();
if (files) {
@@ -488,7 +488,7 @@ int BLI_exists(const char *name)
if (res == -1) return(0);
#else
struct stat st;
- if (stat(name,&st)) return(0);
+ if (stat(name, &st)) return(0);
#endif
return(st.st_mode);
}
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index 4c92a872ed7..d880b895ced 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -125,7 +125,7 @@ size_t BLI_strescape(char *dst, const char *src, const size_t maxlen)
{
size_t len= 0;
while (len < maxlen) {
- switch(*src) {
+ switch (*src) {
case '\0':
goto escape_finish;
case '\\':
@@ -391,10 +391,10 @@ void BLI_timestr(double _time, char *str)
int hun= ( (int) (_time * 100.0)) % 100;
if (hr) {
- sprintf(str, "%.2d:%.2d:%.2d.%.2d",hr,min,sec,hun);
+ sprintf(str, "%.2d:%.2d:%.2d.%.2d", hr, min, sec, hun);
}
else {
- sprintf(str, "%.2d:%.2d.%.2d",min,sec,hun);
+ sprintf(str, "%.2d:%.2d.%.2d", min, sec, hun);
}
str[11]=0;
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
index aede08be7f9..77bebfaf2e8 100644
--- a/source/blender/blenlib/intern/string_utf8.c
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -46,14 +46,14 @@
* it's hard to know how many characters there are! */
static const char trailingBytesForUTF8[256] = {
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5
};
int BLI_utf8_invalid_byte(const char *str, int length)
@@ -153,14 +153,14 @@ int BLI_utf8_invalid_strip(char *str, int length)
* note: this looks to be at odd's with 'trailingBytesForUTF8',
* need to find out what gives here! - campbell */
static const size_t utf8_skip_data[256] = {
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1
};
#define BLI_STR_UTF8_CPY(dst, src, maxncpy) \
@@ -168,7 +168,7 @@ static const size_t utf8_skip_data[256] = {
size_t utf8_size; \
while (*src != '\0' && (utf8_size= utf8_skip_data[*src]) < maxncpy) { \
maxncpy -= utf8_size; \
- switch(utf8_size) { \
+ switch (utf8_size) { \
case 6: *dst ++ = *src ++; \
case 5: *dst ++ = *src ++; \
case 4: *dst ++ = *src ++; \
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index 05d8ded7764..2d82c0989b1 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -304,7 +304,7 @@ void BLI_end_threads(ListBase *threadbase)
/* System Information */
/* how many threads are native on this system? */
-int BLI_system_thread_count( void )
+int BLI_system_thread_count(void)
{
int t;
#ifdef WIN32
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c
index f3cb0dd6f84..0731213d607 100644
--- a/source/blender/blenlib/intern/winstuff.c
+++ b/source/blender/blenlib/intern/winstuff.c
@@ -58,12 +58,12 @@ int BLI_getInstallationDir(char * str)
char dir[FILE_MAXDIR];
int a;
/*change to utf support*/
- GetModuleFileName(NULL,str,FILE_MAX);
+ GetModuleFileName(NULL, str, FILE_MAX);
BLI_split_dir_part(str, dir, sizeof(dir)); /* shouldn't be relative */
a = strlen(dir);
if (dir[a-1] == '\\') dir[a-1]=0;
- strcpy(str,dir);
+ strcpy(str, dir);
return 1;
}
@@ -74,8 +74,8 @@ void RegisterBlendExtension_Fail(HKEY root)
if (root)
RegCloseKey(root);
if (!G.background)
- MessageBox(0,"Could not register file extension.","Blender error",MB_OK|MB_ICONERROR);
- TerminateProcess(GetCurrentProcess(),1);
+ MessageBox(0, "Could not register file extension.", "Blender error", MB_OK|MB_ICONERROR);
+ TerminateProcess(GetCurrentProcess(), 1);
}
void RegisterBlendExtension(void)
@@ -96,7 +96,7 @@ void RegisterBlendExtension(void)
BOOL IsWOW64;
printf("Registering file extension...");
- GetModuleFileName(0,BlPath,MAX_PATH);
+ GetModuleFileName(0, BlPath, MAX_PATH);
// root is HKLM by default
lresult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Classes", 0, KEY_ALL_ACCESS, &root);
@@ -111,7 +111,7 @@ void RegisterBlendExtension(void)
lresult = RegCreateKeyEx(root, "blendfile", 0,
NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
if (lresult == ERROR_SUCCESS) {
- strcpy(buffer,"Blender File");
+ strcpy(buffer, "Blender File");
lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, (BYTE*)buffer, strlen(buffer) + 1);
RegCloseKey(hkey);
}
@@ -131,7 +131,7 @@ void RegisterBlendExtension(void)
lresult = RegCreateKeyEx(root, "blendfile\\DefaultIcon", 0,
NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
if (lresult == ERROR_SUCCESS) {
- sprintf(buffer, "\"%s\",1", BlPath);
+ sprintf(buffer, "\"%s\", 1", BlPath);
lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, (BYTE*)buffer, strlen(buffer) + 1);
RegCloseKey(hkey);
}
@@ -149,26 +149,26 @@ void RegisterBlendExtension(void)
RegisterBlendExtension_Fail(root);
BLI_getInstallationDir(InstallDir);
- GetSystemDirectory(SysDir,FILE_MAXDIR);
+ GetSystemDirectory(SysDir, FILE_MAXDIR);
#ifdef WIN64
ThumbHandlerDLL = "BlendThumb64.dll";
#else
- IsWow64Process(GetCurrentProcess(),&IsWOW64);
+ IsWow64Process(GetCurrentProcess(), &IsWOW64);
if (IsWOW64 == TRUE)
ThumbHandlerDLL = "BlendThumb64.dll";
else
ThumbHandlerDLL = "BlendThumb.dll";
#endif
- snprintf(RegCmd,MAX_PATH*2,"%s\\regsvr32 /s \"%s\\%s\"",SysDir,InstallDir,ThumbHandlerDLL);
+ snprintf(RegCmd, MAX_PATH*2, "%s\\regsvr32 /s \"%s\\%s\"", SysDir, InstallDir, ThumbHandlerDLL);
system(RegCmd);
RegCloseKey(root);
- printf("success (%s)\n",usr_mode ? "user" : "system");
+ printf("success (%s)\n", usr_mode ? "user" : "system");
if (!G.background) {
- sprintf(MBox,"File extension registered for %s.",usr_mode ? "the current user. To register for all users, run as an administrator" : "all users");
- MessageBox(0,MBox,"Blender",MB_OK|MB_ICONINFORMATION);
+ sprintf(MBox, "File extension registered for %s.", usr_mode ? "the current user. To register for all users, run as an administrator" : "all users");
+ MessageBox(0, MBox, "Blender", MB_OK|MB_ICONINFORMATION);
}
- TerminateProcess(GetCurrentProcess(),0);
+ TerminateProcess(GetCurrentProcess(), 0);
}
DIR *opendir (const char *path)
@@ -179,7 +179,7 @@ DIR *opendir (const char *path)
DIR *newd= MEM_mallocN(sizeof(DIR), "opendir");
newd->handle = INVALID_HANDLE_VALUE;
- sprintf(newd->path, "%s\\*",path);
+ sprintf(newd->path, "%s\\*", path);
newd->direntry.d_ino= 0;
newd->direntry.d_off= 0;
@@ -200,8 +200,8 @@ static char *BLI_alloc_utf_8_from_16(wchar_t *in16, size_t add)
size_t bsize = count_utf_8_from_16(in16);
char *out8 = NULL;
if (!bsize) return NULL;
- out8 = (char*)MEM_mallocN(sizeof(char) * (bsize + add),"UTF-8 String");
- conv_utf_16_to_8(in16,out8, bsize);
+ out8 = (char*)MEM_mallocN(sizeof(char) * (bsize + add), "UTF-8 String");
+ conv_utf_16_to_8(in16, out8, bsize);
return out8;
}
@@ -211,7 +211,7 @@ static wchar_t *UNUSED_FUNCTION(BLI_alloc_utf16_from_8)(char *in8, size_t add)
wchar_t *out16 = NULL;
if (!bsize) return NULL;
out16 =(wchar_t*) MEM_mallocN(sizeof(wchar_t) * (bsize + add), "UTF-16 String");
- conv_utf_8_to_16(in8,out16, bsize);
+ conv_utf_8_to_16(in8, out16, bsize);
return out16;
}
@@ -236,7 +236,7 @@ struct dirent *readdir(DIR *dp)
return &dp->direntry;
}
else if (FindNextFileW (dp->handle, &(dp->data))) {
- dp->direntry.d_name= BLI_alloc_utf_8_from_16(dp->data.cFileName,0);
+ dp->direntry.d_name= BLI_alloc_utf_8_from_16(dp->data.cFileName, 0);
return &dp->direntry;
}
@@ -245,7 +245,7 @@ struct dirent *readdir(DIR *dp)
}
}
-int closedir (DIR *dp)
+int closedir(DIR *dp)
{
if (dp->direntry.d_name) MEM_freeN(dp->direntry.d_name);
if (dp->handle!=INVALID_HANDLE_VALUE) FindClose(dp->handle);
@@ -262,7 +262,7 @@ void get_default_root(char *root)
/* the default drive to resolve a directory without a specified drive
* should be the Windows installation drive, since this was what the OS
* assumes. */
- if (GetWindowsDirectory(str,MAX_PATH+1)) {
+ if (GetWindowsDirectory(str, MAX_PATH+1)) {
root[0] = str[0];
root[1] = ':';
root[2] = '\\';
@@ -271,7 +271,7 @@ void get_default_root(char *root)
else {
/* if GetWindowsDirectory fails, something has probably gone wrong,
* we are trying the blender install dir though */
- if (GetModuleFileName(NULL,str,MAX_PATH+1)) {
+ if (GetModuleFileName(NULL, str, MAX_PATH+1)) {
printf("Error! Could not get the Windows Directory - Defaulting to Blender installation Dir!");
root[0] = str[0];
root[1] = ':';
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index 49990a953f6..8f3131c733a 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -156,8 +156,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
if (bhead->code==ofblocktype) {
char *idname= bhead_id_name(fd, bhead);
- switch(GS(idname))
- {
+ switch (GS(idname)) {
case ID_MA: /* fall through */
case ID_TE: /* fall through */
case ID_IM: /* fall through */
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index d278d3733e6..52df43aabdd 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -77,6 +77,7 @@
#include "DNA_nla_types.h"
#include "DNA_node_types.h"
#include "DNA_object_fluidsim.h" // NT
+#include "DNA_object_types.h"
#include "DNA_packedFile_types.h"
#include "DNA_particle_types.h"
#include "DNA_property_types.h"
@@ -1061,8 +1062,7 @@ void blo_freefiledata(FileData *fd)
close(fd->filedes);
}
- if (fd->gzfiledes != NULL)
- {
+ if (fd->gzfiledes != NULL) {
gzclose(fd->gzfiledes);
}
@@ -1477,7 +1477,7 @@ static void test_pointer_array(FileData *fd, void **mat)
len= MEM_allocN_len(*mat)/fd->filesdna->pointerlen;
if (fd->filesdna->pointerlen==8 && fd->memsdna->pointerlen==4) {
- ipoin=imat= MEM_mallocN( len*4, "newmatar");
+ ipoin=imat= MEM_mallocN(len*4, "newmatar");
lpoin= *mat;
while (len-- > 0) {
@@ -1492,7 +1492,7 @@ static void test_pointer_array(FileData *fd, void **mat)
}
if (fd->filesdna->pointerlen==4 && fd->memsdna->pointerlen==8) {
- lpoin=lmat= MEM_mallocN( len*8, "newmatar");
+ lpoin=lmat= MEM_mallocN(len*8, "newmatar");
ipoin= *mat;
while (len-- > 0) {
@@ -2756,9 +2756,9 @@ static void switch_endian_keyblock(Key *key, KeyBlock *kb)
cp= key->elemstr;
poin= data;
- while ( cp[0] ) { /* cp[0]==amount */
+ while ( cp[0] ) { /* cp[0] == amount */
- switch(cp[1]) { /* cp[1]= type */
+ switch (cp[1]) { /* cp[1] = type */
case IPO_FLOAT:
case IPO_BPOINT:
case IPO_BEZTRIPLE:
@@ -3442,7 +3442,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
for (; state; state=state->next) {
rule = state->rules.first;
for (; rule; rule=rule->next)
- switch(rule->type) {
+ switch (rule->type) {
case eBoidRuleType_Goal:
case eBoidRuleType_Avoid:
{
@@ -3541,7 +3541,7 @@ static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase
}
else {
/* particle modifier must be removed before particle system */
- ParticleSystemModifierData *psmd= psys_get_modifier(ob,psys);
+ ParticleSystemModifierData *psmd= psys_get_modifier(ob, psys);
BLI_remlink(&ob->modifiers, psmd);
modifier_free((ModifierData *)psmd);
@@ -3557,15 +3557,15 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
int a;
for (psys=particles->first; psys; psys=psys->next) {
- psys->particles=newdataadr(fd,psys->particles);
+ psys->particles=newdataadr(fd, psys->particles);
if (psys->particles && psys->particles->hair) {
- for (a=0,pa=psys->particles; a<psys->totpart; a++, pa++)
- pa->hair=newdataadr(fd,pa->hair);
+ for (a=0, pa=psys->particles; a<psys->totpart; a++, pa++)
+ pa->hair=newdataadr(fd, pa->hair);
}
if (psys->particles && psys->particles->keys) {
- for (a=0,pa=psys->particles; a<psys->totpart; a++, pa++) {
+ for (a=0, pa=psys->particles; a<psys->totpart; a++, pa++) {
pa->keys= NULL;
pa->totkey= 0;
}
@@ -3576,17 +3576,17 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
if (psys->particles && psys->particles->boid) {
pa = psys->particles;
pa->boid = newdataadr(fd, pa->boid);
- for (a=1,pa++; a<psys->totpart; a++, pa++)
+ for (a=1, pa++; a<psys->totpart; a++, pa++)
pa->boid = (pa-1)->boid + 1;
}
else if (psys->particles) {
- for (a=0,pa=psys->particles; a<psys->totpart; a++, pa++)
+ for (a=0, pa=psys->particles; a<psys->totpart; a++, pa++)
pa->boid = NULL;
}
psys->fluid_springs = newdataadr(fd, psys->fluid_springs);
- psys->child = newdataadr(fd,psys->child);
+ psys->child = newdataadr(fd, psys->child);
psys->effectors = NULL;
link_list(fd, &psys->targets);
@@ -4235,8 +4235,7 @@ static void lib_link_object(FileData *fd, Main *main)
{
SmokeModifierData *smd = (SmokeModifierData *)modifiers_findByType(ob, eModifierType_Smoke);
- if (smd && smd->type == MOD_SMOKE_TYPE_DOMAIN && smd->domain)
- {
+ if (smd && smd->type == MOD_SMOKE_TYPE_DOMAIN && smd->domain) {
smd->domain->flags |= MOD_SMOKE_FILE_LOAD; /* flag for refreshing the simulation after loading */
}
}
@@ -4359,8 +4358,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
else if (md->type==eModifierType_Smoke) {
SmokeModifierData *smd = (SmokeModifierData*) md;
- if (smd->type==MOD_SMOKE_TYPE_DOMAIN)
- {
+ if (smd->type==MOD_SMOKE_TYPE_DOMAIN) {
smd->flow = NULL;
smd->coll = NULL;
smd->domain = newdataadr(fd, smd->domain);
@@ -4405,8 +4403,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
smd->flow = NULL;
smd->domain = NULL;
smd->coll = newdataadr(fd, smd->coll);
- if (smd->coll)
- {
+ if (smd->coll) {
smd->coll->points = NULL;
smd->coll->numpoints = 0;
}
@@ -4418,8 +4415,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
else if (md->type==eModifierType_DynamicPaint) {
DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md;
- if (pmd->canvas)
- {
+ if (pmd->canvas) {
pmd->canvas = newdataadr(fd, pmd->canvas);
pmd->canvas->pmd = pmd;
pmd->canvas->dm = NULL;
@@ -4439,8 +4435,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
}
}
}
- if (pmd->brush)
- {
+ if (pmd->brush) {
pmd->brush = newdataadr(fd, pmd->brush);
pmd->brush->pmd = pmd;
pmd->brush->psys = newdataadr(fd, pmd->brush->psys);
@@ -4459,9 +4454,9 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
collmd->xnew = newdataadr(fd, collmd->xnew);
collmd->mfaces = newdataadr(fd, collmd->mfaces);
- collmd->current_x = MEM_callocN(sizeof(MVert)*collmd->numverts,"current_x");
- collmd->current_xnew = MEM_callocN(sizeof(MVert)*collmd->numverts,"current_xnew");
- collmd->current_v = MEM_callocN(sizeof(MVert)*collmd->numverts,"current_v");
+ collmd->current_x = MEM_callocN(sizeof(MVert)*collmd->numverts, "current_x");
+ collmd->current_xnew = MEM_callocN(sizeof(MVert)*collmd->numverts, "current_xnew");
+ collmd->current_v = MEM_callocN(sizeof(MVert)*collmd->numverts, "current_v");
*/
collmd->x = NULL;
@@ -4687,7 +4682,7 @@ static void direct_link_object(FileData *fd, Object *ob)
ob->fluidsimSettings= newdataadr(fd, ob->fluidsimSettings); /* NT */
link_list(fd, &ob->particlesystem);
- direct_link_particlesystems(fd,&ob->particlesystem);
+ direct_link_particlesystems(fd, &ob->particlesystem);
link_list(fd, &ob->prop);
prop= ob->prop.first;
@@ -4847,7 +4842,7 @@ static void lib_link_scene(FileData *fd, Main *main)
}
}
- SEQ_BEGIN(sce->ed, seq) {
+ SEQ_BEGIN (sce->ed, seq) {
if (seq->ipo) seq->ipo= newlibadr_us(fd, sce->id.lib, seq->ipo);
seq->scene_sound = NULL;
if (seq->scene) {
@@ -4978,7 +4973,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
/* recursive link sequences, lb will be correctly initialized */
link_recurs_seq(fd, &ed->seqbase);
- SEQ_BEGIN(ed, seq) {
+ SEQ_BEGIN (ed, seq) {
seq->seq1= newdataadr(fd, seq->seq1);
seq->seq2= newdataadr(fd, seq->seq2);
seq->seq3= newdataadr(fd, seq->seq3);
@@ -6089,8 +6084,7 @@ static void direct_link_sound(FileData *fd, bSound *sound)
sound->waveform = NULL;
// versioning stuff, if there was a cache, then we enable caching:
- if (sound->cache)
- {
+ if (sound->cache) {
sound->flags |= SOUND_FLAGS_CACHING;
sound->cache = NULL;
}
@@ -6233,8 +6227,7 @@ static void lib_link_movieclip(FileData *fd, Main *main)
static const char *dataname(short id_code)
{
-
- switch( id_code ) {
+ switch ( id_code ) {
case ID_OB: return "Data from OB";
case ID_ME: return "Data from ME";
case ID_IP: return "Data from IP";
@@ -6344,7 +6337,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
bhead= read_data_into_oldnewmap(fd, bhead, allocname);
/* init pointers direct data */
- switch( GS(id->name) ) {
+ switch (GS(id->name)) {
case ID_WM:
direct_link_windowmanager(fd, (wmWindowManager *)id);
break;
@@ -6922,7 +6915,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
if (sl) {
/* first channels for ipo action nla... */
- switch(sl->spacetype) {
+ switch (sl->spacetype) {
case SPACE_IPO:
ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
BLI_addtail(lb, ar);
@@ -7044,7 +7037,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
if (sl) {
/* if active spacetype has view2d data, copy that over to main region */
/* and we split view3d */
- switch(sl->spacetype) {
+ switch (sl->spacetype) {
case SPACE_VIEW3D:
view3d_split_250((View3D *)sl, lb);
break;
@@ -7450,8 +7443,7 @@ static void do_version_constraints_radians_degrees_250(ListBase *lb)
static void do_version_old_trackto_to_constraints(Object *ob)
{
/* create new trackto constraint from the relationship */
- if (ob->track)
- {
+ if (ob->track) {
bConstraint *con= add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_TRACKTO);
bTrackToConstraint *data = con->data;
@@ -8336,8 +8328,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Mesh *me;
sound = main->sound.first;
- while (sound)
- {
+ while (sound) {
sound->max_gain = 1.0;
sound->min_gain = 0.0;
sound->distance = 1.0;
@@ -8399,7 +8390,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* in future, distinguish between different
* object bounding shapes */
ob->formfactor = 0.4f;
- /* patch form factor , note that inertia equiv radius
+ /* patch form factor, note that inertia equiv radius
* of a rotation symmetrical obj */
if (ob->inertia != 1.0f) {
ob->formfactor /= ob->inertia * ob->inertia;
@@ -9004,7 +8995,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
while (sce) {
ed= sce->ed;
if (ed) {
- SEQ_BEGIN(sce->ed, seq) {
+ SEQ_BEGIN (sce->ed, seq) {
if (seq->type==SEQ_IMAGE || seq->type==SEQ_MOVIE)
seq->flag |= SEQ_MAKE_PREMUL;
}
@@ -9151,7 +9142,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
while (sce) {
if (sce->toolsettings == NULL) {
- sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings),"Tool Settings Struct");
+ sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings), "Tool Settings Struct");
sce->toolsettings->cornertype=0;
sce->toolsettings->degr = 90;
sce->toolsettings->step = 9;
@@ -9753,17 +9744,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (md->type==eModifierType_Mirror) {
MirrorModifierData *mmd = (MirrorModifierData*) md;
- switch(mmd->axis)
- {
- case 0:
- mmd->flag |= MOD_MIR_AXIS_X;
- break;
- case 1:
- mmd->flag |= MOD_MIR_AXIS_Y;
- break;
- case 2:
- mmd->flag |= MOD_MIR_AXIS_Z;
- break;
+ switch (mmd->axis) {
+ case 0:
+ mmd->flag |= MOD_MIR_AXIS_X;
+ break;
+ case 1:
+ mmd->flag |= MOD_MIR_AXIS_Y;
+ break;
+ case 2:
+ mmd->flag |= MOD_MIR_AXIS_Z;
+ break;
}
mmd->axis = 0;
@@ -10062,8 +10052,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
* */
{
Scene *sce;
- for (sce=main->scene.first; sce; sce = sce->id.next)
- {
+ for (sce=main->scene.first; sce; sce = sce->id.next) {
if (sce->toolsettings->skgen_subdivisions[0] == sce->toolsettings->skgen_subdivisions[1] ||
sce->toolsettings->skgen_subdivisions[0] == sce->toolsettings->skgen_subdivisions[2] ||
sce->toolsettings->skgen_subdivisions[1] == sce->toolsettings->skgen_subdivisions[2])
@@ -10421,7 +10410,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Sequence *seq;
for (sce=main->scene.first; sce; sce=sce->id.next) {
- SEQ_BEGIN(sce->ed, seq) {
+ SEQ_BEGIN (sce->ed, seq) {
if (seq->blend_mode == 0)
seq->blend_opacity = 100.0f;
}
@@ -10479,13 +10468,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
// convert fluids to modifier
- if (main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1))
- {
+ if (main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) {
Object *ob;
for (ob = main->object.first; ob; ob= ob->id.next) {
- if (ob->fluidsimSettings)
- {
+ if (ob->fluidsimSettings) {
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifier_new(eModifierType_Fluidsim);
BLI_addhead(&ob->modifiers, (ModifierData *)fluidmd);
@@ -10776,7 +10763,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
while (sce) {
ed= sce->ed;
if (ed) {
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (seq->strip && seq->strip->proxy) {
seq->strip->proxy->quality =90;
}
@@ -10809,10 +10796,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
bActuator *act;
int a;
- for (sound = main->sound.first; sound; sound = sound->id.next)
- {
- if (sound->newpackedfile)
- {
+ for (sound = main->sound.first; sound; sound = sound->id.next) {
+ if (sound->newpackedfile) {
sound->packedfile = sound->newpackedfile;
sound->newpackedfile = NULL;
}
@@ -10822,8 +10807,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (act= ob->actuators.first; act; act= act->next) {
if (act->type == ACT_SOUND) {
bSoundActuator *sAct = (bSoundActuator*) act->data;
- if (sAct->sound)
- {
+ if (sAct->sound) {
sound = newlibadr(fd, lib, sAct->sound);
sAct->flag = sound->flags & SOUND_FLAGS_3D ? ACT_SND_3D_SOUND : 0;
sAct->pitch = sound->pitch;
@@ -10846,13 +10830,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- for (scene = main->scene.first; scene; scene = scene->id.next)
- {
- if (scene->ed && scene->ed->seqbasep)
- {
- SEQ_BEGIN(scene->ed, seq) {
- if (seq->type == SEQ_HD_SOUND)
- {
+ for (scene = main->scene.first; scene; scene = scene->id.next) {
+ if (scene->ed && scene->ed->seqbasep) {
+ SEQ_BEGIN (scene->ed, seq) {
+ if (seq->type == SEQ_HD_SOUND) {
char str[FILE_MAX];
BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name);
BLI_path_abs(str, main->name);
@@ -11228,8 +11209,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (tex->vd->extend == 0)
tex->vd->extend = TEX_CLIP;
- for (sce= main->scene.first; sce; sce= sce->id.next)
- {
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
if (sce->audio.main == 0.0f)
sce->audio.main = 1.0f;
@@ -11371,8 +11351,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 8))
- {
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 8)) {
{
Scene *sce= main->scene.first;
while (sce) {
@@ -11494,8 +11473,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 9))
- {
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 9)) {
Scene *sce;
Mesh *me;
Object *ob;
@@ -11521,8 +11499,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 10))
- {
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 10)) {
Object *ob;
/* properly initialize hair clothsim data on old files */
@@ -11539,8 +11516,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
/* fix bad area setup in subversion 10 */
- if (main->versionfile == 250 && main->subversionfile == 10)
- {
+ if (main->versionfile == 250 && main->subversionfile == 10) {
/* fix for new view type in sequencer */
bScreen *screen;
ScrArea *sa;
@@ -11579,8 +11555,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 11))
- {
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 11)) {
{
/* fix for new view type in sequencer */
bScreen *screen;
@@ -11622,8 +11597,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 12))
- {
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 12)) {
Scene *sce;
Object *ob;
Brush *brush;
@@ -11828,7 +11802,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if ((sce->r.ffcodecdata.flags & FFMPEG_MULTIPLEX_AUDIO) == 0)
sce->r.ffcodecdata.audio_codec = 0x0; // CODEC_ID_NONE
- SEQ_BEGIN(sce->ed, seq) {
+ SEQ_BEGIN (sce->ed, seq) {
seq->volume = 1.0f;
}
SEQ_END
@@ -11984,8 +11958,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
- if (main->versionfile < 253)
- {
+ if (main->versionfile < 253) {
Object *ob;
Scene *scene;
bScreen *sc;
@@ -12098,7 +12071,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (scene= main->scene.first; scene; scene=scene->id.next) {
if (scene) {
Sequence *seq;
- SEQ_BEGIN(scene->ed, seq) {
+ SEQ_BEGIN (scene->ed, seq) {
if (seq->sat==0.0f) {
seq->sat= 1.0f;
}
@@ -12196,8 +12169,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 253 || (main->versionfile == 253 && main->subversionfile < 1))
- {
+ if (main->versionfile < 253 || (main->versionfile == 253 && main->subversionfile < 1)) {
Object *ob;
for (ob = main->object.first; ob; ob = ob->id.next) {
@@ -12206,8 +12178,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (md->type == eModifierType_Smoke) {
SmokeModifierData *smd = (SmokeModifierData *)md;
- if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain)
- {
+ if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) {
smd->domain->vorticity = 2.0f;
smd->domain->time_scale = 1.0f;
@@ -12226,8 +12197,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (md2->type == eModifierType_Smoke) {
SmokeModifierData *smd2 = (SmokeModifierData *)md2;
- if ((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow)
- {
+ if ((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow) {
smd2->flow->flags |= MOD_SMOKE_FLOW_INITVELOCITY;
}
}
@@ -12313,8 +12283,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (act= ob->actuators.first; act; act= act->next) {
if (act->type==ACT_STEERING) {
bSteeringActuator* stact = act->data;
- if (stact->facingaxis==0)
- {
+ if (stact->facingaxis==0) {
stact->facingaxis=1;
}
}
@@ -12574,11 +12543,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Scene *scene;
Sequence *seq;
- for (scene=main->scene.first; scene; scene=scene->id.next)
- {
+ for (scene=main->scene.first; scene; scene=scene->id.next) {
scene->r.ffcodecdata.audio_channels = 2;
scene->audio.volume = 1.0f;
- SEQ_BEGIN(scene->ed, seq) {
+ SEQ_BEGIN (scene->ed, seq) {
seq->pitch = 1.0f;
}
SEQ_END
@@ -12749,8 +12717,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
{
/* set defaults for obstacle avoidance, recast data */
Scene *sce;
- for (sce = main->scene.first; sce; sce = sce->id.next)
- {
+ for (sce = main->scene.first; sce; sce = sce->id.next) {
if (sce->gm.levelHeight == 0.f)
sce->gm.levelHeight = 2.f;
@@ -12930,8 +12897,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 6))
- {
+ if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 6)) {
Scene *sce;
MovieClip *clip;
bScreen *sc;
@@ -12995,8 +12961,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 8))
- {
+ if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 8)) {
Brush *brush;
for (brush= main->brush.first; brush; brush= brush->id.next) {
@@ -13005,8 +12970,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 261 || (main->versionfile == 261 && main->subversionfile < 1))
- {
+ if (main->versionfile < 261 || (main->versionfile == 261 && main->subversionfile < 1)) {
{
/* update use flags for node sockets (was only temporary before) */
Scene *sce;
@@ -13107,8 +13071,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 261 || (main->versionfile == 261 && main->subversionfile < 2))
- {
+ if (main->versionfile < 261 || (main->versionfile == 261 && main->subversionfile < 2)) {
{
/* convert Camera Actuator values to defines */
Object *ob;
@@ -13142,8 +13105,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 261 || (main->versionfile == 261 && main->subversionfile < 3))
- {
+ if (main->versionfile < 261 || (main->versionfile == 261 && main->subversionfile < 3)) {
{
/* convert extended ascii to utf-8 for text editor */
Text *text;
@@ -13169,8 +13131,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (md= ob->modifiers.first; md; md= md->next) {
if (md->type == eModifierType_DynamicPaint) {
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
- if (pmd->canvas)
- {
+ if (pmd->canvas) {
DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
for (; surface; surface=surface->next) {
surface->color_dry_threshold = 1.0f;
@@ -13185,8 +13146,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 262)
- {
+ if (main->versionfile < 262) {
Object *ob;
for (ob=main->object.first; ob; ob= ob->id.next) {
ModifierData *md;
@@ -13201,8 +13161,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 263)
- {
+ if (main->versionfile < 263) {
/* set fluidsim rate. the version patch for this in 2.62 was wrong, so
* try to correct it, if rate is 0.0 that's likely not intentional */
Object *ob;
@@ -13219,8 +13178,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 1))
- {
+ if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 1)) {
/* update use flags for node sockets (was only temporary before) */
Scene *sce;
bNodeTree *ntree;
@@ -13235,8 +13193,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
/* only swap for pre-release bmesh merge which had MLoopCol red/blue swap */
- if (main->versionfile == 262 && main->subversionfile == 1)
- {
+ if (main->versionfile == 262 && main->subversionfile == 1) {
{
Mesh *me;
for (me = main->mesh.first; me; me = me->id.next) {
@@ -13246,8 +13203,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
- if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 2))
- {
+ if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 2)) {
{
/* Set new idname of keyingsets from their now "label-only" name. */
Scene *scene;
@@ -13261,8 +13217,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 3))
- {
+ if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 3)) {
Object *ob;
ModifierData *md;
@@ -13276,8 +13231,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 4))
- {
+ if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 4)) {
/* Read Viscosity presets from older files */
Object *ob;
@@ -13301,14 +13255,34 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
- if (main->versionfile < 263)
- {
+ if (main->versionfile < 263) {
/* Default for old files is to save particle rotations to pointcache */
ParticleSettings *part;
for (part = main->particle.first; part; part = part->id.next)
part->flag |= PART_ROTATIONS;
}
+ if (main->versionfile <= 263 && main->subversionfile == 0) {
+ Scene *scene;
+ Brush *brush;
+
+ /* For weight paint, each brush now gets its own weight;
+ unified paint settings also have weight. Update unified
+ paint settings and brushes with a default weight value. */
+
+ for (scene = main->scene.first; scene; scene = scene->id.next) {
+ ToolSettings *ts = scene->toolsettings;
+ if (ts) {
+ ts->unified_paint_settings.weight = ts->vgroup_weight;
+ ts->unified_paint_settings.flag |= UNIFIED_PAINT_WEIGHT;
+ }
+ }
+
+ for (brush = main->brush.first; brush; brush = brush->id.next) {
+ brush->weight = 0.5;
+ }
+ }
+
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
@@ -13440,7 +13414,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
BLI_strncpy(bfd->main->name, filepath, sizeof(bfd->main->name));
while (bhead) {
- switch(bhead->code) {
+ switch (bhead->code) {
case DATA:
case DNA1:
case TEST: /* used as preview since 2.5x */
@@ -14268,7 +14242,7 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
if (sce->ed) {
Sequence *seq;
- SEQ_BEGIN(sce->ed, seq) {
+ SEQ_BEGIN (sce->ed, seq) {
if (seq->scene) expand_doit(fd, mainvar, seq->scene);
if (seq->scene_camera) expand_doit(fd, mainvar, seq->scene_camera);
if (seq->sound) expand_doit(fd, mainvar, seq->sound);
@@ -14336,7 +14310,7 @@ static void expand_main(FileData *fd, Main *mainvar)
while (id) {
if (id->flag & LIB_TEST) {
- switch(GS(id->name)) {
+ switch (GS(id->name)) {
case ID_OB:
expand_object(fd, mainvar, (Object *)id);
@@ -14366,7 +14340,7 @@ static void expand_main(FileData *fd, Main *mainvar)
expand_lattice(fd, mainvar, (Lattice *)id);
break;
case ID_LA:
- expand_lamp(fd, mainvar,(Lamp *)id);
+ expand_lamp(fd, mainvar, (Lamp *)id);
break;
case ID_KE:
expand_key(fd, mainvar, (Key *)id);
@@ -14375,7 +14349,7 @@ static void expand_main(FileData *fd, Main *mainvar)
expand_camera(fd, mainvar, (Camera *)id);
break;
case ID_SPK:
- expand_speaker(fd, mainvar,(Speaker *)id);
+ expand_speaker(fd, mainvar, (Speaker *)id);
break;
case ID_SO:
expand_sound(fd, mainvar, (bSound *)id);
@@ -14473,7 +14447,7 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const
}
if (do_it) {
- base= MEM_callocN( sizeof(Base), "add_ext_base");
+ base= MEM_callocN(sizeof(Base), "add_ext_base");
BLI_addtail(&(sce->base), base);
base->lay= ob->lay;
base->object= ob;
@@ -14577,7 +14551,7 @@ static ID *append_named_part_ex(const bContext *C, Main *mainl, FileData *fd, co
Base *base;
Object *ob;
- base= MEM_callocN( sizeof(Base), "app_nam_part");
+ base= MEM_callocN(sizeof(Base), "app_nam_part");
BLI_addtail(&scene->base, base);
ob= (Object *)id;
@@ -14722,7 +14696,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
/* patch to prevent switch_endian happens twice */
if ((*fd)->flags & FD_FLAGS_SWITCH_ENDIAN) {
- blo_freefiledata( *fd );
+ blo_freefiledata(*fd);
*fd = NULL;
}
}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 61969c7878a..43f35462c7b 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -239,7 +239,7 @@ static void writedata_free(WriteData *wd)
#define MYWRITE_FLUSH NULL
-static void mywrite( WriteData *wd, const void *adr, int len)
+static void mywrite(WriteData *wd, const void *adr, int len)
{
if (wd->error) return;
@@ -837,7 +837,7 @@ static void write_boid_state(WriteData *wd, BoidState *state)
writestruct(wd, DATA, "BoidState", 1, state);
for (; rule; rule=rule->next) {
- switch(rule->type) {
+ switch (rule->type) {
case eBoidRuleType_Goal:
case eBoidRuleType_Avoid:
writestruct(wd, DATA, "BoidRuleGoalAvoid", 1, rule);
@@ -974,7 +974,7 @@ static void write_particlesystems(WriteData *wd, ListBase *particles)
writestruct(wd, DATA, "ParticleSystem", 1, psys);
if (psys->particles) {
- writestruct(wd, DATA, "ParticleData", psys->totpart ,psys->particles);
+ writestruct(wd, DATA, "ParticleData", psys->totpart, psys->particles);
if (psys->particles->hair) {
ParticleData *pa = psys->particles;
@@ -993,7 +993,7 @@ static void write_particlesystems(WriteData *wd, ListBase *particles)
for (; pt; pt=pt->next)
writestruct(wd, DATA, "ParticleTarget", 1, pt);
- if (psys->child) writestruct(wd, DATA, "ChildParticle", psys->totchild ,psys->child);
+ if (psys->child) writestruct(wd, DATA, "ChildParticle", psys->totchild, psys->child);
if (psys->clmd) {
writestruct(wd, DATA, "ClothModifierData", 1, psys->clmd);
@@ -1030,7 +1030,7 @@ static void write_sensors(WriteData *wd, ListBase *lb)
writedata(wd, DATA, sizeof(void *)*sens->totlinks, sens->links);
- switch(sens->type) {
+ switch (sens->type) {
case SENS_NEAR:
writestruct(wd, DATA, "bNearSensor", 1, sens->data);
break;
@@ -1091,7 +1091,7 @@ static void write_controllers(WriteData *wd, ListBase *lb)
writedata(wd, DATA, sizeof(void *)*cont->totlinks, cont->links);
- switch(cont->type) {
+ switch (cont->type) {
case CONT_EXPRESSION:
writestruct(wd, DATA, "bExpressionCont", 1, cont->data);
break;
@@ -1114,7 +1114,7 @@ static void write_actuators(WriteData *wd, ListBase *lb)
while (act) {
writestruct(wd, DATA, "bActuator", 1, act);
- switch(act->type) {
+ switch (act->type) {
case ACT_ACTION:
case ACT_SHAPEACTION:
writestruct(wd, DATA, "bActionActuator", 1, act->data);
@@ -1316,10 +1316,8 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
else if (md->type==eModifierType_Smoke) {
SmokeModifierData *smd = (SmokeModifierData*) md;
- if (smd->type & MOD_SMOKE_TYPE_DOMAIN)
- {
- if (smd->domain)
- {
+ if (smd->type & MOD_SMOKE_TYPE_DOMAIN) {
+ if (smd->domain) {
write_pointcaches(wd, &(smd->domain->ptcaches[0]));
/* create fake pointcache so that old blender versions can read it */
@@ -1353,8 +1351,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
else if (md->type==eModifierType_DynamicPaint) {
DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md;
- if (pmd->canvas)
- {
+ if (pmd->canvas) {
DynamicPaintSurface *surface;
writestruct(wd, DATA, "DynamicPaintCanvasSettings", 1, pmd->canvas);
@@ -1368,8 +1365,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
writestruct(wd, DATA, "EffectorWeights", 1, surface->effector_weights);
}
}
- if (pmd->brush)
- {
+ if (pmd->brush) {
writestruct(wd, DATA, "DynamicPaintBrushSettings", 1, pmd->brush);
writestruct(wd, DATA, "ColorBand", 1, pmd->brush->paint_ramp);
writestruct(wd, DATA, "ColorBand", 1, pmd->brush->vel_ramp);
@@ -2112,19 +2108,19 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
/* reset write flags too */
- SEQ_BEGIN(ed, seq) {
+ SEQ_BEGIN (ed, seq) {
if (seq->strip) seq->strip->done= 0;
writestruct(wd, DATA, "Sequence", 1, seq);
}
SEQ_END
- SEQ_BEGIN(ed, seq) {
+ SEQ_BEGIN (ed, seq) {
if (seq->strip && seq->strip->done==0) {
/* write strip with 'done' at 0 because readfile */
if (seq->plugin) writestruct(wd, DATA, "PluginSeq", 1, seq->plugin);
if (seq->effectdata) {
- switch(seq->type) {
+ switch (seq->type) {
case SEQ_COLOR:
writestruct(wd, DATA, "SolidColorVars", 1, seq->effectdata);
break;
@@ -2258,7 +2254,7 @@ static void write_region(WriteData *wd, ARegion *ar, int spacetype)
writestruct(wd, DATA, "ARegion", 1, ar);
if (ar->regiondata) {
- switch(spacetype) {
+ switch (spacetype) {
case SPACE_VIEW3D:
if (ar->regiontype==RGN_TYPE_WINDOW) {
RegionView3D *rv3d= ar->regiondata;
@@ -2895,7 +2891,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
/* open temporary file, so we preserve the original in case we crash */
BLI_snprintf(tempname, sizeof(tempname), "%s@", filepath);
- file = BLI_open(tempname,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
+ file = BLI_open(tempname, O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
if (file == -1) {
BKE_reportf(reports, RPT_ERROR, "Can't open file %s for writing: %s.", tempname, strerror(errno));
return 0;
@@ -2933,7 +2929,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
makeFilesRelative(mainvar, filepath, NULL); /* note, making relative to something OTHER then G.main->name */
/* actual file writing */
- err= write_file_handle(mainvar, file, NULL,NULL, write_user_block, write_flags, thumb);
+ err= write_file_handle(mainvar, file, NULL, NULL, write_user_block, write_flags, thumb);
close(file);
if (err) {
diff --git a/source/blender/blenpluginapi/iff.h b/source/blender/blenpluginapi/iff.h
index 450dfc7f8d1..6a6764cd961 100644
--- a/source/blender/blenpluginapi/iff.h
+++ b/source/blender/blenpluginapi/iff.h
@@ -83,15 +83,15 @@ typedef struct ImBuf {
int refcounter; /* reference counter for multiple users */
} ImBuf;
-LIBIMPORT struct ImBuf *allocImBuf(short,short,uchar,uint);
+LIBIMPORT struct ImBuf *allocImBuf(short, short, uchar, uint);
LIBIMPORT struct ImBuf *dupImBuf(struct ImBuf *);
LIBIMPORT void freeImBuf(struct ImBuf*);
-LIBIMPORT short saveiff(struct ImBuf *,char *,int);
+LIBIMPORT short saveiff(struct ImBuf *, char *, int);
-LIBIMPORT struct ImBuf *loadifffile(int,int);
-LIBIMPORT struct ImBuf *loadiffname(char *,int);
-LIBIMPORT struct ImBuf *testiffname(char *,int);
+LIBIMPORT struct ImBuf *loadifffile(int, int);
+LIBIMPORT struct ImBuf *loadiffname(char *, int);
+LIBIMPORT struct ImBuf *testiffname(char *, int);
LIBIMPORT struct ImBuf *onehalf(struct ImBuf *);
LIBIMPORT struct ImBuf *half_x(struct ImBuf *);
diff --git a/source/blender/blenpluginapi/intern/pluginapi.c b/source/blender/blenpluginapi/intern/pluginapi.c
index 02166c466fa..efdd11352c6 100644
--- a/source/blender/blenpluginapi/intern/pluginapi.c
+++ b/source/blender/blenpluginapi/intern/pluginapi.c
@@ -268,38 +268,38 @@ LIBEXPORT float turbulence1(float noisesize,
* Otherwise they will not be imported from the archive
* library on Unix. -zr
*/
-int pluginapi_force_ref(void);
+int pluginapi_force_ref(void);
-int pluginapi_force_ref(void)
+int pluginapi_force_ref(void)
{
return
- GET_INT_FROM_POINTER( mallocN ) +
- GET_INT_FROM_POINTER( callocN ) +
- GET_INT_FROM_POINTER( freeN ) +
- GET_INT_FROM_POINTER( mallocT ) +
- GET_INT_FROM_POINTER( callocT ) +
- GET_INT_FROM_POINTER( freeT ) +
- GET_INT_FROM_POINTER( allocImBuf ) +
- GET_INT_FROM_POINTER( dupImBuf ) +
- GET_INT_FROM_POINTER( freeImBuf ) +
- GET_INT_FROM_POINTER( saveiff ) +
- GET_INT_FROM_POINTER( loadifffile ) +
- GET_INT_FROM_POINTER( loadiffname ) +
- GET_INT_FROM_POINTER( testiffname ) +
- GET_INT_FROM_POINTER( onehalf ) +
- GET_INT_FROM_POINTER( half_x ) +
- GET_INT_FROM_POINTER( half_y ) +
- GET_INT_FROM_POINTER( double_x ) +
- GET_INT_FROM_POINTER( double_y ) +
- GET_INT_FROM_POINTER( double_fast_x ) +
- GET_INT_FROM_POINTER( double_fast_y ) +
- GET_INT_FROM_POINTER( ispic ) +
- GET_INT_FROM_POINTER( scaleImBuf ) +
- GET_INT_FROM_POINTER( scalefastImBuf ) +
- GET_INT_FROM_POINTER( hnoise ) +
- GET_INT_FROM_POINTER( hnoisep ) +
- GET_INT_FROM_POINTER( turbulence ) +
- GET_INT_FROM_POINTER( turbulence1 ) +
- GET_INT_FROM_POINTER( de_interlace ) +
- GET_INT_FROM_POINTER( interlace );
+ GET_INT_FROM_POINTER(mallocN) +
+ GET_INT_FROM_POINTER(callocN) +
+ GET_INT_FROM_POINTER(freeN) +
+ GET_INT_FROM_POINTER(mallocT) +
+ GET_INT_FROM_POINTER(callocT) +
+ GET_INT_FROM_POINTER(freeT) +
+ GET_INT_FROM_POINTER(allocImBuf) +
+ GET_INT_FROM_POINTER(dupImBuf) +
+ GET_INT_FROM_POINTER(freeImBuf) +
+ GET_INT_FROM_POINTER(saveiff) +
+ GET_INT_FROM_POINTER(loadifffile) +
+ GET_INT_FROM_POINTER(loadiffname) +
+ GET_INT_FROM_POINTER(testiffname) +
+ GET_INT_FROM_POINTER(onehalf) +
+ GET_INT_FROM_POINTER(half_x) +
+ GET_INT_FROM_POINTER(half_y) +
+ GET_INT_FROM_POINTER(double_x) +
+ GET_INT_FROM_POINTER(double_y) +
+ GET_INT_FROM_POINTER(double_fast_x) +
+ GET_INT_FROM_POINTER(double_fast_y) +
+ GET_INT_FROM_POINTER(ispic) +
+ GET_INT_FROM_POINTER(scaleImBuf) +
+ GET_INT_FROM_POINTER(scalefastImBuf) +
+ GET_INT_FROM_POINTER(hnoise) +
+ GET_INT_FROM_POINTER(hnoisep) +
+ GET_INT_FROM_POINTER(turbulence) +
+ GET_INT_FROM_POINTER(turbulence1) +
+ GET_INT_FROM_POINTER(de_interlace) +
+ GET_INT_FROM_POINTER(interlace);
}
diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt
index 1cf2b9113b2..730b741fa38 100644
--- a/source/blender/bmesh/CMakeLists.txt
+++ b/source/blender/bmesh/CMakeLists.txt
@@ -41,6 +41,7 @@ set(SRC
operators/bmo_dupe.c
operators/bmo_edgesplit.c
operators/bmo_extrude.c
+ operators/bmo_hull.c
operators/bmo_inset.c
operators/bmo_join_triangles.c
operators/bmo_mesh_conv.c
@@ -51,6 +52,7 @@ set(SRC
operators/bmo_subdivide.h
operators/bmo_triangulate.c
operators/bmo_utils.c
+ operators/bmo_wireframe.c
intern/bmesh_construct.c
intern/bmesh_construct.h
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c
index cbdd5dd6983..c2d5d93cbc3 100644
--- a/source/blender/bmesh/intern/bmesh_construct.c
+++ b/source/blender/bmesh/intern/bmesh_construct.c
@@ -871,8 +871,8 @@ BMesh *BM_mesh_copy(BMesh *bm_old)
BLI_array_empty(loops);
BLI_array_empty(edges);
- BLI_array_growitems(loops, f->len);
- BLI_array_growitems(edges, f->len);
+ BLI_array_grow_items(loops, f->len);
+ BLI_array_grow_items(edges, f->len);
l = BM_iter_new(&liter, bm_old, BM_LOOPS_OF_FACE, f);
for (j = 0; j < f->len; j++, l = BM_iter_step(&liter)) {
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index 756fd742fa6..f38c737b8ac 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -184,34 +184,32 @@ static BMLoop *bm_face_boundary_add(BMesh *bm, BMFace *f, BMVert *startv, BMEdge
BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short copyedges)
{
- BMEdge **edges = NULL;
BMVert **verts = NULL;
- BLI_array_staticdeclare(edges, BM_NGON_STACK_SIZE);
- BLI_array_staticdeclare(verts, BM_NGON_STACK_SIZE);
+ BMEdge **edges = NULL;
+ BLI_array_fixedstack_declare(verts, BM_NGON_STACK_SIZE, f->len, __func__);
+ BLI_array_fixedstack_declare(edges, BM_NGON_STACK_SIZE, f->len, __func__);
BMLoop *l_iter;
BMLoop *l_first;
BMLoop *l_copy;
BMFace *f_copy;
int i;
- /* BMESH_TODO - grow verts array in one go! (right here) */
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+ i = 0;
do {
if (copyverts) {
- BMVert *v = BM_vert_create(bm, l_iter->v->co, l_iter->v);
- BLI_array_append(verts, v);
+ verts[i] = BM_vert_create(bm, l_iter->v->co, l_iter->v);
}
else {
- BLI_array_append(verts, l_iter->v);
+ verts[i] = l_iter->v;
}
+ i++;
} while ((l_iter = l_iter->next) != l_first);
- /* BMESH_TODO - grow edges array in one go! (right here) */
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
i = 0;
do {
if (copyedges) {
- BMEdge *e;
BMVert *v1, *v2;
if (l_iter->e->v1 == verts[i]) {
@@ -223,13 +221,11 @@ BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short co
v1 = verts[(i + 1) % f->len];
}
- e = BM_edge_create(bm, v1, v2, l_iter->e, FALSE);
- BLI_array_append(edges, e);
+ edges[i] = BM_edge_create(bm, v1, v2, l_iter->e, FALSE);
}
else {
- BLI_array_append(edges, l_iter->e);
+ edges[i] = l_iter->e;
}
-
i++;
} while ((l_iter = l_iter->next) != l_first);
@@ -243,7 +239,10 @@ BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short co
BM_elem_attrs_copy(bm, bm, l_iter, l_copy);
l_copy = l_copy->next;
} while ((l_iter = l_iter->next) != l_first);
-
+
+ BLI_array_fixedstack_free(verts);
+ BLI_array_fixedstack_free(edges);
+
return f_copy;
}
diff --git a/source/blender/bmesh/intern/bmesh_error.h b/source/blender/bmesh/intern/bmesh_error.h
index 84065fe88f6..606e9eeb23b 100644
--- a/source/blender/bmesh/intern/bmesh_error.h
+++ b/source/blender/bmesh/intern/bmesh_error.h
@@ -69,6 +69,7 @@ void BMO_error_clear(BMesh *bm);
#define BMERR_NONMANIFOLD 8
#define BMERR_INVALID_SELECTION 9
#define BMERR_MESH_ERROR 10
+#define BMERR_CONVEX_HULL_FAILED 11
/* BMESH_ASSERT */
#ifdef WITH_ASSERT_ABORT
diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c
index 384715d74f7..8103ae1ee11 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.c
+++ b/source/blender/bmesh/intern/bmesh_iterators.c
@@ -104,6 +104,50 @@ int BM_iter_as_array(BMesh *bm, const char itype, void *data, void **array, cons
return i;
}
+/**
+ * \brief Elem Iter Flag Count
+ *
+ * Counts how many flagged / unflagged items are found in this element.
+ */
+int BM_iter_elem_count_flag(const char itype, void *data, const char hflag, const short value)
+{
+ BMIter iter;
+ BMElem *ele;
+ int count = 0;
+
+ BLI_assert(ELEM(value, TRUE, FALSE));
+
+ for (ele = BM_iter_new(&iter, NULL, itype, data); ele; ele = BM_iter_step(&iter)) {
+ if (BM_elem_flag_test_bool(ele, hflag) == value) {
+ count++;
+ }
+ }
+
+ return count;
+}
+
+/**
+ * \brief Mesh Iter Flag Count
+ *
+ * Counts how many flagged / unflagged items are found in this mesh.
+ */
+int BM_iter_mesh_count_flag(const char itype, BMesh *bm, const char hflag, const short value)
+{
+ BMIter iter;
+ BMElem *ele;
+ int count = 0;
+
+ BLI_assert(ELEM(value, TRUE, FALSE));
+
+ for (ele = BM_iter_new(&iter, bm, itype, NULL); ele; ele = BM_iter_step(&iter)) {
+ if (BM_elem_flag_test_bool(ele, hflag) == value) {
+ count++;
+ }
+ }
+
+ return count;
+}
+
/**
* \brief Init Iterator
diff --git a/source/blender/bmesh/intern/bmesh_iterators.h b/source/blender/bmesh/intern/bmesh_iterators.h
index c687e4b4e7a..1361a91a692 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.h
+++ b/source/blender/bmesh/intern/bmesh_iterators.h
@@ -117,6 +117,8 @@ typedef struct BMIter {
void *BM_iter_at_index(BMesh *bm, const char itype, void *data, int index);
int BM_iter_as_array(BMesh *bm, const char itype, void *data, void **array, const int len);
+int BM_iter_elem_count_flag(const char itype, void *data, const char hflag, const short value);
+int BM_iter_mesh_count_flag(const char itype, BMesh *bm, const char hflag, const short value);
/* private for bmesh_iterators_inline.c */
void bmiter__vert_of_mesh_begin(struct BMIter *iter);
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c
index f72efe8ab5f..351fb8e941b 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c
@@ -282,8 +282,8 @@ void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, int set_key, int act_key_nr)
BLI_array_empty(fedges);
BLI_array_empty(verts);
- BLI_array_growitems(fedges, mpoly->totloop);
- BLI_array_growitems(verts, mpoly->totloop);
+ BLI_array_grow_items(fedges, mpoly->totloop);
+ BLI_array_grow_items(verts, mpoly->totloop);
for (j = 0; j < mpoly->totloop; j++) {
ml = &me->mloop[mpoly->loopstart + j];
diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c
index a5e761af783..5f3836cc413 100644
--- a/source/blender/bmesh/intern/bmesh_mods.c
+++ b/source/blender/bmesh/intern/bmesh_mods.c
@@ -771,7 +771,7 @@ int BM_face_validate(BMFace *face, FILE *err)
fflush(err);
}
- BLI_array_growitems(verts, face->len);
+ BLI_array_grow_items(verts, face->len);
BM_ITER_ELEM_INDEX (l, &iter, face, BM_LOOPS_OF_FACE, i) {
verts[i] = l->v;
if (l->e->v1 == l->e->v2) {
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index 4b5c67c8671..2ff28aee191 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -1109,6 +1109,26 @@ static BMOpDefine bmo_inset_def = {
};
/*
+ * Wire Frame
+ *
+ * Makes a wire copy of faces.
+ */
+static BMOpDefine bmo_wireframe_def = {
+ "wireframe",
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
+ {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
+ {BMO_OP_SLOT_BOOL, "use_boundary"},
+ {BMO_OP_SLOT_BOOL, "use_even_offset"},
+ {BMO_OP_SLOT_BOOL, "use_crease"},
+ {BMO_OP_SLOT_FLT, "thickness"},
+ {BMO_OP_SLOT_BOOL, "use_relative_offset"},
+ {BMO_OP_SLOT_FLT, "depth"},
+ {0} /* null-terminating sentinel */},
+ bmo_wireframe_exec,
+ 0
+};
+
+/*
* Vertex Slide
*
* Translates vertes along an edge
@@ -1124,6 +1144,35 @@ static BMOpDefine bmo_vertex_slide_def = {
BMO_OP_FLAG_UNTAN_MULTIRES
};
+/*
+ * Convex Hull
+ *
+ * Builds a convex hull from the vertices in 'input'.
+ *
+ * If 'use_existing_faces' is true, the hull will not output triangles
+ * that are covered by a pre-existing face.
+ *
+ * All hull vertices, faces, and edges are added to 'geomout'. Any
+ * input elements that end up inside the hull (i.e. are not used by an
+ * output face) are added to the 'interior_geom' slot. The
+ * 'unused_geom' slot will contain all interior geometry that is
+ * completely unused. Lastly, 'holes_geom' contains edges and faces
+ * that were in the input and are part of the hull.
+*/
+static BMOpDefine bmo_convex_hull_def = {
+ "convex_hull",
+ {{BMO_OP_SLOT_ELEMENT_BUF, "input"},
+ {BMO_OP_SLOT_BOOL, "use_existing_faces"},
+
+ /* Outputs */
+ {BMO_OP_SLOT_ELEMENT_BUF, "geomout"},
+ {BMO_OP_SLOT_ELEMENT_BUF, "interior_geom"},
+ {BMO_OP_SLOT_ELEMENT_BUF, "unused_geom"},
+ {BMO_OP_SLOT_ELEMENT_BUF, "holes_geom"},
+ {0} /* null-terminating sentinel */},
+ bmo_convex_hull_exec,
+ 0
+};
BMOpDefine *opdefines[] = {
&bmo_split_def,
@@ -1192,7 +1241,9 @@ BMOpDefine *opdefines[] = {
&bmo_bridge_loops_def,
&bmo_solidify_def,
&bmo_inset_def,
+ &bmo_wireframe_def,
&bmo_vertex_slide_def,
+ &bmo_convex_hull_def,
};
int bmesh_total_ops = (sizeof(opdefines) / sizeof(void *));
diff --git a/source/blender/bmesh/intern/bmesh_operators_private.h b/source/blender/bmesh/intern/bmesh_operators_private.h
index 423b30a503a..df48ec8468f 100644
--- a/source/blender/bmesh/intern/bmesh_operators_private.h
+++ b/source/blender/bmesh/intern/bmesh_operators_private.h
@@ -100,5 +100,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op);
void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op);
void bmo_solidify_face_region_exec(BMesh *bm, BMOperator *op);
void bmo_inset_exec(BMesh *bm, BMOperator *op);
+void bmo_wireframe_exec(BMesh *bm, BMOperator *op);
+void bmo_convex_hull_exec(BMesh *bm, BMOperator *op);
#endif /* __BMESH_OPERATORS_PRIVATE_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index 3543fd952bb..e9a35ff70a2 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -928,6 +928,28 @@ float BM_vert_calc_shell_factor(BMVert *v)
}
/**
+ * \note quite an obscure function.
+ * used in bmesh operators that have a relative scale options,
+ */
+float BM_vert_calc_mean_tagged_edge_length(BMVert *v)
+{
+ BMIter iter;
+ BMEdge *e;
+ int tot;
+ float length = 0.0f;
+
+ BM_ITER_ELEM_INDEX (e, &iter, v, BM_EDGES_OF_VERT, tot) {
+ BMVert *v_other = BM_edge_other_vert(e, v);
+ if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) {
+ length += BM_edge_calc_length(e);
+ }
+ }
+
+ return length / (float)tot;
+}
+
+
+/**
* Returns the edge existing between v1 and v2, or NULL if there isn't one.
*
* \note multiple edges may exist between any two vertices, and therefore
diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h
index aefeb80c4f3..08e15884b3f 100644
--- a/source/blender/bmesh/intern/bmesh_queries.h
+++ b/source/blender/bmesh/intern/bmesh_queries.h
@@ -65,6 +65,7 @@ void BM_edge_calc_face_tangent(BMEdge *e, BMLoop *e_loop, float r_tangent[3])
float BM_vert_calc_edge_angle(BMVert *v);
float BM_vert_calc_shell_factor(BMVert *v);
+float BM_vert_calc_mean_tagged_edge_length(BMVert *v);
BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2);
diff --git a/source/blender/bmesh/intern/bmesh_walkers.c b/source/blender/bmesh/intern/bmesh_walkers.c
index a3b5d94ba8e..ea29c149c1a 100644
--- a/source/blender/bmesh/intern/bmesh_walkers.c
+++ b/source/blender/bmesh/intern/bmesh_walkers.c
@@ -226,8 +226,7 @@ void *BMW_state_add(BMWalker *walker)
BMwGenericWalker *newstate;
newstate = BLI_mempool_alloc(walker->worklist);
newstate->depth = walker->depth;
- switch (walker->order)
- {
+ switch (walker->order) {
case BMW_DEPTH_FIRST:
BLI_addhead(&walker->states, newstate);
break;
diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c
index 113e1ddc164..01c269657dc 100644
--- a/source/blender/bmesh/intern/bmesh_walkers_impl.c
+++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c
@@ -838,7 +838,7 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker)
{
BMwEdgeringWalker *lwalk = BMW_current_state(walker);
BMEdge *e, *wireedge = lwalk->wireedge;
- BMLoop *l = lwalk->l , *origl = lwalk->l;
+ BMLoop *l = lwalk->l, *origl = lwalk->l;
#ifdef BMW_EDGERING_NGON
int i, len;
#endif
@@ -880,7 +880,7 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker)
}
/* only walk to manifold edge */
if ((l->f->len % 2 == 0) && EDGE_CHECK(l->e) &&
- !BLI_ghash_haskey(walker->visithash, l->e))
+ !BLI_ghash_haskey(walker->visithash, l->e))
#else
diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c
index 46dd7606940..b6b54b82f3d 100644
--- a/source/blender/bmesh/operators/bmo_bevel.c
+++ b/source/blender/bmesh/operators/bmo_bevel.c
@@ -242,7 +242,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
if (!BMO_elem_flag_test(bm, e, EDGE_OLD)) {
BM_elem_index_set(e, BLI_array_count(etags)); /* set_dirty! */
- BLI_array_growone(etags);
+ BLI_array_grow_one(etags);
BMO_elem_flag_enable(bm, e, EDGE_OLD);
}
@@ -256,11 +256,11 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
BM_ITER_ELEM (l2, &liter2, l->f, BM_LOOPS_OF_FACE) {
BM_elem_index_set(l2, BLI_array_count(tags)); /* set_loop */
- BLI_array_growone(tags);
+ BLI_array_grow_one(tags);
if (!BMO_elem_flag_test(bm, l2->e, EDGE_OLD)) {
BM_elem_index_set(l2->e, BLI_array_count(etags)); /* set_dirty! */
- BLI_array_growone(etags);
+ BLI_array_grow_one(etags);
BMO_elem_flag_enable(bm, l2->e, EDGE_OLD);
}
@@ -291,7 +291,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
}
if (!BLI_smallhash_haskey(&hash, (intptr_t)e)) {
- BLI_array_growone(etags);
+ BLI_array_grow_one(etags);
BM_elem_index_set(e, BLI_array_count(etags) - 1); /* set_dirty! */
BLI_smallhash_insert(&hash, (intptr_t)e, NULL);
BMO_elem_flag_enable(bm, e, EDGE_OLD);
@@ -309,11 +309,11 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
/* create tags for all loops in l-> */
BM_ITER_ELEM (l2, &liter2, l->f, BM_LOOPS_OF_FACE) {
- BLI_array_growone(tags);
+ BLI_array_grow_one(tags);
BM_elem_index_set(l2, BLI_array_count(tags) - 1); /* set_loop */
if (!BLI_smallhash_haskey(&hash, (intptr_t)l2->e)) {
- BLI_array_growone(etags);
+ BLI_array_grow_one(etags);
BM_elem_index_set(l2->e, BLI_array_count(etags) - 1); /* set_dirty! */
BLI_smallhash_insert(&hash, (intptr_t)l2->e, NULL);
BMO_elem_flag_enable(bm, l2->e, EDGE_OLD);
diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c
index 3c1f10be4c4..b8abe112c4d 100644
--- a/source/blender/bmesh/operators/bmo_connect.c
+++ b/source/blender/bmesh/operators/bmo_connect.c
@@ -71,10 +71,10 @@ void bmo_connectverts_exec(BMesh *bm, BMOperator *op)
}
if (lastl != l->prev && lastl != l->next) {
- BLI_array_growone(loops);
+ BLI_array_grow_one(loops);
loops[BLI_array_count(loops) - 1] = lastl;
- BLI_array_growone(loops);
+ BLI_array_grow_one(loops);
loops[BLI_array_count(loops) - 1] = l;
}
@@ -87,10 +87,10 @@ void bmo_connectverts_exec(BMesh *bm, BMOperator *op)
}
if (BLI_array_count(loops) > 2) {
- BLI_array_growone(loops);
+ BLI_array_grow_one(loops);
loops[BLI_array_count(loops) - 1] = loops[BLI_array_count(loops) - 2];
- BLI_array_growone(loops);
+ BLI_array_grow_one(loops);
loops[BLI_array_count(loops) - 1] = loops[0];
}
@@ -101,10 +101,10 @@ void bmo_connectverts_exec(BMesh *bm, BMOperator *op)
continue;
}
- BLI_array_growone(verts);
+ BLI_array_grow_one(verts);
verts[BLI_array_count(verts) - 1] = loops[i * 2]->v;
- BLI_array_growone(verts);
+ BLI_array_grow_one(verts);
verts[BLI_array_count(verts) - 1] = loops[i * 2 + 1]->v;
}
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c
index f2ba110b43d..6f08ab421f3 100644
--- a/source/blender/bmesh/operators/bmo_create.c
+++ b/source/blender/bmesh/operators/bmo_create.c
@@ -766,7 +766,7 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
i = 0;
BLI_array_empty(verts);
for (i = 0, node = path->nodes.first; node; node = node->next, i++) {
- BLI_array_growone(verts);
+ BLI_array_grow_one(verts);
verts[i] = node->v;
}
@@ -999,7 +999,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
}
edata[BM_elem_index_get(e)].ftag++;
- BLI_array_growone(edges);
+ BLI_array_grow_one(edges);
edges[i++] = e;
BLI_array_append(verts, node->v);
@@ -1009,7 +1009,7 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
vote_on_winding(edge, path->nodes.last, winding);
}
- BLI_array_growone(edges);
+ BLI_array_grow_one(edges);
edges[i++] = edge;
edata[BM_elem_index_get(edge)].ftag++;
@@ -1157,7 +1157,7 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
i = 0;
while (e) {
BMO_elem_flag_enable(bm, e, EDGE_VIS);
- BLI_array_growone(edges);
+ BLI_array_grow_one(edges);
edges[i] = e;
e = edge_next(bm, e);
@@ -1166,11 +1166,11 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
if (!count) {
edges1 = edges;
- BLI_array_set_length(edges1, BLI_array_count(edges));
+ BLI_array_length_set(edges1, BLI_array_count(edges));
}
else {
edges2 = edges;
- BLI_array_set_length(edges2, BLI_array_count(edges));
+ BLI_array_length_set(edges2, BLI_array_count(edges));
}
BLI_array_empty(edges);
diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c
index 36d446a0a8c..0659a42c26d 100644
--- a/source/blender/bmesh/operators/bmo_dupe.c
+++ b/source/blender/bmesh/operators/bmo_dupe.c
@@ -277,8 +277,8 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target)
BLI_array_empty(vtar);
BLI_array_empty(edar);
- BLI_array_growitems(vtar, f->len);
- BLI_array_growitems(edar, f->len);
+ BLI_array_grow_items(vtar, f->len);
+ BLI_array_grow_items(edar, f->len);
copy_face(op, source, f, target, vtar, edar, vhash, ehash);
BMO_elem_flag_enable(source, f, DUPE_DONE);
diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c
index 19e2dd85b0e..4fced09c588 100644
--- a/source/blender/bmesh/operators/bmo_extrude.c
+++ b/source/blender/bmesh/operators/bmo_extrude.c
@@ -58,7 +58,7 @@ void bmo_extrude_face_indiv_exec(BMesh *bm, BMOperator *op)
BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
BLI_array_empty(edges);
- BLI_array_growitems(edges, f->len);
+ BLI_array_grow_items(edges, f->len);
i = 0;
firstv = lastv = NULL;
@@ -573,12 +573,12 @@ static void solidify_add_thickness(BMesh *bm, const float dist)
continue;
}
- BLI_array_growitems(verts, f->len);
+ BLI_array_grow_items(verts, f->len);
BM_ITER_ELEM_INDEX (l, &loopIter, f, BM_LOOPS_OF_FACE, i) {
verts[i] = l->v->co;
}
- BLI_array_growitems(face_angles, f->len);
+ BLI_array_grow_items(face_angles, f->len);
angle_poly_v3(face_angles, (const float **)verts, f->len);
i = 0;
diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c
index 712f6b736d6..e08f08baacd 100644
--- a/source/blender/bmesh/operators/bmo_inset.c
+++ b/source/blender/bmesh/operators/bmo_inset.c
@@ -80,23 +80,6 @@ static BMLoop *bm_edge_is_mixed_face_tag(BMLoop *l)
}
}
-float bm_vert_avg_tag_dist(BMVert *v)
-{
- BMIter iter;
- BMEdge *e;
- int tot;
- float length = 0.0f;
-
- BM_ITER_ELEM_INDEX (e, &iter, v, BM_EDGES_OF_VERT, tot) {
- BMVert *v_other = BM_edge_other_vert(e, v);
- if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) {
- length += BM_edge_calc_length(e);
- }
- }
-
- return length / (float)tot;
-}
-
/**
* implementation is as follows...
*
@@ -544,7 +527,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
const float fac = (depth *
- (use_relative_offset ? bm_vert_avg_tag_dist(v) : 1.0f) *
+ (use_relative_offset ? BM_vert_calc_mean_tagged_edge_length(v) : 1.0f) *
(use_even_boundry ? BM_vert_calc_shell_factor(v) : 1.0f));
madd_v3_v3v3fl(varr_co[i], v->co, v->no, fac);
}
diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c
index 582039fc1a2..d780e309118 100644
--- a/source/blender/bmesh/operators/bmo_join_triangles.c
+++ b/source/blender/bmesh/operators/bmo_join_triangles.c
@@ -293,7 +293,7 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op)
measure = measure_facepair(v1, v2, v3, v4, limit);
if (measure < limit) {
- BLI_array_growone(jedges);
+ BLI_array_grow_one(jedges);
jedges[i].e = e;
jedges[i].weight = measure;
diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c
index cf1669d441e..53c51dfd483 100644
--- a/source/blender/bmesh/operators/bmo_mirror.c
+++ b/source/blender/bmesh/operators/bmo_mirror.c
@@ -71,7 +71,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
i = 0;
/* v2 = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); */ /* UNUSED */
BMO_ITER (v, &siter, bm, &dupeop, "newout", BM_VERT) {
- BLI_array_growone(vmap);
+ BLI_array_grow_one(vmap);
vmap[i] = v;
/* v2 = BM_iter_step(&iter); */ /* UNUSED */
i++;
diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c
index 149f2537a12..70dcc6fa3ae 100644
--- a/source/blender/bmesh/operators/bmo_removedoubles.c
+++ b/source/blender/bmesh/operators/bmo_removedoubles.c
@@ -191,8 +191,8 @@ void bmo_weldverts_exec(BMesh *bm, BMOperator *op)
continue;
}
- BLI_array_growone(edges);
- BLI_array_growone(loops);
+ BLI_array_grow_one(edges);
+ BLI_array_grow_one(loops);
edges[a] = e2;
loops[a] = l;
@@ -393,7 +393,7 @@ void bmo_collapse_exec(BMesh *bm, BMOperator *op)
INIT_MINMAX(min, max);
for (tot = 0; e; tot++, e = BMW_step(&walker)) {
- BLI_array_growone(edges);
+ BLI_array_grow_one(edges);
edges[tot] = e;
DO_MINMAX(e->v1->co, min, max);
@@ -454,7 +454,7 @@ static void bmo_collapsecon_do_layer(BMesh *bm, BMOperator *op, int layer)
CustomData_data_initminmax(type, &min, &max);
for (tot = 0; l2; tot++, l2 = BMW_step(&walker)) {
- BLI_array_growone(blocks);
+ BLI_array_grow_one(blocks);
blocks[tot] = CustomData_bmesh_get_layer_n(&bm->ldata, l2->head.data, layer);
CustomData_data_dominmax(type, blocks[tot], &min, &max);
}
@@ -501,7 +501,7 @@ void bmesh_finddoubles_common(BMesh *bm, BMOperator *op, BMOperator *optarget, c
i = 0;
BMO_ITER (v, &oiter, bm, op, "verts", BM_VERT) {
- BLI_array_growone(verts);
+ BLI_array_grow_one(verts);
verts[i++] = v;
}
diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c
index 7da02a594d5..d96d0f6c74d 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.c
+++ b/source/blender/bmesh/operators/bmo_subdivide.c
@@ -778,8 +778,8 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
BLI_array_empty(edges);
BLI_array_empty(verts);
- BLI_array_growitems(edges, face->len);
- BLI_array_growitems(verts, face->len);
+ BLI_array_grow_items(edges, face->len);
+ BLI_array_grow_items(verts, face->len);
matched = 0;
@@ -825,7 +825,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
}
}
if (matched) {
- BLI_array_growone(facedata);
+ BLI_array_grow_one(facedata);
b = BLI_array_count(facedata) - 1;
facedata[b].pat = pat;
facedata[b].start = verts[i];
@@ -861,7 +861,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
}
}
if (matched) {
- BLI_array_growone(facedata);
+ BLI_array_grow_one(facedata);
j = BLI_array_count(facedata) - 1;
BMO_elem_flag_enable(bm, face, SUBD_SPLIT);
@@ -877,7 +877,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
}
if (!matched && totesel) {
- BLI_array_growone(facedata);
+ BLI_array_grow_one(facedata);
j = BLI_array_count(facedata) - 1;
BMO_elem_flag_enable(bm, face, SUBD_SPLIT);
@@ -918,7 +918,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
/* for case of two edges, connecting them shouldn't be too hard */
BM_ITER_ELEM (l, &liter, face, BM_LOOPS_OF_FACE) {
- BLI_array_growone(loops);
+ BLI_array_grow_one(loops);
loops[BLI_array_count(loops) - 1] = l;
}
@@ -951,10 +951,10 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
b += numcuts - 1;
for (j = 0; j < numcuts; j++) {
- BLI_array_growone(splits);
+ BLI_array_grow_one(splits);
splits[BLI_array_count(splits) - 1] = loops[a];
- BLI_array_growone(splits);
+ BLI_array_grow_one(splits);
splits[BLI_array_count(splits) - 1] = loops[b];
b = (b - 1) % vlen;
@@ -989,7 +989,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
}
for (j = 0; j < face->len; j++) {
- BLI_array_growone(verts);
+ BLI_array_grow_one(verts);
}
j = 0;
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index 7fd6cf6769c..9632a79b7dd 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -59,8 +59,8 @@ void bmo_triangulate_exec(BMesh *bm, BMOperator *op)
BLI_array_empty(projectverts);
BLI_array_empty(newfaces);
- BLI_array_growitems(projectverts, face->len * 3);
- BLI_array_growitems(newfaces, face->len);
+ BLI_array_grow_items(projectverts, face->len * 3);
+ BLI_array_grow_items(newfaces, face->len);
BM_face_triangulate(bm, face, projectverts, EDGE_NEW, FACE_NEW, newfaces, use_beauty);
diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c
index 3cfa70f6e6c..8409c5b76b8 100644
--- a/source/blender/bmesh/operators/bmo_utils.c
+++ b/source/blender/bmesh/operators/bmo_utils.c
@@ -348,7 +348,7 @@ void bmo_righthandfaces_exec(BMesh *bm, BMOperator *op)
* stack (if we use simple function recursion, we'd end up overloading
* the stack on large meshes). */
- BLI_array_growone(fstack);
+ BLI_array_grow_one(fstack);
fstack[0] = startf;
BMO_elem_flag_enable(bm, startf, FACE_VIS);
@@ -382,7 +382,7 @@ void bmo_righthandfaces_exec(BMesh *bm, BMOperator *op)
}
if (i == maxi) {
- BLI_array_growone(fstack);
+ BLI_array_grow_one(fstack);
maxi++;
}
@@ -420,7 +420,7 @@ void bmo_vertexsmooth_exec(BMesh *bm, BMOperator *op)
i = 0;
BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
- BLI_array_growone(cos);
+ BLI_array_grow_one(cos);
co = cos[i];
j = 0;
@@ -1035,7 +1035,7 @@ void bmo_face_reverseuvs_exec(BMesh *bm, BMOperator *op)
int i;
BLI_array_empty(uvs);
- BLI_array_growitems(uvs, fs->len);
+ BLI_array_grow_items(uvs, fs->len);
BM_ITER_ELEM_INDEX (lf, &l_iter, fs, BM_LOOPS_OF_FACE, i) {
MLoopUV *luv = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPUV);
@@ -1141,7 +1141,7 @@ void bmo_face_reversecolors_exec(BMesh *bm, BMOperator *op)
int i;
BLI_array_empty(cols);
- BLI_array_growitems(cols, fs->len);
+ BLI_array_grow_items(cols, fs->len);
BM_ITER_ELEM_INDEX (lf, &l_iter, fs, BM_LOOPS_OF_FACE, i) {
cols[i] = *((MLoopCol *)CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPCOL));
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index 778e3029266..6565a9e0c2e 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -29,7 +29,7 @@ void forEachObjectInScene(Scene *sce, Functor &f)
{
Base *base= (Base*) sce->base.first;
- while(base) {
+ while (base) {
Object *ob = base->object;
f(ob);
@@ -59,13 +59,11 @@ void AnimationExporter::operator() (Object *ob)
/* bool isMatAnim = false; */ /* UNUSED */
//Export transform animations
- if (ob->adt && ob->adt->action)
- {
+ if (ob->adt && ob->adt->action) {
fcu = (FCurve*)ob->adt->action->curves.first;
//transform matrix export for bones are temporarily disabled here.
- if ( ob->type == OB_ARMATURE )
- {
+ if ( ob->type == OB_ARMATURE ) {
bArmature *arm = (bArmature*)ob->data;
for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next)
write_bone_animation_matrix(ob, bone);
@@ -79,59 +77,63 @@ void AnimationExporter::operator() (Object *ob)
transformName = extract_transform_name( fcu->rna_path );
if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) ||
- (!strcmp(transformName, "rotation_euler") && ob->rotmode == ROT_MODE_EUL)||
- (!strcmp(transformName, "rotation_quaternion")))
- dae_animation(ob ,fcu, transformName, false);
+ (!strcmp(transformName, "rotation_euler") && ob->rotmode == ROT_MODE_EUL)||
+ (!strcmp(transformName, "rotation_quaternion")))
+ {
+ dae_animation(ob, fcu, transformName, false);
+ }
fcu = fcu->next;
}
}
//Export Lamp parameter animations
- if ( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action )
- {
+ if ( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action ) {
fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first);
while (fcu) {
transformName = extract_transform_name( fcu->rna_path );
- if ((!strcmp(transformName, "color")) || (!strcmp(transformName, "spot_size"))|| (!strcmp(transformName, "spot_blend"))||
- (!strcmp(transformName, "distance")) )
- dae_animation(ob , fcu, transformName, true );
+ if ((!strcmp(transformName, "color")) || (!strcmp(transformName, "spot_size"))||
+ (!strcmp(transformName, "spot_blend")) || (!strcmp(transformName, "distance")))
+ {
+ dae_animation(ob, fcu, transformName, true);
+ }
fcu = fcu->next;
}
}
//Export Camera parameter animations
- if ( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action )
- {
+ if ( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action ) {
fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first);
while (fcu) {
transformName = extract_transform_name( fcu->rna_path );
if ((!strcmp(transformName, "lens"))||
- (!strcmp(transformName, "ortho_scale"))||
- (!strcmp(transformName, "clip_end"))||(!strcmp(transformName, "clip_start")))
- dae_animation(ob , fcu, transformName, true );
+ (!strcmp(transformName, "ortho_scale"))||
+ (!strcmp(transformName, "clip_end"))||(!strcmp(transformName, "clip_start")))
+ {
+ dae_animation(ob, fcu, transformName, true);
+ }
fcu = fcu->next;
}
}
//Export Material parameter animations.
- for (int a = 0; a < ob->totcol; a++)
- {
+ for (int a = 0; a < ob->totcol; a++) {
Material *ma = give_current_material(ob, a+1);
if (!ma) continue;
- if (ma->adt && ma->adt->action)
- {
+ if (ma->adt && ma->adt->action) {
/* isMatAnim = true; */
fcu = (FCurve*)ma->adt->action->curves.first;
while (fcu) {
transformName = extract_transform_name( fcu->rna_path );
- if ((!strcmp(transformName, "specular_hardness"))||(!strcmp(transformName, "specular_color"))
- ||(!strcmp(transformName, "diffuse_color"))||(!strcmp(transformName, "alpha"))||
- (!strcmp(transformName, "ior")))
- dae_animation(ob ,fcu, transformName, true, ma );
+ if ((!strcmp(transformName, "specular_hardness"))||(!strcmp(transformName, "specular_color")) ||
+ (!strcmp(transformName, "diffuse_color"))||(!strcmp(transformName, "alpha")) ||
+ (!strcmp(transformName, "ior")))
+ {
+ dae_animation(ob, fcu, transformName, true, ma );
+ }
fcu = fcu->next;
}
}
@@ -148,8 +150,7 @@ float * AnimationExporter::get_eul_source_for_quat(Object *ob )
float *eul = (float*)MEM_callocN(sizeof(float) * fcu->totvert * 3, "quat output source values");
float temp_quat[4];
float temp_eul[3];
- while(fcu)
- {
+ while (fcu) {
char * transformName = extract_transform_name( fcu->rna_path );
if ( !strcmp(transformName, "rotation_quaternion") ) {
@@ -164,7 +165,7 @@ float * AnimationExporter::get_eul_source_for_quat(Object *ob )
for ( int j = 0;j<4;j++)
temp_quat[j] = quat[(i*4)+j];
- quat_to_eul(temp_eul,temp_quat);
+ quat_to_eul(temp_eul, temp_quat);
for (int k = 0;k<3;k++)
eul[i*3 + k] = temp_eul[k];
@@ -176,13 +177,13 @@ float * AnimationExporter::get_eul_source_for_quat(Object *ob )
}
//Get proper name for bones
-std::string AnimationExporter::getObjectBoneName( Object* ob,const FCurve* fcu )
+std::string AnimationExporter::getObjectBoneName( Object* ob, const FCurve* fcu )
{
//hard-way to derive the bone name from rna_path. Must find more compact method
std::string rna_path = std::string(fcu->rna_path);
char* boneName = strtok((char *)rna_path.c_str(), "\"");
- boneName = strtok(NULL,"\"");
+ boneName = strtok(NULL, "\"");
if ( boneName != NULL )
return /*id_name(ob) + "_" +*/ std::string(boneName);
@@ -191,7 +192,7 @@ std::string AnimationExporter::getObjectBoneName( Object* ob,const FCurve* fcu )
}
//convert f-curves to animation curves and write
-void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material * ma )
+void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformName, bool is_param, Material * ma )
{
const char *axis_name = NULL;
char anim_id[200];
@@ -199,8 +200,7 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa
bool has_tangents = false;
bool quatRotation = false;
- if ( !strcmp(transformName, "rotation_quaternion") )
- {
+ if ( !strcmp(transformName, "rotation_quaternion") ) {
fprintf(stderr, "quaternion rotation curves are not supported. rotation curve will not be exported\n");
quatRotation = true;
return;
@@ -223,23 +223,20 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa
if (fcu->array_index < 3)
axis_name = axis_names[fcu->array_index];
}
-
- //no axis name. single parameter.
- else{
+ else {
+ /* no axis name. single parameter */
axis_name = "";
}
std::string ob_name = std::string("null");
//Create anim Id
- if (ob->type == OB_ARMATURE)
- {
- ob_name = getObjectBoneName( ob , fcu);
+ if (ob->type == OB_ARMATURE) {
+ ob_name = getObjectBoneName(ob, fcu);
BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s.%s", (char*)translate_id(ob_name).c_str(),
transformName, axis_name);
}
- else
- {
+ else {
if (ma)
ob_name = id_name(ob) + "_material";
else
@@ -257,18 +254,17 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa
std::string output_id;
//quat rotations are skipped for now, because of complications with determining axis.
- if (quatRotation)
- {
- float * eul = get_eul_source_for_quat(ob);
- float * eul_axis = (float*)MEM_callocN(sizeof(float) * fcu->totvert, "quat output source values");
- for ( int i = 0 ; i< fcu->totvert ; i++)
+ if (quatRotation) {
+ float *eul = get_eul_source_for_quat(ob);
+ float *eul_axis = (float*)MEM_callocN(sizeof(float) * fcu->totvert, "quat output source values");
+ for (int i = 0 ; i< fcu->totvert ; i++) {
eul_axis[i] = eul[i*3 + fcu->array_index];
- output_id= create_source_from_array(COLLADASW::InputSemantic::OUTPUT, eul_axis , fcu->totvert, quatRotation, anim_id, axis_name);
+ }
+ output_id= create_source_from_array(COLLADASW::InputSemantic::OUTPUT, eul_axis, fcu->totvert, quatRotation, anim_id, axis_name);
MEM_freeN(eul);
MEM_freeN(eul_axis);
}
- else
- {
+ else {
output_id= create_source_from_fcurve(COLLADASW::InputSemantic::OUTPUT, fcu, anim_id, axis_name);
}
// create interpolations source
@@ -307,8 +303,7 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa
if ( !is_param )
target = translate_id(ob_name)
+ "/" + get_transform_sid(fcu->rna_path, -1, axis_name, true);
- else
- {
+ else {
if ( ob->type == OB_LAMP )
target = get_light_id(ob)
+ "/" + get_light_param_sid(fcu->rna_path, -1, axis_name, true);
@@ -349,8 +344,7 @@ bool AnimationExporter::is_bone_deform_group(Bone * bone)
//Check if current bone is deform
if ((bone->flag & BONE_NO_DEFORM) == 0 ) return true;
//Check child bones
- else
- {
+ else {
for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) {
//loop through all the children until deform bone is found, and then return
is_def = is_bone_deform_group(child);
@@ -369,10 +363,9 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B
//char prefix[256];
FCurve* fcu = (FCurve*)ob_arm->adt->action->curves.first;
- while(fcu)
- {
- std::string bone_name = getObjectBoneName(ob_arm,fcu);
- int val = BLI_strcasecmp((char*)bone_name.c_str(),bone->name);
+ while (fcu) {
+ std::string bone_name = getObjectBoneName(ob_arm, fcu);
+ int val = BLI_strcasecmp((char*)bone_name.c_str(), bone->name);
if (val==0) break;
fcu = fcu->next;
}
@@ -390,7 +383,7 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B
}
if (fra.size()) {
- dae_baked_animation(fra ,ob_arm, bone );
+ dae_baked_animation(fra, ob_arm, bone );
}
if (flag & ARM_RESTPOS)
@@ -398,7 +391,7 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B
where_is_pose(scene, ob_arm);
}
-void AnimationExporter::dae_baked_animation(std::vector<float> &fra, Object *ob_arm , Bone *bone)
+void AnimationExporter::dae_baked_animation(std::vector<float> &fra, Object *ob_arm, Bone *bone)
{
std::string ob_name = id_name(ob_arm);
std::string bone_name = bone->name;
@@ -417,7 +410,7 @@ void AnimationExporter::dae_baked_animation(std::vector<float> &fra, Object *ob_
// create output source
std::string output_id;
- output_id = create_4x4_source( fra, ob_arm , bone , anim_id);
+ output_id = create_4x4_source( fra, ob_arm, bone, anim_id);
// create interpolations source
std::string interpolation_id = fake_interpolation_source(fra.size(), anim_id, "");
@@ -511,7 +504,7 @@ float AnimationExporter::convert_angle(float angle)
std::string AnimationExporter::get_semantic_suffix(COLLADASW::InputSemantic::Semantics semantic)
{
- switch(semantic) {
+ switch (semantic) {
case COLLADASW::InputSemantic::INPUT:
return INPUT_SOURCE_ID_SUFFIX;
case COLLADASW::InputSemantic::OUTPUT:
@@ -531,7 +524,7 @@ std::string AnimationExporter::get_semantic_suffix(COLLADASW::InputSemantic::Sem
void AnimationExporter::add_source_parameters(COLLADASW::SourceBase::ParameterNameList& param,
COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis, bool transform)
{
- switch(semantic) {
+ switch (semantic) {
case COLLADASW::InputSemantic::INPUT:
param.push_back("TIME");
break;
@@ -544,8 +537,7 @@ void AnimationExporter::add_source_parameters(COLLADASW::SourceBase::ParameterNa
param.push_back(axis);
}
else
- if ( transform )
- {
+ if ( transform ) {
param.push_back("TRANSFORM");
}
else { //assumes if axis isn't specified all axises are added
@@ -727,7 +719,7 @@ std::string AnimationExporter::create_source_from_vector(COLLADASW::InputSemanti
return source_id;
}
-std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Object * ob_arm, Bone *bone , const std::string& anim_id)
+std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Object * ob_arm, Bone *bone, const std::string& anim_id)
{
COLLADASW::InputSemantic::Semantics semantic = COLLADASW::InputSemantic::OUTPUT;
std::string source_id = anim_id + get_semantic_suffix(semantic);
@@ -763,7 +755,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Ob
float ctime = BKE_frame_to_ctime(scene, *it);
- BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM);
+ BKE_animsys_evaluate_animdata(scene, &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM);
where_is_pose_bone(scene, ob_arm, pchan, ctime, 1);
// compute bone local mat
@@ -778,8 +770,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Ob
// SECOND_LIFE_COMPATIBILITY
// AFAIK animation to second life is via BVH, but no
// reason to not have the collada-animation be correct
- if (export_settings->second_life)
- {
+ if (export_settings->second_life) {
float temp[4][4];
copy_m4_m4(temp, bone->arm_mat);
temp[3][0] = temp[3][1] = temp[3][2] = 0.0f;
@@ -787,8 +778,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Ob
mult_m4_m4m4(mat, mat, temp);
- if (bone->parent)
- {
+ if (bone->parent) {
copy_m4_m4(temp, bone->parent->arm_mat);
temp[3][0] = temp[3][1] = temp[3][2] = 0.0f;
@@ -797,7 +787,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Ob
}
float outmat[4][4];
- converter.mat4_to_dae(outmat,mat);
+ converter.mat4_to_dae(outmat, mat);
source.appendValues(outmat);
@@ -1128,7 +1118,7 @@ bool AnimationExporter::hasAnimations(Scene *sce)
{
Base *base= (Base*) sce->base.first;
- while(base) {
+ while (base) {
Object *ob = base->object;
FCurve *fcu = 0;
@@ -1143,12 +1133,10 @@ bool AnimationExporter::hasAnimations(Scene *sce)
fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first);
//Check Material Effect parameter animations.
- for (int a = 0; a < ob->totcol; a++)
- {
+ for (int a = 0; a < ob->totcol; a++) {
Material *ma = give_current_material(ob, a+1);
if (!ma) continue;
- if (ma->adt && ma->adt->action)
- {
+ if (ma->adt && ma->adt->action) {
fcu = (FCurve*)ma->adt->action->curves.first;
}
}
@@ -1293,7 +1281,7 @@ void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, i
float ctime = BKE_frame_to_ctime(scene, *it);
- BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM);
+ BKE_animsys_evaluate_animdata(scene, &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM);
where_is_pose_bone(scene, ob_arm, pchan, ctime, 1);
// compute bone local mat
diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h
index ba7ec6859cc..1313687db28 100644
--- a/source/blender/collada/AnimationExporter.h
+++ b/source/blender/collada/AnimationExporter.h
@@ -96,7 +96,7 @@ public:
protected:
const ExportSettings *export_settings;
- void dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material *ma = NULL);
+ void dae_animation(Object* ob, FCurve *fcu, char* transformName, bool is_param, Material *ma = NULL);
void write_bone_animation_matrix(Object *ob_arm, Bone *bone);
@@ -116,7 +116,7 @@ protected:
// (blend this into dae_bone_animation)
void dae_bone_animation(std::vector<float> &fra, float *v, int tm_type, int axis, std::string ob_name, std::string bone_name);
- void dae_baked_animation(std::vector<float> &fra, Object *ob_arm , Bone *bone);
+ void dae_baked_animation(std::vector<float> &fra, Object *ob_arm, Bone *bone);
float convert_time(float frame);
@@ -125,7 +125,7 @@ protected:
std::string get_semantic_suffix(COLLADASW::InputSemantic::Semantics semantic);
void add_source_parameters(COLLADASW::SourceBase::ParameterNameList& param,
- COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis , bool transform);
+ COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis, bool transform);
void get_source_values(BezTriple *bezt, COLLADASW::InputSemantic::Semantics semantic, bool rotation, float *values, int *length);
@@ -139,7 +139,7 @@ protected:
std::string create_xyz_source(float *v, int tot, const std::string& anim_id);
- std::string create_4x4_source(std::vector<float> &frames , Object * ob_arm, Bone *bone , const std::string& anim_id);
+ std::string create_4x4_source(std::vector<float> &frames, Object * ob_arm, Bone *bone, const std::string& anim_id);
std::string create_interpolation_source(FCurve *fcu, const std::string& anim_id, const char *axis_name, bool *has_tangents);
@@ -161,5 +161,5 @@ protected:
char* extract_transform_name(char *rna_path);
- std::string getObjectBoneName ( Object *ob,const FCurve * fcu);
+ std::string getObjectBoneName(Object *ob, const FCurve * fcu);
};
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index e0079fbb8a0..6ba0aeb2850 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -138,8 +138,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
bez.ipo = BEZT_IPO_CONST;
//bez.h1 = bez.h2 = HD_AUTO;
}
- else
- {
+ else {
bez.h1 = bez.h2 = HD_AUTO;
bez.ipo = BEZT_IPO_LIN;
}
@@ -424,7 +423,7 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act)
//sets the rna_path and array index to curve
-void AnimationImporter::modify_fcurve(std::vector<FCurve*>* curves , const char* rna_path , int array_index )
+void AnimationImporter::modify_fcurve(std::vector<FCurve*>* curves, const char* rna_path, int array_index )
{
std::vector<FCurve*>::iterator it;
int i;
@@ -439,7 +438,7 @@ void AnimationImporter::modify_fcurve(std::vector<FCurve*>* curves , const char*
}
}
-void AnimationImporter::find_frames( std::vector<float>* frames , std::vector<FCurve*>* curves)
+void AnimationImporter::find_frames( std::vector<float>* frames, std::vector<FCurve*>* curves)
{
std::vector<FCurve*>::iterator iter;
for (iter = curves->begin(); iter != curves->end(); iter++) {
@@ -457,7 +456,7 @@ void AnimationImporter::find_frames( std::vector<float>* frames , std::vector<FC
}
//creates the rna_paths and array indices of fcurves from animations using transformation and bound animation class of each animation.
-void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation * transform ,
+void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation * transform,
const COLLADAFW::AnimationList::AnimationBinding * binding,
std::vector<FCurve*>* curves, bool is_joint, char * joint_path)
{
@@ -564,10 +563,10 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation *
}
//creates the rna_paths and array indices of fcurves from animations using color and bound animation class of each animation.
-void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves ,const char * anim_type)
+void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const char * anim_type)
{
char rna_path[100];
- BLI_strncpy(rna_path,anim_type, sizeof(rna_path));
+ BLI_strncpy(rna_path, anim_type, sizeof(rna_path));
const COLLADAFW::AnimationList *animlist = animlist_map[listid];
const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
@@ -622,7 +621,7 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list
for (unsigned int j = 0; j < bindings.getCount(); j++) {
animcurves = curve_map[bindings[j].animation];
- BLI_strncpy(rna_path, anim_type , sizeof(rna_path));
+ BLI_strncpy(rna_path, anim_type, sizeof(rna_path));
modify_fcurve(&animcurves, rna_path, 0 );
std::vector<FCurve*>::iterator iter;
//Add the curves of the current animation to the object
@@ -635,7 +634,7 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list
}
-void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root ,COLLADAFW::Node* node,
+void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node,
COLLADAFW::Transformation * tm )
{
bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
@@ -726,7 +725,7 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>&
calc_joint_parent_mat_rest(par, NULL, root, node);
mult_m4_m4m4(temp, par, matfra);
- // evaluate_joint_world_transform_at_frame(temp, NULL, , node, fra);
+ // evaluate_joint_world_transform_at_frame(temp, NULL, node, fra);
// calc special matrix
mul_serie_m4(mat, irest, temp, irest_dae, rest, NULL, NULL, NULL, NULL);
@@ -779,7 +778,7 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>&
}
-void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
+void AnimationImporter::translate_Animations ( COLLADAFW::Node * node,
std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map,
std::map<COLLADAFW::UniqueId, Object*>& object_map,
std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map)
@@ -789,17 +788,15 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
COLLADAFW::Node *root = root_map.find(node->getUniqueId()) == root_map.end() ? node : root_map[node->getUniqueId()];
Object *ob = is_joint ? armature_importer->get_armature_for_joint(root) : object_map[node->getUniqueId()];
- if (!ob)
- {
+ if (!ob) {
fprintf(stderr, "cannot find Object for Node with id=\"%s\"\n", node->getOriginalId().c_str());
return;
}
bAction * act;
- if ( (animType->transform) != 0 )
- {
- const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL;
+ if ( (animType->transform) != 0 ) {
+ /* const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL; */ /* UNUSED */
char joint_path[200];
if ( is_joint )
@@ -837,7 +834,7 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
for (unsigned int j = 0; j < bindings.getCount(); j++) {
animcurves = curve_map[bindings[j].animation];
if ( is_matrix ) {
- apply_matrix_curves(ob, animcurves, root , node, transform );
+ apply_matrix_curves(ob, animcurves, root, node, transform );
}
else {
@@ -867,8 +864,7 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
}
}
- if ((animType->light) != 0)
- {
+ if ((animType->light) != 0) {
Lamp * lamp = (Lamp*) ob->data;
if (!lamp->adt || !lamp->adt->action) act = verify_adt_action((ID*)&lamp->id, 1);
@@ -880,33 +876,29 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
for (unsigned int i = 0; i < nodeLights.getCount(); i++) {
const COLLADAFW::Light *light = (COLLADAFW::Light *) FW_object_map[nodeLights[i]->getInstanciatedObjectId()];
- if ((animType->light & LIGHT_COLOR) != 0)
- {
+ if ((animType->light & LIGHT_COLOR) != 0) {
const COLLADAFW::Color *col = &(light->getColor());
const COLLADAFW::UniqueId& listid = col->getAnimationList();
Assign_color_animations(listid, AnimCurves, "color");
}
- if ((animType->light & LIGHT_FOA) != 0 )
- {
+ if ((animType->light & LIGHT_FOA) != 0 ) {
const COLLADAFW::AnimatableFloat *foa = &(light->getFallOffAngle());
const COLLADAFW::UniqueId& listid = foa->getAnimationList();
- Assign_float_animations( listid ,AnimCurves, "spot_size");
+ Assign_float_animations( listid, AnimCurves, "spot_size");
}
- if ( (animType->light & LIGHT_FOE) != 0 )
- {
+ if ( (animType->light & LIGHT_FOE) != 0 ) {
const COLLADAFW::AnimatableFloat *foe = &(light->getFallOffExponent());
const COLLADAFW::UniqueId& listid = foe->getAnimationList();
- Assign_float_animations( listid ,AnimCurves, "spot_blend");
+ Assign_float_animations( listid, AnimCurves, "spot_blend");
}
}
}
- if ( (animType->camera) != 0)
- {
+ if ( (animType->camera) != 0) {
Camera * camera = (Camera*) ob->data;
if (!camera->adt || !camera->adt->action) act = verify_adt_action((ID*)&camera->id, 1);
@@ -918,32 +910,28 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
for (unsigned int i = 0; i < nodeCameras.getCount(); i++) {
const COLLADAFW::Camera *camera = (COLLADAFW::Camera *) FW_object_map[nodeCameras[i]->getInstanciatedObjectId()];
- if ((animType->camera & CAMERA_XFOV) != 0 )
- {
+ if ((animType->camera & CAMERA_XFOV) != 0 ) {
const COLLADAFW::AnimatableFloat *xfov = &(camera->getXFov());
const COLLADAFW::UniqueId& listid = xfov->getAnimationList();
- Assign_float_animations( listid ,AnimCurves, "lens");
+ Assign_float_animations( listid, AnimCurves, "lens");
}
- else if ((animType->camera & CAMERA_XMAG) != 0 )
- {
+ else if ((animType->camera & CAMERA_XMAG) != 0 ) {
const COLLADAFW::AnimatableFloat *xmag = &(camera->getXMag());
const COLLADAFW::UniqueId& listid = xmag->getAnimationList();
- Assign_float_animations( listid ,AnimCurves, "ortho_scale");
+ Assign_float_animations( listid, AnimCurves, "ortho_scale");
}
- if ((animType->camera & CAMERA_ZFAR) != 0 )
- {
+ if ((animType->camera & CAMERA_ZFAR) != 0 ) {
const COLLADAFW::AnimatableFloat *zfar = &(camera->getFarClippingPlane());
const COLLADAFW::UniqueId& listid = zfar->getAnimationList();
- Assign_float_animations( listid ,AnimCurves, "clip_end");
+ Assign_float_animations( listid, AnimCurves, "clip_end");
}
- if ((animType->camera & CAMERA_ZNEAR) != 0 )
- {
+ if ((animType->camera & CAMERA_ZNEAR) != 0 ) {
const COLLADAFW::AnimatableFloat *znear = &(camera->getNearClippingPlane());
const COLLADAFW::UniqueId& listid = znear->getAnimationList();
- Assign_float_animations( listid ,AnimCurves, "clip_start");
+ Assign_float_animations( listid, AnimCurves, "clip_start");
}
}
@@ -967,25 +955,25 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
if ((animType->material & MATERIAL_SHININESS) != 0) {
const COLLADAFW::FloatOrParam *shin = &(efc->getShininess());
const COLLADAFW::UniqueId& listid = shin->getAnimationList();
- Assign_float_animations( listid, AnimCurves , "specular_hardness" );
+ Assign_float_animations( listid, AnimCurves, "specular_hardness" );
}
if ((animType->material & MATERIAL_IOR) != 0) {
const COLLADAFW::FloatOrParam *ior = &(efc->getIndexOfRefraction());
const COLLADAFW::UniqueId& listid = ior->getAnimationList();
- Assign_float_animations( listid, AnimCurves , "raytrace_transparency.ior" );
+ Assign_float_animations( listid, AnimCurves, "raytrace_transparency.ior" );
}
if ((animType->material & MATERIAL_SPEC_COLOR) != 0) {
const COLLADAFW::ColorOrTexture *cot = &(efc->getSpecular());
const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList();
- Assign_color_animations( listid, AnimCurves , "specular_color" );
+ Assign_color_animations( listid, AnimCurves, "specular_color" );
}
if ((animType->material & MATERIAL_DIFF_COLOR) != 0) {
const COLLADAFW::ColorOrTexture *cot = &(efc->getDiffuse());
const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList();
- Assign_color_animations( listid, AnimCurves , "diffuse_color" );
+ Assign_color_animations( listid, AnimCurves, "diffuse_color" );
}
}
}
@@ -1090,7 +1078,7 @@ void AnimationImporter::add_bone_animation_sampled(Object * ob, std::vector<FCur
calc_joint_parent_mat_rest(par, NULL, root, node);
mult_m4_m4m4(temp, par, matfra);
- // evaluate_joint_world_transform_at_frame(temp, NULL, , node, fra);
+ // evaluate_joint_world_transform_at_frame(temp, NULL,, node, fra);
// calc special matrix
mul_serie_m4(mat, irest, temp, irest_dae, rest, NULL, NULL, NULL, NULL);
@@ -1125,7 +1113,7 @@ void AnimationImporter::add_bone_animation_sampled(Object * ob, std::vector<FCur
//Check if object is animated by checking if animlist_map holds the animlist_id of node transforms
-AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLADAFW::Node * node ,
+AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLADAFW::Node * node,
std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map)
{
AnimMix *types = new AnimMix();
@@ -1150,9 +1138,9 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
for (unsigned int i = 0; i < nodeLights.getCount(); i++) {
const COLLADAFW::Light *light = (COLLADAFW::Light *) FW_object_map[nodeLights[i]->getInstanciatedObjectId()];
- types->light = setAnimType(&(light->getColor()),(types->light), LIGHT_COLOR);
- types->light = setAnimType(&(light->getFallOffAngle()),(types->light), LIGHT_FOA);
- types->light = setAnimType(&(light->getFallOffExponent()),(types->light), LIGHT_FOE);
+ types->light = setAnimType(&(light->getColor()), (types->light), LIGHT_COLOR);
+ types->light = setAnimType(&(light->getFallOffAngle()), (types->light), LIGHT_FOA);
+ types->light = setAnimType(&(light->getFallOffExponent()), (types->light), LIGHT_FOE);
if ( types->light != 0) break;
@@ -1162,16 +1150,14 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
for (unsigned int i = 0; i < nodeCameras.getCount(); i++) {
const COLLADAFW::Camera *camera = (COLLADAFW::Camera *) FW_object_map[nodeCameras[i]->getInstanciatedObjectId()];
- if ( camera->getCameraType() == COLLADAFW::Camera::PERSPECTIVE )
- {
- types->camera = setAnimType(&(camera->getXMag()),(types->camera), CAMERA_XFOV);
+ if ( camera->getCameraType() == COLLADAFW::Camera::PERSPECTIVE ) {
+ types->camera = setAnimType(&(camera->getXMag()), (types->camera), CAMERA_XFOV);
}
- else
- {
- types->camera = setAnimType(&(camera->getXMag()),(types->camera), CAMERA_XMAG);
+ else {
+ types->camera = setAnimType(&(camera->getXMag()), (types->camera), CAMERA_XMAG);
}
- types->camera = setAnimType(&(camera->getFarClippingPlane()),(types->camera), CAMERA_ZFAR);
- types->camera = setAnimType(&(camera->getNearClippingPlane()),(types->camera), CAMERA_ZNEAR);
+ types->camera = setAnimType(&(camera->getFarClippingPlane()), (types->camera), CAMERA_ZFAR);
+ types->camera = setAnimType(&(camera->getNearClippingPlane()), (types->camera), CAMERA_ZNEAR);
if ( types->camera != 0) break;
@@ -1187,11 +1173,11 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects();
if (!commonEffects.empty()) {
COLLADAFW::EffectCommon *efc = commonEffects[0];
- types->material = setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS);
- types->material = setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR);
- types->material = setAnimType(&(efc->getDiffuse().getColor()),(types->material), MATERIAL_DIFF_COLOR);
- // types->material = setAnimType(&(efc->get()),(types->material), MATERIAL_TRANSPARENCY);
- types->material = setAnimType(&(efc->getIndexOfRefraction()),(types->material), MATERIAL_IOR);
+ types->material = setAnimType(&(efc->getShininess()), (types->material), MATERIAL_SHININESS);
+ types->material = setAnimType(&(efc->getSpecular().getColor()), (types->material), MATERIAL_SPEC_COLOR);
+ types->material = setAnimType(&(efc->getDiffuse().getColor()), (types->material), MATERIAL_DIFF_COLOR);
+ // types->material = setAnimType(&(efc->get()), (types->material), MATERIAL_TRANSPARENCY);
+ types->material = setAnimType(&(efc->getIndexOfRefraction()), (types->material), MATERIAL_IOR);
}
}
}
@@ -1199,7 +1185,7 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
return types;
}
-int AnimationImporter::setAnimType ( const COLLADAFW::Animatable * prop , int types, int addition)
+int AnimationImporter::setAnimType ( const COLLADAFW::Animatable * prop, int types, int addition)
{
const COLLADAFW::UniqueId& listid = prop->getAnimationList();
if (animlist_map.find(listid) != animlist_map.end())
@@ -1208,7 +1194,7 @@ int AnimationImporter::setAnimType ( const COLLADAFW::Animatable * prop , int ty
}
// Is not used anymore.
-void AnimationImporter::find_frames_old(std::vector<float> * frames, COLLADAFW::Node * node , COLLADAFW::Transformation::TransformationType tm_type)
+void AnimationImporter::find_frames_old(std::vector<float> * frames, COLLADAFW::Node * node, COLLADAFW::Transformation::TransformationType tm_type)
{
bool is_matrix = tm_type == COLLADAFW::Transformation::MATRIX;
bool is_rotation = tm_type == COLLADAFW::Transformation::ROTATE;
@@ -1293,7 +1279,7 @@ Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node,
// frames at which to sample
std::vector<float> frames;
- find_frames_old(&frames, node , tm_type);
+ find_frames_old(&frames, node, tm_type);
unsigned int i;
@@ -1410,7 +1396,7 @@ Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node,
calc_joint_parent_mat_rest(par, NULL, root, node);
mult_m4_m4m4(temp, par, matfra);
- // evaluate_joint_world_transform_at_frame(temp, NULL, , node, fra);
+ // evaluate_joint_world_transform_at_frame(temp, NULL,, node, fra);
// calc special matrix
mul_serie_m4(mat, irest, temp, irest_dae, rest, NULL, NULL, NULL, NULL);
@@ -1641,7 +1627,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
COLLADABU::Math::Vector3& axis = ((COLLADAFW::Rotate*)tm)->getRotationAxis();
- float ax[3] = {axis[0], axis[1], axis[2]};
+ float ax[3] = {(float)axis[0], (float)axis[1], (float)axis[2]};
float angle = evaluate_fcurve(curves[0], fra);
axis_angle_to_mat4(mat, ax, angle);
diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h
index e42a1cc7a55..953c454c73c 100644
--- a/source/blender/collada/AnimationImporter.h
+++ b/source/blender/collada/AnimationImporter.h
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory , Sukhitha Jayathilake.
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Nathan Letwory, Sukhitha Jayathilake.
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -143,38 +143,38 @@ public:
virtual void change_eul_to_quat(Object *ob, bAction *act);
#endif
- void translate_Animations( COLLADAFW::Node * Node ,
- std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map,
- std::map<COLLADAFW::UniqueId, Object*>& object_map ,
- std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map);
+ void translate_Animations(COLLADAFW::Node * Node,
+ std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map,
+ std::map<COLLADAFW::UniqueId, Object*>& object_map,
+ std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map);
- AnimMix* get_animation_type( const COLLADAFW::Node * node , std::map<COLLADAFW::UniqueId,const COLLADAFW::Object*> FW_object_map );
+ AnimMix* get_animation_type( const COLLADAFW::Node * node, std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map );
- void apply_matrix_curves( Object * ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root ,COLLADAFW::Node* node,
- COLLADAFW::Transformation * tm );
-
- void add_bone_animation_sampled(Object * ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root ,COLLADAFW::Node* node, COLLADAFW::Transformation * tm);
+ void apply_matrix_curves(Object * ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node,
+ COLLADAFW::Transformation * tm );
+
+ void add_bone_animation_sampled(Object * ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node, COLLADAFW::Transformation * tm);
- void Assign_transform_animations(COLLADAFW::Transformation* transform ,
- const COLLADAFW::AnimationList::AnimationBinding * binding,
- std::vector<FCurve*>* curves, bool is_joint, char * joint_path);
+ void Assign_transform_animations(COLLADAFW::Transformation* transform,
+ const COLLADAFW::AnimationList::AnimationBinding * binding,
+ std::vector<FCurve*>* curves, bool is_joint, char * joint_path);
void Assign_color_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const char * anim_type);
void Assign_float_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const char * anim_type);
- int setAnimType ( const COLLADAFW::Animatable * prop , int type, int addition);
+ int setAnimType ( const COLLADAFW::Animatable * prop, int type, int addition);
- void modify_fcurve(std::vector<FCurve*>* curves , const char* rna_path , int array_index );
+ void modify_fcurve(std::vector<FCurve*>* curves, const char* rna_path, int array_index );
// prerequisites:
// animlist_map - map animlist id -> animlist
// curve_map - map anim id -> curve(s)
Object * translate_animation_OLD(COLLADAFW::Node *node,
- std::map<COLLADAFW::UniqueId, Object*>& object_map,
- std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map,
- COLLADAFW::Transformation::TransformationType tm_type,
- Object *par_job = NULL);
+ std::map<COLLADAFW::UniqueId, Object*>& object_map,
+ std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map,
+ COLLADAFW::Transformation::TransformationType tm_type,
+ Object *par_job = NULL);
- void find_frames( std::vector<float>* frames , std::vector<FCurve*>* curves );
+ void find_frames( std::vector<float>* frames, std::vector<FCurve*>* curves );
void find_frames_old( std::vector<float>* frames, COLLADAFW::Node * node, COLLADAFW::Transformation::TransformationType tm_type );
// internal, better make it private
// warning: evaluates only rotation
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index 743d3c2a158..d5a3b4cb0a2 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -127,7 +127,7 @@ void ArmatureExporter::find_objects_using_armature(Object *ob_arm, std::vector<O
objects.clear();
Base *base= (Base*) sce->base.first;
- while(base) {
+ while (base) {
Object *ob = base->object;
if (ob->type == OB_MESH && get_assigned_armature(ob) == ob_arm) {
@@ -191,10 +191,8 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene* sce,
// Write nodes of childobjects, remove written objects from list
std::list<Object*>::iterator i = child_objects.begin();
- while( i != child_objects.end() )
- {
- if ((*i)->partype == PARBONE && (0 == strcmp((*i)->parsubstr, bone->name)))
- {
+ while (i != child_objects.end()) {
+ if ((*i)->partype == PARBONE && (0 == strcmp((*i)->parsubstr, bone->name))) {
float backup_parinv[4][4];
copy_m4_m4(backup_parinv, (*i)->parentinv);
@@ -210,8 +208,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene* sce,
// TODO: when such objects are animated as
// single matrix the tweak must be applied
// to the result.
- if (export_settings->second_life)
- {
+ if (export_settings->second_life) {
// tweak objects parentinverse to match compatibility
float temp[4][4];
@@ -274,8 +271,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW:
}
// SECOND_LIFE_COMPATIBILITY
- if (export_settings->second_life)
- {
+ if (export_settings->second_life) {
// Remove rotations vs armature from transform
// parent_rest_rot * mat * irest_rot
float temp[4][4];
@@ -285,8 +281,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW:
mult_m4_m4m4(mat, mat, temp);
- if (bone->parent)
- {
+ if (bone->parent) {
copy_m4_m4(temp, bone->parent->arm_mat);
temp[3][0] = temp[3][1] = temp[3][2] = 0.0f;
@@ -294,7 +289,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW:
}
}
- TransformWriter::add_node_transform(node, mat,NULL );
+ TransformWriter::add_node_transform(node, mat, NULL);
}
std::string ArmatureExporter::get_controller_id(Object *ob_arm, Object *ob)
@@ -370,25 +365,21 @@ void ArmatureExporter::export_controller(Object* ob, Object *ob_arm)
for (j = 0; j < vert->totweight; j++) {
int joint_index = joint_index_by_def_index[vert->dw[j].def_nr];
- if (joint_index != -1 && vert->dw[j].weight > 0.0f)
- {
+ if (joint_index != -1 && vert->dw[j].weight > 0.0f) {
jw[joint_index] += vert->dw[j].weight;
sumw += vert->dw[j].weight;
}
}
- if (sumw > 0.0f)
- {
+ if (sumw > 0.0f) {
float invsumw = 1.0f/sumw;
vcounts.push_back(jw.size());
- for (std::map<int, float>::iterator m = jw.begin(); m != jw.end(); ++m)
- {
+ for (std::map<int, float>::iterator m = jw.begin(); m != jw.end(); ++m) {
joints.push_back((*m).first);
weights.push_back(invsumw*(*m).second);
}
}
- else
- {
+ else {
vcounts.push_back(0);
/*vcounts.push_back(1);
joints.push_back(-1);
@@ -502,16 +493,14 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase
float inv_bind_mat[4][4];
// SECOND_LIFE_COMPATIBILITY
- if (export_settings->second_life)
- {
+ if (export_settings->second_life) {
// Only translations, no rotation vs armature
float temp[4][4];
unit_m4(temp);
copy_v3_v3(temp[3], pchan->bone->arm_mat[3]);
mult_m4_m4m4(world, ob_arm->obmat, temp);
}
- else
- {
+ else {
// make world-space matrix, arm_mat is armature-space
mult_m4_m4m4(world, ob_arm->obmat, pchan->bone->arm_mat);
}
@@ -597,8 +586,7 @@ void ArmatureExporter::add_vertex_weights_element(const std::string& weights_sou
// write deformer index - weight index pairs
int weight_index = 0;
- for (std::list<int>::const_iterator i = joints.begin(); i != joints.end(); ++i)
- {
+ for (std::list<int>::const_iterator i = joints.begin(); i != joints.end(); ++i) {
weightselem.appendValues(*i, weight_index++);
}
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index a978a4757a7..833904e20c2 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -81,7 +81,7 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p
float parent_mat[][4], Object * ob_arm)
{
std::vector<COLLADAFW::Node*>::iterator it;
- it = std::find(finished_joints.begin(),finished_joints.end(),node);
+ it = std::find(finished_joints.begin(), finished_joints.end(), node);
if ( it != finished_joints.end()) return;
float mat[4][4];
@@ -159,7 +159,7 @@ void ArmatureImporter::create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBo
{
//Checking if bone is already made.
std::vector<COLLADAFW::Node*>::iterator it;
- it = std::find(finished_joints.begin(),finished_joints.end(),node);
+ it = std::find(finished_joints.begin(), finished_joints.end(), node);
if ( it != finished_joints.end()) return;
float joint_inv_bind_mat[4][4];
@@ -189,7 +189,7 @@ void ArmatureImporter::create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBo
else
copy_m4_m4(mat, obmat);
- float loc[3], size[3], rot[3][3] , angle;
+ float loc[3], size[3], rot[3][3], angle;
mat4_to_loc_rot_size( loc, rot, size, obmat);
mat3_to_vec_roll(rot, NULL, &angle );
bone->roll=angle;
@@ -261,7 +261,7 @@ void ArmatureImporter::create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBo
// in second case it's not a leaf bone, but we handle it the same way
if (!children.getCount() || children.getCount() > 1) {
- add_leaf_bone(mat, bone , node);
+ add_leaf_bone(mat, bone, node);
}
finished_joints.push_back(node);
@@ -278,16 +278,15 @@ void ArmatureImporter::add_leaf_bone(float mat[][4], EditBone *bone, COLLADAFW:
TagsMap::iterator etit;
ExtraTags *et = 0;
etit = uid_tags_map.find(node->getUniqueId().toAscii());
- if (etit != uid_tags_map.end())
- {
+ if (etit != uid_tags_map.end()) {
et = etit->second;
//else return;
- float x,y,z;
- et->setData("tip_x",&x);
- et->setData("tip_y",&y);
- et->setData("tip_z",&z);
- float vec[3] = {x,y,z};
+ float x, y, z;
+ et->setData("tip_x", &x);
+ et->setData("tip_y", &y);
+ et->setData("tip_z", &z);
+ float vec[3] = {x, y, z};
copy_v3_v3(leaf.bone->tail, leaf.bone->head);
add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec);
}else
@@ -441,7 +440,7 @@ void ArmatureImporter::create_armature_bones( )
ED_armature_from_edit(ob_arm);
- set_pose(ob_arm , *ri, NULL, NULL );
+ set_pose(ob_arm, *ri, NULL, NULL );
ED_armature_edit_free(ob_arm);
DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB|OB_RECALC_DATA);
@@ -570,7 +569,7 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin)
// is a child of a node (not joint), root should be true since
// this is where we build armature bones from
-void ArmatureImporter::set_pose ( Object * ob_arm , COLLADAFW::Node * root_node , const char *parentname, float parent_mat[][4])
+void ArmatureImporter::set_pose(Object * ob_arm, COLLADAFW::Node * root_node, const char *parentname, float parent_mat[][4])
{
char * bone_name = (char *) bc_get_joint_name ( root_node);
float mat[4][4];
@@ -583,7 +582,7 @@ void ArmatureImporter::set_pose ( Object * ob_arm , COLLADAFW::Node * root_node
get_node_mat(obmat, root_node, NULL, NULL);
//if (*edbone)
- bPoseChannel * pchan = get_pose_channel(ob_arm -> pose , bone_name);
+ bPoseChannel * pchan = get_pose_channel(ob_arm -> pose, bone_name);
//else fprintf ( "",
// get world-space
@@ -601,7 +600,7 @@ void ArmatureImporter::set_pose ( Object * ob_arm , COLLADAFW::Node * root_node
mult_m4_m4m4(pchan->pose_mat, invObmat, mat);
}
- mat4_to_axis_angle(ax,&angle,mat);
+ mat4_to_axis_angle(ax, &angle, mat);
pchan->bone->roll = angle;
diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h
index 0c95ee81272..eead45353af 100644
--- a/source/blender/collada/ArmatureImporter.h
+++ b/source/blender/collada/ArmatureImporter.h
@@ -113,7 +113,7 @@ private:
void fix_leaf_bones();
- void set_pose ( Object * ob_arm , COLLADAFW::Node * root_node , const char *parentname, float parent_mat[][4]);
+ void set_pose ( Object * ob_arm, COLLADAFW::Node * root_node, const char *parentname, float parent_mat[][4]);
#if 0
diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp
index fcb98cc7c32..c3614ac49a2 100644
--- a/source/blender/collada/CameraExporter.cpp
+++ b/source/blender/collada/CameraExporter.cpp
@@ -42,15 +42,14 @@ CamerasExporter::CamerasExporter(COLLADASW::StreamWriter *sw, const ExportSettin
template<class Functor>
void forEachCameraObjectInScene(Scene *sce, Functor &f, bool export_selected)
{
- Base *base= (Base*) sce->base.first;
- while(base) {
+ Base *base = (Base*) sce->base.first;
+ while (base) {
Object *ob = base->object;
-
- if (ob->type == OB_CAMERA && ob->data
- && !(export_selected && !(ob->flag & SELECT))) {
+
+ if (ob->type == OB_CAMERA && ob->data && !(export_selected && !(ob->flag & SELECT))) {
f(ob, sce);
}
- base= base->next;
+ base = base->next;
}
}
@@ -72,18 +71,18 @@ void CamerasExporter::operator()(Object *ob, Scene *sce)
if (cam->type == CAM_PERSP) {
COLLADASW::PerspectiveOptic persp(mSW);
persp.setXFov(RAD2DEGF(focallength_to_fov(cam->lens, cam->sensor_x)), "xfov");
- persp.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch),false,"aspect_ratio");
- persp.setZFar(cam->clipend, false , "zfar");
- persp.setZNear(cam->clipsta,false , "znear");
+ persp.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch), false, "aspect_ratio");
+ persp.setZFar(cam->clipend, false, "zfar");
+ persp.setZNear(cam->clipsta, false, "znear");
COLLADASW::Camera ccam(mSW, &persp, cam_id, cam_name);
addCamera(ccam);
}
else {
COLLADASW::OrthographicOptic ortho(mSW);
- ortho.setXMag(cam->ortho_scale,"xmag");
- ortho.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch),false,"aspect_ratio");
- ortho.setZFar(cam->clipend , false , "zfar");
- ortho.setZNear(cam->clipsta, false , "znear");
+ ortho.setXMag(cam->ortho_scale, "xmag");
+ ortho.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch), false, "aspect_ratio");
+ ortho.setZFar(cam->clipend, false, "zfar");
+ ortho.setZNear(cam->clipsta, false, "znear");
COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name);
addCamera(ccam);
}
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index 52261346acb..19fc30a2790 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -175,7 +175,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
std::string unitname = "meter";
float linearmeasure = RNA_float_get(&unit_settings, "scale_length");
- switch(RNA_property_enum_get(&unit_settings, system)) {
+ switch (RNA_property_enum_get(&unit_settings, system)) {
case USER_UNIT_NONE:
case USER_UNIT_METRIC:
if (linearmeasure == 0.001f) {
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index bc0606107ab..352f477c9d8 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -106,7 +106,7 @@ DocumentImporter::~DocumentImporter()
{
TagsMap::iterator etit;
etit = uid_tags_map.begin();
- while(etit!=uid_tags_map.end()) {
+ while (etit!=uid_tags_map.end()) {
delete etit->second;
etit++;
}
@@ -178,7 +178,7 @@ void DocumentImporter::finish()
system = RNA_struct_find_property(&unit_settings, "system");
scale = RNA_struct_find_property(&unit_settings, "scale_length");
- switch(unit_converter.isMetricSystem()) {
+ switch (unit_converter.isMetricSystem()) {
case UnitConverter::Metric:
RNA_property_enum_set(&unit_settings, system, USER_UNIT_METRIC);
break;
@@ -208,7 +208,7 @@ void DocumentImporter::finish()
const COLLADAFW::NodePointerArray& roots = (*it)->getRootNodes();
for (unsigned int i = 0; i < roots.getCount(); i++)
- translate_anim_recursive(roots[i],NULL,NULL);
+ translate_anim_recursive(roots[i], NULL, NULL);
}
if (libnode_ob.size()) {
@@ -396,7 +396,7 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
if ( par ) {
Object * empty = par;
par = add_object(sce, OB_ARMATURE);
- bc_set_parent(par,empty->parent, mContext);
+ bc_set_parent(par, empty->parent, mContext);
//remove empty : todo
object_map[parent_node->getUniqueId()] = par;
}
@@ -744,8 +744,7 @@ bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect )
Material *ma = uid_effect_map[uid];
std::map<COLLADAFW::UniqueId, Material*>::iterator iter;
- for (iter = uid_material_map.begin(); iter != uid_material_map.end() ; iter++ )
- {
+ for (iter = uid_material_map.begin(); iter != uid_material_map.end() ; iter++ ) {
if ( iter->second == ma ) {
this->FW_object_map[iter->first] = effect;
break;
@@ -789,7 +788,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
cam->clipend = camera->getFarClippingPlane().getValue();
COLLADAFW::Camera::CameraType type = camera->getCameraType();
- switch(type) {
+ switch (type) {
case COLLADAFW::Camera::ORTHOGRAPHIC:
{
cam->type = CAM_ORTHO;
@@ -808,10 +807,10 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
break;
}
- switch(camera->getDescriptionType()) {
+ switch (camera->getDescriptionType()) {
case COLLADAFW::Camera::ASPECTRATIO_AND_Y:
{
- switch(cam->type) {
+ switch (cam->type) {
case CAM_ORTHO:
{
double ymag = camera->getYMag().getValue();
@@ -839,7 +838,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
case COLLADAFW::Camera::SINGLE_X:
case COLLADAFW::Camera::X_AND_Y:
{
- switch(cam->type) {
+ switch (cam->type) {
case CAM_ORTHO:
cam->ortho_scale = (float)camera->getXMag().getValue();
break;
@@ -856,7 +855,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
break;
case COLLADAFW::Camera::SINGLE_Y:
{
- switch(cam->type) {
+ switch (cam->type) {
case CAM_ORTHO:
cam->ortho_scale = (float)camera->getYMag().getValue();
break;
@@ -1030,7 +1029,7 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
lamp->dist = d;
COLLADAFW::Light::LightType type = light->getLightType();
- switch(type) {
+ switch (type) {
case COLLADAFW::Light::AMBIENT_LIGHT:
{
lamp->type = LA_HEMI;
diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
index 9720b92ffae..36ed6867525 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -60,11 +60,10 @@ bool EffectsExporter::hasEffects(Scene *sce)
{
Base *base = (Base *)sce->base.first;
- while(base) {
+ while (base) {
Object *ob= base->object;
int a;
- for (a = 0; a < ob->totcol; a++)
- {
+ for (a = 0; a < ob->totcol; a++) {
Material *ma = give_current_material(ob, a+1);
// no material, but check all of the slots
@@ -94,10 +93,10 @@ void EffectsExporter::writeBlinn(COLLADASW::EffectProfile &ep, Material *ma)
COLLADASW::ColorOrTexture cot;
ep.setShaderType(COLLADASW::EffectProfile::BLINN);
// shininess
- ep.setShininess(ma->har, false , "shininess");
+ ep.setShininess(ma->har, false, "shininess");
// specular
cot = getcol(ma->specr, ma->specg, ma->specb, 1.0f);
- ep.setSpecular(cot, false , "specular" );
+ ep.setSpecular(cot, false, "specular" );
}
void EffectsExporter::writeLambert(COLLADASW::EffectProfile &ep, Material *ma)
@@ -111,10 +110,10 @@ void EffectsExporter::writePhong(COLLADASW::EffectProfile &ep, Material *ma)
COLLADASW::ColorOrTexture cot;
ep.setShaderType(COLLADASW::EffectProfile::PHONG);
// shininess
- ep.setShininess(ma->har , false , "shininess" );
+ ep.setShininess(ma->har, false, "shininess" );
// specular
cot = getcol(ma->specr, ma->specg, ma->specb, 1.0f);
- ep.setSpecular(cot, false , "specular" );
+ ep.setSpecular(cot, false, "specular" );
}
void EffectsExporter::operator()(Material *ma, Object *ob)
@@ -151,10 +150,10 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
// index of refraction
if (ma->mode & MA_RAYTRANSP) {
- ep.setIndexOfRefraction(ma->ang, false , "index_of_refraction");
+ ep.setIndexOfRefraction(ma->ang, false, "index_of_refraction");
}
else {
- ep.setIndexOfRefraction(1.0f, false , "index_of_refraction");
+ ep.setIndexOfRefraction(1.0f, false, "index_of_refraction");
}
COLLADASW::ColorOrTexture cot;
@@ -162,18 +161,18 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
// transparency
if (ma->mode & MA_TRANSP) {
// Tod: because we are in A_ONE mode transparency is calculated like this:
- ep.setTransparency(ma->alpha, false , "transparency");
+ ep.setTransparency(ma->alpha, false, "transparency");
// cot = getcol(1.0f, 1.0f, 1.0f, 1.0f);
// ep.setTransparent(cot);
}
// emission
cot=getcol(ma->emit, ma->emit, ma->emit, 1.0f);
- ep.setEmission(cot, false , "emission");
+ ep.setEmission(cot, false, "emission");
// diffuse multiplied by diffuse intensity
cot = getcol(ma->r * ma->ref, ma->g * ma->ref, ma->b * ma->ref, 1.0f);
- ep.setDiffuse(cot, false , "diffuse");
+ ep.setDiffuse(cot, false, "diffuse");
// ambient
/* ma->ambX is calculated only on render, so lets do it here manually and not rely on ma->ambX. */
@@ -182,7 +181,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
else
cot = getcol(ma->amb, ma->amb, ma->amb, 1.0f);
- ep.setAmbient(cot, false , "ambient");
+ ep.setAmbient(cot, false, "ambient");
// reflective, reflectivity
if (ma->mode & MA_RAYMIRROR) {
@@ -199,7 +198,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
// specular
if (ep.getShaderType() != COLLADASW::EffectProfile::LAMBERT) {
cot = getcol(ma->specr * ma->spec, ma->specg * ma->spec, ma->specb * ma->spec, 1.0f);
- ep.setSpecular(cot, false , "specular");
+ ep.setSpecular(cot, false, "specular");
}
// XXX make this more readable if possible
@@ -280,19 +279,19 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
// color
if (t->mapto & (MAP_COL | MAP_COLSPEC)) {
- ep.setDiffuse(createTexture(ima, uvname, sampler), false , "diffuse");
+ ep.setDiffuse(createTexture(ima, uvname, sampler), false, "diffuse");
}
// ambient
if (t->mapto & MAP_AMB) {
- ep.setAmbient(createTexture(ima, uvname, sampler), false , "ambient");
+ ep.setAmbient(createTexture(ima, uvname, sampler), false, "ambient");
}
// specular
if (t->mapto & MAP_SPEC) {
- ep.setSpecular(createTexture(ima, uvname, sampler), false , "specular");
+ ep.setSpecular(createTexture(ima, uvname, sampler), false, "specular");
}
// emission
if (t->mapto & MAP_EMIT) {
- ep.setEmission(createTexture(ima, uvname, sampler), false , "emission");
+ ep.setEmission(createTexture(ima, uvname, sampler), false, "emission");
}
// reflective
if (t->mapto & MAP_REF) {
@@ -351,7 +350,7 @@ COLLADASW::ColorOrTexture EffectsExporter::createTexture(Image *ima,
COLLADASW::ColorOrTexture EffectsExporter::getcol(float r, float g, float b, float a)
{
- COLLADASW::Color color(r,g,b,a);
+ COLLADASW::Color color(r, g, b, a);
COLLADASW::ColorOrTexture cot(color);
return cot;
}
diff --git a/source/blender/collada/ErrorHandler.cpp b/source/blender/collada/ErrorHandler.cpp
index 1c0f40d2185..530158ed418 100644
--- a/source/blender/collada/ErrorHandler.cpp
+++ b/source/blender/collada/ErrorHandler.cpp
@@ -49,37 +49,31 @@ bool ErrorHandler::handleError( const COLLADASaxFWL::IError* error )
{
mError = true;
- if ( error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXPARSER )
- {
+ if ( error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXPARSER ) {
COLLADASaxFWL::SaxParserError* saxParserError = (COLLADASaxFWL::SaxParserError*) error;
const GeneratedSaxParser::ParserError& parserError = saxParserError->getError();
// Workaround to avoid wrong error
- if ( parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_VALIDATION_MIN_OCCURS_UNMATCHED)
- {
- if ( strcmp(parserError.getElement(), "effect") == 0 )
- {
+ if ( parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_VALIDATION_MIN_OCCURS_UNMATCHED) {
+ if ( strcmp(parserError.getElement(), "effect") == 0 ) {
mError = false;
}
}
- if ( parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_VALIDATION_SEQUENCE_PREVIOUS_SIBLING_NOT_PRESENT)
- {
- if ( !((strcmp(parserError.getElement(), "extra") == 0)
- && (strcmp(parserError.getAdditionalText().c_str(), "sibling: fx_profile_abstract") == 0)))
+ if ( parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_VALIDATION_SEQUENCE_PREVIOUS_SIBLING_NOT_PRESENT) {
+ if ( !((strcmp(parserError.getElement(), "extra") == 0) &&
+ (strcmp(parserError.getAdditionalText().c_str(), "sibling: fx_profile_abstract") == 0)))
{
mError = false;
}
}
- if ( parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_COULD_NOT_OPEN_FILE)
- {
+ if ( parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_COULD_NOT_OPEN_FILE) {
std::cout << "Couldn't open file" << std::endl;
}
std::cout << "Schema validation error: " << parserError.getErrorMessage() << std::endl;
}
- else if ( error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXFWL )
- {
+ else if ( error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXFWL ) {
COLLADASaxFWL::SaxFWLError* saxFWLError = (COLLADASaxFWL::SaxFWLError*) error;
std::cout << "Sax FWL Error: " << saxFWLError->getErrorMessage() << std::endl;
}
diff --git a/source/blender/collada/ErrorHandler.h b/source/blender/collada/ErrorHandler.h
index 07eccb713e8..3b3797e935a 100644
--- a/source/blender/collada/ErrorHandler.h
+++ b/source/blender/collada/ErrorHandler.h
@@ -47,7 +47,7 @@ public:
bool hasError() { return mError; }
private:
/** Disable default copy ctor. */
- ErrorHandler( const ErrorHandler& pre );
+ ErrorHandler(const ErrorHandler& pre);
/** Disable default assignment operator. */
const ErrorHandler& operator= ( const ErrorHandler& pre );
/** Hold error status. */
diff --git a/source/blender/collada/ExtraHandler.h b/source/blender/collada/ExtraHandler.h
index 68656dfc690..900e7b70331 100644
--- a/source/blender/collada/ExtraHandler.h
+++ b/source/blender/collada/ExtraHandler.h
@@ -63,7 +63,7 @@ public:
const COLLADAFW::UniqueId& uniqueId );
private:
/** Disable default copy constructor. */
- ExtraHandler( const ExtraHandler& pre );
+ ExtraHandler(const ExtraHandler& pre);
/** Disable default assignment operator. */
const ExtraHandler& operator= ( const ExtraHandler& pre );
diff --git a/source/blender/collada/ExtraTags.h b/source/blender/collada/ExtraTags.h
index f8d12e6288a..03a311a7e86 100644
--- a/source/blender/collada/ExtraTags.h
+++ b/source/blender/collada/ExtraTags.h
@@ -59,7 +59,7 @@ public:
private:
/** Disable default copy constructor. */
- ExtraTags( const ExtraTags& pre );
+ ExtraTags(const ExtraTags& pre);
/** Disable default assignment operator. */
const ExtraTags& operator= ( const ExtraTags& pre );
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index ca112abc0af..8e4fa057daf 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -440,9 +440,9 @@ void GeometryExporter::create_normals(std::vector<Normal> &nor, std::vector<Face
*nn = nshar[*vv];
else {
Normal n = {
- vert[*vv].no[0]/32767.0,
- vert[*vv].no[1]/32767.0,
- vert[*vv].no[2]/32767.0
+ (float)vert[*vv].no[0] / 32767.0f,
+ (float)vert[*vv].no[1] / 32767.0f,
+ (float)vert[*vv].no[2] / 32767.0f
};
nor.push_back(n);
*nn = (unsigned int)nor.size() - 1;
diff --git a/source/blender/collada/GeometryExporter.h b/source/blender/collada/GeometryExporter.h
index f6dc5a18449..5d79fabb713 100644
--- a/source/blender/collada/GeometryExporter.h
+++ b/source/blender/collada/GeometryExporter.h
@@ -108,12 +108,13 @@ struct GeometryFunctor {
{
Base *base= (Base*) sce->base.first;
- while(base) {
+ while (base) {
Object *ob = base->object;
- if (ob->type == OB_MESH && ob->data
- && !(export_selected && !(ob->flag && SELECT))
- && ((sce->lay & ob->lay)!=0)) {
+ if (ob->type == OB_MESH && ob->data &&
+ !(export_selected && !(ob->flag & SELECT)) &&
+ ((sce->lay & ob->lay)!=0))
+ {
f(ob);
}
base= base->next;
diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp
index 946effda832..4d7c56ab419 100644
--- a/source/blender/collada/ImageExporter.cpp
+++ b/source/blender/collada/ImageExporter.cpp
@@ -48,11 +48,10 @@ bool ImagesExporter::hasImages(Scene *sce)
{
Base *base = (Base *)sce->base.first;
- while(base) {
+ while (base) {
Object *ob= base->object;
int a;
- for (a = 0; a < ob->totcol; a++)
- {
+ for (a = 0; a < ob->totcol; a++) {
Material *ma = give_current_material(ob, a+1);
// no material, but check all of the slots
diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp
index 51242b36b64..6d276cd782f 100644
--- a/source/blender/collada/LightExporter.cpp
+++ b/source/blender/collada/LightExporter.cpp
@@ -39,11 +39,10 @@ template<class Functor>
void forEachLampObjectInScene(Scene *sce, Functor &f, bool export_selected)
{
Base *base= (Base*) sce->base.first;
- while(base) {
+ while (base) {
Object *ob = base->object;
-
- if (ob->type == OB_LAMP && ob->data
- && !(export_selected && !(ob->flag & SELECT))) {
+
+ if (ob->type == OB_LAMP && ob->data && !(export_selected && !(ob->flag & SELECT))) {
f(ob);
}
base= base->next;
@@ -85,7 +84,7 @@ void LightsExporter::operator()(Object *ob)
// sun
if (la->type == LA_SUN) {
COLLADASW::DirectionalLight cla(mSW, la_id, la_name);
- cla.setColor(col,false,"color");
+ cla.setColor(col, false, "color");
cla.setConstantAttenuation(constatt);
exportBlenderProfile(cla, la);
addLight(cla);
@@ -93,7 +92,7 @@ void LightsExporter::operator()(Object *ob)
// hemi
else if (la->type == LA_HEMI) {
COLLADASW::AmbientLight cla(mSW, la_id, la_name);
- cla.setColor(col,false,"color");
+ cla.setColor(col, false, "color");
cla.setConstantAttenuation(constatt);
exportBlenderProfile(cla, la);
addLight(cla);
@@ -101,9 +100,9 @@ void LightsExporter::operator()(Object *ob)
// spot
else if (la->type == LA_SPOT) {
COLLADASW::SpotLight cla(mSW, la_id, la_name);
- cla.setColor(col,false,"color");
- cla.setFallOffAngle(la->spotsize,false,"fall_off_angle");
- cla.setFallOffExponent(la->spotblend,false,"fall_off_exponent");
+ cla.setColor(col, false, "color");
+ cla.setFallOffAngle(la->spotsize, false, "fall_off_angle");
+ cla.setFallOffExponent(la->spotblend, false, "fall_off_exponent");
cla.setConstantAttenuation(constatt);
cla.setLinearAttenuation(linatt);
cla.setQuadraticAttenuation(quadatt);
@@ -113,7 +112,7 @@ void LightsExporter::operator()(Object *ob)
// lamp
else if (la->type == LA_LOCAL) {
COLLADASW::PointLight cla(mSW, la_id, la_name);
- cla.setColor(col,false,"color");
+ cla.setColor(col, false, "color");
cla.setConstantAttenuation(constatt);
cla.setLinearAttenuation(linatt);
cla.setQuadraticAttenuation(quadatt);
@@ -124,7 +123,7 @@ void LightsExporter::operator()(Object *ob)
// it will be exported as a local lamp
else {
COLLADASW::PointLight cla(mSW, la_id, la_name);
- cla.setColor(col,false,"color");
+ cla.setColor(col, false, "color");
cla.setConstantAttenuation(constatt);
cla.setLinearAttenuation(linatt);
cla.setQuadraticAttenuation(quadatt);
diff --git a/source/blender/collada/MaterialExporter.cpp b/source/blender/collada/MaterialExporter.cpp
index 1e3358c9216..ac1a5d32a08 100644
--- a/source/blender/collada/MaterialExporter.cpp
+++ b/source/blender/collada/MaterialExporter.cpp
@@ -50,11 +50,10 @@ bool MaterialsExporter::hasMaterials(Scene *sce)
{
Base *base = (Base *)sce->base.first;
- while(base) {
+ while (base) {
Object *ob= base->object;
int a;
- for (a = 0; a < ob->totcol; a++)
- {
+ for (a = 0; a < ob->totcol; a++) {
Material *ma = give_current_material(ob, a+1);
// no material, but check all of the slots
diff --git a/source/blender/collada/MaterialExporter.h b/source/blender/collada/MaterialExporter.h
index eb7886c23b9..4a5422184d4 100644
--- a/source/blender/collada/MaterialExporter.h
+++ b/source/blender/collada/MaterialExporter.h
@@ -68,7 +68,7 @@ public:
void operator ()(Object *ob)
{
int a;
- for(a = 0; a < ob->totcol; a++) {
+ for (a = 0; a < ob->totcol; a++) {
Material *ma = give_current_material(ob, a+1);
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp
index 5c01c31bd0d..0bf33206fa7 100644
--- a/source/blender/collada/MeshImporter.cpp
+++ b/source/blender/collada/MeshImporter.cpp
@@ -116,7 +116,7 @@ UVDataWrapper::UVDataWrapper(COLLADAFW::MeshVertexData& vdata) : mVData(&vdata)
void WVDataWrapper::print()
{
fprintf(stderr, "UVs:\n");
- switch(mVData->getType()) {
+ switch (mVData->getType()) {
case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
{
COLLADAFW::ArrayPrimitiveType<float>* values = mVData->getFloatValues();
@@ -147,7 +147,7 @@ void UVDataWrapper::getUV(int uv_index, float *uv)
int stride = mVData->getStride(0);
if (stride==0) stride = 2;
- switch(mVData->getType()) {
+ switch (mVData->getType()) {
case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
{
COLLADAFW::ArrayPrimitiveType<float>* values = mVData->getFloatValues();
@@ -676,7 +676,7 @@ void MeshImporter::get_vector(float v[3], COLLADAFW::MeshVertexData& arr, int i,
{
i *= stride;
- switch(arr.getType()) {
+ switch (arr.getType()) {
case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
{
COLLADAFW::ArrayPrimitiveType<float>* values = arr.getFloatValues();
@@ -797,7 +797,7 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri
// what we already have handled.
std::multimap<COLLADAFW::UniqueId, COLLADAFW::UniqueId>::iterator it;
it=materials_mapped_to_geom.find(*geom_uid);
- while(it!=materials_mapped_to_geom.end()) {
+ while (it!=materials_mapped_to_geom.end()) {
if (it->second == ma_uid && it->first == *geom_uid) return NULL; // do nothing if already found
it++;
}
diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp
index 9010fd5062a..cd36267fd56 100644
--- a/source/blender/collada/SceneExporter.cpp
+++ b/source/blender/collada/SceneExporter.cpp
@@ -43,12 +43,12 @@ void SceneExporter::exportScene(Scene *sce)
void SceneExporter::exportHierarchy(Scene *sce)
{
Base *base= (Base*) sce->base.first;
- while(base) {
+ while (base) {
Object *ob = base->object;
if (!ob->parent) {
if (sce->lay & ob->lay) {
- switch(ob->type) {
+ switch (ob->type) {
case OB_MESH:
case OB_CAMERA:
case OB_LAMP:
@@ -81,12 +81,12 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
// list child objects
Base *b = (Base*) sce->base.first;
- while(b) {
+ while (b) {
// cob - child object
Object *cob = b->object;
if (cob->parent == ob) {
- switch(cob->type) {
+ switch (cob->type) {
case OB_MESH:
case OB_CAMERA:
case OB_LAMP:
@@ -154,8 +154,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
}
}
- for (std::list<Object*>::iterator i= child_objects.begin(); i != child_objects.end(); ++i)
- {
+ for (std::list<Object*>::iterator i= child_objects.begin(); i != child_objects.end(); ++i) {
writeNodes(*i, sce);
}
diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp
index a73d5243624..4c7fde8ef17 100644
--- a/source/blender/collada/TransformReader.cpp
+++ b/source/blender/collada/TransformReader.cpp
@@ -43,7 +43,7 @@ void TransformReader::get_node_mat(float mat[][4], COLLADAFW::Node *node, std::m
COLLADAFW::Transformation *tm = node->getTransformations()[i];
COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
- switch(type) {
+ switch (type) {
case COLLADAFW::Transformation::TRANSLATE:
dae_translate_to_mat4(tm, cur);
break;
diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp
index f441833233c..4974566bba1 100644
--- a/source/blender/collada/TransformWriter.cpp
+++ b/source/blender/collada/TransformWriter.cpp
@@ -48,11 +48,11 @@ void TransformWriter::add_node_transform(COLLADASW::Node& node, float mat[][4],
double dmat[4][4];
UnitConverter* converter = new UnitConverter();
- converter->mat4_to_dae_double(dmat,local);
+ converter->mat4_to_dae_double(dmat, local);
TransformBase::decompose(local, loc, rot, NULL, scale);
if ( node.getType() == COLLADASW::Node::JOINT)
- node.addMatrix("transform",dmat);
+ node.addMatrix("transform", dmat);
else
add_transform(node, loc, rot, scale);
}
@@ -95,19 +95,16 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob)
*/
/* Using parentinv should allow use of existing curves */
- if (ob->parent)
- {
+ if (ob->parent) {
// If parentinv is identity don't add it.
bool add_parinv = false;
- for (int i = 0; i < 16; ++i)
- {
+ for (int i = 0; i < 16; ++i) {
float f = (i % 4 == i / 4) ? 1.0f : 0.0f;
add_parinv |= (ob->parentinv[i % 4][i / 4] != f);
}
- if (add_parinv)
- {
+ if (add_parinv) {
double dmat[4][4];
UnitConverter converter;
converter.mat4_to_dae_double(dmat, ob->parentinv);
diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp
index fc4093bd795..fa99d460184 100644
--- a/source/blender/collada/collada_internal.cpp
+++ b/source/blender/collada/collada_internal.cpp
@@ -40,7 +40,7 @@ void UnitConverter::read_asset(const COLLADAFW::FileInfo* asset)
UnitConverter::UnitSystem UnitConverter::isMetricSystem()
{
- switch(unit.getLinearUnitUnit()) {
+ switch (unit.getLinearUnitUnit()) {
case COLLADAFW::FileInfo::Unit::MILLIMETER:
case COLLADAFW::FileInfo::Unit::CENTIMETER:
case COLLADAFW::FileInfo::Unit::DECIMETER:
@@ -198,44 +198,39 @@ void clear_global_id_map()
/** Look at documentation of translate_map */
std::string translate_id(const std::string &id)
{
- if (id.size() == 0)
- { return id; }
+ if (id.size() == 0) {
+ return id;
+ }
+
std::string id_translated = id;
id_translated[0] = translate_start_name_map[(unsigned int)id_translated[0]];
- for (unsigned int i=1; i < id_translated.size(); i++)
- {
+ for (unsigned int i=1; i < id_translated.size(); i++) {
id_translated[i] = translate_name_map[(unsigned int)id_translated[i]];
}
// It's so much workload now, the if () should speed up things.
- if (id_translated != id)
- {
+ if (id_translated != id) {
// Search duplicates
map_string_list::iterator iter = global_id_map.find(id_translated);
- if (iter != global_id_map.end())
- {
+ if (iter != global_id_map.end()) {
unsigned int i = 0;
bool found = false;
- for (i=0; i < iter->second.size(); i++)
- {
- if (id == iter->second[i])
- {
+ for (i=0; i < iter->second.size(); i++) {
+ if (id == iter->second[i]) {
found = true;
break;
}
}
bool convert = false;
- if (found)
- {
- if (i > 0)
- { convert = true; }
+ if (found) {
+ if (i > 0) {
+ convert = true;
+ }
}
- else
- {
+ else {
convert = true;
global_id_map[id_translated].push_back(id);
}
- if (convert)
- {
+ if (convert) {
std::stringstream out;
out << ++i;
id_translated += out.str();
@@ -279,7 +274,7 @@ std::string get_material_id(Material *mat)
bool has_object_type(Scene *sce, short obtype)
{
Base *base= (Base*) sce->base.first;
- while(base) {
+ while (base) {
Object *ob = base->object;
if (ob->type == obtype && ob->data) {
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 01ab36133fd..b62222317bd 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -98,10 +98,10 @@
/* Draw Backdrop ---------------------------------- */
/* get backdrop color for top-level widgets (Scene and Object only) */
-static void acf_generic_root_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color)
+static void acf_generic_root_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
{
/* darker blue for top-level widgets */
- UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELOB, color);
+ UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELOB, r_color);
}
/* backdrop for top-level widgets (Scene and Object only) */
@@ -124,10 +124,10 @@ static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, floa
/* get backdrop color for data expanders under top-level Scene/Object */
-static void acf_generic_dataexpand_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color)
+static void acf_generic_dataexpand_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
{
/* lighter color than top-level widget */
- UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELSUBOB, color);
+ UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELSUBOB, r_color);
}
/* backdrop for data expanders under top-level Scene/Object */
@@ -147,7 +147,7 @@ static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale
}
/* get backdrop color for generic channels */
-static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, float *color)
+static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3])
{
bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
SpaceAction *saction = NULL;
@@ -183,12 +183,12 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa
}
/* copy the colors over, transforming from bytes to floats */
- rgb_uchar_to_float(color, cp);
+ rgb_uchar_to_float(r_color, cp);
}
else {
// FIXME: what happens when the indention is 1 greater than what it should be (due to grouping)?
int colOfs= 20 - 20*indent;
- UI_GetThemeColorShade3fv(TH_HEADER, colOfs, color);
+ UI_GetThemeColorShade3fv(TH_HEADER, colOfs, r_color);
}
}
@@ -291,7 +291,7 @@ static short acf_generic_group_offset(bAnimContext *ac, bAnimListElem *ale)
offset += 21;
}
/* materials and particles animdata */
- else if (ELEM(GS(ale->id->name),ID_MA,ID_PA))
+ else if (ELEM(GS(ale->id->name), ID_MA, ID_PA))
offset += 14;
/* if not in Action Editor mode, action-groups (and their children) must carry some offset too... */
@@ -374,13 +374,13 @@ static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListEle
/* Animation Summary ----------------------------------- */
/* get backdrop color for summary widget */
-static void acf_summary_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color)
+static void acf_summary_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
{
// FIXME: hardcoded color - same as the 'action' line in NLA
// reddish color
- color[0] = 0.8f;
- color[1] = 0.2f;
- color[2] = 0.0f;
+ r_color[0] = 0.8f;
+ r_color[1] = 0.2f;
+ r_color[2] = 0.0f;
}
/* backdrop for summary widget */
@@ -730,13 +730,13 @@ static bAnimChannelType ACF_OBJECT =
/* Group ------------------------------------------- */
/* get backdrop color for group widget */
-static void acf_group_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float *color)
+static void acf_group_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float r_color[3])
{
/* highlight only for action group channels */
if (ale->flag & AGRP_ACTIVE)
- UI_GetThemeColorShade3fv(TH_GROUP_ACTIVE, 10, color);
+ UI_GetThemeColorShade3fv(TH_GROUP_ACTIVE, 10, r_color);
else
- UI_GetThemeColorShade3fv(TH_GROUP, 20, color);
+ UI_GetThemeColorShade3fv(TH_GROUP, 20, r_color);
}
/* backdrop for group widget */
@@ -1427,7 +1427,7 @@ static bAnimChannelType ACF_DSCAM=
static int acf_dscur_icon(bAnimListElem *ale)
{
Curve *cu= (Curve *)ale->data;
- short obtype= curve_type(cu);
+ short obtype= BKE_curve_type_get(cu);
switch (obtype) {
case OB_FONT:
@@ -2322,10 +2322,10 @@ static bAnimChannelType ACF_SHAPEKEY=
/* GPencil Datablock ------------------------------------------- */
/* get backdrop color for gpencil datablock widget */
-static void acf_gpd_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color)
+static void acf_gpd_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
{
/* these are ID-blocks, but not exactly standalone... */
- UI_GetThemeColorShade3fv(TH_DOPESHEET_CHANNELSUBOB, 20, color);
+ UI_GetThemeColorShade3fv(TH_DOPESHEET_CHANNELSUBOB, 20, r_color);
}
// TODO: just get this from RNA?
@@ -2560,7 +2560,7 @@ bAnimChannelType *ANIM_channel_get_typeinfo (bAnimListElem *ale)
/* --------------------------- */
/* Print debug info string for the given channel */
-void ANIM_channel_debug_print_info (bAnimListElem *ale, short indent_level)
+void ANIM_channel_debug_print_info(bAnimListElem *ale, short indent_level)
{
bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
@@ -2592,7 +2592,7 @@ void ANIM_channel_debug_print_info (bAnimListElem *ale, short indent_level)
/* Check if some setting for a channel is enabled
* Returns: 1 = On, 0 = Off, -1 = Invalid
*/
-short ANIM_channel_setting_get (bAnimContext *ac, bAnimListElem *ale, int setting)
+short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting)
{
bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
@@ -2669,7 +2669,7 @@ short ANIM_channel_setting_get (bAnimContext *ac, bAnimListElem *ale, int settin
* - setting: eAnimChannel_Settings
* - mode: eAnimChannels_SetFlag
*/
-void ANIM_channel_setting_set (bAnimContext *ac, bAnimListElem *ale, int setting, short mode)
+void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting, short mode)
{
bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
@@ -2722,7 +2722,7 @@ void ANIM_channel_setting_set (bAnimContext *ac, bAnimListElem *ale, int setting
/* Draw the given channel */
// TODO: make this use UI controls for the buttons
-void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
+void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
{
bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
View2D *v2d= &ac->ar->v2d;
@@ -3043,7 +3043,8 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi
}
/* Draw a widget for some setting */
-static void draw_setting_widget (bAnimContext *ac, bAnimListElem *ale, bAnimChannelType *acf, uiBlock *block, int xpos, int ypos, int setting)
+static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChannelType *acf,
+ uiBlock *block, int xpos, int ypos, int setting)
{
short negflag, ptrsize /* , enabled */ /* UNUSED */, butType;
int flag, icon;
@@ -3150,7 +3151,7 @@ static void draw_setting_widget (bAnimContext *ac, bAnimListElem *ale, bAnimChan
}
/* Draw UI widgets the given channel */
-void ANIM_channel_draw_widgets (bContext *C, bAnimContext *ac, bAnimListElem *ale, uiBlock *block, float yminc, float ymaxc, size_t channel_index)
+void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale, uiBlock *block, float yminc, float ymaxc, size_t channel_index)
{
bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
View2D *v2d= &ac->ar->v2d;
@@ -3222,7 +3223,8 @@ void ANIM_channel_draw_widgets (bContext *C, bAnimContext *ac, bAnimListElem *al
uiBlockSetEmboss(block, UI_EMBOSS);
- but = uiDefButR(block, TEX, 1, "", offset+3, yminc, RENAME_TEXT_WIDTH, channel_height, &ptr, RNA_property_identifier(prop), -1, 0, 0, -1, -1, NULL);
+ but = uiDefButR(block, TEX, 1, "", offset+3, yminc, RENAME_TEXT_WIDTH, channel_height,
+ &ptr, RNA_property_identifier(prop), -1, 0, 0, -1, -1, NULL);
uiButSetFunc(but, achannel_setting_rename_done_cb, ac->ads, NULL);
uiButActiveOnly(C, block, but);
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index fb6a65a585f..e3c1aacd7ac 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -69,7 +69,7 @@
/* Set the given animation-channel as the active one for the active context */
// TODO: extend for animdata types...
-void ANIM_set_active_channel (bAnimContext *ac, void *data, short datatype, int filter, void *channel_data, short channel_type)
+void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int filter, void *channel_data, short channel_type)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -188,7 +188,7 @@ void ANIM_set_active_channel (bAnimContext *ac, void *data, short datatype, int
* - test: check if deselecting instead of selecting
* - sel: eAnimChannels_SetFlag;
*/
-void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype, short test, short sel)
+void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, short test, short sel)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -372,7 +372,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype,
* - setting: type of setting to set
* - on: whether the visibility setting has been enabled or disabled
*/
-void ANIM_flush_setting_anim_channels (bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short on)
+void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, int setting, short on)
{
bAnimListElem *ale, *match=NULL;
int prevLevel=0, matchLevel=0;
@@ -504,7 +504,7 @@ void ANIM_flush_setting_anim_channels (bAnimContext *ac, ListBase *anim_data, bA
/* -------------------------- F-Curves ------------------------------------- */
/* Delete the given F-Curve from its AnimData block */
-void ANIM_fcurve_delete_from_animdata (bAnimContext *ac, AnimData *adt, FCurve *fcu)
+void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, AnimData *adt, FCurve *fcu)
{
/* - if no AnimData, we've got nowhere to remove the F-Curve from
* (this doesn't guarantee that the F-Curve is in there, but at least we tried
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index 3f0e1b1be14..b449c11ff7b 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -241,7 +241,7 @@ static void animchan_sync_fcurve (bAnimContext *UNUSED(ac), bAnimListElem *ale)
/* ---------------- */
/* Main call to be exported to animation editors */
-void ANIM_sync_animchannels_to_data (const bContext *C)
+void ANIM_sync_animchannels_to_data(const bContext *C)
{
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index bab341ae70b..236b8d18b78 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -63,7 +63,7 @@
* - cfra: time in frames or seconds, consistent with the values shown by timecodes
*/
// TODO: have this in kernel instead under scene?
-void ANIM_timecode_string_from_frame (char *str, Scene *scene, int power, short timecodes, float cfra)
+void ANIM_timecode_string_from_frame(char *str, Scene *scene, int power, short timecodes, float cfra)
{
if (timecodes) {
int hours=0, minutes=0, seconds=0, frames=0;
@@ -212,7 +212,7 @@ static void draw_cfra_number (Scene *scene, View2D *v2d, float cfra, short time)
}
/* General call for drawing current frame indicator in animation editor */
-void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag)
+void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag)
{
Scene *scene= CTX_data_scene(C);
float vec[2];
@@ -248,7 +248,7 @@ void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag)
/* Note: 'Preview Range' tools are defined in anim_ops.c */
/* Draw preview range 'curtains' for highlighting where the animation data is */
-void ANIM_draw_previewrange (const bContext *C, View2D *v2d)
+void ANIM_draw_previewrange(const bContext *C, View2D *v2d)
{
Scene *scene= CTX_data_scene(C);
@@ -335,7 +335,7 @@ static short bezt_nlamapping_apply(KeyframeEditData *ked, BezTriple *bezt)
* - restore = whether to map points back to non-mapped time
* - only_keys = whether to only adjust the location of the center point of beztriples
*/
-void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, short only_keys)
+void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, short restore, short only_keys)
{
KeyframeEditData ked= {{NULL}};
KeyframeEditFunc map_cb;
@@ -361,7 +361,7 @@ void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, s
/* UNITS CONVERSION MAPPING (required for drawing and editing keyframes) */
/* Get unit conversion factor for given ID + F-Curve */
-float ANIM_unit_mapping_get_factor (Scene *scene, ID *id, FCurve *fcu, short restore)
+float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short restore)
{
/* sanity checks */
if (id && fcu && fcu->rna_path) {
@@ -415,7 +415,7 @@ static short bezt_unit_mapping_apply (KeyframeEditData *ked, BezTriple *bezt)
}
/* Apply/Unapply units conversions to keyframes */
-void ANIM_unit_mapping_apply_fcurve (Scene *scene, ID *id, FCurve *fcu, short flag)
+void ANIM_unit_mapping_apply_fcurve(Scene *scene, ID *id, FCurve *fcu, short flag)
{
KeyframeEditData ked;
KeyframeEditFunc sel_cb;
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index e5822c76fa1..cc3401da6c5 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -260,7 +260,7 @@ static short nlaedit_get_context (bAnimContext *ac, SpaceNla *snla)
* - AnimContext to write to is provided as pointer to var on stack so that we don't have
* allocation/freeing costs (which are not that avoidable with channels).
*/
-short ANIM_animdata_context_getdata (bAnimContext *ac)
+short ANIM_animdata_context_getdata(bAnimContext *ac)
{
SpaceLink *sl = ac->sl;
short ok= 0;
@@ -303,7 +303,7 @@ short ANIM_animdata_context_getdata (bAnimContext *ac)
* allocation/freeing costs (which are not that avoidable with channels).
* - Clears data and sets the information from Blender Context which is useful
*/
-short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac)
+short ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= CTX_wm_region(C);
@@ -824,11 +824,14 @@ static bAnimListElem *make_new_animlistelem (void *data, short datatype, ID *own
/* ----------------------------------------- */
-/* 'Only Selected' selected data filtering
+/* 'Only Selected' selected data and/or 'Include Hidden' filtering
* NOTE: when this function returns true, the F-Curve is to be skipped
*/
-static size_t skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner_id, int filter_mode)
+static short skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner_id, int filter_mode)
{
+ /* hidden items should be skipped if we only care about visible data, but we aren't interested in hidden stuff */
+ short skip_hidden = (filter_mode & ANIMFILTER_DATA_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN);
+
if (GS(owner_id->name) == ID_OB) {
Object *ob= (Object *)owner_id;
@@ -845,17 +848,22 @@ static size_t skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner
/* check whether to continue or skip */
if ((pchan) && (pchan->bone)) {
/* if only visible channels, skip if bone not visible unless user wants channels from hidden data too */
- if ((filter_mode & ANIMFILTER_DATA_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN)) {
+ if (skip_hidden) {
bArmature *arm= (bArmature *)ob->data;
+ /* skipping - not visible on currently visible layers */
if ((arm->layer & pchan->bone->layer) == 0)
return 1;
- // TODO: manually hidden using flags
+ /* skipping - is currently hidden */
+ if (pchan->bone->flag & BONE_HIDDEN_P)
+ return 1;
}
/* can only add this F-Curve if it is selected */
- if ((pchan->bone->flag & BONE_SELECTED) == 0)
- return 1;
+ if (ads->filterflag & ADS_FILTER_ONLYSEL) {
+ if ((pchan->bone->flag & BONE_SELECTED) == 0)
+ return 1;
+ }
}
}
}
@@ -874,14 +882,16 @@ static size_t skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner
if (seq_name) MEM_freeN(seq_name);
/* can only add this F-Curve if it is selected */
- if (seq==NULL || (seq->flag & SELECT)==0)
- return 1;
+ if (ads->filterflag & ADS_FILTER_ONLYSEL) {
+ if ((seq == NULL) || (seq->flag & SELECT)==0)
+ return 1;
+ }
}
}
else if (GS(owner_id->name) == ID_NT) {
bNodeTree *ntree = (bNodeTree *)owner_id;
- /* check for selected nodes */
+ /* check for selected nodes */
if ((fcu->rna_path) && strstr(fcu->rna_path, "nodes")) {
bNode *node;
char *node_name;
@@ -892,8 +902,10 @@ static size_t skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner
if (node_name) MEM_freeN(node_name);
/* can only add this F-Curve if it is selected */
- if ((node) && (node->flag & NODE_SELECT)==0)
- return 1;
+ if (ads->filterflag & ADS_FILTER_ONLYSEL) {
+ if ((node) && (node->flag & NODE_SELECT)==0)
+ return 1;
+ }
}
}
return 0;
@@ -940,17 +952,19 @@ static FCurve *animfilter_fcurve_next (bDopeSheet *ads, FCurve *first, bActionGr
*/
for (fcu= first; ((fcu) && (fcu->grp==grp)); fcu= fcu->next) {
/* special exception for Pose-Channel/Sequence-Strip/Node Based F-Curves:
- * - the 'Only Selected' data filter should be applied to Pose-Channel data too, but those are
- * represented as F-Curves. The way the filter for objects worked was to be the first check
- * after 'normal' visibility, so this is done first here too...
+ * - the 'Only Selected' and 'Include Hidden' data filters should be applied to sub-ID data which
+ * can be independently selected/hidden, such as Pose-Channels, Sequence Strips, and Nodes.
+ * Since these checks were traditionally done as first check for objects, we do the same here
* - we currently use an 'approximate' method for getting these F-Curves that doesn't require
* carefully checking the entire path
* - this will also affect things like Drivers, and also works for Bone Constraints
*/
- if ( ((ads) && (ads->filterflag & ADS_FILTER_ONLYSEL)) && (owner_id) ) {
- if (skip_fcurve_selected_data(ads, fcu, owner_id, filter_mode))
- continue;
- }
+ if (ads && owner_id) {
+ if ((ads->filterflag & ADS_FILTER_ONLYSEL) || (ads->filterflag & ADS_FILTER_INCL_HIDDEN)==0) {
+ if (skip_fcurve_selected_data(ads, fcu, owner_id, filter_mode))
+ continue;
+ }
+ }
/* only include if visible (Graph Editor check, not channels check) */
if (!(filter_mode & ANIMFILTER_CURVE_VISIBLE) || (fcu->flag & FCURVE_VISIBLE)) {
@@ -992,8 +1006,7 @@ static size_t animfilter_fcurves (ListBase *anim_data, bDopeSheet *ads, FCurve *
* 4) the fcu pointer is set to the F-Curve after the one we just added, so that we can keep going through
* the rest of the F-Curve list without an eternal loop. Back to step 2 :)
*/
- for (fcu=first; ( (fcu = animfilter_fcurve_next(ads, fcu, grp, filter_mode, owner_id)) ); fcu=fcu->next)
- {
+ for (fcu = first; ( (fcu = animfilter_fcurve_next(ads, fcu, grp, filter_mode, owner_id)) ); fcu = fcu->next) {
ANIMCHANNEL_NEW_CHANNEL(fcu, ANIMTYPE_FCURVE, owner_id);
}
@@ -2205,7 +2218,7 @@ static size_t animdata_filter_remove_duplis (ListBase *anim_data)
* will be placed for use.
* filter_mode: how should the data be filtered - bitmapping accessed flags
*/
-size_t ANIM_animdata_filter (bAnimContext *ac, ListBase *anim_data, int filter_mode, void *data, short datatype)
+size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mode, void *data, short datatype)
{
size_t items = 0;
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c
index 6f4d4c4a431..4be3f79060e 100644
--- a/source/blender/editors/animation/anim_ipo_utils.c
+++ b/source/blender/editors/animation/anim_ipo_utils.c
@@ -191,7 +191,7 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
/* used to determine the color of F-Curves with FCURVE_COLOR_AUTO_RAINBOW set */
//void fcurve_rainbow (unsigned int cur, unsigned int tot, float *out)
-void getcolor_fcurve_rainbow (int cur, int tot, float *out)
+void getcolor_fcurve_rainbow(int cur, int tot, float *out)
{
float hue, val, sat, fac;
int grouping;
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 73dba91207f..2527cb7eb40 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -121,7 +121,7 @@ ListBase *ED_animcontext_get_markers(const bAnimContext *ac)
* < value: from the transform code, this is t->vec[0] (which is delta transform for grab/extend, and scale factor for scale)
* < side: (B/L/R) for 'extend' functionality, which side of current frame to use
*/
-int ED_markers_post_apply_transform (ListBase *markers, Scene *scene, int mode, float value, char side)
+int ED_markers_post_apply_transform(ListBase *markers, Scene *scene, int mode, float value, char side)
{
TimeMarker *marker;
float cfra = (float)CFRA;
@@ -187,14 +187,14 @@ TimeMarker *ED_markers_find_nearest_marker (ListBase *markers, float x)
}
/* Return the time of the marker that occurs on a frame closest to the given time */
-int ED_markers_find_nearest_marker_time (ListBase *markers, float x)
+int ED_markers_find_nearest_marker_time(ListBase *markers, float x)
{
TimeMarker *nearest= ED_markers_find_nearest_marker(markers, x);
return (nearest) ? (nearest->frame) : (int)floor(x + 0.5f);
}
-void ED_markers_get_minmax (ListBase *markers, short sel, float *first, float *last)
+void ED_markers_get_minmax(ListBase *markers, short sel, float *first, float *last)
{
TimeMarker *marker;
float min, max;
@@ -509,7 +509,7 @@ static int ed_markers_poll_markers_exist(bContext *C)
* exec() callback will be called instead in the appropriate places.
*/
static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, wmEvent *evt,
- int (*invoke_func)(bContext*,wmOperator*,wmEvent*))
+ int (*invoke_func)(bContext *, wmOperator *, wmEvent *))
{
ScrArea *sa = CTX_wm_area(C);
int retval = OPERATOR_PASS_THROUGH;
@@ -745,7 +745,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
float dx, fac;
char str[256];
- switch(evt->type) {
+ switch (evt->type) {
case ESCKEY:
ed_marker_move_cancel(C, op);
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 9c4f96ebe6d..a4bc0cc854c 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -66,7 +66,7 @@
#include "anim_intern.h"
/* called by WM */
-void free_anim_drivers_copybuf (void);
+void free_anim_drivers_copybuf(void);
/* ************************************************** */
/* Animation Data Validation */
@@ -135,7 +135,7 @@ FCurve *verify_driver_fcurve (ID *id, const char rna_path[], const int array_ind
/* Main Driver Management API calls:
* Add a new driver for the specified property on the given ID block
*/
-short ANIM_add_driver (ReportList *reports, ID *id, const char rna_path[], int array_index, short flag, int type)
+short ANIM_add_driver(ReportList *reports, ID *id, const char rna_path[], int array_index, short flag, int type)
{
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
@@ -229,7 +229,7 @@ short ANIM_add_driver (ReportList *reports, ID *id, const char rna_path[], int a
/* Main Driver Management API calls:
* Remove the driver for the specified property on the given ID block (if available)
*/
-short ANIM_remove_driver (ReportList *UNUSED(reports), ID *id, const char rna_path[], int array_index, short UNUSED(flag))
+short ANIM_remove_driver(ReportList *UNUSED(reports), ID *id, const char rna_path[], int array_index, short UNUSED(flag))
{
AnimData *adt;
FCurve *fcu;
@@ -281,7 +281,7 @@ static FCurve *channeldriver_copypaste_buf = NULL;
/* This function frees any MEM_calloc'ed copy/paste buffer data */
// XXX find some header to put this in!
-void free_anim_drivers_copybuf (void)
+void free_anim_drivers_copybuf(void)
{
/* free the buffer F-Curve if it exists, as if it were just another F-Curve */
if (channeldriver_copypaste_buf)
@@ -290,7 +290,7 @@ void free_anim_drivers_copybuf (void)
}
/* Checks if there is a driver in the copy/paste buffer */
-short ANIM_driver_can_paste (void)
+short ANIM_driver_can_paste(void)
{
return (channeldriver_copypaste_buf != NULL);
}
@@ -300,7 +300,7 @@ short ANIM_driver_can_paste (void)
/* Main Driver Management API calls:
* Make a copy of the driver for the specified property on the given ID block
*/
-short ANIM_copy_driver (ReportList *reports, ID *id, const char rna_path[], int array_index, short UNUSED(flag))
+short ANIM_copy_driver(ReportList *reports, ID *id, const char rna_path[], int array_index, short UNUSED(flag))
{
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
@@ -347,7 +347,7 @@ short ANIM_copy_driver (ReportList *reports, ID *id, const char rna_path[], int
* Add a new driver for the specified property on the given ID block or replace an existing one
* with the driver + driver-curve data from the buffer
*/
-short ANIM_paste_driver (ReportList *reports, ID *id, const char rna_path[], int array_index, short UNUSED(flag))
+short ANIM_paste_driver(ReportList *reports, ID *id, const char rna_path[], int array_index, short UNUSED(flag))
{
PointerRNA id_ptr, ptr;
PropertyRNA *prop;
@@ -512,7 +512,7 @@ static int add_driver_button_exec (bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void ANIM_OT_driver_button_add (wmOperatorType *ot)
+void ANIM_OT_driver_button_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Driver";
@@ -564,7 +564,7 @@ static int remove_driver_button_exec (bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void ANIM_OT_driver_button_remove (wmOperatorType *ot)
+void ANIM_OT_driver_button_remove(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove Driver";
@@ -611,7 +611,7 @@ static int copy_driver_button_exec (bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void ANIM_OT_copy_driver_button (wmOperatorType *ot)
+void ANIM_OT_copy_driver_button(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Copy Driver";
@@ -655,7 +655,7 @@ static int paste_driver_button_exec (bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void ANIM_OT_paste_driver_button (wmOperatorType *ot)
+void ANIM_OT_paste_driver_button(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Paste Driver";
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index d5ec98da588..9b46729b489 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -625,7 +625,7 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho
/* --------------- */
-void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm)
+void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm)
{
FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm);
uiLayout *box, *row, *sub, *col;
@@ -769,7 +769,7 @@ static ListBase fmodifier_copypaste_buf = {NULL, NULL};
/* ---------- */
/* free the copy/paste buffer */
-void free_fmodifiers_copybuf (void)
+void free_fmodifiers_copybuf(void)
{
/* just free the whole buffer */
free_fmodifiers(&fmodifier_copypaste_buf);
@@ -779,7 +779,7 @@ void free_fmodifiers_copybuf (void)
* assuming that the buffer has been cleared already with free_fmodifiers_copybuf()
* - active: only copy the active modifier
*/
-short ANIM_fmodifiers_copy_to_buf (ListBase *modifiers, short active)
+short ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, short active)
{
short ok = 1;
@@ -808,7 +808,7 @@ short ANIM_fmodifiers_copy_to_buf (ListBase *modifiers, short active)
/* 'Paste' the F-Modifier(s) from the buffer to the specified list
* - replace: free all the existing modifiers to leave only the pasted ones
*/
-short ANIM_fmodifiers_paste_from_buf (ListBase *modifiers, short replace)
+short ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, short replace)
{
FModifier *fcm;
short ok = 0;
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 0e0ff0defbb..cc5cb42a783 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -80,7 +80,7 @@
/* Comparator callback used for ActKeyColumns and cframe float-value pointer */
/* NOTE: this is exported to other modules that use the ActKeyColumns for finding keyframes */
-short compare_ak_cfraPtr (void *node, void *data)
+short compare_ak_cfraPtr(void *node, void *data)
{
ActKeyColumn *ak= (ActKeyColumn *)node;
float *cframe= data;
@@ -312,7 +312,7 @@ static BezTriple *abk_get_bezt_with_value (ActBeztColumn *abk, float value)
/* Comparator callback used for ActKeyBlock and cframe float-value pointer */
/* NOTE: this is exported to other modules that use the ActKeyBlocks for finding long-keyframes */
-short compare_ab_cfraPtr (void *node, void *data)
+short compare_ab_cfraPtr(void *node, void *data)
{
ActKeyBlock *ab= (ActKeyBlock *)node;
float *cframe= data;
@@ -459,7 +459,7 @@ static void set_touched_actkeyblock (ActKeyBlock *ab)
/* --------- */
/* Checks if ActKeyBlock should exist... */
-short actkeyblock_is_valid (ActKeyBlock *ab, DLRBT_Tree *keys)
+short actkeyblock_is_valid(ActKeyBlock *ab, DLRBT_Tree *keys)
{
ActKeyColumn *ak;
short startCurves, endCurves, totCurves;
@@ -494,7 +494,7 @@ static const float _unit_diamond_shape[4][2] = {
};
/* draw a simple diamond shape with OpenGL */
-void draw_keyframe_shape (float x, float y, float xscale, float hsize, short sel, short key_type, short mode, float alpha)
+void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel, short key_type, short mode, float alpha)
{
static GLuint displist1=0;
static GLuint displist2=0;
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index 831b8d21b01..c54f8c5bd25 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -282,7 +282,7 @@ typedef struct tSmooth_Bezt {
/* Use a weighted moving-means method to reduce intensity of fluctuations */
// TODO: introduce scaling factor for weighting falloff
-void smooth_fcurve (FCurve *fcu)
+void smooth_fcurve(FCurve *fcu)
{
BezTriple *bezt;
int i, x, totSel = 0;
@@ -380,7 +380,7 @@ typedef struct tempFrameValCache {
/* Evaluates the curves between each selected keyframe on each frame, and keys the value */
-void sample_fcurve (FCurve *fcu)
+void sample_fcurve(FCurve *fcu)
{
BezTriple *bezt, *start=NULL, *end=NULL;
tempFrameValCache *value_cache, *fp;
@@ -477,7 +477,7 @@ typedef struct tAnimCopybufItem {
/* This function frees any MEM_calloc'ed copy/paste buffer data */
// XXX find some header to put this in!
-void free_anim_copybuf (void)
+void free_anim_copybuf(void)
{
tAnimCopybufItem *aci, *acn;
@@ -506,7 +506,7 @@ void free_anim_copybuf (void)
/* ------------------- */
/* This function adds data to the keyframes copy/paste buffer, freeing existing data first */
-short copy_animedit_keys (bAnimContext *ac, ListBase *anim_data)
+short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data)
{
bAnimListElem *ale;
Scene *scene= ac->scene;
@@ -760,8 +760,8 @@ EnumPropertyItem keyframe_paste_merge_items[] = {
/* This function pastes data from the keyframes copy/paste buffer
* > return status code is whether the method FAILED to do anything
*/
-short paste_animedit_keys (bAnimContext *ac, ListBase *anim_data,
- const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode)
+short paste_animedit_keys(bAnimContext *ac, ListBase *anim_data,
+ const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode)
{
bAnimListElem *ale;
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 47972ca2c6f..0df68c3775c 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -86,7 +86,7 @@
/* Keyframing Setting Wrangling */
/* Get the active settings for keyframing settings from context (specifically the given scene) */
-short ANIM_get_keyframing_flags (Scene *scene, short incl_mode)
+short ANIM_get_keyframing_flags(Scene *scene, short incl_mode)
{
short flag = 0;
@@ -214,7 +214,7 @@ FCurve *verify_fcurve (bAction *act, const char group[], const char rna_path[],
* NOTE: any recalculate of the F-Curve that needs to be done will need to
* be done by the caller.
*/
-int insert_bezt_fcurve (FCurve *fcu, BezTriple *bezt, short flag)
+int insert_bezt_fcurve(FCurve *fcu, BezTriple *bezt, short flag)
{
int i= 0;
@@ -295,7 +295,7 @@ int insert_bezt_fcurve (FCurve *fcu, BezTriple *bezt, short flag)
* adding a new keyframe to a curve, when the keyframe doesn't exist anywhere else yet.
* It returns the index at which the keyframe was added.
*/
-int insert_vert_fcurve (FCurve *fcu, float x, float y, short flag)
+int insert_vert_fcurve(FCurve *fcu, float x, float y, short flag)
{
BezTriple beztr= {{{0}}};
unsigned int oldTot = fcu->totvert;
@@ -759,7 +759,7 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_
* the keyframe insertion. These include the 'visual' keyframing modes, quick refresh,
* and extra keyframe filtering.
*/
-short insert_keyframe_direct (ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, float cfra, short flag)
+short insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, float cfra, short flag)
{
float curval= 0.0f;
@@ -880,7 +880,7 @@ short insert_keyframe_direct (ReportList *reports, PointerRNA ptr, PropertyRNA *
*
* index of -1 keys all array indices
*/
-short insert_keyframe (ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short flag)
+short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short flag)
{
PointerRNA id_ptr, ptr;
PropertyRNA *prop = NULL;
@@ -971,7 +971,7 @@ short insert_keyframe (ReportList *reports, ID *id, bAction *act, const char gro
* The flag argument is used for special settings that alter the behavior of
* the keyframe deletion. These include the quick refresh options.
*/
-short delete_keyframe (ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short UNUSED(flag))
+short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short UNUSED(flag))
{
AnimData *adt= BKE_animdata_from_id(id);
PointerRNA id_ptr, ptr;
@@ -1153,7 +1153,7 @@ static int insert_key_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_keyframe_insert (wmOperatorType *ot)
+void ANIM_OT_keyframe_insert(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -1214,7 +1214,7 @@ static int insert_key_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(
}
}
-void ANIM_OT_keyframe_insert_menu (wmOperatorType *ot)
+void ANIM_OT_keyframe_insert_menu(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -1309,7 +1309,7 @@ static int delete_key_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_keyframe_delete (wmOperatorType *ot)
+void ANIM_OT_keyframe_delete(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -1353,8 +1353,7 @@ static int delete_key_v3d_exec (bContext *C, wmOperator *op)
float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
// XXX more comprehensive tests will be needed
- CTX_DATA_BEGIN(C, Object*, ob, selected_objects)
- {
+ CTX_DATA_BEGIN (C, Object*, ob, selected_objects) {
ID *id= (ID *)ob;
FCurve *fcu, *fcn;
short success= 0;
@@ -1384,7 +1383,7 @@ static int delete_key_v3d_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_keyframe_delete_v3d (wmOperatorType *ot)
+void ANIM_OT_keyframe_delete_v3d(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Keyframe";
@@ -1474,7 +1473,7 @@ static int insert_key_button_exec (bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void ANIM_OT_keyframe_insert_button (wmOperatorType *ot)
+void ANIM_OT_keyframe_insert_button(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Insert Keyframe (Buttons)";
@@ -1546,7 +1545,7 @@ static int delete_key_button_exec (bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void ANIM_OT_keyframe_delete_button (wmOperatorType *ot)
+void ANIM_OT_keyframe_delete_button(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Keyframe (Buttons)";
@@ -1592,7 +1591,7 @@ int autokeyframe_cfra_can_key(Scene *scene, ID *id)
/* --------------- API/Per-Datablock Handling ------------------- */
/* Checks if some F-Curve has a keyframe for a given frame */
-short fcurve_frame_has_keyframe (FCurve *fcu, float frame, short filter)
+short fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter)
{
/* quick sanity check */
if (ELEM(NULL, fcu, fcu->bezt))
@@ -1705,7 +1704,7 @@ static short object_frame_has_keyframe (Object *ob, float frame, short filter)
/* --------------- API ------------------- */
/* Checks whether a keyframe exists for the given ID-block one the given frame */
-short id_frame_has_keyframe (ID *id, float frame, short filter)
+short id_frame_has_keyframe(ID *id, float frame, short filter)
{
/* sanity checks */
if (id == NULL)
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index f66aa31f3f4..f9c4082e429 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -137,7 +137,7 @@ static int add_default_keyingset_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ANIM_OT_keying_set_add (wmOperatorType *ot)
+void ANIM_OT_keying_set_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Empty Keying Set";
@@ -184,7 +184,7 @@ static int remove_active_keyingset_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_keying_set_remove (wmOperatorType *ot)
+void ANIM_OT_keying_set_remove(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove Active Keying Set";
@@ -227,7 +227,7 @@ static int add_empty_ks_path_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_keying_set_path_add (wmOperatorType *ot)
+void ANIM_OT_keying_set_path_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Empty Keying Set Path";
@@ -270,7 +270,7 @@ static int remove_active_ks_path_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_keying_set_path_remove (wmOperatorType *ot)
+void ANIM_OT_keying_set_path_remove(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove Active Keying Set Path";
@@ -368,7 +368,7 @@ static int add_keyingset_button_exec (bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void ANIM_OT_keyingset_button_add (wmOperatorType *ot)
+void ANIM_OT_keyingset_button_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add to Keying Set";
@@ -447,7 +447,7 @@ static int remove_keyingset_button_exec (bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void ANIM_OT_keyingset_button_remove (wmOperatorType *ot)
+void ANIM_OT_keyingset_button_remove(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove from Keying Set";
@@ -494,7 +494,7 @@ static int keyingset_active_menu_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_keying_set_active_set (wmOperatorType *ot)
+void ANIM_OT_keying_set_active_set(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -571,7 +571,7 @@ KeyingSet *ANIM_builtin_keyingset_get_named (KeyingSet *prevKS, const char name[
/* --------------- */
/* Add the given KeyingSetInfo to the list of type infos, and create an appropriate builtin set too */
-void ANIM_keyingset_info_register (KeyingSetInfo *ksi)
+void ANIM_keyingset_info_register(KeyingSetInfo *ksi)
{
KeyingSet *ks;
@@ -591,7 +591,7 @@ void ANIM_keyingset_info_register (KeyingSetInfo *ksi)
}
/* Remove the given KeyingSetInfo from the list of type infos, and also remove the builtin set if appropriate */
-void ANIM_keyingset_info_unregister (Main *bmain, KeyingSetInfo *ksi)
+void ANIM_keyingset_info_unregister(Main *bmain, KeyingSetInfo *ksi)
{
KeyingSet *ks, *ksn;
@@ -620,7 +620,7 @@ void ANIM_keyingset_info_unregister (Main *bmain, KeyingSetInfo *ksi)
/* --------------- */
-void ANIM_keyingset_infos_exit (void)
+void ANIM_keyingset_infos_exit(void)
{
KeyingSetInfo *ksi, *next;
@@ -662,7 +662,7 @@ KeyingSet *ANIM_scene_get_active_keyingset (Scene *scene)
}
/* Get the index of the Keying Set provided, for the given Scene */
-int ANIM_scene_get_keyingset_index (Scene *scene, KeyingSet *ks)
+int ANIM_scene_get_keyingset_index(Scene *scene, KeyingSet *ks)
{
int index;
@@ -780,7 +780,7 @@ EnumPropertyItem *ANIM_keying_sets_enum_itemf (bContext *C, PointerRNA *UNUSED(p
/* Polling API ----------------------------------------------- */
/* Check if KeyingSet can be used in the current context */
-short ANIM_keyingset_context_ok_poll (bContext *C, KeyingSet *ks)
+short ANIM_keyingset_context_ok_poll(bContext *C, KeyingSet *ks)
{
if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) {
KeyingSetInfo *ksi = ANIM_keyingset_info_find_named(ks->typeinfo);
@@ -824,7 +824,7 @@ static void RKS_ITER_overrides_list (KeyingSetInfo *ksi, bContext *C, KeyingSet
}
/* Add new data source for relative Keying Sets */
-void ANIM_relative_keyingset_add_source (ListBase *dsources, ID *id, StructRNA *srna, void *data)
+void ANIM_relative_keyingset_add_source(ListBase *dsources, ID *id, StructRNA *srna, void *data)
{
tRKS_DSource *ds;
@@ -857,7 +857,7 @@ void ANIM_relative_keyingset_add_source (ListBase *dsources, ID *id, StructRNA *
*
* Returns 0 if succeeded, otherwise an error code: eModifyKey_Returns
*/
-short ANIM_validate_keyingset (bContext *C, ListBase *dsources, KeyingSet *ks)
+short ANIM_validate_keyingset(bContext *C, ListBase *dsources, KeyingSet *ks)
{
/* sanity check */
if (ks == NULL)
@@ -905,7 +905,7 @@ short ANIM_validate_keyingset (bContext *C, ListBase *dsources, KeyingSet *ks)
* by the KeyingSet. This takes into account many of the different combinations of using KeyingSets.
* Returns the number of channels that keyframes were added to
*/
-int ANIM_apply_keyingset (bContext *C, ListBase *dsources, bAction *act, KeyingSet *ks, short mode, float cfra)
+int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSet *ks, short mode, float cfra)
{
Scene *scene= CTX_data_scene(C);
ReportList *reports = CTX_wm_reports(C);
diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h
index 13239f87e65..72d261ec187 100644
--- a/source/blender/editors/armature/armature_intern.h
+++ b/source/blender/editors/armature/armature_intern.h
@@ -63,6 +63,7 @@ void ARMATURE_OT_select_all(struct wmOperatorType *ot);
void ARMATURE_OT_select_inverse(struct wmOperatorType *ot);
void ARMATURE_OT_select_hierarchy(struct wmOperatorType *ot);
void ARMATURE_OT_select_linked(struct wmOperatorType *ot);
+void ARMATURE_OT_select_similar(struct wmOperatorType *ot);
void ARMATURE_OT_delete(struct wmOperatorType *ot);
void ARMATURE_OT_duplicate(struct wmOperatorType *ot);
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index 21b97188522..aeecbc1fd28 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -69,6 +69,7 @@ void ED_operatortypes_armature(void)
WM_operatortype_append(ARMATURE_OT_select_inverse);
WM_operatortype_append(ARMATURE_OT_select_hierarchy);
WM_operatortype_append(ARMATURE_OT_select_linked);
+ WM_operatortype_append(ARMATURE_OT_select_similar);
WM_operatortype_append(ARMATURE_OT_delete);
WM_operatortype_append(ARMATURE_OT_duplicate);
@@ -261,6 +262,8 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
RNA_boolean_set(kmi->ptr, "extend", TRUE);
+ WM_keymap_add_item(keymap, "ARMATURE_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
+
WM_keymap_add_item(keymap, "ARMATURE_OT_select_linked", LKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_delete", XKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index cc3d0c6e184..e983b89e3d8 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -42,6 +42,7 @@
#include "DNA_armature_types.h"
#include "DNA_constraint_types.h"
#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "MEM_guardedalloc.h"
@@ -534,7 +535,7 @@ void ED_armature_apply_transform(Object *ob, float mat[4][4])
/* exported for use in editors/object/ */
/* 0 == do center, 1 == center new, 2 == center cursor */
-void docenter_armature (Scene *scene, Object *ob, float cursor[3], int centermode, int around)
+void docenter_armature(Scene *scene, Object *ob, float cursor[3], int centermode, int around)
{
Object *obedit= scene->obedit; // XXX get from context
EditBone *ebone;
@@ -610,7 +611,7 @@ static int editbone_unique_check(void *arg, const char *name)
return dupli && dupli != data->bone;
}
-void unique_editbone_name (ListBase *edbo, char *name, EditBone *bone)
+void unique_editbone_name(ListBase *edbo, char *name, EditBone *bone)
{
struct {ListBase *lb; void *bone;} data;
data.lb= edbo;
@@ -680,7 +681,7 @@ static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op)
* 2. remove this from the 'visual' y-rotation
*/
{
- float premat[3][3], imat[3][3],pmat[3][3], tmat[3][3];
+ float premat[3][3], imat[3][3], pmat[3][3], tmat[3][3];
float delta[3], eul[3];
/* obtain new auto y-rotation */
@@ -693,7 +694,7 @@ static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op)
/* remove auto from visual and get euler rotation */
mul_m3_m3m3(tmat, imat, pmat);
- mat3_to_eul( eul,tmat);
+ mat3_to_eul(eul, tmat);
/* just use this euler-y as new roll value */
curbone->roll= eul[1];
@@ -726,7 +727,7 @@ static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSE_OT_armature_apply (wmOperatorType *ot)
+void POSE_OT_armature_apply(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Apply Pose as Rest Pose";
@@ -755,8 +756,7 @@ static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op)
*
* TODO, loop over children before parents if multiple bones
* at once are to be predictable*/
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
float delta_mat[4][4];
/* chan_mat already contains the delta transform from rest pose to pose-mode pose
@@ -777,7 +777,7 @@ static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op)
return OPERATOR_FINISHED;
}
-void POSE_OT_visual_transform_apply (wmOperatorType *ot)
+void POSE_OT_visual_transform_apply(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Apply Visual Transform to Pose";
@@ -922,7 +922,7 @@ int join_armature_exec(bContext *C, wmOperator *UNUSED(op))
pose= ob->pose;
ob->mode &= ~OB_MODE_POSE;
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base*, base, selected_editable_bases) {
if ((base->object->type==OB_ARMATURE) && (base->object!=ob)) {
bArmature *curarm= base->object->data;
@@ -1193,7 +1193,7 @@ static int separate_armature_exec (bContext *C, wmOperator *UNUSED(op))
/* 1) only edit-base selected */
// TODO: use context iterators for this?
- CTX_DATA_BEGIN(C, Base *, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
if (base->object==obedit) base->flag |= 1;
else base->flag &= ~1;
}
@@ -1240,7 +1240,7 @@ static int separate_armature_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ARMATURE_OT_separate (wmOperatorType *ot)
+void ARMATURE_OT_separate(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Separate Bones";
@@ -2286,7 +2286,7 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op))
View3D *v3d;
bArmature *arm;
EditBone *ebone, *newbone, *flipbone;
- float *curs, mat[3][3],imat[3][3];
+ float *curs, mat[3][3], imat[3][3];
int a, to_root= 0;
Object *obedit;
Scene *scene;
@@ -2458,8 +2458,7 @@ void preEditBoneDuplicate(ListBase *editbones)
EditBone *eBone;
/* clear temp */
- for (eBone = editbones->first; eBone; eBone = eBone->next)
- {
+ for (eBone = editbones->first; eBone; eBone = eBone->next) {
eBone->temp = NULL;
}
}
@@ -2817,8 +2816,7 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* loop over all bones, and only consider if visible */
- CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, visible_bones) {
if (!(ebone->flag & BONE_CONNECTED) && (ebone->flag & BONE_ROOTSEL))
fill_add_joint(ebone, 0, &points);
if (ebone->flag & BONE_TIPSEL)
@@ -2947,7 +2945,7 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ARMATURE_OT_fill (wmOperatorType *ot)
+void ARMATURE_OT_fill(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Fill Between Joints";
@@ -3126,7 +3124,7 @@ static int armature_merge_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ARMATURE_OT_merge (wmOperatorType *ot)
+void ARMATURE_OT_merge(wmOperatorType *ot)
{
static EnumPropertyItem merge_types[] = {
{1, "WITHIN_CHAIN", 0, "Within Chains", ""},
@@ -3460,7 +3458,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "name", name);
- copy_v3_v3(curs, give_cursor(CTX_data_scene(C),CTX_wm_view3d(C)));
+ copy_v3_v3(curs, give_cursor(CTX_data_scene(C), CTX_wm_view3d(C)));
/* Get inverse point for head and orientation for tail */
invert_m4_m4(obedit->imat, obedit->obmat);
@@ -3531,8 +3529,7 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op)
/* loop over all editable bones */
// XXX the old code did this in reverse order though!
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
for (i=numcuts+1; i>1; i--) {
/* compute cut ratio first */
float cutratio= 1.0f / (float)i;
@@ -3820,7 +3817,7 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op)
*/
/* parent selected bones to the active one */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
if (ELEM(ebone, actbone, actmirb) == 0) {
if (ebone->flag & BONE_SELECTED)
bone_connect_to_new_parent(arm->edbo, ebone, actbone, val);
@@ -3845,7 +3842,7 @@ static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEve
uiLayout *layout= uiPupMenuLayout(pup);
int allchildbones = 0;
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
if (ebone != actbone) {
if (ebone->parent != actbone) allchildbones= 1;
}
@@ -3904,7 +3901,7 @@ static int armature_parent_clear_exec(bContext *C, wmOperator *op)
bArmature *arm= (bArmature *)ob->data;
int val = RNA_enum_get(op->ptr, "type");
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
editbone_clear_parent(ebone, val);
}
CTX_DATA_END;
@@ -3940,7 +3937,7 @@ void ARMATURE_OT_parent_clear(wmOperatorType *ot)
static int armature_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
{
/* Set the flags */
- CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, visible_bones) {
/* ignore bone if selection can't change */
if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
/* select bone */
@@ -3982,7 +3979,7 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op)
}
/* Set the flags */
- CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, visible_bones) {
/* ignore bone if selection can't change */
if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
switch (action) {
@@ -4031,6 +4028,191 @@ void ARMATURE_OT_select_all(wmOperatorType *ot)
WM_operator_properties_select_all(ot);
}
+enum {
+ SIMEDBONE_LENGTH = 1,
+ SIMEDBONE_DIRECTION,
+ SIMEDBONE_PREFIX,
+ SIMEDBONE_SUFFIX,
+ SIMEDBONE_LAYER
+};
+
+static EnumPropertyItem prop_similar_types[] = {
+ {SIMEDBONE_LENGTH, "LENGTH", 0, "Length", ""},
+ {SIMEDBONE_DIRECTION, "DIRECTION", 0, "Direction (Y axis)", ""},
+ {SIMEDBONE_PREFIX, "PREFIX", 0, "Prefix", ""},
+ {SIMEDBONE_SUFFIX, "SUFFIX", 0, "Suffix", ""},
+ {SIMEDBONE_LAYER, "LAYER", 0, "Layer", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+/* could be used in more places */
+static void ED_armature_edit_bone_select(EditBone *ebone)
+{
+ BLI_assert((ebone->flag & BONE_UNSELECTABLE) == 0);
+ ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
+
+ if ((ebone->flag & BONE_CONNECTED) && (ebone->parent != NULL)) {
+ ebone->parent->flag |= BONE_TIPSEL;
+ }
+}
+
+static void select_similar_length(bArmature *arm, EditBone *ebone_act, const float thresh)
+{
+ EditBone *ebone;
+
+ /* thresh is always relative to current length */
+ const float len_min = ebone_act->length / (1.0f + thresh);
+ const float len_max = ebone_act->length * (1.0f + thresh);
+
+ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+ if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_UNSELECTABLE) == 0) {
+ if ((ebone->length >= len_min) &&
+ (ebone->length <= len_max))
+ {
+ ED_armature_edit_bone_select(ebone);
+ }
+ }
+ }
+}
+
+static void select_similar_direction(bArmature *arm, EditBone *ebone_act, const float thresh)
+{
+ EditBone *ebone;
+ float dir_act[3];
+ sub_v3_v3v3(dir_act, ebone_act->head, ebone_act->tail);
+
+ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+ if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_UNSELECTABLE) == 0) {
+ float dir[3];
+ sub_v3_v3v3(dir, ebone->head, ebone->tail);
+
+ if (angle_v3v3(dir_act, dir) / M_PI < thresh) {
+ ED_armature_edit_bone_select(ebone);
+ }
+ }
+ }
+}
+
+static void select_similar_layer(bArmature *arm, EditBone *ebone_act)
+{
+ EditBone *ebone;
+
+ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+ if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_UNSELECTABLE) == 0) {
+ if (ebone->layer & ebone_act->layer) {
+ ED_armature_edit_bone_select(ebone);
+ }
+ }
+ }
+}
+
+static void select_similar_prefix(bArmature *arm, EditBone *ebone_act)
+{
+ EditBone *ebone;
+
+ char body_tmp[MAX_VGROUP_NAME];
+ char prefix_act[MAX_VGROUP_NAME];
+
+ BKE_deform_split_prefix(ebone_act->name, prefix_act, body_tmp);
+
+ if (prefix_act[0] == '\0')
+ return;
+
+ /* Find matches */
+ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+ if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_UNSELECTABLE) == 0) {
+ char prefix_other[MAX_VGROUP_NAME];
+ BKE_deform_split_prefix(ebone->name, prefix_other, body_tmp);
+ if (!strcmp(prefix_act, prefix_other)) {
+ ED_armature_edit_bone_select(ebone);
+ }
+ }
+ }
+}
+
+static void select_similar_suffix(bArmature *arm, EditBone *ebone_act)
+{
+ EditBone *ebone;
+
+ char body_tmp[MAX_VGROUP_NAME];
+ char suffix_act[MAX_VGROUP_NAME];
+
+ BKE_deform_split_suffix(ebone_act->name, body_tmp, suffix_act);
+
+ if (suffix_act[0] == '\0')
+ return;
+
+ /* Find matches */
+ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+ if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_UNSELECTABLE) == 0) {
+ char suffix_other[MAX_VGROUP_NAME];
+ BKE_deform_split_suffix(ebone->name, body_tmp, suffix_other);
+ if (!strcmp(suffix_act, suffix_other)) {
+ ED_armature_edit_bone_select(ebone);
+ }
+ }
+ }
+}
+
+static int armature_select_similar_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit = CTX_data_edit_object(C);
+ bArmature *arm = obedit->data;
+ EditBone *ebone_act = CTX_data_active_bone(C);
+
+ /* Get props */
+ int type = RNA_enum_get(op->ptr, "type");
+ float thresh = RNA_float_get(op->ptr, "threshold");
+
+ /* Check for active bone */
+ if (ebone_act == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "Operation requires an Active Bone");
+ return OPERATOR_CANCELLED;
+ }
+
+ switch (type) {
+ case SIMEDBONE_LENGTH:
+ select_similar_length(arm, ebone_act, thresh);
+ break;
+ case SIMEDBONE_DIRECTION:
+ select_similar_direction(arm, ebone_act, thresh);
+ break;
+ case SIMEDBONE_PREFIX:
+ select_similar_prefix(arm, ebone_act);
+ break;
+ case SIMEDBONE_SUFFIX:
+ select_similar_suffix(arm, ebone_act);
+ break;
+ case SIMEDBONE_LAYER:
+ select_similar_layer(arm, ebone_act);
+ break;
+ }
+
+ WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);
+
+ return OPERATOR_FINISHED;
+}
+
+void ARMATURE_OT_select_similar(wmOperatorType *ot) {
+
+ /* identifiers */
+ ot->name = "Select Similar";
+ ot->idname = "ARMATURE_OT_select_similar";
+
+ /* callback functions */
+ ot->invoke = WM_menu_invoke;
+ ot->exec = armature_select_similar_exec;
+ ot->poll = ED_operator_editarmature;
+ ot->description = "Select similar bones by property types";
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ ot->prop = RNA_def_enum(ot->srna, "type", prop_similar_types, 0, "Type", "");
+ RNA_def_float(ot->srna, "threshold", 0.1f, 0.0f, 1.0f, "Threshold", "", 0.0f, 1.0f);
+}
+
/* ********************* select hierarchy operator ************** */
static int armature_select_hierarchy_exec(bContext *C, wmOperator *op)
@@ -4216,7 +4398,7 @@ static int armature_align_bones_exec(bContext *C, wmOperator *op)
*/
/* align selected bones to the active one */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
if (ELEM(ebone, actbone, actmirb) == 0) {
if (ebone->flag & BONE_SELECTED)
bone_align_to_bone(arm->edbo, ebone, actbone);
@@ -4349,7 +4531,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor
* test==2: only clear active tag
* test==3: swap select (no test / inverse selection status of all independently)
*/
-void ED_pose_deselectall (Object *ob, int test)
+void ED_pose_deselectall(Object *ob, int test)
{
bArmature *arm= ob->data;
bPoseChannel *pchan;
@@ -4444,7 +4626,7 @@ static int vgroup_add_unique_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
* If such a vertex group aleady exist the routine exits.
*/
if (!(bone->flag & BONE_NO_DEFORM)) {
- if (!defgroup_find_name(ob,bone->name)) {
+ if (!defgroup_find_name(ob, bone->name)) {
ED_vgroup_add_name(ob, bone->name);
return 1;
}
@@ -4832,7 +5014,7 @@ static void pchan_clear_rot(bPoseChannel *pchan)
quat_to_eul(oldeul, quat1);
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
- axis_angle_to_eulO( oldeul, EULER_ORDER_DEFAULT,pchan->rotAxis, pchan->rotAngle);
+ axis_angle_to_eulO(oldeul, EULER_ORDER_DEFAULT, pchan->rotAxis, pchan->rotAngle);
}
else {
copy_v3_v3(oldeul, pchan->eul);
@@ -4859,7 +5041,7 @@ static void pchan_clear_rot(bPoseChannel *pchan)
}
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
- eulO_to_axis_angle( pchan->rotAxis, &pchan->rotAngle,eul, EULER_ORDER_DEFAULT);
+ eulO_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, eul, EULER_ORDER_DEFAULT);
}
else {
copy_v3_v3(pchan->eul, eul);
@@ -4905,8 +5087,7 @@ static int pose_clear_transform_generic_exec(bContext *C, wmOperator *op,
}
/* only clear relevant transforms for selected bones */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
/* run provided clearing function */
clear_func(pchan);
@@ -5047,7 +5228,7 @@ static int pose_de_select_all_exec(bContext *C, wmOperator *op)
}
/* Set the flags */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones) {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
/* select pchan only if selectable, but deselect works always */
switch (action) {
case SEL_SELECT:
@@ -5099,7 +5280,7 @@ void POSE_OT_select_all(wmOperatorType *ot)
static int pose_select_parent_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= object_pose_armature_get(CTX_data_active_object(C));
- bPoseChannel *pchan,*parent;
+ bPoseChannel *pchan, *parent;
/* Determine if there is an active bone */
pchan=CTX_data_active_pose_bone(C);
@@ -5436,8 +5617,7 @@ static int armature_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
arm= ob->data;
/* loop through selected bones, auto-naming them */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
flip_side_name(newname, ebone->name, TRUE); // 1 = do strip off number extensions
ED_armature_bone_rename(arm, ebone->name, newname);
}
@@ -5452,7 +5632,7 @@ static int armature_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ARMATURE_OT_flip_names (wmOperatorType *ot)
+void ARMATURE_OT_flip_names(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Flip Names";
@@ -5481,8 +5661,7 @@ static int armature_autoside_names_exec (bContext *C, wmOperator *op)
arm= ob->data;
/* loop through selected bones, auto-naming them */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
BLI_strncpy(newname, ebone->name, sizeof(newname));
if (bone_autoside_name(newname, 1, axis, ebone->head[axis], ebone->tail[axis]))
ED_armature_bone_rename(arm, ebone->name, newname);
@@ -5498,7 +5677,7 @@ static int armature_autoside_names_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ARMATURE_OT_autoside_names (wmOperatorType *ot)
+void ARMATURE_OT_autoside_names(wmOperatorType *ot)
{
static EnumPropertyItem axis_items[]= {
{0, "XAXIS", 0, "X-Axis", "Left/Right"},
@@ -5686,7 +5865,7 @@ float arcLengthRatio(ReebArc *arc)
if (arc->bcount > 0) {
/* Add the embedding */
- for ( i = 1; i < arc->bcount; i++) {
+ for (i = 1; i < arc->bcount; i++) {
embedLength += len_v3v3(arc->buckets[i - 1].p, arc->buckets[i].p);
}
/* Add head and tail -> embedding vectors */
@@ -5744,8 +5923,8 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
/* Copy orientation from source */
copy_v3_v3(dst->loc, src->obmat[3]);
- mat4_to_eul( dst->rot,src->obmat);
- mat4_to_size( dst->size,src->obmat);
+ mat4_to_eul(dst->rot, src->obmat);
+ mat4_to_size(dst->size, src->obmat);
where_is_object(scene, obedit);
@@ -5800,7 +5979,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
/* Loop over subdivision methods */
for (i = 0; lastBone == NULL && i < SKGEN_SUB_TOTAL; i++) {
- switch(scene->toolsettings->skgen_subdivisions[i]) {
+ switch (scene->toolsettings->skgen_subdivisions[i]) {
case SKGEN_SUB_LENGTH:
lastBone = test_subdivideByLength(scene, obedit, arc, head, tail);
break;
diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c
index 37d095221c9..5b56f5fe7fe 100644
--- a/source/blender/editors/armature/editarmature_generate.c
+++ b/source/blender/editors/armature/editarmature_generate.c
@@ -52,8 +52,7 @@
void setBoneRollFromNormal(EditBone *bone, float *no, float UNUSED(invmat[][4]), float tmat[][3])
{
- if (no != NULL && !is_zero_v3(no))
- {
+ if (no != NULL && !is_zero_v3(no)) {
float normal[3];
copy_v3_v3(normal, no);
@@ -67,16 +66,14 @@ float calcArcCorrelation(BArcIterator *iter, int start, int end, float v0[3], fl
{
int len = 2 + abs(end - start);
- if (len > 2)
- {
+ if (len > 2) {
float avg_t = 0.0f;
float s_t = 0.0f;
float s_xyz = 0.0f;
int i;
/* First pass, calculate average */
- for (i = start; i <= end; i++)
- {
+ for (i = start; i <= end; i++) {
float v[3];
IT_peek(iter, i);
@@ -89,8 +86,7 @@ float calcArcCorrelation(BArcIterator *iter, int start, int end, float v0[3], fl
avg_t /= len;
/* Second pass, calculate s_xyz and s_t */
- for (i = start; i <= end; i++)
- {
+ for (i = start; i <= end; i++) {
float v[3], d[3];
float dt;
@@ -110,8 +106,7 @@ float calcArcCorrelation(BArcIterator *iter, int start, int end, float v0[3], fl
return 1.0f - s_xyz / s_t;
}
- else
- {
+ else {
return 1.0f;
}
}
@@ -125,15 +120,13 @@ int nextFixedSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int sta
float length_threshold;
int i;
- if (stroke_length == 0)
- {
+ if (stroke_length == 0) {
current_length = 0;
IT_peek(iter, start);
v1 = iter->p;
- for (i = start + 1; i <= end; i++)
- {
+ for (i = start + 1; i <= end; i++) {
IT_peek(iter, i);
v2 = iter->p;
@@ -154,8 +147,7 @@ int nextFixedSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int sta
v1 = iter->p;
/* < and not <= because we don't care about end, it is P_EXACT anyway */
- for (i = start + 1; i < end; i++)
- {
+ for (i = start + 1; i < end; i++) {
IT_peek(iter, i);
v2 = iter->p;
@@ -183,8 +175,7 @@ int nextAdaptativeSubdivision(ToolSettings *toolsettings, BArcIterator *iter, in
IT_peek(iter, start);
start_p = iter->p;
- for (i = start + 2; i <= end; i++)
- {
+ for (i = start + 2; i <= end; i++) {
/* Calculate normal */
IT_peek(iter, i);
sub_v3_v3v3(n, iter->p, head);
@@ -206,8 +197,7 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st
int i;
i = start + 1;
- while (i <= end)
- {
+ while (i <= end) {
float *vec0;
float *vec1;
@@ -218,10 +208,8 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st
vec1 = iter->p;
/* If lengthLimit hits the current segment */
- if (len_v3v3(vec1, head) > lengthLimit)
- {
- if (same == 0)
- {
+ if (len_v3v3(vec1, head) > lengthLimit) {
+ if (same == 0) {
float dv[3], off[3];
float a, b, c, f;
@@ -260,8 +248,7 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st
return i - 1; /* restart at lower bound */
}
- else
- {
+ else {
i++;
same = 0; // Reset same
}
@@ -286,16 +273,14 @@ EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *
parent = ED_armature_edit_bone_add(arm, "Bone");
copy_v3_v3(parent->head, iter->p);
- if (iter->size > 0)
- {
+ if (iter->size > 0) {
parent->rad_head = iter->size * size_buffer;
}
normal = iter->no;
index = next_subdividion(toolsettings, iter, bone_start, end, parent->head, parent->tail);
- while (index != -1)
- {
+ while (index != -1) {
IT_peek(iter, index);
child = ED_armature_edit_bone_add(arm, "Bone");
@@ -303,8 +288,7 @@ EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *
child->parent = parent;
child->flag |= BONE_CONNECTED;
- if (iter->size > 0)
- {
+ if (iter->size > 0) {
child->rad_head = iter->size * size_buffer;
parent->rad_tail = iter->size * size_buffer;
}
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index f554b7b1c50..77b035024a9 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -119,10 +119,8 @@ static int countEditBoneChildren(ListBase *list, EditBone *parent)
EditBone *ebone;
int count = 0;
- for (ebone = list->first; ebone; ebone = ebone->next)
- {
- if (ebone->parent == parent)
- {
+ for (ebone = list->first; ebone; ebone = ebone->next) {
+ if (ebone->parent == parent) {
count++;
}
}
@@ -134,12 +132,9 @@ static EditBone* nextEditBoneChild(ListBase *list, EditBone *parent, int n)
{
EditBone *ebone;
- for (ebone = list->first; ebone; ebone = ebone->next)
- {
- if (ebone->parent == parent)
- {
- if (n == 0)
- {
+ for (ebone = list->first; ebone; ebone = ebone->next) {
+ if (ebone->parent == parent) {
+ if (n == 0) {
return ebone;
}
n--;
@@ -175,23 +170,19 @@ static float rollBoneByQuatAligned(EditBone *bone, float old_up_axis[3], float q
normalize_v3(x_axis);
normalize_v3(z_axis);
- if (dot_v3v3(new_up_axis, x_axis) < 0)
- {
+ if (dot_v3v3(new_up_axis, x_axis) < 0) {
negate_v3(x_axis);
}
- if (dot_v3v3(new_up_axis, z_axis) < 0)
- {
+ if (dot_v3v3(new_up_axis, z_axis) < 0) {
negate_v3(z_axis);
}
- if (angle_normalized_v3v3(x_axis, new_up_axis) < angle_normalized_v3v3(z_axis, new_up_axis))
- {
+ if (angle_normalized_v3v3(x_axis, new_up_axis) < angle_normalized_v3v3(z_axis, new_up_axis)) {
rotation_between_vecs_to_quat(qroll, new_up_axis, x_axis); /* set roll rotation quat */
return ED_rollBoneToVector(bone, x_axis, FALSE);
}
- else
- {
+ else {
rotation_between_vecs_to_quat(qroll, new_up_axis, z_axis); /* set roll rotation quat */
return ED_rollBoneToVector(bone, z_axis, FALSE);
}
@@ -199,26 +190,21 @@ static float rollBoneByQuatAligned(EditBone *bone, float old_up_axis[3], float q
static float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float qroll[4], float up_axis[3])
{
- if (previous == NULL)
- {
+ if (previous == NULL) {
/* default to up_axis if no previous */
return rollBoneByQuatAligned(edge->bone, edge->up_axis, qrot, qroll, up_axis);
}
- else
- {
+ else {
float new_up_axis[3];
float vec_first[3], vec_second[3], normal[3];
- if (previous->bone)
- {
+ if (previous->bone) {
sub_v3_v3v3(vec_first, previous->bone->tail, previous->bone->head);
}
- else if (previous->prev->bone)
- {
+ else if (previous->prev->bone) {
sub_v3_v3v3(vec_first, edge->bone->head, previous->prev->bone->tail);
}
- else
- {
+ else {
/* default to up_axis if first bone in the chain is an offset */
return rollBoneByQuatAligned(edge->bone, edge->up_axis, qrot, qroll, up_axis);
}
@@ -274,19 +260,16 @@ void RIG_freeRigGraph(BGraph *rg)
BLI_destroy_worker(rigg->worker);
#endif
- if (rigg->link_mesh)
- {
+ if (rigg->link_mesh) {
REEB_freeGraph(rigg->link_mesh);
}
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
RIG_freeRigArc(arc);
}
BLI_freelistN(&rg->arcs);
- for (node = rg->nodes.first; node; node = node->next)
- {
+ for (node = rg->nodes.first; node; node = node->next) {
BLI_freeNode(rg, (BNode*)node);
}
BLI_freelistN(&rg->nodes);
@@ -296,8 +279,7 @@ void RIG_freeRigGraph(BGraph *rg)
BLI_ghash_free(rigg->bones_map, NULL, NULL);
BLI_ghash_free(rigg->controls_map, NULL, NULL);
- if (rigg->flag & RIG_FREE_BONELIST)
- {
+ if (rigg->flag & RIG_FREE_BONELIST) {
BLI_freelistN(rigg->editbones);
MEM_freeN(rigg->editbones);
}
@@ -409,12 +391,10 @@ static void RIG_appendEdgeToArc(RigArc *arc, RigEdge *edge)
{
BLI_addtail(&arc->edges, edge);
- if (edge->prev == NULL)
- {
+ if (edge->prev == NULL) {
copy_v3_v3(edge->head, arc->head->p);
}
- else
- {
+ else {
RigEdge *last_edge = edge->prev;
copy_v3_v3(edge->head, last_edge->tail);
RIG_calculateEdgeAngles(last_edge, edge);
@@ -436,8 +416,7 @@ static void RIG_addEdgeToArc(RigArc *arc, float tail[3], EditBone *bone)
copy_v3_v3(edge->tail, tail);
edge->bone = bone;
- if (bone)
- {
+ if (bone) {
getEditBoneRollUpAxis(bone, bone->roll, edge->up_axis);
}
@@ -449,28 +428,22 @@ static void renameTemplateBone(char *name, char *template_name, ListBase *editbo
{
int i, j;
- for (i = 0, j = 0; i < (MAXBONENAME-1) && j < (MAXBONENAME-1) && template_name[i] != '\0'; i++)
- {
- if (template_name[i] == '&')
- {
- if (template_name[i+1] == 'S' || template_name[i+1] == 's')
- {
+ for (i = 0, j = 0; i < (MAXBONENAME-1) && j < (MAXBONENAME-1) && template_name[i] != '\0'; i++) {
+ if (template_name[i] == '&') {
+ if (template_name[i+1] == 'S' || template_name[i+1] == 's') {
j += sprintf(name + j, "%s", side_string);
i++;
}
- else if (template_name[i+1] == 'N' || template_name[i+1] == 'n')
- {
+ else if (template_name[i+1] == 'N' || template_name[i+1] == 'n') {
j += sprintf(name + j, "%s", num_string);
i++;
}
- else
- {
+ else {
name[j] = template_name[i];
j++;
}
}
- else
- {
+ else {
name[j] = template_name[i];
j++;
}
@@ -524,8 +497,7 @@ static RigArc *cloneArc(RigGraph *rg, RigGraph *src_rg, RigArc *src_arc, GHash *
arc->count = src_arc->count;
- for (src_edge = src_arc->edges.first; src_edge; src_edge = src_edge->next)
- {
+ for (src_edge = src_arc->edges.first; src_edge; src_edge = src_edge->next) {
RigEdge *edge;
edge = MEM_callocN(sizeof(RigEdge), "rig edge");
@@ -538,8 +510,7 @@ static RigArc *cloneArc(RigGraph *rg, RigGraph *src_rg, RigArc *src_arc, GHash *
edge->angle = src_edge->angle;
edge->up_angle = src_edge->up_angle;
- if (src_edge->bone != NULL)
- {
+ if (src_edge->bone != NULL) {
char name[MAXBONENAME];
renameTemplateBone(name, src_edge->bone->name, rg->editbones, side_string, num_string);
edge->bone = duplicateEditBoneObjects(src_edge->bone, name, rg->editbones, src_rg->ob, rg->ob);
@@ -572,8 +543,7 @@ static RigGraph *cloneRigGraph(RigGraph *src, ListBase *editbones, Object *ob, c
preEditBoneDuplicate(src->editbones); /* prime bones for duplication */
/* Clone nodes */
- for (node = src->nodes.first; node; node = node->next)
- {
+ for (node = src->nodes.first; node; node = node->next) {
RigNode *cloned_node = newRigNode(rg, node->p);
BLI_ghash_insert(ptr_hash, node, cloned_node);
}
@@ -581,40 +551,32 @@ static RigGraph *cloneRigGraph(RigGraph *src, ListBase *editbones, Object *ob, c
rg->head = BLI_ghash_lookup(ptr_hash, src->head);
/* Clone arcs */
- for (arc = src->arcs.first; arc; arc = arc->next)
- {
+ for (arc = src->arcs.first; arc; arc = arc->next) {
cloneArc(rg, src, arc, ptr_hash, side_string, num_string);
}
/* Clone controls */
- for (ctrl = src->controls.first; ctrl; ctrl = ctrl->next)
- {
+ for (ctrl = src->controls.first; ctrl; ctrl = ctrl->next) {
cloneControl(rg, src, ctrl, ptr_hash, side_string, num_string);
}
/* Relink bones properly */
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
RigEdge *edge;
- for (edge = arc->edges.first; edge; edge = edge->next)
- {
- if (edge->bone != NULL)
- {
+ for (edge = arc->edges.first; edge; edge = edge->next) {
+ if (edge->bone != NULL) {
EditBone *bone;
updateDuplicateSubtargetObjects(edge->bone, src->editbones, src->ob, rg->ob);
- if (edge->bone->parent)
- {
+ if (edge->bone->parent) {
bone = BLI_ghash_lookup(ptr_hash, edge->bone->parent);
- if (bone != NULL)
- {
+ if (bone != NULL) {
edge->bone->parent = bone;
}
- else
- {
+ else {
/* disconnect since parent isn't cloned
* this will only happen when cloning from selected bones
* */
@@ -625,22 +587,18 @@ static RigGraph *cloneRigGraph(RigGraph *src, ListBase *editbones, Object *ob, c
}
}
- for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next)
- {
+ for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next) {
EditBone *bone;
updateDuplicateSubtargetObjects(ctrl->bone, src->editbones, src->ob, rg->ob);
- if (ctrl->bone->parent)
- {
+ if (ctrl->bone->parent) {
bone = BLI_ghash_lookup(ptr_hash, ctrl->bone->parent);
- if (bone != NULL)
- {
+ if (bone != NULL) {
ctrl->bone->parent = bone;
}
- else
- {
+ else {
/* disconnect since parent isn't cloned
* this will only happen when cloning from selected bones
* */
@@ -672,8 +630,7 @@ static void RIG_calculateEdgeAngles(RigEdge *edge_first, RigEdge *edge_second)
edge_first->angle = angle_normalized_v3v3(vec_first, vec_second);
- if (edge_second->bone != NULL)
- {
+ if (edge_second->bone != NULL) {
float normal[3];
cross_v3_v3v3(normal, vec_first, vec_second);
@@ -699,16 +656,14 @@ static void RIG_addControlBone(RigGraph *rg, EditBone *bone)
static int RIG_parentControl(RigControl *ctrl, EditBone *link)
{
- if (link)
- {
+ if (link) {
float offset[3];
int flag = 0;
sub_v3_v3v3(offset, ctrl->bone->head, link->head);
/* if root matches, check for direction too */
- if (dot_v3v3(offset, offset) < 0.0001f)
- {
+ if (dot_v3v3(offset, offset) < 0.0001f) {
float vbone[3], vparent[3];
flag |= RIG_CTRL_FIT_ROOT;
@@ -717,45 +672,38 @@ static int RIG_parentControl(RigControl *ctrl, EditBone *link)
sub_v3_v3v3(vparent, link->tail, link->head);
/* test for opposite direction */
- if (dot_v3v3(vbone, vparent) > 0)
- {
+ if (dot_v3v3(vbone, vparent) > 0) {
float nor[3];
float len;
cross_v3_v3v3(nor, vbone, vparent);
len = dot_v3v3(nor, nor);
- if (len < 0.0001f)
- {
+ if (len < 0.0001f) {
flag |= RIG_CTRL_FIT_BONE;
}
}
}
/* Bail out if old one is automatically better */
- if (flag < ctrl->flag)
- {
+ if (flag < ctrl->flag) {
return 0;
}
/* if there's already a link
* overwrite only if new link is higher in the chain */
- if (ctrl->link && flag == ctrl->flag)
- {
+ if (ctrl->link && flag == ctrl->flag) {
EditBone *bone = NULL;
- for (bone = ctrl->link; bone; bone = bone->parent)
- {
+ for (bone = ctrl->link; bone; bone = bone->parent) {
/* if link is in the chain, break and use that one */
- if (bone == link)
- {
+ if (bone == link) {
break;
}
}
/* not in chain, don't update link */
- if (bone == NULL)
- {
+ if (bone == NULL) {
return 0;
}
}
@@ -778,43 +726,34 @@ static void RIG_reconnectControlBones(RigGraph *rg)
int change = 1;
/* first pass, link to deform bones */
- for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next)
- {
+ for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next) {
bPoseChannel *pchan;
bConstraint *con;
int found = 0;
/* DO SOME MAGIC HERE */
- for (pchan= rg->ob->pose->chanbase.first; pchan; pchan= pchan->next)
- {
- for (con= pchan->constraints.first; con; con= con->next)
- {
+ for (pchan= rg->ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (con= pchan->constraints.first; con; con= con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
/* constraint targets */
- if (cti && cti->get_constraint_targets)
- {
+ if (cti && cti->get_constraint_targets) {
int target_index;
cti->get_constraint_targets(con, &targets);
- for (target_index = 0, ct= targets.first; ct; target_index++, ct= ct->next)
- {
- if ((ct->tar == rg->ob) && strcmp(ct->subtarget, ctrl->bone->name) == 0)
- {
+ for (target_index = 0, ct= targets.first; ct; target_index++, ct= ct->next) {
+ if ((ct->tar == rg->ob) && strcmp(ct->subtarget, ctrl->bone->name) == 0) {
/* SET bone link to bone corresponding to pchan */
EditBone *link = BLI_ghash_lookup(rg->bones_map, pchan->name);
/* Making sure bone is in this armature */
- if (link != NULL)
- {
+ if (link != NULL) {
/* for pole targets, link to parent bone instead, if possible */
- if (con->type == CONSTRAINT_TYPE_KINEMATIC && target_index == 1)
- {
- if (link->parent && BLI_ghash_haskey(rg->bones_map, link->parent->name))
- {
+ if (con->type == CONSTRAINT_TYPE_KINEMATIC && target_index == 1) {
+ if (link->parent && BLI_ghash_haskey(rg->bones_map, link->parent->name)) {
link = link->parent;
}
}
@@ -831,10 +770,8 @@ static void RIG_reconnectControlBones(RigGraph *rg)
}
/* if not found yet, check parent */
- if (found == 0)
- {
- if (ctrl->bone->parent)
- {
+ if (found == 0) {
+ if (ctrl->bone->parent) {
/* make sure parent is a deforming bone
* NULL if not
* */
@@ -849,24 +786,19 @@ static void RIG_reconnectControlBones(RigGraph *rg)
RigArc *best_arc = NULL;
EditBone *link = NULL;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
RigEdge *edge;
- for (edge = arc->edges.first; edge; edge = edge->next)
- {
- if (edge->bone)
- {
+ for (edge = arc->edges.first; edge; edge = edge->next) {
+ if (edge->bone) {
int fit = 0;
fit = len_v3v3(ctrl->bone->head, edge->bone->head) < 0.0001f;
fit = fit || len_v3v3(ctrl->bone->tail, edge->bone->tail) < 0.0001f;
- if (fit)
- {
+ if (fit) {
/* pick the bone on the arc with the lowest symmetry level
* means you connect control to the trunk of the skeleton */
- if (best_arc == NULL || arc->symmetry_level < best_arc->symmetry_level)
- {
+ if (best_arc == NULL || arc->symmetry_level < best_arc->symmetry_level) {
best_arc = arc;
link = edge->bone;
}
@@ -880,23 +812,18 @@ static void RIG_reconnectControlBones(RigGraph *rg)
}
/* if not found yet, check child */
- if (found == 0)
- {
+ if (found == 0) {
RigArc *arc;
RigArc *best_arc = NULL;
EditBone *link = NULL;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
RigEdge *edge;
- for (edge = arc->edges.first; edge; edge = edge->next)
- {
- if (edge->bone && edge->bone->parent == ctrl->bone)
- {
+ for (edge = arc->edges.first; edge; edge = edge->next) {
+ if (edge->bone && edge->bone->parent == ctrl->bone) {
/* pick the bone on the arc with the lowest symmetry level
* means you connect control to the trunk of the skeleton */
- if (best_arc == NULL || arc->symmetry_level < best_arc->symmetry_level)
- {
+ if (best_arc == NULL || arc->symmetry_level < best_arc->symmetry_level) {
best_arc = arc;
link = edge->bone;
}
@@ -911,52 +838,42 @@ static void RIG_reconnectControlBones(RigGraph *rg)
/* second pass, make chains in control bones */
- while (change)
- {
+ while (change) {
change = 0;
- for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next)
- {
+ for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next) {
/* if control is not linked yet */
- if (ctrl->link == NULL)
- {
+ if (ctrl->link == NULL) {
bPoseChannel *pchan;
bConstraint *con;
RigControl *ctrl_parent = NULL;
RigControl *ctrl_child;
int found = 0;
- if (ctrl->bone->parent)
- {
+ if (ctrl->bone->parent) {
ctrl_parent = BLI_ghash_lookup(rg->controls_map, ctrl->bone->parent->name);
}
/* check constraints first */
/* DO SOME MAGIC HERE */
- for (pchan= rg->ob->pose->chanbase.first; pchan; pchan= pchan->next)
- {
- for (con= pchan->constraints.first; con; con= con->next)
- {
+ for (pchan= rg->ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (con= pchan->constraints.first; con; con= con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
/* constraint targets */
- if (cti && cti->get_constraint_targets)
- {
+ if (cti && cti->get_constraint_targets) {
cti->get_constraint_targets(con, &targets);
- for (ct= targets.first; ct; ct= ct->next)
- {
- if ((ct->tar == rg->ob) && strcmp(ct->subtarget, ctrl->bone->name) == 0)
- {
+ for (ct= targets.first; ct; ct= ct->next) {
+ if ((ct->tar == rg->ob) && strcmp(ct->subtarget, ctrl->bone->name) == 0) {
/* SET bone link to ctrl corresponding to pchan */
RigControl *link = BLI_ghash_lookup(rg->controls_map, pchan->name);
/* if owner is a control bone, link with it */
- if (link && link->link)
- {
+ if (link && link->link) {
RIG_parentControl(ctrl, link->bone);
found = 1;
break;
@@ -970,22 +887,17 @@ static void RIG_reconnectControlBones(RigGraph *rg)
}
}
- if (found == 0)
- {
+ if (found == 0) {
/* check if parent is already linked */
- if (ctrl_parent && ctrl_parent->link)
- {
+ if (ctrl_parent && ctrl_parent->link) {
RIG_parentControl(ctrl, ctrl_parent->bone);
change = 1;
}
- else
- {
+ else {
/* check childs */
- for (ctrl_child = rg->controls.first; ctrl_child; ctrl_child = ctrl_child->next)
- {
+ for (ctrl_child = rg->controls.first; ctrl_child; ctrl_child = ctrl_child->next) {
/* if a child is linked, link to that one */
- if (ctrl_child->link && ctrl_child->bone->parent == ctrl->bone)
- {
+ if (ctrl_child->link && ctrl_child->bone->parent == ctrl->bone) {
RIG_parentControl(ctrl, ctrl_child->bone);
change = 1;
break;
@@ -998,31 +910,25 @@ static void RIG_reconnectControlBones(RigGraph *rg)
}
/* third pass, link control tails */
- for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next)
- {
+ for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next) {
/* fit bone already means full match, so skip those */
- if ((ctrl->flag & RIG_CTRL_FIT_BONE) == 0)
- {
+ if ((ctrl->flag & RIG_CTRL_FIT_BONE) == 0) {
GHashIterator ghi;
/* look on deform bones first */
BLI_ghashIterator_init(&ghi, rg->bones_map);
- for ( ; !BLI_ghashIterator_isDone(&ghi); BLI_ghashIterator_step(&ghi))
- {
+ for ( ; !BLI_ghashIterator_isDone(&ghi); BLI_ghashIterator_step(&ghi)) {
EditBone *bone = (EditBone*)BLI_ghashIterator_getValue(&ghi);
/* don't link with parent */
- if (bone->parent != ctrl->bone)
- {
- if (len_v3v3(ctrl->bone->tail, bone->head) < 0.01f)
- {
+ if (bone->parent != ctrl->bone) {
+ if (len_v3v3(ctrl->bone->tail, bone->head) < 0.01f) {
ctrl->tail_mode = TL_HEAD;
ctrl->link_tail = bone;
break;
}
- else if (len_v3v3(ctrl->bone->tail, bone->tail) < 0.01f)
- {
+ else if (len_v3v3(ctrl->bone->tail, bone->tail) < 0.01f) {
ctrl->tail_mode = TL_TAIL;
ctrl->link_tail = bone;
break;
@@ -1031,8 +937,7 @@ static void RIG_reconnectControlBones(RigGraph *rg)
}
/* if we haven't found one yet, look in control bones */
- if (ctrl->tail_mode == TL_NONE)
- {
+ if (ctrl->tail_mode == TL_NONE) {
}
}
}
@@ -1046,21 +951,18 @@ static void RIG_joinArcs(RigGraph *rg, RigNode *node, RigArc *joined_arc1, RigAr
RigEdge *edge, *next_edge;
/* ignore cases where joint is at start or end */
- if (joined_arc1->head == joined_arc2->head || joined_arc1->tail == joined_arc2->tail)
- {
+ if (joined_arc1->head == joined_arc2->head || joined_arc1->tail == joined_arc2->tail) {
return;
}
/* swap arcs to make sure arc1 is before arc2 */
- if (joined_arc1->head == joined_arc2->tail)
- {
+ if (joined_arc1->head == joined_arc2->tail) {
RigArc *tmp = joined_arc1;
joined_arc1 = joined_arc2;
joined_arc2 = tmp;
}
- for (edge = joined_arc2->edges.first; edge; edge = next_edge)
- {
+ for (edge = joined_arc2->edges.first; edge; edge = next_edge) {
next_edge = edge->next;
RIG_appendEdgeToArc(joined_arc1, edge);
@@ -1079,24 +981,18 @@ static void RIG_removeNormalNodes(RigGraph *rg)
{
RigNode *node, *next_node;
- for (node = rg->nodes.first; node; node = next_node)
- {
+ for (node = rg->nodes.first; node; node = next_node) {
next_node = node->next;
- if (node->degree == 2)
- {
+ if (node->degree == 2) {
RigArc *arc, *joined_arc1 = NULL, *joined_arc2 = NULL;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (arc->head == node || arc->tail == node)
- {
- if (joined_arc1 == NULL)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
+ if (arc->head == node || arc->tail == node) {
+ if (joined_arc1 == NULL) {
joined_arc1 = arc;
}
- else
- {
+ else {
joined_arc2 = arc;
break;
}
@@ -1112,36 +1008,29 @@ static void RIG_removeUneededOffsets(RigGraph *rg)
{
RigArc *arc;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
RigEdge *first_edge, *last_edge;
first_edge = arc->edges.first;
last_edge = arc->edges.last;
- if (first_edge->bone == NULL)
- {
- if (first_edge->bone == NULL && len_v3v3(first_edge->tail, arc->head->p) <= 0.001f)
- {
+ if (first_edge->bone == NULL) {
+ if (first_edge->bone == NULL && len_v3v3(first_edge->tail, arc->head->p) <= 0.001f) {
BLI_remlink(&arc->edges, first_edge);
MEM_freeN(first_edge);
}
- else if (arc->head->degree == 1)
- {
+ else if (arc->head->degree == 1) {
RigNode *new_node = (RigNode*)BLI_FindNodeByPosition((BGraph*)rg, first_edge->tail, 0.001f);
- if (new_node)
- {
+ if (new_node) {
BLI_remlink(&arc->edges, first_edge);
MEM_freeN(first_edge);
BLI_replaceNodeInArc((BGraph*)rg, (BArc*)arc, (BNode*)new_node, (BNode*)arc->head);
}
- else
- {
+ else {
RigEdge *next_edge = first_edge->next;
- if (next_edge)
- {
+ if (next_edge) {
BLI_remlink(&arc->edges, first_edge);
MEM_freeN(first_edge);
@@ -1149,57 +1038,44 @@ static void RIG_removeUneededOffsets(RigGraph *rg)
}
}
}
- else
- {
+ else {
/* check if all arc connected start with a null edge */
RigArc *other_arc;
- for (other_arc = rg->arcs.first; other_arc; other_arc = other_arc->next)
- {
- if (other_arc != arc)
- {
+ for (other_arc = rg->arcs.first; other_arc; other_arc = other_arc->next) {
+ if (other_arc != arc) {
RigEdge *test_edge;
- if (other_arc->head == arc->head)
- {
+ if (other_arc->head == arc->head) {
test_edge = other_arc->edges.first;
- if (test_edge->bone != NULL)
- {
+ if (test_edge->bone != NULL) {
break;
}
}
- else if (other_arc->tail == arc->head)
- {
+ else if (other_arc->tail == arc->head) {
test_edge = other_arc->edges.last;
- if (test_edge->bone != NULL)
- {
+ if (test_edge->bone != NULL) {
break;
}
}
}
}
- if (other_arc == NULL)
- {
+ if (other_arc == NULL) {
RigNode *new_node = (RigNode*)BLI_FindNodeByPosition((BGraph*)rg, first_edge->tail, 0.001);
- if (new_node)
- {
+ if (new_node) {
/* remove null edge in other arcs too */
- for (other_arc = rg->arcs.first; other_arc; other_arc = other_arc->next)
- {
- if (other_arc != arc)
- {
+ for (other_arc = rg->arcs.first; other_arc; other_arc = other_arc->next) {
+ if (other_arc != arc) {
RigEdge *test_edge;
- if (other_arc->head == arc->head)
- {
+ if (other_arc->head == arc->head) {
BLI_replaceNodeInArc((BGraph*)rg, (BArc*)other_arc, (BNode*)new_node, (BNode*)other_arc->head);
test_edge = other_arc->edges.first;
BLI_remlink(&other_arc->edges, test_edge);
MEM_freeN(test_edge);
}
- else if (other_arc->tail == arc->head)
- {
+ else if (other_arc->tail == arc->head) {
BLI_replaceNodeInArc((BGraph*)rg, (BArc*)other_arc, (BNode*)new_node, (BNode*)other_arc->tail);
test_edge = other_arc->edges.last;
BLI_remlink(&other_arc->edges, test_edge);
@@ -1212,31 +1088,25 @@ static void RIG_removeUneededOffsets(RigGraph *rg)
MEM_freeN(first_edge);
BLI_replaceNodeInArc((BGraph*)rg, (BArc*)arc, (BNode*)new_node, (BNode*)arc->head);
}
- else
- {
+ else {
RigEdge *next_edge = first_edge->next;
- if (next_edge)
- {
+ if (next_edge) {
BLI_remlink(&arc->edges, first_edge);
MEM_freeN(first_edge);
copy_v3_v3(arc->head->p, next_edge->head);
/* remove null edge in other arcs too */
- for (other_arc = rg->arcs.first; other_arc; other_arc = other_arc->next)
- {
- if (other_arc != arc)
- {
+ for (other_arc = rg->arcs.first; other_arc; other_arc = other_arc->next) {
+ if (other_arc != arc) {
RigEdge *test_edge;
- if (other_arc->head == arc->head)
- {
+ if (other_arc->head == arc->head) {
test_edge = other_arc->edges.first;
BLI_remlink(&other_arc->edges, test_edge);
MEM_freeN(test_edge);
}
- else if (other_arc->tail == arc->head)
- {
+ else if (other_arc->tail == arc->head) {
test_edge = other_arc->edges.last;
BLI_remlink(&other_arc->edges, test_edge);
MEM_freeN(test_edge);
@@ -1249,19 +1119,15 @@ static void RIG_removeUneededOffsets(RigGraph *rg)
}
}
- if (last_edge->bone == NULL)
- {
- if (len_v3v3(last_edge->head, arc->tail->p) <= 0.001f)
- {
+ if (last_edge->bone == NULL) {
+ if (len_v3v3(last_edge->head, arc->tail->p) <= 0.001f) {
BLI_remlink(&arc->edges, last_edge);
MEM_freeN(last_edge);
}
- else if (arc->tail->degree == 1)
- {
+ else if (arc->tail->degree == 1) {
RigNode *new_node = (RigNode*)BLI_FindNodeByPosition((BGraph*)rg, last_edge->head, 0.001f);
- if (new_node)
- {
+ if (new_node) {
RigEdge *previous_edge = last_edge->prev;
BLI_remlink(&arc->edges, last_edge);
@@ -1269,17 +1135,14 @@ static void RIG_removeUneededOffsets(RigGraph *rg)
BLI_replaceNodeInArc((BGraph*)rg, (BArc*)arc, (BNode*)new_node, (BNode*)arc->tail);
/* set previous angle to 0, since there's no following edges */
- if (previous_edge)
- {
+ if (previous_edge) {
previous_edge->angle = 0;
}
}
- else
- {
+ else {
RigEdge *previous_edge = last_edge->prev;
- if (previous_edge)
- {
+ if (previous_edge) {
BLI_remlink(&arc->edges, last_edge);
MEM_freeN(last_edge);
@@ -1298,32 +1161,25 @@ static void RIG_arcFromBoneChain(RigGraph *rg, ListBase *list, EditBone *root_bo
RigArc *arc = NULL;
int contain_head = 0;
- for (bone = root_bone; bone; bone = nextEditBoneChild(list, bone, 0))
- {
+ for (bone = root_bone; bone; bone = nextEditBoneChild(list, bone, 0)) {
int nb_children;
- if (selected == 0 || (bone->flag & BONE_SELECTED))
- {
- if ((bone->flag & BONE_NO_DEFORM) == 0)
- {
+ if (selected == 0 || (bone->flag & BONE_SELECTED)) {
+ if ((bone->flag & BONE_NO_DEFORM) == 0) {
BLI_ghash_insert(rg->bones_map, bone->name, bone);
- if (arc == NULL)
- {
+ if (arc == NULL) {
arc = newRigArc(rg);
- if (starting_node == NULL)
- {
+ if (starting_node == NULL) {
starting_node = newRigNodeHead(rg, arc, root_bone->head);
}
- else
- {
+ else {
addRigNodeHead(rg, arc, starting_node);
}
}
- if (bone->parent && (bone->flag & BONE_CONNECTED) == 0)
- {
+ if (bone->parent && (bone->flag & BONE_CONNECTED) == 0) {
RIG_addEdgeToArc(arc, bone->head, NULL);
}
@@ -1331,34 +1187,28 @@ static void RIG_arcFromBoneChain(RigGraph *rg, ListBase *list, EditBone *root_bo
last_bone = bone;
- if (strcmp(bone->name, "head") == 0)
- {
+ if (strcmp(bone->name, "head") == 0) {
contain_head = 1;
}
}
- else if ((bone->flag & BONE_EDITMODE_LOCKED) == 0) /* ignore locked bones */
- {
+ else if ((bone->flag & BONE_EDITMODE_LOCKED) == 0) { /* ignore locked bones */
RIG_addControlBone(rg, bone);
}
}
nb_children = countEditBoneChildren(list, bone);
- if (nb_children > 1)
- {
+ if (nb_children > 1) {
RigNode *end_node = NULL;
int i;
- if (arc != NULL)
- {
+ if (arc != NULL) {
end_node = newRigNodeTail(rg, arc, bone->tail);
}
- else
- {
+ else {
end_node = newRigNode(rg, bone->tail);
}
- for (i = 0; i < nb_children; i++)
- {
+ for (i = 0; i < nb_children; i++) {
root_bone = nextEditBoneChild(list, bone, i);
RIG_arcFromBoneChain(rg, list, root_bone, end_node, selected);
}
@@ -1369,13 +1219,11 @@ static void RIG_arcFromBoneChain(RigGraph *rg, ListBase *list, EditBone *root_bo
}
/* If the loop exited without forking */
- if (arc != NULL && bone == NULL)
- {
+ if (arc != NULL && bone == NULL) {
newRigNodeTail(rg, arc, last_bone->tail);
}
- if (contain_head)
- {
+ if (contain_head) {
rg->head = arc->tail;
}
}
@@ -1383,32 +1231,26 @@ static void RIG_arcFromBoneChain(RigGraph *rg, ListBase *list, EditBone *root_bo
/*******************************************************************************************************/
static void RIG_findHead(RigGraph *rg)
{
- if (rg->head == NULL)
- {
- if (BLI_countlist(&rg->arcs) == 1)
- {
+ if (rg->head == NULL) {
+ if (BLI_countlist(&rg->arcs) == 1) {
RigArc *arc = rg->arcs.first;
rg->head = (RigNode*)arc->head;
}
- else
- {
+ else {
RigArc *arc;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
RigEdge *edge = arc->edges.last;
- if (edge->bone->flag & (BONE_TIPSEL|BONE_SELECTED))
- {
+ if (edge->bone->flag & (BONE_TIPSEL|BONE_SELECTED)) {
rg->head = arc->tail;
break;
}
}
}
- if (rg->head == NULL)
- {
+ if (rg->head == NULL) {
rg->head = rg->nodes.first;
}
}
@@ -1420,8 +1262,7 @@ static void RIG_printNode(RigNode *node, const char name[])
{
printf("%s %p %i <%0.3f, %0.3f, %0.3f>\n", name, (void *)node, node->degree, node->p[0], node->p[1], node->p[2]);
- if (node->symmetry_flag & SYM_TOPOLOGICAL)
- {
+ if (node->symmetry_flag & SYM_TOPOLOGICAL) {
if (node->symmetry_flag & SYM_AXIAL)
printf("Symmetry AXIAL\n");
else if (node->symmetry_flag & SYM_RADIAL)
@@ -1435,8 +1276,7 @@ void RIG_printArcBones(RigArc *arc)
{
RigEdge *edge;
- for (edge = arc->edges.first; edge; edge = edge->next)
- {
+ for (edge = arc->edges.first; edge; edge = edge->next) {
if (edge->bone)
printf("%s ", edge->bone->name);
else
@@ -1465,17 +1305,14 @@ static void RIG_printLinkedCtrl(RigGraph *rg, EditBone *bone, int tabs)
char *s = indent;
int i;
- for (i = 0; i < tabs; i++)
- {
+ for (i = 0; i < tabs; i++) {
s[0] = '\t';
s++;
}
s[0] = 0;
- for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next)
- {
- if (ctrl->link == bone)
- {
+ for (ctrl = rg->controls.first; ctrl; ctrl = ctrl->next) {
+ if (ctrl->link == bone) {
RIG_printCtrl(ctrl, indent);
RIG_printLinkedCtrl(rg, ctrl->bone, tabs + 1);
}
@@ -1488,13 +1325,11 @@ void RIG_printArc(RigGraph *rg, RigArc *arc)
RIG_printNode((RigNode*)arc->head, "head");
- for (edge = arc->edges.first; edge; edge = edge->next)
- {
+ for (edge = arc->edges.first; edge; edge = edge->next) {
printf("\tinner joints %0.3f %0.3f %0.3f\n", edge->tail[0], edge->tail[1], edge->tail[2]);
printf("\t\tlength %f\n", edge->length);
printf("\t\tangle %f\n", edge->angle * 180 / M_PI);
- if (edge->bone)
- {
+ if (edge->bone) {
printf("\t\t%s\n", edge->bone->name);
RIG_printLinkedCtrl(rg, edge->bone, 3);
}
@@ -1509,18 +1344,15 @@ void RIG_printGraph(RigGraph *rg)
RigArc *arc;
printf("---- ARCS ----\n");
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
RIG_printArc(rg, arc);
printf("\n");
}
- if (rg->head)
- {
+ if (rg->head) {
RIG_printNode(rg->head, "HEAD NODE:");
}
- else
- {
+ else {
printf("HEAD NODE: NONE\n");
}
}
@@ -1536,12 +1368,10 @@ RigGraph *RIG_graphFromArmature(const bContext *C, Object *ob, bArmature *arm)
rg = newRigGraph();
- if (obedit == ob)
- {
+ if (obedit == ob) {
rg->editbones = ((bArmature *)obedit->data)->edbo;
}
- else
- {
+ else {
rg->editbones = MEM_callocN(sizeof(ListBase), "EditBones");
make_boneList(rg->editbones, &arm->bonebase, NULL, NULL);
rg->flag |= RIG_FREE_BONELIST;
@@ -1551,8 +1381,7 @@ RigGraph *RIG_graphFromArmature(const bContext *C, Object *ob, bArmature *arm)
/* Do the rotations */
for (ebone = rg->editbones->first; ebone; ebone=ebone->next) {
- if (ebone->parent == NULL)
- {
+ if (ebone->parent == NULL) {
RIG_arcFromBoneChain(rg, rg->editbones, ebone, NULL, 0);
}
}
@@ -1571,8 +1400,7 @@ RigGraph *RIG_graphFromArmature(const bContext *C, Object *ob, bArmature *arm)
RIG_reconnectControlBones(rg); /* after symmetry, because we use levels to find best match */
- if (BLI_isGraphCyclic((BGraph*)rg))
- {
+ if (BLI_isGraphCyclic((BGraph*)rg)) {
printf("armature cyclic\n");
}
@@ -1588,12 +1416,10 @@ static RigGraph *armatureSelectedToGraph(bContext *C, Object *ob, bArmature *arm
rg = newRigGraph();
- if (obedit == ob)
- {
+ if (obedit == ob) {
rg->editbones = arm->edbo;
}
- else
- {
+ else {
rg->editbones = MEM_callocN(sizeof(ListBase), "EditBones");
make_boneList(rg->editbones, &arm->bonebase, NULL, NULL);
rg->flag |= RIG_FREE_BONELIST;
@@ -1603,8 +1429,7 @@ static RigGraph *armatureSelectedToGraph(bContext *C, Object *ob, bArmature *arm
/* Do the rotations */
for (ebone = rg->editbones->first; ebone; ebone=ebone->next) {
- if (ebone->parent == NULL)
- {
+ if (ebone->parent == NULL) {
RIG_arcFromBoneChain(rg, rg->editbones, ebone, NULL, 1);
}
}
@@ -1623,8 +1448,7 @@ static RigGraph *armatureSelectedToGraph(bContext *C, Object *ob, bArmature *arm
RIG_reconnectControlBones(rg); /* after symmetry, because we use levels to find best match */
- if (BLI_isGraphCyclic((BGraph*)rg))
- {
+ if (BLI_isGraphCyclic((BGraph*)rg)) {
printf("armature cyclic\n");
}
@@ -1721,8 +1545,7 @@ static void repositionTailControl(RigGraph *rigg, RigControl *ctrl);
static void finalizeControl(RigGraph *rigg, RigControl *ctrl, float resize)
{
- if ((ctrl->flag & RIG_CTRL_DONE) == RIG_CTRL_DONE)
- {
+ if ((ctrl->flag & RIG_CTRL_DONE) == RIG_CTRL_DONE) {
RigControl *ctrl_child;
#if 0
@@ -1737,17 +1560,14 @@ static void finalizeControl(RigGraph *rigg, RigControl *ctrl, float resize)
#endif
/* if there was a tail link: apply link, recalc resize factor and qrot */
- if (ctrl->tail_mode != TL_NONE)
- {
+ if (ctrl->tail_mode != TL_NONE) {
float *tail_vec = NULL;
float v1[3], v2[3], qtail[4];
- if (ctrl->tail_mode == TL_TAIL)
- {
+ if (ctrl->tail_mode == TL_TAIL) {
tail_vec = ctrl->link_tail->tail;
}
- else if (ctrl->tail_mode == TL_HEAD)
- {
+ else if (ctrl->tail_mode == TL_HEAD) {
tail_vec = ctrl->link_tail->head;
}
@@ -1765,14 +1585,11 @@ static void finalizeControl(RigGraph *rigg, RigControl *ctrl, float resize)
ctrl->bone->roll = rollBoneByQuat(ctrl->bone, ctrl->up_axis, ctrl->qrot);
/* Cascade to connected control bones */
- for (ctrl_child = rigg->controls.first; ctrl_child; ctrl_child = ctrl_child->next)
- {
- if (ctrl_child->link == ctrl->bone)
- {
+ for (ctrl_child = rigg->controls.first; ctrl_child; ctrl_child = ctrl_child->next) {
+ if (ctrl_child->link == ctrl->bone) {
repositionControl(rigg, ctrl_child, ctrl->bone->head, ctrl->bone->tail, ctrl->qrot, resize);
}
- if (ctrl_child->link_tail == ctrl->bone)
- {
+ if (ctrl_child->link_tail == ctrl->bone) {
repositionTailControl(rigg, ctrl_child);
}
}
@@ -1800,8 +1617,7 @@ static void repositionControl(RigGraph *rigg, RigControl *ctrl, float head[3], f
copy_qt_qt(ctrl->qrot, qrot);
- if (ctrl->tail_mode == TL_NONE)
- {
+ if (ctrl->tail_mode == TL_NONE) {
sub_v3_v3v3(tail_offset, ctrl->tail, ctrl->head);
mul_v3_fl(tail_offset, resize);
mul_qt_v3(qrot, tail_offset);
@@ -1838,38 +1654,30 @@ static void repositionBone(bContext *C, RigGraph *rigg, RigEdge *edge, float vec
copy_v3_v3(bone->head, vec0);
copy_v3_v3(bone->tail, vec1);
- if (!is_zero_v3(up_axis))
- {
+ if (!is_zero_v3(up_axis)) {
float qroll[4];
- if (scene->toolsettings->skgen_retarget_roll == SK_RETARGET_ROLL_VIEW)
- {
+ if (scene->toolsettings->skgen_retarget_roll == SK_RETARGET_ROLL_VIEW) {
bone->roll = rollBoneByQuatAligned(bone, edge->up_axis, qrot, qroll, up_axis);
}
- else if (scene->toolsettings->skgen_retarget_roll == SK_RETARGET_ROLL_JOINT)
- {
+ else if (scene->toolsettings->skgen_retarget_roll == SK_RETARGET_ROLL_JOINT) {
bone->roll = rollBoneByQuatJoint(edge, edge->prev, qrot, qroll, up_axis);
}
- else
- {
+ else {
unit_qt(qroll);
}
mul_qt_qtqt(qrot, qroll, qrot);
}
- else
- {
+ else {
bone->roll = rollBoneByQuat(bone, edge->up_axis, qrot);
}
- for (ctrl = rigg->controls.first; ctrl; ctrl = ctrl->next)
- {
- if (ctrl->link == bone)
- {
+ for (ctrl = rigg->controls.first; ctrl; ctrl = ctrl->next) {
+ if (ctrl->link == bone) {
repositionControl(rigg, ctrl, vec0, vec1, qrot, resize);
}
- if (ctrl->link_tail == bone)
- {
+ if (ctrl->link_tail == bone) {
repositionTailControl(rigg, ctrl);
}
}
@@ -1890,8 +1698,7 @@ static RetargetMode detectArcRetargetMode(RigArc *iarc)
int nb_edges = 0;
- for (edge = iarc->edges.first; edge; edge = edge->next)
- {
+ for (edge = iarc->edges.first; edge; edge = edge->next) {
avg_angle += edge->angle;
nb_edges++;
}
@@ -1901,29 +1708,23 @@ static RetargetMode detectArcRetargetMode(RigArc *iarc)
/* avg_length = iarc->length / nb_edges; */ /* UNUSED */
- if (nb_edges > 2)
- {
- for (edge = iarc->edges.first; edge; edge = edge->next)
- {
- if (fabs(edge->angle - avg_angle) > M_PI / 6)
- {
+ if (nb_edges > 2) {
+ for (edge = iarc->edges.first; edge; edge = edge->next) {
+ if (fabs(edge->angle - avg_angle) > M_PI / 6) {
large_angle = 1;
}
}
}
- else if (nb_edges == 2 && avg_angle > 0)
- {
+ else if (nb_edges == 2 && avg_angle > 0) {
large_angle = 1;
}
- if (large_angle == 0)
- {
+ if (large_angle == 0) {
mode = RETARGET_LENGTH;
}
- if (earc->bcount <= (iarc->count - 1))
- {
+ if (earc->bcount <= (iarc->count - 1)) {
mode = RETARGET_LENGTH;
}
@@ -1936,8 +1737,7 @@ static void printMovesNeeded(int *positions, int nb_positions)
int moves = 0;
int i;
- for (i = 0; i < nb_positions; i++)
- {
+ for (i = 0; i < nb_positions; i++) {
moves += positions[i] - (i + 1);
}
@@ -1948,8 +1748,7 @@ static void printPositions(int *positions, int nb_positions)
{
int i;
- for (i = 0; i < nb_positions; i++)
- {
+ for (i = 0; i < nb_positions; i++) {
printf("%i ", positions[i]);
}
printf("\n");
@@ -1965,17 +1764,14 @@ static float costDistance(BArcIterator *iter, float *vec0, float *vec1, int i0,
float v1[3], v2[3], c[3];
float v1_inpf;
- if (distance_weight > 0)
- {
+ if (distance_weight > 0) {
sub_v3_v3v3(v1, vec0, vec1);
v1_inpf = dot_v3v3(v1, v1);
- if (v1_inpf > 0)
- {
+ if (v1_inpf > 0) {
int j;
- for (j = i0 + 1; j < i1 - 1; j++)
- {
+ for (j = i0 + 1; j < i1 - 1; j++) {
float dist;
bucket = IT_peek(iter, j);
@@ -1991,48 +1787,40 @@ static float costDistance(BArcIterator *iter, float *vec0, float *vec1, int i0,
return distance_weight * max_dist;
}
- else
- {
+ else {
return MAX_COST;
}
}
- else
- {
+ else {
return 0;
}
}
static float costAngle(float original_angle, float vec_first[3], float vec_second[3], float angle_weight)
{
- if (angle_weight > 0)
- {
+ if (angle_weight > 0) {
float current_angle;
- if (!is_zero_v3(vec_first) && !is_zero_v3(vec_second))
- {
+ if (!is_zero_v3(vec_first) && !is_zero_v3(vec_second)) {
current_angle = saacos(dot_v3v3(vec_first, vec_second));
return angle_weight * fabsf(current_angle - original_angle);
}
- else
- {
+ else {
return angle_weight * (float)M_PI;
}
}
- else
- {
+ else {
return 0;
}
}
static float costLength(float original_length, float current_length, float length_weight)
{
- if (current_length == 0)
- {
+ if (current_length == 0) {
return MAX_COST;
}
- else
- {
+ else {
float length_ratio = fabs((current_length - original_length) / original_length);
return length_weight * length_ratio * length_ratio;
}
@@ -2062,8 +1850,7 @@ static float calcCostAngleLengthDistance(BArcIterator *iter, float **UNUSED(vec_
/* Angle cost */
- if (edge->prev)
- {
+ if (edge->prev) {
sub_v3_v3v3(vec_first, vec1, vec0);
normalize_v3(vec_first);
@@ -2089,8 +1876,7 @@ static void copyMemoPositions(int *positions, MemoNode *table, int nb_positions,
int previous = 0, current = 0;
int i = 0;
- for (i = 0; joints_left > 0; joints_left--, i++)
- {
+ for (i = 0; joints_left > 0; joints_left--, i++) {
MemoNode *node;
node = table + indexMemoNode(nb_positions, previous, current, joints_left);
@@ -2108,12 +1894,10 @@ static MemoNode * solveJoints(MemoNode *table, BArcIterator *iter, float **vec_c
node = table + index;
- if (node->weight != 0)
- {
+ if (node->weight != 0) {
return node;
}
- else if (joints_left == 0)
- {
+ else if (joints_left == 0) {
float *vec0 = vec_cache[previous];
float *vec1 = vec_cache[current];
float *vec2 = vec_cache[nb_positions + 1];
@@ -2122,8 +1906,7 @@ static MemoNode * solveJoints(MemoNode *table, BArcIterator *iter, float **vec_c
return node;
}
- else
- {
+ else {
MemoNode *min_node = NULL;
float *vec0 = vec_cache[previous];
float *vec1 = vec_cache[current];
@@ -2131,8 +1914,7 @@ static MemoNode * solveJoints(MemoNode *table, BArcIterator *iter, float **vec_c
int min_next= 0;
int next;
- for (next = current + 1; next <= nb_positions - (joints_left - 1); next++)
- {
+ for (next = current + 1; next <= nb_positions - (joints_left - 1); next++) {
MemoNode *next_node;
float *vec2 = vec_cache[next];
float weight = 0.0f;
@@ -2140,8 +1922,7 @@ static MemoNode * solveJoints(MemoNode *table, BArcIterator *iter, float **vec_c
/* ADD WEIGHT OF PREVIOUS - CURRENT - NEXT triple */
weight = calcCostAngleLengthDistance(iter, vec_cache, edge, vec0, vec1, vec2, current, next, angle_weight, length_weight, distance_weight);
- if (weight >= MAX_COST)
- {
+ if (weight >= MAX_COST) {
continue;
}
@@ -2149,22 +1930,19 @@ static MemoNode * solveJoints(MemoNode *table, BArcIterator *iter, float **vec_c
next_node = solveJoints(table, iter, vec_cache, nb_joints, nb_positions, current, next, edge->next, joints_left - 1, angle_weight, length_weight, distance_weight);
weight += next_node->weight;
- if (min_node == NULL || weight < min_weight)
- {
+ if (min_node == NULL || weight < min_weight) {
min_weight = weight;
min_node = next_node;
min_next = next;
}
}
- if (min_node)
- {
+ if (min_node) {
node->weight = min_weight;
node->next = min_next;
return node;
}
- else
- {
+ else {
node->weight = MAX_COST;
return node;
}
@@ -2178,12 +1956,12 @@ static int testFlipArc(RigArc *iarc, RigNode *inode_start)
ReebNode *enode_start = BIF_NodeFromIndex(earc, inode_start->link_mesh);
/* no flip needed if both nodes are the same */
- if ((enode_start == earc->head && inode_start == iarc->head) || (enode_start == earc->tail && inode_start == iarc->tail))
+ if ((enode_start == earc->head && inode_start == iarc->head) ||
+ (enode_start == earc->tail && inode_start == iarc->tail))
{
return 0;
}
- else
- {
+ else {
return 1;
}
}
@@ -2209,38 +1987,32 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc,
RetargetMethod method = METHOD_MEMOIZE;
int i;
- if (nb_joints > earc->bcount)
- {
+ if (nb_joints > earc->bcount) {
printf("NOT ENOUGH BUCKETS!\n");
return;
}
best_positions = MEM_callocN(sizeof(int) * nb_joints, "Best positions");
- if (testFlipArc(iarc, inode_start))
- {
+ if (testFlipArc(iarc, inode_start)) {
node_start = earc->tail;
node_end = earc->head;
}
- else
- {
+ else {
node_start = earc->head;
node_end = earc->tail;
}
/* equal number of joints and potential position, just fill them in */
- if (nb_joints == earc->bcount)
- {
+ if (nb_joints == earc->bcount) {
int i;
/* init with first values */
- for (i = 0; i < nb_joints; i++)
- {
+ for (i = 0; i < nb_joints; i++) {
best_positions[i] = i + 1;
}
}
- if (method == METHOD_MEMOIZE)
- {
+ if (method == METHOD_MEMOIZE) {
int nb_positions = earc->bcount;
int nb_memo_nodes = nb_positions * nb_positions * (nb_joints + 1);
MemoNode *table = MEM_callocN(nb_memo_nodes * sizeof(MemoNode), "memoization table");
@@ -2255,8 +2027,7 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc,
initArcIterator(iter, earc, node_start);
- for (i = 1; i <= nb_positions; i++)
- {
+ for (i = 1; i <= nb_positions; i++) {
EmbedBucket *bucket = IT_peek(iter, i);
positions_cache[i] = bucket->p;
}
@@ -2290,20 +2061,17 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc,
edge = edge->next, i++)
{
float *no = NULL;
- if (i < nb_joints)
- {
+ if (i < nb_joints) {
bucket = IT_peek(iter, best_positions[i]);
vec1 = bucket->p;
no = bucket->no;
}
- else
- {
+ else {
vec1 = node_end->p;
no = node_end->no;
}
- if (edge->bone)
- {
+ if (edge->bone) {
repositionBone(C, rigg, edge, vec0, vec1, no);
}
@@ -2327,13 +2095,11 @@ static void retargetArctoArcLength(bContext *C, RigGraph *rigg, RigArc *iarc, Ri
float *previous_vec = NULL;
- if (testFlipArc(iarc, inode_start))
- {
+ if (testFlipArc(iarc, inode_start)) {
node_start = (ReebNode*)earc->tail;
node_end = (ReebNode*)earc->head;
}
- else
- {
+ else {
node_start = (ReebNode*)earc->head;
node_end = (ReebNode*)earc->tail;
}
@@ -2344,8 +2110,7 @@ static void retargetArctoArcLength(bContext *C, RigGraph *rigg, RigArc *iarc, Ri
vec0 = node_start->p;
- while (bucket != NULL)
- {
+ while (bucket != NULL) {
vec1 = bucket->p;
embedding_length += len_v3v3(vec0, vec1);
@@ -2365,14 +2130,12 @@ static void retargetArctoArcLength(bContext *C, RigGraph *rigg, RigArc *iarc, Ri
previous_vec = vec0;
vec1 = bucket->p;
- for (edge = iarc->edges.first; edge; edge = edge->next)
- {
+ for (edge = iarc->edges.first; edge; edge = edge->next) {
float new_bone_length = edge->length / iarc->length * embedding_length;
float *no = NULL;
float length = 0;
- while (bucket && new_bone_length > length)
- {
+ while (bucket && new_bone_length > length) {
length += len_v3v3(previous_vec, vec1);
bucket = IT_next(iter);
previous_vec = vec1;
@@ -2380,15 +2143,13 @@ static void retargetArctoArcLength(bContext *C, RigGraph *rigg, RigArc *iarc, Ri
no = bucket->no;
}
- if (bucket == NULL)
- {
+ if (bucket == NULL) {
vec1 = node_end->p;
no = node_end->no;
}
/* no need to move virtual edges (space between unconnected bones) */
- if (edge->bone)
- {
+ if (edge->bone) {
repositionBone(C, rigg, edge, vec0, vec1, no);
}
@@ -2429,29 +2190,23 @@ void *exec_retargetArctoArc(void *param)
RigNode *inode_start = p->inode_start;
ReebArc *earc = iarc->link_mesh;
- if (BLI_countlist(&iarc->edges) == 1)
- {
+ if (BLI_countlist(&iarc->edges) == 1) {
RigEdge *edge = iarc->edges.first;
- if (testFlipArc(iarc, inode_start))
- {
+ if (testFlipArc(iarc, inode_start)) {
repositionBone(C, rigg, edge, earc->tail->p, earc->head->p, earc->head->no);
}
- else
- {
+ else {
repositionBone(C, rigg, edge, earc->head->p, earc->tail->p, earc->tail->no);
}
}
- else
- {
+ else {
RetargetMode mode = detectArcRetargetMode(iarc);
- if (mode == RETARGET_AGGRESSIVE)
- {
+ if (mode == RETARGET_AGGRESSIVE) {
retargetArctoArcAggresive(C, rigg, iarc, inode_start);
}
- else
- {
+ else {
retargetArctoArcLength(C, rigg, iarc, inode_start);
}
}
@@ -2474,8 +2229,7 @@ static void matchMultiResolutionNode(RigGraph *rigg, RigNode *inode, ReebNode *t
inode->link_mesh = enode;
- while (ishape == eshape && enode->link_down)
- {
+ while (ishape == eshape && enode->link_down) {
inode->link_mesh = enode;
enode = enode->link_down;
@@ -2488,16 +2242,13 @@ static void markMultiResolutionChildArc(ReebNode *end_enode, ReebNode *enode)
{
int i;
- for (i = 0; i < enode->degree; i++)
- {
+ for (i = 0; i < enode->degree; i++) {
ReebArc *earc = (ReebArc*)enode->arcs[i];
- if (earc->flag == ARC_FREE)
- {
+ if (earc->flag == ARC_FREE) {
earc->flag = ARC_TAKEN;
- if (earc->tail->degree > 1 && earc->tail != end_enode)
- {
+ if (earc->tail->degree > 1 && earc->tail != end_enode) {
markMultiResolutionChildArc(end_enode, earc->tail);
}
break;
@@ -2507,15 +2258,12 @@ static void markMultiResolutionChildArc(ReebNode *end_enode, ReebNode *enode)
static void markMultiResolutionArc(ReebArc *start_earc)
{
- if (start_earc->link_up)
- {
+ if (start_earc->link_up) {
ReebArc *earc;
- for (earc = start_earc->link_up ; earc; earc = earc->link_up)
- {
+ for (earc = start_earc->link_up ; earc; earc = earc->link_up) {
earc->flag = ARC_TAKEN;
- if (earc->tail->index != start_earc->tail->index)
- {
+ if (earc->tail->index != start_earc->tail->index) {
markMultiResolutionChildArc(earc->tail, earc->tail);
}
}
@@ -2531,8 +2279,7 @@ static void matchMultiResolutionArc(RigGraph *rigg, RigNode *start_node, RigArc
ishape = BLI_subtreeShape((BGraph*)rigg, (BNode*)start_node, (BArc*)next_iarc, 1) % SHAPE_LEVELS;
eshape = BLI_subtreeShape((BGraph*)reebg, (BNode*)enode, (BArc*)next_earc, 1) % SHAPE_LEVELS;
- while (ishape != eshape && next_earc->link_up)
- {
+ while (ishape != eshape && next_earc->link_up) {
next_earc->flag = ARC_TAKEN; // mark previous as taken, to prevent backtrack on lower levels
next_earc = next_earc->link_up;
@@ -2563,8 +2310,7 @@ static void matchMultiResolutionStartingNode(RigGraph *rigg, ReebGraph *reebg, R
ishape = BLI_subtreeShape((BGraph*)rigg, (BNode*)inode, NULL, 0) % SHAPE_LEVELS;
eshape = BLI_subtreeShape((BGraph*)rigg->link_mesh, (BNode*)enode, NULL, 0) % SHAPE_LEVELS;
- while (ishape != eshape && reebg->link_up)
- {
+ while (ishape != eshape && reebg->link_up) {
reebg = reebg->link_up;
enode = reebg->nodes.first;
@@ -2593,8 +2339,7 @@ static void findCorrespondingArc(RigGraph *rigg, RigArc *start_arc, RigNode *sta
// RIG_printArcBones(next_iarc);
// }
- for (i = 0; i < enode->degree; i++)
- {
+ for (i = 0; i < enode->degree; i++) {
next_earc = (ReebArc*)enode->arcs[i];
// if (next_earc->flag == ARC_FREE)
@@ -2619,20 +2364,17 @@ static void findCorrespondingArc(RigGraph *rigg, RigArc *start_arc, RigNode *sta
}
/* not found, try at higher nodes (lower node might have filtered internal arcs, messing shape of tree */
- if (next_iarc->link_mesh == NULL)
- {
+ if (next_iarc->link_mesh == NULL) {
// printf("NO CORRESPONDING ARC FOUND - GOING TO HIGHER LEVELS\n");
- if (enode->link_up)
- {
+ if (enode->link_up) {
start_node->link_mesh = enode->link_up;
findCorrespondingArc(rigg, start_arc, start_node, next_iarc, 0);
}
}
/* still not found, print debug info */
- if (root && next_iarc->link_mesh == NULL)
- {
+ if (root && next_iarc->link_mesh == NULL) {
start_node->link_mesh = enode; /* linking back with root node */
// printf("NO CORRESPONDING ARC FOUND\n");
@@ -2651,12 +2393,10 @@ static void findCorrespondingArc(RigGraph *rigg, RigArc *start_arc, RigNode *sta
// }
/* Emergency matching */
- for (i = 0; i < enode->degree; i++)
- {
+ for (i = 0; i < enode->degree; i++) {
next_earc = (ReebArc*)enode->arcs[i];
- if (next_earc->flag == ARC_FREE && next_earc->symmetry_level == symmetry_level)
- {
+ if (next_earc->flag == ARC_FREE && next_earc->symmetry_level == symmetry_level) {
// printf("USING:\n");
// printf("flag %i -- level %i -- flag %i -- group %i\n", next_earc->flag, next_earc->symmetry_level, next_earc->symmetry_flag, next_earc->symmetry_group);
matchMultiResolutionArc(rigg, start_node, next_iarc, next_earc);
@@ -2673,8 +2413,7 @@ static void retargetSubgraph(bContext *C, RigGraph *rigg, RigArc *start_arc, Rig
int i;
/* no start arc on first node */
- if (start_arc)
- {
+ if (start_arc) {
ReebNode *enode = start_node->link_mesh;
ReebArc *earc = start_arc->link_mesh;
@@ -2687,16 +2426,13 @@ static void retargetSubgraph(bContext *C, RigGraph *rigg, RigArc *start_arc, Rig
matchMultiResolutionNode(rigg, inode, enode);
}
- for (i = 0; i < inode->degree; i++)
- {
+ for (i = 0; i < inode->degree; i++) {
RigArc *next_iarc = (RigArc*)inode->arcs[i];
/* no back tracking */
- if (next_iarc != start_arc)
- {
+ if (next_iarc != start_arc) {
findCorrespondingArc(rigg, start_arc, inode, next_iarc, 1);
- if (next_iarc->link_mesh)
- {
+ if (next_iarc->link_mesh) {
retargetSubgraph(C, rigg, next_iarc, inode);
}
}
@@ -2715,10 +2451,8 @@ static void adjustGraphs(bContext *C, RigGraph *rigg)
bArmature *arm= rigg->ob->data;
RigArc *arc;
- for (arc = rigg->arcs.first; arc; arc = arc->next)
- {
- if (arc->link_mesh)
- {
+ for (arc = rigg->arcs.first; arc; arc = arc->next) {
+ if (arc->link_mesh) {
retargetArctoArc(C, rigg, arc, arc->head);
}
}
@@ -2762,25 +2496,21 @@ const char *RIG_nameBone(RigGraph *rg, int arc_index, int bone_index)
RigArc *arc = BLI_findlink(&rg->arcs, arc_index);
RigEdge *iedge;
- if (arc == NULL)
- {
+ if (arc == NULL) {
return "None";
}
- if (bone_index == BLI_countlist(&arc->edges))
- {
+ if (bone_index == BLI_countlist(&arc->edges)) {
return "Last joint";
}
iedge = BLI_findlink(&arc->edges, bone_index);
- if (iedge == NULL)
- {
+ if (iedge == NULL) {
return "Done";
}
- if (iedge->bone == NULL)
- {
+ if (iedge->bone == NULL) {
return "Bone offset";
}
@@ -2794,8 +2524,7 @@ int RIG_nbJoints(RigGraph *rg)
total += BLI_countlist(&rg->nodes);
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
total += BLI_countlist(&arc->edges) - 1; /* -1 because end nodes are already counted */
}
@@ -2804,8 +2533,7 @@ int RIG_nbJoints(RigGraph *rg)
static void BIF_freeRetarget(void)
{
- if (GLOBAL_RIGG)
- {
+ if (GLOBAL_RIGG) {
RIG_freeRigGraph((BGraph*)GLOBAL_RIGG);
GLOBAL_RIGG = NULL;
}
@@ -2827,11 +2555,10 @@ void BIF_retargetArmature(bContext *C)
printf("Reeb Graph created\n");
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base*, base, selected_editable_bases) {
Object *ob = base->object;
- if (ob->type==OB_ARMATURE)
- {
+ if (ob->type==OB_ARMATURE) {
RigGraph *rigg;
bArmature *arm;
@@ -2910,8 +2637,7 @@ void BIF_retargetArc(bContext *C, ReebArc *earc, RigGraph *template_rigg)
template_rigg = armatureSelectedToGraph(C, ob, ob->data);
}
- if (template_rigg->arcs.first == NULL)
- {
+ if (template_rigg->arcs.first == NULL) {
// XXX
// error("No Template and no deforming bones selected");
return;
@@ -2930,8 +2656,7 @@ void BIF_retargetArc(bContext *C, ReebArc *earc, RigGraph *template_rigg)
finishRetarget(rigg);
/* free template if it comes from the edit armature */
- if (free_template)
- {
+ if (free_template) {
RIG_freeRigGraph((BGraph*)template_rigg);
}
RIG_freeRigGraph((BGraph*)rigg);
@@ -2944,8 +2669,7 @@ void BIF_retargetArc(bContext *C, ReebArc *earc, RigGraph *template_rigg)
void BIF_adjustRetarget(bContext *C)
{
- if (GLOBAL_RIGG)
- {
+ if (GLOBAL_RIGG) {
adjustGraphs(C, GLOBAL_RIGG);
}
}
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 81b020a4cf9..09b0226c58c 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -162,25 +162,21 @@ void BIF_makeListTemplates(const bContext *C)
Base *base;
int index = 0;
- if (TEMPLATES_HASH != NULL)
- {
+ if (TEMPLATES_HASH != NULL) {
BLI_ghash_free(TEMPLATES_HASH, NULL, NULL);
}
TEMPLATES_HASH = BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "makeListTemplates gh");
TEMPLATES_CURRENT = 0;
- for ( base = FIRSTBASE; base; base = base->next )
- {
+ for ( base = FIRSTBASE; base; base = base->next ) {
Object *ob = base->object;
- if (ob != obedit && ob->type == OB_ARMATURE)
- {
+ if (ob != obedit && ob->type == OB_ARMATURE) {
index++;
BLI_ghash_insert(TEMPLATES_HASH, SET_INT_IN_POINTER(index), ob);
- if (ob == ts->skgen_template)
- {
+ if (ob == ts->skgen_template) {
TEMPLATES_CURRENT = index;
}
}
@@ -193,8 +189,7 @@ const char *BIF_listTemplates(const bContext *UNUSED(C))
char menu_header[] = "Template%t|None%x0|";
char *p;
- if (TEMPLATES_MENU != NULL)
- {
+ if (TEMPLATES_MENU != NULL) {
MEM_freeN(TEMPLATES_MENU);
}
@@ -206,8 +201,7 @@ const char *BIF_listTemplates(const bContext *UNUSED(C))
BLI_ghashIterator_init(&ghi, TEMPLATES_HASH);
- while (!BLI_ghashIterator_isDone(&ghi))
- {
+ while (!BLI_ghashIterator_isDone(&ghi)) {
Object *ob = BLI_ghashIterator_getValue(&ghi);
int key = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&ghi));
@@ -223,18 +217,15 @@ int BIF_currentTemplate(const bContext *C)
{
ToolSettings *ts = CTX_data_tool_settings(C);
- if (TEMPLATES_CURRENT == 0 && ts->skgen_template != NULL)
- {
+ if (TEMPLATES_CURRENT == 0 && ts->skgen_template != NULL) {
GHashIterator ghi;
BLI_ghashIterator_init(&ghi, TEMPLATES_HASH);
- while (!BLI_ghashIterator_isDone(&ghi))
- {
+ while (!BLI_ghashIterator_isDone(&ghi)) {
Object *ob = BLI_ghashIterator_getValue(&ghi);
int key = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&ghi));
- if (ob == ts->skgen_template)
- {
+ if (ob == ts->skgen_template) {
TEMPLATES_CURRENT = key;
break;
}
@@ -249,21 +240,17 @@ int BIF_currentTemplate(const bContext *C)
static RigGraph* sk_makeTemplateGraph(const bContext *C, Object *ob)
{
Object *obedit = CTX_data_edit_object(C);
- if (ob == obedit)
- {
+ if (ob == obedit) {
return NULL;
}
- if (ob != NULL)
- {
- if (TEMPLATE_RIGG && TEMPLATE_RIGG->ob != ob)
- {
+ if (ob != NULL) {
+ if (TEMPLATE_RIGG && TEMPLATE_RIGG->ob != ob) {
RIG_freeRigGraph((BGraph*)TEMPLATE_RIGG);
TEMPLATE_RIGG = NULL;
}
- if (TEMPLATE_RIGG == NULL)
- {
+ if (TEMPLATE_RIGG == NULL) {
bArmature *arm;
arm = ob->data;
@@ -280,12 +267,10 @@ int BIF_nbJointsTemplate(const bContext *C)
ToolSettings *ts = CTX_data_tool_settings(C);
RigGraph *rg = sk_makeTemplateGraph(C, ts->skgen_template);
- if (rg)
- {
+ if (rg) {
return RIG_nbJoints(rg);
}
- else
- {
+ else {
return -1;
}
}
@@ -297,15 +282,13 @@ const char * BIF_nameBoneTemplate(const bContext *C)
RigGraph *rg;
int index = 0;
- if (stk && stk->active_stroke != NULL)
- {
+ if (stk && stk->active_stroke != NULL) {
index = stk->active_stroke->nb_points;
}
rg = sk_makeTemplateGraph(C, ts->skgen_template);
- if (rg == NULL)
- {
+ if (rg == NULL) {
return "";
}
@@ -314,20 +297,17 @@ const char * BIF_nameBoneTemplate(const bContext *C)
void BIF_freeTemplates(bContext *UNUSED(C))
{
- if (TEMPLATES_MENU != NULL)
- {
+ if (TEMPLATES_MENU != NULL) {
MEM_freeN(TEMPLATES_MENU);
TEMPLATES_MENU = NULL;
}
- if (TEMPLATES_HASH != NULL)
- {
+ if (TEMPLATES_HASH != NULL) {
BLI_ghash_free(TEMPLATES_HASH, NULL, NULL);
TEMPLATES_HASH = NULL;
}
- if (TEMPLATE_RIGG != NULL)
- {
+ if (TEMPLATE_RIGG != NULL) {
RIG_freeRigGraph((BGraph*)TEMPLATE_RIGG);
TEMPLATE_RIGG = NULL;
}
@@ -336,16 +316,13 @@ void BIF_freeTemplates(bContext *UNUSED(C))
void BIF_setTemplate(bContext *C, int index)
{
ToolSettings *ts = CTX_data_tool_settings(C);
- if (index > 0)
- {
+ if (index > 0) {
ts->skgen_template = BLI_ghash_lookup(TEMPLATES_HASH, SET_INT_IN_POINTER(index));
}
- else
- {
+ else {
ts->skgen_template = NULL;
- if (TEMPLATE_RIGG != NULL)
- {
+ if (TEMPLATE_RIGG != NULL) {
RIG_freeRigGraph((BGraph*)TEMPLATE_RIGG);
}
TEMPLATE_RIGG = NULL;
@@ -357,44 +334,35 @@ void BIF_setTemplate(bContext *C, int index)
static void sk_autoname(bContext *C, ReebArc *arc)
{
ToolSettings *ts = CTX_data_tool_settings(C);
- if (ts->skgen_retarget_options & SK_RETARGET_AUTONAME)
- {
- if (arc == NULL)
- {
+ if (ts->skgen_retarget_options & SK_RETARGET_AUTONAME) {
+ if (arc == NULL) {
char *num = ts->skgen_num_string;
int i = atoi(num);
i++;
BLI_snprintf(num, 8, "%i", i);
}
- else
- {
+ else {
char *side = ts->skgen_side_string;
int valid = 0;
int caps = 0;
- if (side[0] == '\0')
- {
+ if (side[0] == '\0') {
valid = 1;
}
- else if (strcmp(side, "R")==0 || strcmp(side, "L")==0)
- {
+ else if (strcmp(side, "R")==0 || strcmp(side, "L")==0) {
valid = 1;
caps = 1;
}
- else if (strcmp(side, "r")==0 || strcmp(side, "l")==0)
- {
+ else if (strcmp(side, "r")==0 || strcmp(side, "l")==0) {
valid = 1;
caps = 0;
}
- if (valid)
- {
- if (arc->head->p[0] < 0)
- {
+ if (valid) {
+ if (arc->head->p[0] < 0) {
BLI_snprintf(side, 8, caps?"R":"r");
}
- else
- {
+ else {
BLI_snprintf(side, 8, caps?"L":"l");
}
}
@@ -428,8 +396,7 @@ static ReebArc *sk_strokeToArc(SK_Stroke *stk, float imat[][4], float tmat[][3])
arc->bcount = stk->nb_points - 2; /* first and last are nodes, don't count */
arc->buckets = MEM_callocN(sizeof(EmbedBucket) * arc->bcount, "Buckets");
- for (i = 0; i < arc->bcount; i++)
- {
+ for (i = 0; i < arc->bcount; i++) {
copy_v3_v3(arc->buckets[i].p, stk->points[i + 1].p);
mul_m4_v3(imat, arc->buckets[i].p);
@@ -473,8 +440,7 @@ static void sk_retargetStroke(bContext *C, SK_Stroke *stk)
static void sk_cancelStroke(SK_Sketch *sketch)
{
- if (sketch->active_stroke != NULL)
- {
+ if (sketch->active_stroke != NULL) {
sk_resetOverdraw(sketch);
sk_removeStroke(sketch, sketch->active_stroke);
}
@@ -501,8 +467,7 @@ static void sk_drawEdge(GLUquadric *quad, SK_Point *pt0, SK_Point *pt1, float si
length = normalize_v3(vec1);
cross_v3_v3v3(axis, vec2, vec1);
- if (is_zero_v3(axis))
- {
+ if (is_zero_v3(axis)) {
axis[1] = 1;
}
@@ -522,8 +487,7 @@ static void sk_drawNormal(GLUquadric *quad, SK_Point *pt, float size, float heig
cross_v3_v3v3(axis, vec2, pt->no);
- if (is_zero_v3(axis))
- {
+ if (is_zero_v3(axis)) {
axis[1] = 1;
}
@@ -544,18 +508,15 @@ static void sk_drawStroke(SK_Stroke *stk, int id, float color[3], int start, int
GLUquadric *quad = gluNewQuadric();
gluQuadricNormals(quad, GLU_SMOOTH);
- if (id != -1)
- {
+ if (id != -1) {
glLoadName(id);
- for (i = 0; i < stk->nb_points; i++)
- {
+ for (i = 0; i < stk->nb_points; i++) {
glPushMatrix();
sk_drawPoint(quad, stk->points + i, 0.1);
- if (i > 0)
- {
+ if (i > 0) {
sk_drawEdge(quad, stk->points + i - 1, stk->points + i, 0.1);
}
@@ -563,44 +524,37 @@ static void sk_drawStroke(SK_Stroke *stk, int id, float color[3], int start, int
}
}
- else
- {
+ else {
float d_rgb[3] = {1, 1, 1};
copy_v3_v3(rgb, color);
sub_v3_v3(d_rgb, rgb);
mul_v3_fl(d_rgb, 1.0f / (float)stk->nb_points);
- for (i = 0; i < stk->nb_points; i++)
- {
+ for (i = 0; i < stk->nb_points; i++) {
SK_Point *pt = stk->points + i;
glPushMatrix();
- if (pt->type == PT_EXACT)
- {
+ if (pt->type == PT_EXACT) {
glColor3f(0, 0, 0);
sk_drawPoint(quad, pt, 0.15);
sk_drawNormal(quad, pt, 0.05, 0.9);
}
- if (i >= start && i <= end)
- {
+ if (i >= start && i <= end) {
glColor3f(0.3, 0.3, 0.3);
}
- else
- {
+ else {
glColor3fv(rgb);
}
- if (pt->type != PT_EXACT)
- {
+ if (pt->type != PT_EXACT) {
sk_drawPoint(quad, pt, 0.1);
}
- if (i > 0)
- {
+ if (i > 0) {
sk_drawEdge(quad, pt - 1, pt, 0.1);
}
@@ -627,8 +581,7 @@ static void drawSubdividedStrokeBy(ToolSettings *toolsettings, BArcIterator *ite
copy_v3_v3(head, iter->p);
index = next_subdividion(toolsettings, iter, bone_start, end, head, tail);
- while (index != -1)
- {
+ while (index != -1) {
SK_Point *pt = stk->points + index;
glPushMatrix();
@@ -654,41 +607,32 @@ static void sk_drawStrokeSubdivision(ToolSettings *toolsettings, SK_Stroke *stk)
int head_index = -1;
int i;
- if (toolsettings->bone_sketching_convert == SK_CONVERT_RETARGET)
- {
+ if (toolsettings->bone_sketching_convert == SK_CONVERT_RETARGET) {
return;
}
- for (i = 0; i < stk->nb_points; i++)
- {
+ for (i = 0; i < stk->nb_points; i++) {
SK_Point *pt = stk->points + i;
- if (pt->type == PT_EXACT || i == stk->nb_points - 1) /* stop on exact or on last point */
- {
- if (head_index == -1)
- {
+ if (pt->type == PT_EXACT || i == stk->nb_points - 1) /* stop on exact or on last point */ {
+ if (head_index == -1) {
head_index = i;
}
- else
- {
- if (i - head_index > 1)
- {
+ else {
+ if (i - head_index > 1) {
SK_StrokeIterator sk_iter;
BArcIterator *iter = (BArcIterator*)&sk_iter;
initStrokeIterator(iter, stk, head_index, i);
- if (toolsettings->bone_sketching_convert == SK_CONVERT_CUT_ADAPTATIVE)
- {
+ if (toolsettings->bone_sketching_convert == SK_CONVERT_CUT_ADAPTATIVE) {
drawSubdividedStrokeBy(toolsettings, iter, nextAdaptativeSubdivision);
}
- else if (toolsettings->bone_sketching_convert == SK_CONVERT_CUT_LENGTH)
- {
+ else if (toolsettings->bone_sketching_convert == SK_CONVERT_CUT_LENGTH) {
drawSubdividedStrokeBy(toolsettings, iter, nextLengthSubdivision);
}
- else if (toolsettings->bone_sketching_convert == SK_CONVERT_CUT_FIXED)
- {
+ else if (toolsettings->bone_sketching_convert == SK_CONVERT_CUT_FIXED) {
drawSubdividedStrokeBy(toolsettings, iter, nextFixedSubdivision);
}
@@ -706,10 +650,8 @@ static SK_Point *sk_snapPointStroke(bContext *C, SK_Stroke *stk, int mval[2], in
SK_Point *pt = NULL;
int i;
- for (i = 0; i < stk->nb_points; i++)
- {
- if (all_pts || stk->points[i].type == PT_EXACT)
- {
+ for (i = 0; i < stk->nb_points; i++) {
+ if (all_pts || stk->points[i].type == PT_EXACT) {
short pval[2];
int pdist;
@@ -717,13 +659,11 @@ static SK_Point *sk_snapPointStroke(bContext *C, SK_Stroke *stk, int mval[2], in
pdist = ABS(pval[0] - mval[0]) + ABS(pval[1] - mval[1]);
- if (pdist < *dist)
- {
+ if (pdist < *dist) {
*dist = pdist;
pt = stk->points + i;
- if (index != NULL)
- {
+ if (index != NULL) {
*index = i;
}
}
@@ -801,75 +741,60 @@ int sk_hasOverdraw(SK_Sketch *sketch, SK_Stroke *stk)
static void sk_updateOverdraw(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd)
{
- if (sketch->over.target == NULL)
- {
+ if (sketch->over.target == NULL) {
SK_Stroke *target;
int closest_index = -1;
int dist = SNAP_MIN_DISTANCE * 2;
- for (target = sketch->strokes.first; target; target = target->next)
- {
- if (target != stk)
- {
+ for (target = sketch->strokes.first; target; target = target->next) {
+ if (target != stk) {
int index;
SK_Point *spt = sk_snapPointStroke(C, target, dd->mval, &dist, &index, 1);
- if (spt != NULL)
- {
+ if (spt != NULL) {
sketch->over.target = target;
closest_index = index;
}
}
}
- if (sketch->over.target != NULL)
- {
- if (closest_index > -1)
- {
- if (sk_lastStrokePoint(stk)->type == PT_EXACT)
- {
+ if (sketch->over.target != NULL) {
+ if (closest_index > -1) {
+ if (sk_lastStrokePoint(stk)->type == PT_EXACT) {
sketch->over.count = SK_OVERDRAW_LIMIT;
}
- else
- {
+ else {
sketch->over.count++;
}
}
- if (stk->nb_points == 1)
- {
+ if (stk->nb_points == 1) {
sketch->over.start = closest_index;
}
- else
- {
+ else {
sketch->over.end = closest_index;
}
}
}
- else if (sketch->over.target != NULL)
- {
+ else if (sketch->over.target != NULL) {
SK_Point *closest_pt = NULL;
int dist = SNAP_MIN_DISTANCE * 2;
int index;
closest_pt = sk_snapPointStroke(C, sketch->over.target, dd->mval, &dist, &index, 1);
- if (closest_pt != NULL)
- {
- if (sk_lastStrokePoint(stk)->type == PT_EXACT)
- {
+ if (closest_pt != NULL) {
+ if (sk_lastStrokePoint(stk)->type == PT_EXACT) {
sketch->over.count = SK_OVERDRAW_LIMIT;
}
- else
- {
+ else {
sketch->over.count++;
}
sketch->over.end = index;
}
- else
- {
+ else {
sketch->over.end = -1;
}
}
@@ -883,18 +808,15 @@ static int sk_adjustIndexes(SK_Sketch *sketch, int *start, int *end)
*start = sketch->over.start;
*end = sketch->over.end;
- if (*start == -1)
- {
+ if (*start == -1) {
*start = 0;
}
- if (*end == -1)
- {
+ if (*end == -1) {
*end = sketch->over.target->nb_points - 1;
}
- if (*end < *start)
- {
+ if (*end < *start) {
int tmp = *start;
*start = *end;
*end = tmp;
@@ -908,18 +830,15 @@ static void sk_endOverdraw(SK_Sketch *sketch)
{
SK_Stroke *stk = sketch->active_stroke;
- if (sk_hasOverdraw(sketch, NULL))
- {
+ if (sk_hasOverdraw(sketch, NULL)) {
int start;
int end;
- if (sk_adjustIndexes(sketch, &start, &end))
- {
+ if (sk_adjustIndexes(sketch, &start, &end)) {
sk_reverseStroke(stk);
}
- if (stk->nb_points > 1)
- {
+ if (stk->nb_points > 1) {
stk->points->type = sketch->over.target->points[start].type;
sk_lastStrokePoint(stk)->type = sketch->over.target->points[end].type;
}
@@ -948,8 +867,7 @@ static void sk_endStroke(bContext *C, SK_Sketch *sketch)
ToolSettings *ts = CTX_data_tool_settings(C);
sk_shrinkStrokeBuffer(sketch->active_stroke);
- if (ts->bone_sketching & BONE_SKETCHING_ADJUST)
- {
+ if (ts->bone_sketching & BONE_SKETCHING_ADJUST) {
sk_endOverdraw(sketch);
}
@@ -977,8 +895,7 @@ static float sk_distanceDepth(bContext *C, float p1[3], float p2[3])
distance = len_v3(vec);
- if (dot_v3v3(rv3d->viewinv[2], vec) > 0)
- {
+ if (dot_v3v3(rv3d->viewinv[2], vec) > 0) {
distance *= -1;
}
@@ -996,8 +913,7 @@ static void sk_interpolateDepth(bContext *C, SK_Stroke *stk, int start, int end,
progress = len_v3v3(stk->points[start].p, stk->points[start - 1].p);
- for (i = start; i <= end; i++)
- {
+ for (i = start; i <= end; i++) {
float ray_start[3], ray_normal[3];
float delta = len_v3v3(stk->points[i].p, stk->points[i + 1].p);
float pval[2];
@@ -1022,8 +938,7 @@ static void sk_projectDrawPoint(bContext *C, float vec[3], SK_Stroke *stk, SK_Dr
float dvec[3];
float mval_f[2];
- if (last != NULL)
- {
+ if (last != NULL) {
copy_v3_v3(fp, last->p);
}
@@ -1065,8 +980,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
ToolSettings *ts = CTX_data_tool_settings(C);
int point_added = 0;
- if (ts->snap_mode == SCE_SNAP_MODE_VOLUME)
- {
+ if (ts->snap_mode == SCE_SNAP_MODE_VOLUME) {
DepthPeel *p1, *p2;
float *last_p = NULL;
float dist = FLT_MAX;
@@ -1081,20 +995,16 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
mvalf[1]= dd->mval[1];
peelObjectsContext(C, &sketch->depth_peels, mvalf, SNAP_ALL);
- if (stk->nb_points > 0 && stk->points[stk->nb_points - 1].type == PT_CONTINUOUS)
- {
+ if (stk->nb_points > 0 && stk->points[stk->nb_points - 1].type == PT_CONTINUOUS) {
last_p = stk->points[stk->nb_points - 1].p;
}
- else if (LAST_SNAP_POINT_VALID)
- {
+ else if (LAST_SNAP_POINT_VALID) {
last_p = LAST_SNAP_POINT;
}
- for (p1 = sketch->depth_peels.first; p1; p1 = p1->next)
- {
- if (p1->flag == 0)
- {
+ for (p1 = sketch->depth_peels.first; p1; p1 = p1->next) {
+ if (p1->flag == 0) {
float vec[3];
float new_dist;
float new_size = 0;
@@ -1103,42 +1013,34 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
p1->flag = 1;
/* if peeling objects, take the first and last from each object */
- if (ts->snap_flag & SCE_SNAP_PEEL_OBJECT)
- {
+ if (ts->snap_flag & SCE_SNAP_PEEL_OBJECT) {
DepthPeel *peel;
- for (peel = p1->next; peel; peel = peel->next)
- {
- if (peel->ob == p1->ob)
- {
+ for (peel = p1->next; peel; peel = peel->next) {
+ if (peel->ob == p1->ob) {
peel->flag = 1;
p2 = peel;
}
}
}
/* otherwise, pair first with second and so on */
- else
- {
- for (p2 = p1->next; p2 && p2->ob != p1->ob; p2 = p2->next)
- {
+ else {
+ for (p2 = p1->next; p2 && p2->ob != p1->ob; p2 = p2->next) {
/* nothing to do here */
}
}
- if (p2)
- {
+ if (p2) {
p2->flag = 1;
add_v3_v3v3(vec, p1->p, p2->p);
mul_v3_fl(vec, 0.5f);
new_size = len_v3v3(p1->p, p2->p);
}
- else
- {
+ else {
copy_v3_v3(vec, p1->p);
}
- if (last_p == NULL)
- {
+ if (last_p == NULL) {
copy_v3_v3(p, vec);
size = new_size;
dist = 0;
@@ -1147,8 +1049,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
new_dist = len_v3v3(last_p, vec);
- if (new_dist < dist)
- {
+ if (new_dist < dist) {
copy_v3_v3(p, vec);
dist = new_dist;
size = new_size;
@@ -1156,8 +1057,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
}
}
- if (dist != FLT_MAX)
- {
+ if (dist != FLT_MAX) {
pt->type = dd->type;
pt->mode = PT_SNAP;
pt->size = size / 2;
@@ -1168,8 +1068,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
//BLI_freelistN(&depth_peels);
}
- else
- {
+ else {
SK_Stroke *snap_stk;
float vec[3];
float no[3];
@@ -1179,20 +1078,16 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
/* snap to strokes */
// if (ts->snap_mode == SCE_SNAP_MODE_VERTEX) /* snap all the time to strokes */
- for (snap_stk = sketch->strokes.first; snap_stk; snap_stk = snap_stk->next)
- {
+ for (snap_stk = sketch->strokes.first; snap_stk; snap_stk = snap_stk->next) {
SK_Point *spt = NULL;
- if (snap_stk == stk)
- {
+ if (snap_stk == stk) {
spt = sk_snapPointStroke(C, snap_stk, dd->mval, &dist, NULL, 0);
}
- else
- {
+ else {
spt = sk_snapPointStroke(C, snap_stk, dd->mval, &dist, NULL, 1);
}
- if (spt != NULL)
- {
+ if (spt != NULL) {
copy_v3_v3(pt->p, spt->p);
point_added = 1;
}
@@ -1203,8 +1098,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
/* try to snap to closer object */
found = snapObjectsContext(C, mval, &dist, vec, no, SNAP_NOT_SELECTED);
- if (found == 1)
- {
+ if (found == 1) {
pt->type = dd->type;
pt->mode = PT_SNAP;
copy_v3_v3(pt->p, vec);
@@ -1227,8 +1121,7 @@ static int sk_addStrokeSnapPoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk,
point_added = sk_getStrokeSnapPoint(C, &pt, sketch, stk, dd);
- if (point_added)
- {
+ if (point_added) {
float final_p[3];
float length, distance;
int total;
@@ -1242,18 +1135,15 @@ static int sk_addStrokeSnapPoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk,
/* update all previous point to give smooth Z progresion */
total = 0;
length = 0;
- for (i = stk->nb_points - 2; i > 0; i--)
- {
+ for (i = stk->nb_points - 2; i > 0; i--) {
length += len_v3v3(stk->points[i].p, stk->points[i + 1].p);
total++;
- if (stk->points[i].mode == PT_SNAP || stk->points[i].type == PT_EXACT)
- {
+ if (stk->points[i].mode == PT_SNAP || stk->points[i].type == PT_EXACT) {
break;
}
}
- if (total > 1)
- {
+ if (total > 1) {
distance = sk_distanceDepth(C, final_p, stk->points[i].p);
sk_interpolateDepth(C, stk, i + 1, stk->nb_points - 2, length, distance);
@@ -1272,18 +1162,15 @@ static void sk_addStrokePoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK
ToolSettings *ts = CTX_data_tool_settings(C);
int point_added = 0;
- if (snap)
- {
+ if (snap) {
point_added = sk_addStrokeSnapPoint(C, sketch, stk, dd);
}
- if (point_added == 0)
- {
+ if (point_added == 0) {
point_added = sk_addStrokeDrawPoint(C, sketch, stk, dd);
}
- if (stk == sketch->active_stroke && ts->bone_sketching & BONE_SKETCHING_ADJUST)
- {
+ if (stk == sketch->active_stroke && ts->bone_sketching & BONE_SKETCHING_ADJUST) {
sk_updateOverdraw(C, sketch, stk, dd);
}
}
@@ -1292,19 +1179,16 @@ static void sk_getStrokePoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_S
{
int point_added = 0;
- if (snap)
- {
+ if (snap) {
point_added = sk_getStrokeSnapPoint(C, pt, sketch, stk, dd);
LAST_SNAP_POINT_VALID = 1;
copy_v3_v3(LAST_SNAP_POINT, pt->p);
}
- else
- {
+ else {
LAST_SNAP_POINT_VALID = 0;
}
- if (point_added == 0)
- {
+ if (point_added == 0) {
point_added = sk_getStrokeDrawPoint(C, pt, sketch, stk, dd);
}
}
@@ -1334,15 +1218,13 @@ static SK_Point* setIteratorValues(SK_StrokeIterator *iter, int index)
{
SK_Point *pt = NULL;
- if (index >= 0 && index < iter->length)
- {
+ if (index >= 0 && index < iter->length) {
pt = &(iter->stroke->points[iter->start + (iter->stride * index)]);
iter->p = pt->p;
iter->no = pt->no;
iter->size = pt->size;
}
- else
- {
+ else {
iter->p = NULL;
iter->no = NULL;
iter->size = 0;
@@ -1358,14 +1240,12 @@ void initStrokeIterator(BArcIterator *arg, SK_Stroke *stk, int start, int end)
initIteratorFct(iter);
iter->stroke = stk;
- if (start < end)
- {
+ if (start < end) {
iter->start = start + 1;
iter->end = end - 1;
iter->stride = 1;
}
- else
- {
+ else {
iter->start = start - 1;
iter->end = end + 1;
iter->stride = -1;
@@ -1409,8 +1289,7 @@ static void* nextPoint(void *arg)
SK_Point *result = NULL;
iter->index++;
- if (iter->index < iter->length)
- {
+ if (iter->index < iter->length) {
result = setIteratorValues(iter, iter->index);
}
@@ -1425,8 +1304,7 @@ static void* nextNPoint(void *arg, int n)
iter->index += n;
/* check if passed end */
- if (iter->index < iter->length)
- {
+ if (iter->index < iter->length) {
result = setIteratorValues(iter, iter->index);
}
@@ -1440,8 +1318,7 @@ static void* peekPoint(void *arg, int n)
int index = iter->index + n;
/* check if passed end */
- if (index < iter->length)
- {
+ if (index < iter->length) {
result = setIteratorValues(iter, index);
}
@@ -1453,8 +1330,7 @@ static void* previousPoint(void *arg)
SK_StrokeIterator *iter = (SK_StrokeIterator*)arg;
SK_Point *result = NULL;
- if (iter->index > 0)
- {
+ if (iter->index > 0) {
iter->index--;
result = setIteratorValues(iter, iter->index);
}
@@ -1466,12 +1342,10 @@ static int iteratorStopped(void *arg)
{
SK_StrokeIterator *iter = (SK_StrokeIterator*)arg;
- if (iter->index >= iter->length)
- {
+ if (iter->index >= iter->length) {
return 1;
}
- else
- {
+ else {
return 0;
}
}
@@ -1495,45 +1369,36 @@ static void sk_convertStroke(bContext *C, SK_Stroke *stk)
copy_m3_m4(tmat, obedit->obmat);
transpose_m3(tmat);
- for (i = 0; i < stk->nb_points; i++)
- {
+ for (i = 0; i < stk->nb_points; i++) {
SK_Point *pt = stk->points + i;
- if (pt->type == PT_EXACT)
- {
- if (head == NULL)
- {
+ if (pt->type == PT_EXACT) {
+ if (head == NULL) {
head_index = i;
head = pt;
}
- else
- {
+ else {
EditBone *bone = NULL;
EditBone *new_parent;
- if (i - head_index > 1)
- {
+ if (i - head_index > 1) {
SK_StrokeIterator sk_iter;
BArcIterator *iter = (BArcIterator*)&sk_iter;
initStrokeIterator(iter, stk, head_index, i);
- if (ts->bone_sketching_convert == SK_CONVERT_CUT_ADAPTATIVE)
- {
+ if (ts->bone_sketching_convert == SK_CONVERT_CUT_ADAPTATIVE) {
bone = subdivideArcBy(ts, arm, arm->edbo, iter, invmat, tmat, nextAdaptativeSubdivision);
}
- else if (ts->bone_sketching_convert == SK_CONVERT_CUT_LENGTH)
- {
+ else if (ts->bone_sketching_convert == SK_CONVERT_CUT_LENGTH) {
bone = subdivideArcBy(ts, arm, arm->edbo, iter, invmat, tmat, nextLengthSubdivision);
}
- else if (ts->bone_sketching_convert == SK_CONVERT_CUT_FIXED)
- {
+ else if (ts->bone_sketching_convert == SK_CONVERT_CUT_FIXED) {
bone = subdivideArcBy(ts, arm, arm->edbo, iter, invmat, tmat, nextFixedSubdivision);
}
}
- if (bone == NULL)
- {
+ if (bone == NULL) {
bone = ED_armature_edit_bone_add(arm, "Bone");
copy_v3_v3(bone->head, head->p);
@@ -1548,14 +1413,12 @@ static void sk_convertStroke(bContext *C, SK_Stroke *stk)
bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
/* move to end of chain */
- while (bone->parent != NULL)
- {
+ while (bone->parent != NULL) {
bone = bone->parent;
bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
}
- if (parent != NULL)
- {
+ if (parent != NULL) {
bone->parent = parent;
bone->flag |= BONE_CONNECTED;
}
@@ -1573,16 +1436,12 @@ static void sk_convert(bContext *C, SK_Sketch *sketch)
ToolSettings *ts = CTX_data_tool_settings(C);
SK_Stroke *stk;
- for (stk = sketch->strokes.first; stk; stk = stk->next)
- {
- if (stk->selected == 1)
- {
- if (ts->bone_sketching_convert == SK_CONVERT_RETARGET)
- {
+ for (stk = sketch->strokes.first; stk; stk = stk->next) {
+ if (stk->selected == 1) {
+ if (ts->bone_sketching_convert == SK_CONVERT_RETARGET) {
sk_retargetStroke(C, stk);
}
- else
- {
+ else {
sk_convertStroke(C, stk);
}
// XXX
@@ -1600,8 +1459,7 @@ static int sk_getSelfIntersections(bContext *C, ListBase *list, SK_Stroke *gestu
int added = 0;
int s_i;
- for (s_i = 0; s_i < gesture->nb_points - 1; s_i++)
- {
+ for (s_i = 0; s_i < gesture->nb_points - 1; s_i++) {
float s_p1[3] = {0, 0, 0};
float s_p2[3] = {0, 0, 0};
int g_i;
@@ -1610,8 +1468,7 @@ static int sk_getSelfIntersections(bContext *C, ListBase *list, SK_Stroke *gestu
project_float(ar, gesture->points[s_i + 1].p, s_p2);
/* start checking from second next, because two consecutive cannot intersect */
- for (g_i = s_i + 2; g_i < gesture->nb_points - 1; g_i++)
- {
+ for (g_i = s_i + 2; g_i < gesture->nb_points - 1; g_i++) {
float g_p1[3] = {0, 0, 0};
float g_p2[3] = {0, 0, 0};
float vi[3];
@@ -1620,8 +1477,7 @@ static int sk_getSelfIntersections(bContext *C, ListBase *list, SK_Stroke *gestu
project_float(ar, gesture->points[g_i].p, g_p1);
project_float(ar, gesture->points[g_i + 1].p, g_p2);
- if (isect_line_line_strict_v3(s_p1, s_p2, g_p1, g_p2, vi, &lambda))
- {
+ if (isect_line_line_strict_v3(s_p1, s_p2, g_p1, g_p2, vi, &lambda)) {
SK_Intersection *isect = MEM_callocN(sizeof(SK_Intersection), "Intersection");
isect->gesture_index = g_i;
@@ -1647,24 +1503,18 @@ static int cmpIntersections(void *i1, void *i2)
{
SK_Intersection *isect1 = i1, *isect2 = i2;
- if (isect1->stroke == isect2->stroke)
- {
- if (isect1->before < isect2->before)
- {
+ if (isect1->stroke == isect2->stroke) {
+ if (isect1->before < isect2->before) {
return -1;
}
- else if (isect1->before > isect2->before)
- {
+ else if (isect1->before > isect2->before) {
return 1;
}
- else
- {
- if (isect1->lambda < isect2->lambda)
- {
+ else {
+ if (isect1->lambda < isect2->lambda) {
return -1;
}
- else if (isect1->lambda > isect2->lambda)
- {
+ else if (isect1->lambda > isect2->lambda) {
return 1;
}
}
@@ -1683,13 +1533,11 @@ static int sk_getIntersections(bContext *C, ListBase *list, SK_Sketch *sketch, S
SK_Stroke *stk;
int added = 0;
- for (stk = sketch->strokes.first; stk; stk = stk->next)
- {
+ for (stk = sketch->strokes.first; stk; stk = stk->next) {
int s_added = 0;
int s_i;
- for (s_i = 0; s_i < stk->nb_points - 1; s_i++)
- {
+ for (s_i = 0; s_i < stk->nb_points - 1; s_i++) {
float s_p1[3] = {0, 0, 0};
float s_p2[3] = {0, 0, 0};
int g_i;
@@ -1697,8 +1545,7 @@ static int sk_getIntersections(bContext *C, ListBase *list, SK_Sketch *sketch, S
project_float(ar, stk->points[s_i].p, s_p1);
project_float(ar, stk->points[s_i + 1].p, s_p2);
- for (g_i = 0; g_i < gesture->nb_points - 1; g_i++)
- {
+ for (g_i = 0; g_i < gesture->nb_points - 1; g_i++) {
float g_p1[3] = {0, 0, 0};
float g_p2[3] = {0, 0, 0};
float vi[3];
@@ -1707,8 +1554,7 @@ static int sk_getIntersections(bContext *C, ListBase *list, SK_Sketch *sketch, S
project_float(ar, gesture->points[g_i].p, g_p1);
project_float(ar, gesture->points[g_i + 1].p, g_p2);
- if (isect_line_line_strict_v3(s_p1, s_p2, g_p1, g_p2, vi, &lambda))
- {
+ if (isect_line_line_strict_v3(s_p1, s_p2, g_p1, g_p2, vi, &lambda)) {
SK_Intersection *isect = MEM_callocN(sizeof(SK_Intersection), "Intersection");
float ray_start[3], ray_end[3];
float mval[2];
@@ -1723,12 +1569,12 @@ static int sk_getIntersections(bContext *C, ListBase *list, SK_Sketch *sketch, S
mval[1] = vi[1];
ED_view3d_win_to_segment_clip(ar, v3d, mval, ray_start, ray_end);
- isect_line_line_v3( stk->points[s_i].p,
- stk->points[s_i + 1].p,
- ray_start,
- ray_end,
- isect->p,
- vi);
+ isect_line_line_v3(stk->points[s_i].p,
+ stk->points[s_i + 1].p,
+ ray_start,
+ ray_end,
+ isect->p,
+ vi);
BLI_addtail(list, isect);
@@ -1759,15 +1605,13 @@ static int sk_getSegments(SK_Stroke *segments, SK_Stroke *gesture)
initStrokeIterator(iter, gesture, 0, gesture->nb_points - 1);
- for (i = 1, j = 0; i < gesture->nb_points; i++)
- {
+ for (i = 1, j = 0; i < gesture->nb_points; i++) {
float n[3];
/* Calculate normal */
sub_v3_v3v3(n, gesture->points[i].p, vec);
- if (calcArcCorrelation(iter, j, i, vec, n) < CORRELATION_THRESHOLD)
- {
+ if (calcArcCorrelation(iter, j, i, vec, n) < CORRELATION_THRESHOLD) {
j = i - 1;
sk_appendStrokePoint(segments, &gesture->points[j]);
vec = segments->points[segments->nb_points - 1].p;
@@ -1782,8 +1626,7 @@ static int sk_getSegments(SK_Stroke *segments, SK_Stroke *gesture)
int sk_detectCutGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
- if (gest->nb_segments == 1 && gest->nb_intersections == 1)
- {
+ if (gest->nb_segments == 1 && gest->nb_intersections == 1) {
return 1;
}
@@ -1794,8 +1637,7 @@ void sk_applyCutGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED
{
SK_Intersection *isect;
- for (isect = gest->intersections.first; isect; isect = isect->next)
- {
+ for (isect = gest->intersections.first; isect; isect = isect->next) {
SK_Point pt;
pt.type = PT_EXACT;
@@ -1809,8 +1651,7 @@ void sk_applyCutGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED
int sk_detectTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
- if (gest->nb_segments == 2 && gest->nb_intersections == 1 && gest->nb_self_intersections == 0)
- {
+ if (gest->nb_segments == 2 && gest->nb_intersections == 1 && gest->nb_self_intersections == 0) {
float s1[3], s2[3];
float angle;
@@ -1819,8 +1660,7 @@ int sk_detectTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSE
angle = RAD2DEGF(angle_v2v2(s1, s2));
- if (angle > 60 && angle < 120)
- {
+ if (angle > 60 && angle < 120) {
return 1;
}
}
@@ -1835,8 +1675,7 @@ void sk_applyTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSE
sub_v3_v3v3(trim_dir, gest->segments->points[2].p, gest->segments->points[1].p);
- for (isect = gest->intersections.first; isect; isect = isect->next)
- {
+ for (isect = gest->intersections.first; isect; isect = isect->next) {
SK_Point pt;
float stroke_dir[3];
@@ -1848,14 +1687,12 @@ void sk_applyTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSE
sub_v3_v3v3(stroke_dir, isect->stroke->points[isect->after].p, isect->stroke->points[isect->before].p);
/* same direction, trim end */
- if (dot_v3v3(stroke_dir, trim_dir) > 0)
- {
+ if (dot_v3v3(stroke_dir, trim_dir) > 0) {
sk_replaceStrokePoint(isect->stroke, &pt, isect->after);
sk_trimStroke(isect->stroke, 0, isect->after);
}
/* else, trim start */
- else
- {
+ else {
sk_replaceStrokePoint(isect->stroke, &pt, isect->before);
sk_trimStroke(isect->stroke, isect->before, isect->stroke->nb_points - 1);
}
@@ -1865,15 +1702,12 @@ void sk_applyTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSE
int sk_detectCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
- if (gest->nb_segments > 2 && gest->nb_intersections == 2 && gest->nb_self_intersections == 1)
- {
+ if (gest->nb_segments > 2 && gest->nb_intersections == 2 && gest->nb_self_intersections == 1) {
SK_Intersection *isect, *self_isect;
/* get the the last intersection of the first pair */
- for ( isect = gest->intersections.first; isect; isect = isect->next )
- {
- if (isect->stroke == isect->next->stroke)
- {
+ for ( isect = gest->intersections.first; isect; isect = isect->next ) {
+ if (isect->stroke == isect->next->stroke) {
isect = isect->next;
break;
}
@@ -1881,8 +1715,7 @@ int sk_detectCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN
self_isect = gest->self_intersections.first;
- if (isect && isect->gesture_index < self_isect->gesture_index)
- {
+ if (isect && isect->gesture_index < self_isect->gesture_index) {
return 1;
}
}
@@ -1899,16 +1732,13 @@ void sk_applyCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN
// command = pupmenu("Action %t|Flatten %x1|Straighten %x2|Polygonize %x3");
if (command < 1) return;
- for (isect = gest->intersections.first; isect; isect = isect->next)
- {
+ for (isect = gest->intersections.first; isect; isect = isect->next) {
SK_Intersection *i2;
i2 = isect->next;
- if (i2 && i2->stroke == isect->stroke)
- {
- switch (command)
- {
+ if (i2 && i2->stroke == isect->stroke) {
+ switch (command) {
case 1:
sk_flattenStroke(isect->stroke, isect->before, i2->after);
break;
@@ -1927,8 +1757,7 @@ void sk_applyCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN
int sk_detectDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
- if (gest->nb_segments == 2 && gest->nb_intersections == 2)
- {
+ if (gest->nb_segments == 2 && gest->nb_intersections == 2) {
float s1[3], s2[3];
float angle;
@@ -1937,8 +1766,7 @@ int sk_detectDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNU
angle = RAD2DEGF(angle_v2v2(s1, s2));
- if (angle > 120)
- {
+ if (angle > 120) {
return 1;
}
}
@@ -1950,11 +1778,9 @@ void sk_applyDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *ske
{
SK_Intersection *isect;
- for (isect = gest->intersections.first; isect; isect = isect->next)
- {
+ for (isect = gest->intersections.first; isect; isect = isect->next) {
/* only delete strokes that are crossed twice */
- if (isect->next && isect->next->stroke == isect->stroke)
- {
+ if (isect->next && isect->next->stroke == isect->stroke) {
isect = isect->next;
sk_removeStroke(sketch, isect->stroke);
@@ -1965,8 +1791,7 @@ void sk_applyDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *ske
int sk_detectMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
ARegion *ar = CTX_wm_region(C);
- if (gest->nb_segments > 2 && gest->nb_intersections == 2)
- {
+ if (gest->nb_segments > 2 && gest->nb_intersections == 2) {
short start_val[2], end_val[2];
short dist;
@@ -1976,26 +1801,21 @@ int sk_detectMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *UNUSED(sketc
dist = MAX2(ABS(start_val[0] - end_val[0]), ABS(start_val[1] - end_val[1]));
/* if gesture is a circle */
- if ( dist <= 20 )
- {
+ if ( dist <= 20 ) {
SK_Intersection *isect;
/* check if it circled around an exact point */
- for (isect = gest->intersections.first; isect; isect = isect->next)
- {
+ for (isect = gest->intersections.first; isect; isect = isect->next) {
/* only delete strokes that are crossed twice */
- if (isect->next && isect->next->stroke == isect->stroke)
- {
+ if (isect->next && isect->next->stroke == isect->stroke) {
int start_index, end_index;
int i;
start_index = MIN2(isect->after, isect->next->after);
end_index = MAX2(isect->before, isect->next->before);
- for (i = start_index; i <= end_index; i++)
- {
- if (isect->stroke->points[i].type == PT_EXACT)
- {
+ for (i = start_index; i <= end_index; i++) {
+ if (isect->stroke->points[i].type == PT_EXACT) {
return 1; /* at least one exact point found, stop detect here */
}
}
@@ -2015,22 +1835,18 @@ void sk_applyMergeGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUS
SK_Intersection *isect;
/* check if it circled around an exact point */
- for (isect = gest->intersections.first; isect; isect = isect->next)
- {
+ for (isect = gest->intersections.first; isect; isect = isect->next) {
/* only merge strokes that are crossed twice */
- if (isect->next && isect->next->stroke == isect->stroke)
- {
+ if (isect->next && isect->next->stroke == isect->stroke) {
int start_index, end_index;
int i;
start_index = MIN2(isect->after, isect->next->after);
end_index = MAX2(isect->before, isect->next->before);
- for (i = start_index; i <= end_index; i++)
- {
+ for (i = start_index; i <= end_index; i++) {
/* if exact, switch to continuous */
- if (isect->stroke->points[i].type == PT_EXACT)
- {
+ if (isect->stroke->points[i].type == PT_EXACT) {
isect->stroke->points[i].type = PT_CONTINUOUS;
}
}
@@ -2043,34 +1859,28 @@ void sk_applyMergeGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUS
int sk_detectReverseGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
- if (gest->nb_segments > 2 && gest->nb_intersections == 2 && gest->nb_self_intersections == 0)
- {
+ if (gest->nb_segments > 2 && gest->nb_intersections == 2 && gest->nb_self_intersections == 0) {
SK_Intersection *isect;
/* check if it circled around an exact point */
- for (isect = gest->intersections.first; isect; isect = isect->next)
- {
+ for (isect = gest->intersections.first; isect; isect = isect->next) {
/* only delete strokes that are crossed twice */
- if (isect->next && isect->next->stroke == isect->stroke)
- {
+ if (isect->next && isect->next->stroke == isect->stroke) {
float start_v[3], end_v[3];
float angle;
- if (isect->gesture_index < isect->next->gesture_index)
- {
+ if (isect->gesture_index < isect->next->gesture_index) {
sub_v3_v3v3(start_v, isect->p, gest->stk->points[0].p);
sub_v3_v3v3(end_v, sk_lastStrokePoint(gest->stk)->p, isect->next->p);
}
- else
- {
+ else {
sub_v3_v3v3(start_v, isect->next->p, gest->stk->points[0].p);
sub_v3_v3v3(end_v, sk_lastStrokePoint(gest->stk)->p, isect->p);
}
angle = RAD2DEGF(angle_v2v2(start_v, end_v));
- if (angle > 120)
- {
+ if (angle > 120) {
return 1;
}
@@ -2087,11 +1897,9 @@ void sk_applyReverseGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN
{
SK_Intersection *isect;
- for (isect = gest->intersections.first; isect; isect = isect->next)
- {
+ for (isect = gest->intersections.first; isect; isect = isect->next) {
/* only reverse strokes that are crossed twice */
- if (isect->next && isect->next->stroke == isect->stroke)
- {
+ if (isect->next && isect->next->stroke == isect->stroke) {
sk_reverseStroke(isect->stroke);
/* skip next */
@@ -2102,8 +1910,7 @@ void sk_applyReverseGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN
int sk_detectConvertGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch))
{
- if (gest->nb_segments == 3 && gest->nb_self_intersections == 1)
- {
+ if (gest->nb_segments == 3 && gest->nb_self_intersections == 1) {
return 1;
}
return 0;
@@ -2142,10 +1949,8 @@ static void sk_applyGesture(bContext *C, SK_Sketch *sketch)
sk_initGesture(C, &gest, sketch);
/* detect and apply */
- for (act = GESTURE_ACTIONS; act->apply != NULL; act++)
- {
- if (act->detect(C, &gest, sketch))
- {
+ for (act = GESTURE_ACTIONS; act->apply != NULL; act++) {
+ if (act->detect(C, &gest, sketch)) {
act->apply(C, &gest, sketch);
break;
}
@@ -2173,8 +1978,7 @@ static int sk_selectStroke(bContext *C, SK_Sketch *sketch, const int mval[2], in
hits = view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect);
- if (hits>0)
- {
+ if (hits>0) {
int besthitresult = -1;
if (hits == 1) {
@@ -2185,18 +1989,15 @@ static int sk_selectStroke(bContext *C, SK_Sketch *sketch, const int mval[2], in
/* loop and get best hit */
}
- if (besthitresult > 0)
- {
+ if (besthitresult > 0) {
SK_Stroke *selected_stk = BLI_findlink(&sketch->strokes, besthitresult - 1);
- if (extend == 0)
- {
+ if (extend == 0) {
sk_selectAllSketch(sketch, -1);
selected_stk->selected = 1;
}
- else
- {
+ else {
selected_stk->selected ^= 1;
}
@@ -2232,50 +2033,41 @@ static void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch,
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
- if (with_names)
- {
+ if (with_names) {
int id;
- for (id = 1, stk = sketch->strokes.first; stk; id++, stk = stk->next)
- {
+ for (id = 1, stk = sketch->strokes.first; stk; id++, stk = stk->next) {
sk_drawStroke(stk, id, NULL, -1, -1);
}
glLoadName(-1);
}
- else
- {
+ else {
float selected_rgb[3] = {1, 0, 0};
float unselected_rgb[3] = {1, 0.5, 0};
- for (stk = sketch->strokes.first; stk; stk = stk->next)
- {
+ for (stk = sketch->strokes.first; stk; stk = stk->next) {
int start = -1;
int end = -1;
- if (sk_hasOverdraw(sketch, stk))
- {
+ if (sk_hasOverdraw(sketch, stk)) {
sk_adjustIndexes(sketch, &start, &end);
}
sk_drawStroke(stk, -1, (stk->selected==1?selected_rgb:unselected_rgb), start, end);
- if (stk->selected == 1)
- {
+ if (stk->selected == 1) {
sk_drawStrokeSubdivision(ts, stk);
}
}
- if (sketch->active_stroke != NULL)
- {
+ if (sketch->active_stroke != NULL) {
SK_Point *last = sk_lastStrokePoint(sketch->active_stroke);
- if (ts->bone_sketching & BONE_SKETCHING_QUICK)
- {
+ if (ts->bone_sketching & BONE_SKETCHING_QUICK) {
sk_drawStrokeSubdivision(ts, sketch->active_stroke);
}
- if (last != NULL)
- {
+ if (last != NULL) {
GLUquadric *quad = gluNewQuadric();
gluQuadricNormals(quad, GLU_SMOOTH);
@@ -2284,8 +2076,7 @@ static void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch,
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- switch (sketch->next_point.mode)
- {
+ switch (sketch->next_point.mode) {
case PT_SNAP:
glColor3f(0, 1, 0);
break;
@@ -2345,8 +2136,7 @@ static void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch,
glDisable(GL_DEPTH_TEST);
/* only draw gesture in active area */
- if (sketch->gesture != NULL /*&& area_is_active_area(G.vd->area)*/)
- {
+ if (sketch->gesture != NULL /* && area_is_active_area(G.vd->area) */) {
float gesture_rgb[3] = {0, 0.5, 1};
sk_drawStroke(sketch->gesture, -1, gesture_rgb, -1, -1);
}
@@ -2356,20 +2146,16 @@ static int sk_finish_stroke(bContext *C, SK_Sketch *sketch)
{
ToolSettings *ts = CTX_data_tool_settings(C);
- if (sketch->active_stroke != NULL)
- {
+ if (sketch->active_stroke != NULL) {
SK_Stroke *stk = sketch->active_stroke;
sk_endStroke(C, sketch);
- if (ts->bone_sketching & BONE_SKETCHING_QUICK)
- {
- if (ts->bone_sketching_convert == SK_CONVERT_RETARGET)
- {
+ if (ts->bone_sketching & BONE_SKETCHING_QUICK) {
+ if (ts->bone_sketching_convert == SK_CONVERT_RETARGET) {
sk_retargetStroke(C, stk);
}
- else
- {
+ else {
sk_convertStroke(C, stk);
}
// XXX
@@ -2389,8 +2175,7 @@ static int sk_finish_stroke(bContext *C, SK_Sketch *sketch)
static void sk_start_draw_stroke(SK_Sketch *sketch)
{
- if (sketch->active_stroke == NULL)
- {
+ if (sketch->active_stroke == NULL) {
sk_startStroke(sketch);
sk_selectAllSketch(sketch, -1);
@@ -2405,8 +2190,7 @@ static void sk_start_draw_gesture(SK_Sketch *sketch)
static int sk_draw_stroke(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd, short snap)
{
- if (sk_stroke_filtermval(dd))
- {
+ if (sk_stroke_filtermval(dd)) {
sk_addStrokePoint(C, sketch, stk, dd, snap);
sk_updateDrawData(dd);
sk_updateNextPoint(sketch, stk);
@@ -2428,19 +2212,16 @@ static int ValidSketchViewContext(ViewContext *vc)
{
return 1;
}
- else
- {
+ else {
return 0;
}
}
int BDR_drawSketchNames(ViewContext *vc)
{
- if (ValidSketchViewContext(vc))
- {
+ if (ValidSketchViewContext(vc)) {
SK_Sketch *sketch = viewcontextSketch(vc, 0);
- if (sketch)
- {
+ if (sketch) {
sk_drawSketch(vc->scene, vc->v3d, sketch, 1);
return 1;
}
@@ -2451,11 +2232,9 @@ int BDR_drawSketchNames(ViewContext *vc)
void BDR_drawSketch(const bContext *C)
{
- if (ED_operator_sketch_mode(C))
- {
+ if (ED_operator_sketch_mode(C)) {
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch)
- {
+ if (sketch) {
sk_drawSketch(CTX_data_scene(C), CTX_wm_view3d(C), sketch, 0);
}
}
@@ -2464,8 +2243,7 @@ void BDR_drawSketch(const bContext *C)
static int sketch_delete(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch)
- {
+ if (sketch) {
sk_deleteSelectedStrokes(sketch);
// allqueue(REDRAWVIEW3D, 0);
}
@@ -2478,8 +2256,7 @@ void BIF_sk_selectStroke(bContext *C, const int mval[2], short extend)
ToolSettings *ts = CTX_data_tool_settings(C);
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch != NULL && ts->bone_sketching & BONE_SKETCHING)
- {
+ if (sketch != NULL && ts->bone_sketching & BONE_SKETCHING) {
if (sk_selectStroke(C, sketch, mval, extend))
ED_area_tag_redraw(CTX_wm_area(C));
}
@@ -2487,11 +2264,9 @@ void BIF_sk_selectStroke(bContext *C, const int mval[2], short extend)
void BIF_convertSketch(bContext *C)
{
- if (ED_operator_sketch_full_mode(C))
- {
+ if (ED_operator_sketch_full_mode(C)) {
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch)
- {
+ if (sketch) {
sk_convert(C, sketch);
// BIF_undo_push("Convert Sketch");
// allqueue(REDRAWVIEW3D, 0);
@@ -2502,11 +2277,9 @@ void BIF_convertSketch(bContext *C)
void BIF_deleteSketch(bContext *C)
{
- if (ED_operator_sketch_full_mode(C))
- {
+ if (ED_operator_sketch_full_mode(C)) {
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch)
- {
+ if (sketch) {
sk_deleteSelectedStrokes(sketch);
// BIF_undo_push("Convert Sketch");
// allqueue(REDRAWVIEW3D, 0);
@@ -2535,12 +2308,10 @@ SK_Sketch* contextSketch(const bContext *C, int create)
Object *obedit = CTX_data_edit_object(C);
SK_Sketch *sketch = NULL;
- if (obedit && obedit->type == OB_ARMATURE)
- {
+ if (obedit && obedit->type == OB_ARMATURE) {
bArmature *arm = obedit->data;
- if (arm->sketch == NULL && create)
- {
+ if (arm->sketch == NULL && create) {
arm->sketch = createSketch();
}
sketch = arm->sketch;
@@ -2554,12 +2325,10 @@ SK_Sketch* viewcontextSketch(ViewContext *vc, int create)
Object *obedit = vc->obedit;
SK_Sketch *sketch = NULL;
- if (obedit && obedit->type == OB_ARMATURE)
- {
+ if (obedit && obedit->type == OB_ARMATURE) {
bArmature *arm = obedit->data;
- if (arm->sketch == NULL && create)
- {
+ if (arm->sketch == NULL && create) {
arm->sketch = createSketch();
}
sketch = arm->sketch;
@@ -2571,8 +2340,7 @@ SK_Sketch* viewcontextSketch(ViewContext *vc, int create)
static int sketch_convert(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch != NULL)
- {
+ if (sketch != NULL) {
sk_convert(C, sketch);
ED_area_tag_redraw(CTX_wm_area(C));
}
@@ -2582,8 +2350,7 @@ static int sketch_convert(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(e
static int sketch_cancel(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch != NULL)
- {
+ if (sketch != NULL) {
sk_cancelStroke(sketch);
ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
@@ -2594,10 +2361,8 @@ static int sketch_cancel(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(ev
static int sketch_finish(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch != NULL)
- {
- if (sk_finish_stroke(C, sketch))
- {
+ if (sketch != NULL) {
+ if (sk_finish_stroke(C, sketch)) {
ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
}
@@ -2608,8 +2373,7 @@ static int sketch_finish(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(ev
static int sketch_select(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch)
- {
+ if (sketch) {
short extend = 0;
if (sk_selectStroke(C, sketch, event->mval, extend))
ED_area_tag_redraw(CTX_wm_area(C));
@@ -2677,8 +2441,7 @@ static int sketch_draw_modal(bContext *C, wmOperator *op, wmEvent *event, short
SK_Sketch *sketch = contextSketch(C, 1); /* create just to be sure */
int retval = OPERATOR_RUNNING_MODAL;
- switch (event->type)
- {
+ switch (event->type) {
case LEFTCTRLKEY:
case RIGHTCTRLKEY:
snap = event->ctrl;
@@ -2697,10 +2460,8 @@ static int sketch_draw_modal(bContext *C, wmOperator *op, wmEvent *event, short
retval = OPERATOR_CANCELLED;
break;
case LEFTMOUSE:
- if (event->val == KM_RELEASE)
- {
- if (gesture == 0)
- {
+ if (event->val == KM_RELEASE) {
+ if (gesture == 0) {
sk_endContinuousStroke(stk);
sk_filterLastContinuousStroke(stk);
sk_updateNextPoint(sketch, stk);
@@ -2708,13 +2469,11 @@ static int sketch_draw_modal(bContext *C, wmOperator *op, wmEvent *event, short
MEM_freeN(op->customdata);
retval = OPERATOR_FINISHED;
}
- else
- {
+ else {
sk_endContinuousStroke(stk);
sk_filterLastContinuousStroke(stk);
- if (stk->nb_points > 1)
- {
+ if (stk->nb_points > 1) {
/* apply gesture here */
sk_applyGesture(C, sketch);
}
@@ -2750,8 +2509,7 @@ static int sketch_draw_preview(bContext *C, wmOperator *op, wmEvent *event)
short snap = RNA_boolean_get(op->ptr, "snap");
SK_Sketch *sketch = contextSketch(C, 0);
- if (sketch)
- {
+ if (sketch) {
SK_DrawData dd;
sk_initDrawData(&dd, event->mval);
@@ -2775,8 +2533,7 @@ int ED_operator_sketch_mode_active_stroke(bContext *C)
{
return 1;
}
- else
- {
+ else {
return 0;
}
}
@@ -2793,8 +2550,7 @@ static int ED_operator_sketch_mode_gesture(bContext *C)
{
return 1;
}
- else
- {
+ else {
return 0;
}
}
@@ -2811,8 +2567,7 @@ int ED_operator_sketch_full_mode(bContext *C)
{
return 1;
}
- else
- {
+ else {
return 0;
}
}
@@ -2828,8 +2583,7 @@ int ED_operator_sketch_mode(const bContext *C)
{
return 1;
}
- else
- {
+ else {
return 0;
}
}
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 59a7437e753..3828c025bcd 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -584,7 +584,7 @@ static void heat_calc_vnormals(LaplacianSystem *sys)
v2= (*face)[1];
v3= (*face)[2];
- normal_tri_v3( fnor,sys->verts[v1], sys->verts[v2], sys->verts[v3]);
+ normal_tri_v3(fnor, sys->verts[v1], sys->verts[v2], sys->verts[v3]);
add_v3_v3(sys->heat.vnors[v1], fnor);
add_v3_v3(sys->heat.vnors[v2], fnor);
@@ -945,7 +945,7 @@ void rigid_deform_iteration()
}
}
- /* solve for positions, for X,Y and Z separately */
+ /* solve for positions, for X, Y and Z separately */
for (i=0; i<3; i++) {
laplacian_begin_solve(sys, i);
@@ -1069,7 +1069,7 @@ void rigid_deform_end(int cancel)
#define MESHDEFORM_MIN_INFLUENCE 0.0005f
static int MESHDEFORM_OFFSET[7][3] =
- {{0,0,0}, {1,0,0}, {-1,0,0}, {0,1,0}, {0,-1,0}, {0,0,1}, {0,0,-1}};
+ {{0, 0, 0}, {1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1}};
typedef struct MDefBoundIsect {
float co[3], uvw[4];
@@ -1128,10 +1128,10 @@ typedef struct MeshDeformIsect {
/* our own triangle intersection, so we can fully control the epsilons and
* prevent corner case from going wrong*/
static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3],
- float vert1[3], float vert2[3], float *isectco, float *uvw)
+ float vert1[3], float vert2[3], float *isectco, float *uvw)
{
float edge1[3], edge2[3], tvec[3], pvec[3], qvec[3];
- float det,inv_det, u, v, dir[3], isectdir[3];
+ float det, inv_det, u, v, dir[3], isectdir[3];
sub_v3_v3v3(dir, end, orig);
@@ -1208,16 +1208,16 @@ static int meshdeform_intersect(MeshDeformBind *mdb, MeshDeformIsect *isec)
hit = meshdeform_tri_intersect(isec->start, end, face[0], face[1], face[2], co, uvw);
if (hit) {
- normal_tri_v3( nor,face[0], face[1], face[2]);
+ normal_tri_v3(nor, face[0], face[1], face[2]);
}
else {
hit= meshdeform_tri_intersect(isec->start, end, face[0], face[2], face[3], co, uvw);
- normal_tri_v3( nor,face[0], face[2], face[3]);
+ normal_tri_v3(nor, face[0], face[2], face[3]);
}
}
else {
hit= meshdeform_tri_intersect(isec->start, end, face[0], face[1], face[2], co, uvw);
- normal_tri_v3( nor,face[0], face[1], face[2]);
+ normal_tri_v3(nor, face[0], face[1], face[2]);
}
if (hit) {
@@ -1281,7 +1281,7 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float
copy_v3_v3(vert[1], cagecos[mface->v2]);
copy_v3_v3(vert[2], cagecos[mface->v3]);
if (mface->v4) copy_v3_v3(vert[3], cagecos[mface->v4]);
- interp_weights_poly_v3( isect->uvw,vert, isect->nvert, isect->co);
+ interp_weights_poly_v3(isect->uvw, vert, isect->nvert, isect->co);
return isect;
}
diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c
index be520d1e8a0..40dc0a7cd36 100644
--- a/source/blender/editors/armature/poseSlide.c
+++ b/source/blender/editors/armature/poseSlide.c
@@ -433,7 +433,7 @@ static void pose_slide_apply_quat (tPoseSlideOp *pso, tPChanFCurveLink *pfl)
/* perform this blending several times until a satisfactory result is reached */
while (iters-- > 0) {
/* calculate the interpolation between the endpoints */
- interp_qt_qtqt(quat_interp, quat_prev, quat_next, (cframe-pso->prevFrame) / (pso->nextFrame-pso->prevFrame) );
+ interp_qt_qtqt(quat_interp, quat_prev, quat_next, (cframe-pso->prevFrame) / (pso->nextFrame-pso->prevFrame));
/* make a copy of the original rotation */
copy_qt_qt(quat_orig, pchan->quat);
@@ -759,7 +759,7 @@ static int pose_slide_push_exec (bContext *C, wmOperator *op)
return pose_slide_exec_common(C, op, pso);
}
-void POSE_OT_push (wmOperatorType *ot)
+void POSE_OT_push(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Push Pose";
@@ -816,7 +816,7 @@ static int pose_slide_relax_exec (bContext *C, wmOperator *op)
return pose_slide_exec_common(C, op, pso);
}
-void POSE_OT_relax (wmOperatorType *ot)
+void POSE_OT_relax(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Relax Pose";
@@ -873,7 +873,7 @@ static int pose_slide_breakdown_exec (bContext *C, wmOperator *op)
return pose_slide_exec_common(C, op, pso);
}
-void POSE_OT_breakdown (wmOperatorType *ot)
+void POSE_OT_breakdown(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Pose Breakdowner";
@@ -1228,7 +1228,7 @@ static int pose_propagate_exec (bContext *C, wmOperator *op)
/* --------------------------------- */
-void POSE_OT_propagate (wmOperatorType *ot)
+void POSE_OT_propagate(wmOperatorType *ot)
{
static EnumPropertyItem terminate_items[]= {
{POSE_PROPAGATE_SMART_HOLDS, "WHILE_HELD", 0, "While Held", "Propagate pose to all keyframes after current frame that don't change (Default behavior)"},
diff --git a/source/blender/editors/armature/poseUtils.c b/source/blender/editors/armature/poseUtils.c
index 1a9ff73e5dc..c32655fb680 100644
--- a/source/blender/editors/armature/poseUtils.c
+++ b/source/blender/editors/armature/poseUtils.c
@@ -126,13 +126,12 @@ static void fcurves_to_pchan_links_get (ListBase *pfLinks, Object *ob, bAction *
/* get sets of F-Curves providing transforms for the bones in the Pose */
-void poseAnim_mapping_get (bContext *C, ListBase *pfLinks, Object *ob, bAction *act)
+void poseAnim_mapping_get(bContext *C, ListBase *pfLinks, Object *ob, bAction *act)
{
/* for each Pose-Channel which gets affected, get the F-Curves for that channel
* and set the relevant transform flags...
*/
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
fcurves_to_pchan_links_get(pfLinks, ob, act, pchan);
}
CTX_DATA_END;
@@ -141,8 +140,7 @@ void poseAnim_mapping_get (bContext *C, ListBase *pfLinks, Object *ob, bAction *
* i.e. if nothing selected, do whole pose
*/
if (pfLinks->first == NULL) {
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, visible_pose_bones) {
fcurves_to_pchan_links_get(pfLinks, ob, act, pchan);
}
CTX_DATA_END;
@@ -150,7 +148,7 @@ void poseAnim_mapping_get (bContext *C, ListBase *pfLinks, Object *ob, bAction *
}
/* free F-Curve <-> PoseChannel links */
-void poseAnim_mapping_free (ListBase *pfLinks)
+void poseAnim_mapping_free(ListBase *pfLinks)
{
tPChanFCurveLink *pfl, *pfln=NULL;
@@ -178,7 +176,7 @@ void poseAnim_mapping_free (ListBase *pfLinks)
/* ------------------------- */
/* helper for apply() / reset() - refresh the data */
-void poseAnim_mapping_refresh (bContext *C, Scene *scene, Object *ob)
+void poseAnim_mapping_refresh(bContext *C, Scene *scene, Object *ob)
{
bArmature *arm= (bArmature *)ob->data;
@@ -196,7 +194,7 @@ void poseAnim_mapping_refresh (bContext *C, Scene *scene, Object *ob)
}
/* reset changes made to current pose */
-void poseAnim_mapping_reset (ListBase *pfLinks)
+void poseAnim_mapping_reset(ListBase *pfLinks)
{
tPChanFCurveLink *pfl;
@@ -219,7 +217,7 @@ void poseAnim_mapping_reset (ListBase *pfLinks)
}
/* perform autokeyframing after changes were made + confirmed */
-void poseAnim_mapping_autoKeyframe (bContext *C, Scene *scene, Object *ob, ListBase *pfLinks, float cframe)
+void poseAnim_mapping_autoKeyframe(bContext *C, Scene *scene, Object *ob, ListBase *pfLinks, float cframe)
{
/* insert keyframes as necessary if autokeyframing */
if (autokeyframe_cfra_can_key(scene, &ob->id)) {
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index 2799d7994bc..8791a345489 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -232,7 +232,7 @@ static int poselib_new_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSELIB_OT_new (wmOperatorType *ot)
+void POSELIB_OT_new(wmOperatorType *ot)
{
/* identifiers */
ot->name = "New Pose Library";
@@ -267,7 +267,7 @@ static int poselib_unlink_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSELIB_OT_unlink (wmOperatorType *ot)
+void POSELIB_OT_unlink(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Unlink Pose Library";
@@ -353,7 +353,7 @@ static int poselib_sanitise_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSELIB_OT_action_sanitise (wmOperatorType *ot)
+void POSELIB_OT_action_sanitise(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Sanitise Pose Library Action";
@@ -483,7 +483,7 @@ static int poselib_add_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSELIB_OT_pose_add (wmOperatorType *ot)
+void POSELIB_OT_pose_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "PoseLib Add Pose";
@@ -597,7 +597,7 @@ static int poselib_remove_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSELIB_OT_pose_remove (wmOperatorType *ot)
+void POSELIB_OT_pose_remove(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -684,7 +684,7 @@ static int poselib_rename_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSELIB_OT_pose_rename (wmOperatorType *ot)
+void POSELIB_OT_pose_rename(wmOperatorType *ot)
{
PropertyRNA *prop;
static EnumPropertyItem prop_poses_dummy_types[] = {
@@ -897,10 +897,12 @@ static void poselib_apply_pose (tPoseLib_PreviewData *pld)
}
else if (pchan->bone) {
/* only ok if bone is visible and selected */
- if ( (pchan->bone->flag & BONE_SELECTED) &&
- (pchan->bone->flag & BONE_HIDDEN_P)==0 &&
- (pchan->bone->layer & arm->layer) )
+ if ((pchan->bone->flag & BONE_SELECTED) &&
+ (pchan->bone->flag & BONE_HIDDEN_P) == 0 &&
+ (pchan->bone->layer & arm->layer))
+ {
ok = 1;
+ }
}
if (ok)
@@ -1620,7 +1622,7 @@ static int poselib_preview_exec (bContext *C, wmOperator *op)
return poselib_preview_exit(C, op);
}
-void POSELIB_OT_browse_interactive (wmOperatorType *ot)
+void POSELIB_OT_browse_interactive(wmOperatorType *ot)
{
/* identifiers */
ot->name = "PoseLib Browse Poses";
@@ -1646,7 +1648,7 @@ void POSELIB_OT_browse_interactive (wmOperatorType *ot)
/* RNA_def_float_factor(ot->srna, "blend_factor", 1.0f, 0.0f, 1.0f, "Blend Factor", "Amount that the pose is applied on top of the existing poses", 0.0f, 1.0f); */
}
-void POSELIB_OT_apply_pose (wmOperatorType *ot)
+void POSELIB_OT_apply_pose(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Apply Pose Library Pose";
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index 043383d79a3..817a2da8325 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -216,8 +216,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* set up path data for bones being calculated */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
/* verify makes sure that the selected bone has a bone with the appropriate settings */
animviz_verify_motionpaths(op->reports, scene, ob, pchan);
}
@@ -233,7 +232,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSE_OT_paths_calculate (wmOperatorType *ot)
+void POSE_OT_paths_calculate(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Calculate Bone Paths";
@@ -301,7 +300,7 @@ static int pose_clear_paths_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSE_OT_paths_clear (wmOperatorType *ot)
+void POSE_OT_paths_clear(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear Bone Paths";
@@ -324,8 +323,7 @@ static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op
bConstraint *con;
int found= 0;
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
if (pchan->bone->flag & BONE_SELECTED) {
for (con= pchan->constraints.first; con; con= con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
@@ -387,8 +385,7 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
int add_to_sel = RNA_boolean_get(op->ptr, "extend");
int found= 0;
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
curbone= pchan->bone;
if ((curbone->flag & BONE_UNSELECTABLE)==0) {
@@ -505,8 +502,7 @@ static short pose_select_same_group (bContext *C, Object *ob, short extend)
*/
group_flags= MEM_callocN(numGroups+1, "pose_select_same_group");
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
/* keep track of group as group to use later? */
if (pchan->bone->flag & BONE_SELECTED) {
group_flags[pchan->agrp_index] = 1;
@@ -522,8 +518,7 @@ static short pose_select_same_group (bContext *C, Object *ob, short extend)
/* small optimization: only loop through bones a second time if there are any groups tagged */
if (tagged) {
/* only if group matches (and is not selected or current bone) */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
if ((pchan->bone->flag & BONE_UNSELECTABLE)==0) {
/* check if the group used by this bone is counted */
if (group_flags[pchan->agrp_index]) {
@@ -552,8 +547,7 @@ static short pose_select_same_layer (bContext *C, Object *ob, short extend)
return 0;
/* figure out what bones are selected */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
/* keep track of layers to use later? */
if (pchan->bone->flag & BONE_SELECTED)
layers |= pchan->bone->layer;
@@ -567,8 +561,7 @@ static short pose_select_same_layer (bContext *C, Object *ob, short extend)
return 0;
/* select bones that are on same layers as layers flag */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
/* if bone is on a suitable layer, and the bone can have its selection changed, select it */
if ((layers & pchan->bone->layer) && (pchan->bone->flag & BONE_UNSELECTABLE)==0) {
pchan->bone->flag |= BONE_SELECTED;
@@ -598,8 +591,7 @@ static int pose_select_same_keyingset(bContext *C, Object *ob, short extend)
/* if not extending selection, deselect all selected first */
if (extend == 0) {
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
if ((pchan->bone->flag & BONE_UNSELECTABLE)==0)
pchan->bone->flag &= ~BONE_SELECTED;
}
@@ -673,7 +665,7 @@ static int pose_select_grouped_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
-void POSE_OT_select_grouped (wmOperatorType *ot)
+void POSE_OT_select_grouped(wmOperatorType *ot)
{
static EnumPropertyItem prop_select_grouped_types[] = {
{0, "LAYER", 0, "Layer", "Shared layers"},
@@ -800,7 +792,7 @@ static void pose_copy_menu(Scene *scene)
if (nr != 5) {
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if ( (arm->layer & pchan->bone->layer) &&
+ if ((arm->layer & pchan->bone->layer) &&
(pchan->bone->flag & BONE_SELECTED) &&
(pchan != pchanact) )
{
@@ -869,13 +861,13 @@ static void pose_copy_menu(Scene *scene)
float tmp_quat[4];
/* need to convert to quat first (in temp var)... */
- mat4_to_quat( tmp_quat,delta_mat);
- quat_to_axis_angle( pchan->rotAxis, &pchan->rotAngle,tmp_quat);
+ mat4_to_quat(tmp_quat, delta_mat);
+ quat_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, tmp_quat);
}
else if (pchan->rotmode == ROT_MODE_QUAT)
- mat4_to_quat( pchan->quat,delta_mat);
+ mat4_to_quat(pchan->quat, delta_mat);
else
- mat4_to_eulO( pchan->eul, pchan->rotmode,delta_mat);
+ mat4_to_eulO(pchan->eul, pchan->rotmode, delta_mat);
}
break;
case 11: /* Visual Size */
@@ -883,7 +875,7 @@ static void pose_copy_menu(Scene *scene)
float delta_mat[4][4], size[4];
armature_mat_pose_to_bone(pchan, pchanact->pose_mat, delta_mat);
- mat4_to_size( size,delta_mat);
+ mat4_to_size(size, delta_mat);
copy_v3_v3(pchan->size, size);
}
}
@@ -922,7 +914,7 @@ static void pose_copy_menu(Scene *scene)
/* Copy the temo listbase to the selected posebones */
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- if ( (arm->layer & pchan->bone->layer) &&
+ if ((arm->layer & pchan->bone->layer) &&
(pchan->bone->flag & BONE_SELECTED) &&
(pchan!=pchanact) )
{
@@ -1058,9 +1050,9 @@ static bPoseChannel *pose_bone_do_paste (Object *ob, bPoseChannel *chan, short s
else if (pchan->rotmode > 0) {
/* quat/axis-angle to euler */
if (chan->rotmode == ROT_MODE_AXISANGLE)
- axis_angle_to_eulO( pchan->eul, pchan->rotmode,chan->rotAxis, chan->rotAngle);
+ axis_angle_to_eulO(pchan->eul, pchan->rotmode, chan->rotAxis, chan->rotAngle);
else
- quat_to_eulO( pchan->eul, pchan->rotmode,chan->quat);
+ quat_to_eulO(pchan->eul, pchan->rotmode, chan->quat);
}
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
/* quat/euler to axis angle */
@@ -1148,7 +1140,7 @@ static int pose_copy_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSE_OT_copy (wmOperatorType *ot)
+void POSE_OT_copy(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Copy Pose";
@@ -1215,7 +1207,7 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSE_OT_paste (wmOperatorType *ot)
+void POSE_OT_paste(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -1265,7 +1257,7 @@ static int pose_group_add_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSE_OT_group_add (wmOperatorType *ot)
+void POSE_OT_group_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Bone Group";
@@ -1305,7 +1297,7 @@ static int pose_group_remove_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSE_OT_group_remove (wmOperatorType *ot)
+void POSE_OT_group_remove(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove Bone Group";
@@ -1403,8 +1395,7 @@ static int pose_group_assign_exec (bContext *C, wmOperator *op)
pose_add_group(ob);
/* add selected bones to group then */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
pchan->agrp_index= pose->active_group;
done= 1;
}
@@ -1420,7 +1411,7 @@ static int pose_group_assign_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
-void POSE_OT_group_assign (wmOperatorType *ot)
+void POSE_OT_group_assign(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Selected to Bone Group";
@@ -1457,8 +1448,7 @@ static int pose_group_unassign_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
/* find selected bones to remove from all bone groups */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
if (pchan->agrp_index) {
pchan->agrp_index= 0;
done= 1;
@@ -1476,7 +1466,7 @@ static int pose_group_unassign_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
}
-void POSE_OT_group_unassign (wmOperatorType *ot)
+void POSE_OT_group_unassign(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove Selected from Bone Groups";
@@ -1660,8 +1650,7 @@ static void pose_group_select(bContext *C, Object *ob, int select)
{
bPose *pose= ob->pose;
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, visible_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, visible_pose_bones) {
if ((pchan->bone->flag & BONE_UNSELECTABLE)==0) {
if (select) {
if (pchan->agrp_index == pose->active_group)
@@ -1699,7 +1688,7 @@ static int pose_group_select_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSE_OT_group_select (wmOperatorType *ot)
+void POSE_OT_group_select(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Bones of Bone Group";
@@ -1737,7 +1726,7 @@ static int pose_group_deselect_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSE_OT_group_deselect (wmOperatorType *ot)
+void POSE_OT_group_deselect(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Deselect Bone Group";
@@ -1765,8 +1754,7 @@ static int pose_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
arm= ob->data;
/* loop through selected bones, auto-naming them */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
char newname[MAXBONENAME];
flip_side_name(newname, pchan->name, TRUE);
ED_armature_bone_rename(arm, pchan->name, newname);
@@ -1782,7 +1770,7 @@ static int pose_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSE_OT_flip_names (wmOperatorType *ot)
+void POSE_OT_flip_names(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Flip Names";
@@ -1812,8 +1800,7 @@ static int pose_autoside_names_exec (bContext *C, wmOperator *op)
arm= ob->data;
/* loop through selected bones, auto-naming them */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
BLI_strncpy(newname, pchan->name, sizeof(newname));
if (bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis]))
ED_armature_bone_rename(arm, pchan->name, newname);
@@ -1829,7 +1816,7 @@ static int pose_autoside_names_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSE_OT_autoside_names (wmOperatorType *ot)
+void POSE_OT_autoside_names(wmOperatorType *ot)
{
static EnumPropertyItem axis_items[]= {
{0, "XAXIS", 0, "X-Axis", "Left/Right"},
@@ -1862,8 +1849,7 @@ static int pose_bone_rotmode_exec (bContext *C, wmOperator *op)
int mode = RNA_enum_get(op->ptr, "type");
/* set rotation mode of selected bones */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
pchan->rotmode = mode;
}
CTX_DATA_END;
@@ -1875,7 +1861,7 @@ static int pose_bone_rotmode_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSE_OT_rotation_mode_set (wmOperatorType *ot)
+void POSE_OT_rotation_mode_set(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Rotation Mode";
@@ -1934,7 +1920,7 @@ static int pose_armature_layers_showall_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ARMATURE_OT_layers_show_all (wmOperatorType *ot)
+void ARMATURE_OT_layers_show_all(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Show All Layers";
@@ -2000,7 +1986,7 @@ static int pose_armature_layers_exec (bContext *C, wmOperator *op)
}
-void POSE_OT_armature_layers (wmOperatorType *ot)
+void POSE_OT_armature_layers(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Change Armature Layers";
@@ -2019,7 +2005,7 @@ void POSE_OT_armature_layers (wmOperatorType *ot)
RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers to make visible");
}
-void ARMATURE_OT_armature_layers (wmOperatorType *ot)
+void ARMATURE_OT_armature_layers(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Change Armature Layers";
@@ -2046,8 +2032,7 @@ static int pose_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt)
int layers[32]= {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
/* get layers that are active already */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
short bit;
/* loop over the bits for this pchan's layers, adding layers where they're needed */
@@ -2080,8 +2065,7 @@ static int pose_bone_layers_exec (bContext *C, wmOperator *op)
RNA_boolean_get_array(op->ptr, "layers", layers);
/* set layers of pchans based on the values set in the operator props */
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
/* get pointer for pchan, and write flags this way */
RNA_pointer_create((ID *)ob->data, &RNA_Bone, pchan->bone, &ptr);
RNA_boolean_set_array(&ptr, "layers", layers);
@@ -2094,7 +2078,7 @@ static int pose_bone_layers_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSE_OT_bone_layers (wmOperatorType *ot)
+void POSE_OT_bone_layers(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Change Bone Layers";
@@ -2121,8 +2105,7 @@ static int armature_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *ev
int layers[32]= {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
/* get layers that are active already */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
short bit;
/* loop over the bits for this pchan's layers, adding layers where they're needed */
@@ -2152,8 +2135,7 @@ static int armature_bone_layers_exec (bContext *C, wmOperator *op)
RNA_boolean_get_array(op->ptr, "layers", layers);
/* set layers of pchans based on the values set in the operator props */
- CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
- {
+ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) {
/* get pointer for pchan, and write flags this way */
RNA_pointer_create((ID *)arm, &RNA_EditBone, ebone, &ptr);
RNA_boolean_set_array(&ptr, "layers", layers);
@@ -2166,7 +2148,7 @@ static int armature_bone_layers_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ARMATURE_OT_bone_layers (wmOperatorType *ot)
+void ARMATURE_OT_bone_layers(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Change Bone Layers";
@@ -2195,8 +2177,7 @@ static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op))
KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOC_ROT_SCALE_ID);
/* loop through all selected pchans, flipping and keying (as needed) */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) {
/* only if bone is using quaternion rotation */
if (pchan->rotmode == ROT_MODE_QUAT) {
/* quaternions have 720 degree range */
@@ -2214,7 +2195,7 @@ static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSE_OT_quaternions_flip (wmOperatorType *ot)
+void POSE_OT_quaternions_flip(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Flip Quats";
@@ -2290,7 +2271,7 @@ static int pose_clear_user_transforms_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void POSE_OT_user_transforms_clear (wmOperatorType *ot)
+void POSE_OT_user_transforms_clear(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear User Transforms";
diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c
index 546bcb1f40f..efcbab78884 100644
--- a/source/blender/editors/armature/reeb.c
+++ b/source/blender/editors/armature/reeb.c
@@ -41,7 +41,6 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
-#include "BLI_editVert.h"
#include "BLI_edgehash.h"
#include "BLI_ghash.h"
#include "BLI_heap.h"
@@ -81,15 +80,23 @@ static ReebGraph *FILTERED_RG = NULL;
#define DEBUG_REEB
#define DEBUG_REEB_NODE
-typedef struct VertexData
-{
+/* place-holders! */
+typedef struct EditEdge {
+ void *fake;
+} EditEdge;
+
+typedef struct EditFace {
+ void *fake;
+} EditFace;
+/* end place-holders! */
+
+typedef struct VertexData {
float w; /* weight */
int i; /* index */
ReebNode *n;
} VertexData;
-typedef struct EdgeIndex
-{
+typedef struct EdgeIndex {
EditEdge **edges;
int *offset;
} EdgeIndex;
@@ -183,16 +190,14 @@ void REEB_freeGraph(ReebGraph *rg)
ReebNode *node;
// free nodes
- for ( node = rg->nodes.first; node; node = node->next )
- {
+ for (node = rg->nodes.first; node; node = node->next) {
BLI_freeNode((BGraph*)rg, (BNode*)node);
}
BLI_freelistN(&rg->nodes);
// free arcs
arc = rg->arcs.first;
- while ( arc )
- {
+ while (arc) {
ReebArc *next = arc->next;
REEB_freeArc((BArc*)arc);
arc = next;
@@ -202,8 +207,7 @@ void REEB_freeGraph(ReebGraph *rg)
BLI_edgehash_free(rg->emap, NULL);
/* free linked graph */
- if (rg->link_up)
- {
+ if (rg->link_up) {
REEB_freeGraph(rg->link_up);
}
@@ -229,8 +233,7 @@ ReebGraph * newReebGraph(void)
void BIF_flagMultiArcs(ReebGraph *rg, int flag)
{
- for ( ; rg; rg = rg->link_up)
- {
+ for ( ; rg; rg = rg->link_up) {
BLI_flagArcs((BGraph*)rg, flag);
}
}
@@ -318,8 +321,7 @@ ReebNode *BIF_NodeFromIndex(ReebArc *arc, ReebNode *node)
ReebNode *BIF_lowestLevelNode(ReebNode *node)
{
- while (node->link_down)
- {
+ while (node->link_down) {
node = node->link_down;
}
@@ -407,8 +409,7 @@ ReebGraph *BIF_graphForMultiNode(ReebGraph *rg, ReebNode *node)
{
ReebGraph *multi_rg = rg;
- while (multi_rg && multi_rg->multi_level != node->multi_level)
- {
+ while (multi_rg && multi_rg->multi_level != node->multi_level) {
multi_rg = multi_rg->link_up;
}
@@ -484,15 +485,12 @@ void repositionNodes(ReebGraph *rg)
BNode *node = NULL;
// Reset node positions
- for (node = rg->nodes.first; node; node = node->next)
- {
+ for (node = rg->nodes.first; node; node = node->next) {
node->p[0] = node->p[1] = node->p[2] = 0;
}
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (((ReebArc*)arc)->bcount > 0)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
+ if (((ReebArc*)arc)->bcount > 0) {
float p[3];
copy_v3_v3(p, ((ReebArc*)arc)->buckets[0].p);
@@ -512,22 +510,17 @@ void verifyNodeDegree(ReebGraph *rg)
ReebNode *node = NULL;
ReebArc *arc = NULL;
- for (node = rg->nodes.first; node; node = node->next)
- {
+ for (node = rg->nodes.first; node; node = node->next) {
int count = 0;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (arc->head == node || arc->tail == node)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
+ if (arc->head == node || arc->tail == node) {
count++;
}
}
- if (count != node->degree)
- {
+ if (count != node->degree) {
printf("degree error in node %i: expected %i got %i\n", node->index, count, node->degree);
}
- if (node->degree == 0)
- {
+ if (node->degree == 0) {
printf("zero degree node %i with weight %f\n", node->index, node->weight);
}
}
@@ -539,25 +532,20 @@ static void verifyBucketsArc(ReebGraph *UNUSED(rg), ReebArc *arc)
ReebNode *head = (ReebNode*)arc->head;
ReebNode *tail = (ReebNode*)arc->tail;
- if (arc->bcount > 0)
- {
+ if (arc->bcount > 0) {
int i;
- for (i = 0; i < arc->bcount; i++)
- {
- if (arc->buckets[i].nv == 0)
- {
+ for (i = 0; i < arc->bcount; i++) {
+ if (arc->buckets[i].nv == 0) {
printArc(arc);
printf("count error in bucket %i/%i\n", i+1, arc->bcount);
}
}
- if (ceilf(head->weight) != arc->buckets[0].val)
- {
+ if (ceilf(head->weight) != arc->buckets[0].val) {
printArc(arc);
printf("alloc error in first bucket: %f should be %f\n", arc->buckets[0].val, ceil(head->weight));
}
- if (floorf(tail->weight) != arc->buckets[arc->bcount - 1].val)
- {
+ if (floorf(tail->weight) != arc->buckets[arc->bcount - 1].val) {
printArc(arc);
printf("alloc error in last bucket: %f should be %f\n", arc->buckets[arc->bcount - 1].val, floor(tail->weight));
}
@@ -568,8 +556,7 @@ void verifyBuckets(ReebGraph *rg)
{
#ifdef DEBUG_REEB
ReebArc *arc = NULL;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
verifyBucketsArc(rg, arc);
}
#endif
@@ -580,8 +567,7 @@ void verifyFaces(ReebGraph *rg)
#ifdef DEBUG_REEB
int total = 0;
ReebArc *arc = NULL;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
total += BLI_ghash_size(arc->faces);
}
@@ -592,10 +578,8 @@ void verifyArcs(ReebGraph *rg)
{
ReebArc *arc;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (arc->head->weight > arc->tail->weight)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
+ if (arc->head->weight > arc->tail->weight) {
printf("FLIPPED ARC!\n");
}
}
@@ -606,14 +590,11 @@ static void verifyMultiResolutionLinks(ReebGraph *rg, int level)
#ifdef DEBUG_REEB
ReebGraph *lower_rg = rg->link_up;
- if (lower_rg)
- {
+ if (lower_rg) {
ReebArc *arc;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (BLI_findindex(&lower_rg->arcs, arc->link_up) == -1)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
+ if (BLI_findindex(&lower_rg->arcs, arc->link_up) == -1) {
printf("missing arc %p for level %i\n", (void *)arc->link_up, level);
printf("Source arc was ---\n");
printArc(arc);
@@ -647,13 +628,11 @@ static void removeVertFromBucket(EmbedBucket *b, float co[3])
static void mergeBuckets(EmbedBucket *bDst, EmbedBucket *bSrc)
{
- if (bDst->nv > 0 && bSrc->nv > 0)
- {
+ if (bDst->nv > 0 && bSrc->nv > 0) {
bDst->nv += bSrc->nv;
interp_v3_v3v3(bDst->p, bDst->p, bSrc->p, (float)bSrc->nv / (float)(bDst->nv));
}
- else if (bSrc->nv > 0)
- {
+ else if (bSrc->nv > 0) {
bDst->nv = bSrc->nv;
copy_v3_v3(bDst->p, bSrc->p);
}
@@ -661,19 +640,16 @@ static void mergeBuckets(EmbedBucket *bDst, EmbedBucket *bSrc)
static void mergeArcBuckets(ReebArc *aDst, ReebArc *aSrc, float start, float end)
{
- if (aDst->bcount > 0 && aSrc->bcount > 0)
- {
+ if (aDst->bcount > 0 && aSrc->bcount > 0) {
int indexDst = 0, indexSrc = 0;
start = MAX3(start, aDst->buckets[0].val, aSrc->buckets[0].val);
- while (indexDst < aDst->bcount && aDst->buckets[indexDst].val < start)
- {
+ while (indexDst < aDst->bcount && aDst->buckets[indexDst].val < start) {
indexDst++;
}
- while (indexSrc < aSrc->bcount && aSrc->buckets[indexSrc].val < start)
- {
+ while (indexSrc < aSrc->bcount && aSrc->buckets[indexSrc].val < start) {
indexSrc++;
}
@@ -693,8 +669,7 @@ void flipArcBuckets(ReebArc *arc)
{
int i, j;
- for (i = 0, j = arc->bcount - 1; i < j; i++, j--)
- {
+ for (i = 0, j = arc->bcount - 1; i < j; i++, j--) {
EmbedBucket tmp;
tmp = arc->buckets[i];
@@ -714,20 +689,16 @@ static void allocArcBuckets(ReebArc *arc)
float start = ceil(arc->head->weight);
arc->bcount = countArcBuckets(arc);
- if (arc->bcount > 0)
- {
+ if (arc->bcount > 0) {
arc->buckets = MEM_callocN(sizeof(EmbedBucket) * arc->bcount, "embed bucket");
- for (i = 0; i < arc->bcount; i++)
- {
+ for (i = 0; i < arc->bcount; i++) {
arc->buckets[i].val = start + i;
}
}
- else
- {
+ else {
arc->buckets = NULL;
}
-
}
static void resizeArcBuckets(ReebArc *arc)
@@ -735,15 +706,13 @@ static void resizeArcBuckets(ReebArc *arc)
EmbedBucket *oldBuckets = arc->buckets;
int oldBCount = arc->bcount;
- if (countArcBuckets(arc) == oldBCount)
- {
+ if (countArcBuckets(arc) == oldBCount) {
return;
}
allocArcBuckets(arc);
- if (oldBCount != 0 && arc->bcount != 0)
- {
+ if (oldBCount != 0 && arc->bcount != 0) {
int oldStart = (int)oldBuckets[0].val;
int oldEnd = (int)oldBuckets[oldBCount - 1].val;
int newStart = (int)arc->buckets[0].val;
@@ -752,12 +721,10 @@ static void resizeArcBuckets(ReebArc *arc)
int newOffset = 0;
int len;
- if (oldStart < newStart)
- {
+ if (oldStart < newStart) {
oldOffset = newStart - oldStart;
}
- else
- {
+ else {
newOffset = oldStart - newStart;
}
@@ -766,8 +733,7 @@ static void resizeArcBuckets(ReebArc *arc)
memcpy(arc->buckets + newOffset, oldBuckets + oldOffset, len * sizeof(EmbedBucket));
}
- if (oldBuckets != NULL)
- {
+ if (oldBuckets != NULL) {
MEM_freeN(oldBuckets);
}
}
@@ -777,10 +743,8 @@ static void reweightBuckets(ReebArc *arc)
int i;
float start = ceil((arc->head)->weight);
- if (arc->bcount > 0)
- {
- for (i = 0; i < arc->bcount; i++)
- {
+ if (arc->bcount > 0) {
+ for (i = 0; i < arc->bcount; i++) {
arc->buckets[i].val = start + i;
}
}
@@ -793,8 +757,7 @@ static void interpolateBuckets(ReebArc *arc, float *start_p, float *end_p, int s
total = end_index - start_index + 2;
- for (j = start_index; j <= end_index; j++)
- {
+ for (j = start_index; j <= end_index; j++) {
EmbedBucket *empty = arc->buckets + j;
empty->nv = 1;
interp_v3_v3v3(empty->p, start_p, end_p, (float)(j - start_index + 1) / total);
@@ -810,14 +773,11 @@ static void fillArcEmptyBuckets(ReebArc *arc)
start_p = arc->head->p;
- for (i = 0; i < arc->bcount; i++)
- {
+ for (i = 0; i < arc->bcount; i++) {
EmbedBucket *bucket = arc->buckets + i;
- if (missing)
- {
- if (bucket->nv > 0)
- {
+ if (missing) {
+ if (bucket->nv > 0) {
missing = 0;
end_p = bucket->p;
@@ -826,14 +786,11 @@ static void fillArcEmptyBuckets(ReebArc *arc)
interpolateBuckets(arc, start_p, end_p, start_index, end_index);
}
}
- else
- {
- if (bucket->nv == 0)
- {
+ else {
+ if (bucket->nv == 0) {
missing = 1;
- if (i > 0)
- {
+ if (i > 0) {
start_p = arc->buckets[i - 1].p;
}
start_index = i;
@@ -841,8 +798,7 @@ static void fillArcEmptyBuckets(ReebArc *arc)
}
}
- if (missing)
- {
+ if (missing) {
end_p = arc->tail->p;
end_index = arc->bcount - 1;
@@ -859,8 +815,7 @@ static void ExtendArcBuckets(ReebArc *arc)
float average_length = 0, length;
int padding_head = 0, padding_tail = 0;
- if (arc->bcount == 0)
- {
+ if (arc->bcount == 0) {
return; /* failsafe, shouldn't happen */
}
@@ -881,19 +836,16 @@ static void ExtendArcBuckets(ReebArc *arc)
last_bucket = arc->buckets + (arc->bcount - 1);
length = len_v3v3(first_bucket->p, arc->head->p);
- if (length > 2 * average_length)
- {
+ if (length > 2 * average_length) {
padding_head = (int)floor(length / average_length);
}
length = len_v3v3(last_bucket->p, arc->tail->p);
- if (length > 2 * average_length)
- {
+ if (length > 2 * average_length) {
padding_tail = (int)floor(length / average_length);
}
- if (padding_head + padding_tail > 0)
- {
+ if (padding_head + padding_tail > 0) {
EmbedBucket *old_buckets = arc->buckets;
arc->buckets = MEM_callocN(sizeof(EmbedBucket) * (padding_head + arc->bcount + padding_tail), "embed bucket");
@@ -904,13 +856,11 @@ static void ExtendArcBuckets(ReebArc *arc)
MEM_freeN(old_buckets);
}
- if (padding_head > 0)
- {
+ if (padding_head > 0) {
interpolateBuckets(arc, arc->head->p, first_bucket->p, 0, padding_head);
}
- if (padding_tail > 0)
- {
+ if (padding_tail > 0) {
interpolateBuckets(arc, last_bucket->p, arc->tail->p, arc->bcount - padding_tail, arc->bcount - 1);
}
}
@@ -920,8 +870,7 @@ static void extendGraphBuckets(ReebGraph *rg)
{
ReebArc *arc;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
ExtendArcBuckets(arc);
}
}
@@ -941,8 +890,7 @@ static void calculateArcLength(ReebArc *arc)
vec0 = arc->head->p;
vec1 = arc->head->p; /* in case there's no embedding */
- while (IT_next(iter))
- {
+ while (IT_next(iter)) {
vec1 = iter->p;
arc->length += len_v3v3(vec0, vec1);
@@ -957,8 +905,7 @@ static void calculateGraphLength(ReebGraph *rg)
{
ReebArc *arc;
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
calculateArcLength(arc);
}
}
@@ -975,8 +922,7 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
copy_v3_v3(axis, root_node->symmetry_axis);
/* first pass, merge incrementally */
- for (i = 0; i < count - 1; i++)
- {
+ for (i = 0; i < count - 1; i++) {
ReebNode *node1, *node2;
ReebArc *arc1, *arc2;
float tangent[3];
@@ -999,8 +945,7 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
/* Merge buckets
* there shouldn't be any null arcs here, but just to be safe
* */
- if (arc1->bcount > 0 && arc2->bcount > 0)
- {
+ if (arc1->bcount > 0 && arc2->bcount > 0) {
ReebArcIterator arc_iter1, arc_iter2;
BArcIterator *iter1 = (BArcIterator*)&arc_iter1;
BArcIterator *iter2 = (BArcIterator*)&arc_iter2;
@@ -1013,19 +958,16 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
bucket2 = IT_next(iter2);
/* Make sure they both start at the same value */
- while (bucket1 && bucket2 && bucket1->val < bucket2->val)
- {
+ while (bucket1 && bucket2 && bucket1->val < bucket2->val) {
bucket1 = IT_next(iter1);
}
- while (bucket1 && bucket2 && bucket2->val < bucket1->val)
- {
+ while (bucket1 && bucket2 && bucket2->val < bucket1->val) {
bucket2 = IT_next(iter2);
}
- for ( ;bucket1 && bucket2; bucket1 = IT_next(iter1), bucket2 = IT_next(iter2))
- {
+ for ( ;bucket1 && bucket2; bucket1 = IT_next(iter1), bucket2 = IT_next(iter2)) {
bucket2->nv += bucket1->nv; /* add counts */
/* mirror on axis */
@@ -1037,8 +979,7 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
}
/* second pass, mirror back on previous arcs */
- for (i = count - 1; i > 0; i--)
- {
+ for (i = count - 1; i > 0; i--) {
ReebNode *node1, *node2;
ReebArc *arc1, *arc2;
float tangent[3];
@@ -1061,8 +1002,7 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
/* Copy buckets
* there shouldn't be any null arcs here, but just to be safe
* */
- if (arc1->bcount > 0 && arc2->bcount > 0)
- {
+ if (arc1->bcount > 0 && arc2->bcount > 0) {
ReebArcIterator arc_iter1, arc_iter2;
BArcIterator *iter1 = (BArcIterator*)&arc_iter1;
BArcIterator *iter2 = (BArcIterator*)&arc_iter2;
@@ -1075,19 +1015,16 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
bucket2 = IT_next(iter2);
/* Make sure they both start at the same value */
- while (bucket1 && bucket1->val < bucket2->val)
- {
+ while (bucket1 && bucket1->val < bucket2->val) {
bucket1 = IT_next(iter1);
}
- while (bucket2 && bucket2->val < bucket1->val)
- {
+ while (bucket2 && bucket2->val < bucket1->val) {
bucket2 = IT_next(iter2);
}
- for ( ;bucket1 && bucket2; bucket1 = IT_next(iter1), bucket2 = IT_next(iter2))
- {
+ for ( ;bucket1 && bucket2; bucket1 = IT_next(iter1), bucket2 = IT_next(iter2)) {
/* copy and mirror back to bucket2 */
bucket2->nv = bucket1->nv;
copy_v3_v3(bucket2->p, bucket1->p);
@@ -1122,8 +1059,7 @@ void REEB_AxialSymmetry(BNode* root_node, BNode* node1, BNode* node2, struct BAr
/* Merge buckets
* there shouldn't be any null arcs here, but just to be safe
* */
- if (arc1->bcount > 0 && arc2->bcount > 0)
- {
+ if (arc1->bcount > 0 && arc2->bcount > 0) {
ReebArcIterator arc_iter1, arc_iter2;
BArcIterator *iter1 = (BArcIterator*)&arc_iter1;
BArcIterator *iter2 = (BArcIterator*)&arc_iter2;
@@ -1136,19 +1072,16 @@ void REEB_AxialSymmetry(BNode* root_node, BNode* node1, BNode* node2, struct BAr
bucket2 = IT_next(iter2);
/* Make sure they both start at the same value */
- while (bucket1 && bucket1->val < bucket2->val)
- {
+ while (bucket1 && bucket1->val < bucket2->val) {
bucket1 = IT_next(iter1);
}
- while (bucket2 && bucket2->val < bucket1->val)
- {
+ while (bucket2 && bucket2->val < bucket1->val) {
bucket2 = IT_next(iter2);
}
- for ( ;bucket1 && bucket2; bucket1 = IT_next(iter1), bucket2 = IT_next(iter2))
- {
+ for ( ; bucket1 && bucket2; bucket1 = IT_next(iter1), bucket2 = IT_next(iter2)) {
bucket1->nv += bucket2->nv; /* add counts */
/* mirror on axis */
@@ -1175,7 +1108,7 @@ void postprocessGraph(ReebGraph *rg, char mode)
ReebArc *arc;
float fac1 = 0, fac2 = 1, fac3 = 0;
- switch(mode)
+ switch (mode)
{
case SKGEN_AVERAGE:
fac1 = fac2 = fac3 = 1.0f / 3.0f;
@@ -1490,16 +1423,13 @@ static int compareArcs(void *varc1, void *varc2)
float len1 = lengthArc(arc1);
float len2 = lengthArc(arc2);
- if (len1 < len2)
- {
+ if (len1 < len2) {
return -1;
}
- if (len1 > len2)
- {
+ if (len1 > len2) {
return 1;
}
- else
- {
+ else {
return 0;
}
}
@@ -1508,13 +1438,10 @@ static void filterArc(ReebGraph *rg, ReebNode *newNode, ReebNode *removedNode, R
{
ReebArc *arc = NULL, *nextArc = NULL;
- if (merging)
- {
+ if (merging) {
/* first pass, merge buckets for arcs that spawned the two nodes into the source arc*/
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
- if (arc->head == srcArc->head && arc->tail == srcArc->tail && arc != srcArc)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
+ if (arc->head == srcArc->head && arc->tail == srcArc->tail && arc != srcArc) {
ReebNode *head = srcArc->head;
ReebNode *tail = srcArc->tail;
mergeArcBuckets(srcArc, arc, head->weight, tail->weight);
@@ -1524,47 +1451,38 @@ static void filterArc(ReebGraph *rg, ReebNode *newNode, ReebNode *removedNode, R
/* second pass, replace removedNode by newNode, remove arcs that are collapsed in a loop */
arc = rg->arcs.first;
- while (arc)
- {
+ while (arc) {
nextArc = arc->next;
- if (arc->head == removedNode || arc->tail == removedNode)
- {
- if (arc->head == removedNode)
- {
+ if (arc->head == removedNode || arc->tail == removedNode) {
+ if (arc->head == removedNode) {
arc->head = newNode;
}
- else
- {
+ else {
arc->tail = newNode;
}
// Remove looped arcs
- if (arc->head == arc->tail)
- {
+ if (arc->head == arc->tail) {
// v1 or v2 was already newNode, since we're removing an arc, decrement degree
NodeDegreeDecrement(rg, newNode);
// If it's srcArc, it'll be removed later, so keep it for now
- if (arc != srcArc)
- {
+ if (arc != srcArc) {
BLI_remlink(&rg->arcs, arc);
REEB_freeArc((BArc*)arc);
}
}
- else
- {
+ else {
/* flip arcs that flipped, can happen on diamond shapes, mostly on null arcs */
- if (arc->head->weight > arc->tail->weight)
- {
+ if (arc->head->weight > arc->tail->weight) {
flipArc(arc);
}
//newNode->degree++; // incrementing degree since we're adding an arc
NodeDegreeIncrement(rg, newNode);
mergeArcFaces(rg, arc, srcArc);
- if (merging)
- {
+ if (merging) {
ReebNode *head = arc->head;
ReebNode *tail = arc->tail;
@@ -1587,12 +1505,10 @@ void filterNullReebGraph(ReebGraph *rg)
ReebArc *arc = NULL, *nextArc = NULL;
arc = rg->arcs.first;
- while (arc)
- {
+ while (arc) {
nextArc = arc->next;
// Only collapse arcs too short to have any embed bucket
- if (arc->bcount == 0)
- {
+ if (arc->bcount == 0) {
ReebNode *newNode = (ReebNode*)arc->head;
ReebNode *removedNode = (ReebNode*)arc->tail;
float blend;
@@ -1623,12 +1539,14 @@ static int filterInternalExternalReebGraph(ReebGraph *rg, float threshold_intern
BLI_sortlist(&rg->arcs, compareArcs);
- for (arc = rg->arcs.first; arc; arc = nextArc)
- {
+ for (arc = rg->arcs.first; arc; arc = nextArc) {
nextArc = arc->next;
- // Only collapse non-terminal arcs that are shorter than threshold
- if (threshold_internal > 0 && arc->head->degree > 1 && arc->tail->degree > 1 && (lengthArc(arc) < threshold_internal))
+ /* Only collapse non-terminal arcs that are shorter than threshold */
+ if ((threshold_internal > 0) &&
+ (arc->head->degree > 1) &&
+ (arc->tail->degree > 1) &&
+ (lengthArc(arc) < threshold_internal))
{
ReebNode *newNode = NULL;
ReebNode *removedNode = NULL;
@@ -1650,26 +1568,25 @@ static int filterInternalExternalReebGraph(ReebGraph *rg, float threshold_intern
}
// Only collapse terminal arcs that are shorter than threshold
- else if (threshold_external > 0 && (arc->head->degree == 1 || arc->tail->degree == 1) && (lengthArc(arc) < threshold_external))
+ else if ((threshold_external > 0) &&
+ (arc->head->degree == 1 || arc->tail->degree == 1) &&
+ (lengthArc(arc) < threshold_external))
{
ReebNode *terminalNode = NULL;
ReebNode *middleNode = NULL;
ReebNode *removedNode = NULL;
// Assign terminal and middle nodes
- if (arc->head->degree == 1)
- {
+ if (arc->head->degree == 1) {
terminalNode = arc->head;
middleNode = arc->tail;
}
- else
- {
+ else {
terminalNode = arc->tail;
middleNode = arc->head;
}
- if (middleNode->degree == 2 && middleNode != rg->nodes.first)
- {
+ if (middleNode->degree == 2 && middleNode != rg->nodes.first) {
#if 1
// If middle node is a normal node, it will be removed later
// Only if middle node is not the root node
@@ -1685,8 +1602,7 @@ static int filterInternalExternalReebGraph(ReebGraph *rg, float threshold_intern
#endif
}
// Otherwise, just plain remove of the arc
- else
- {
+ else {
removedNode = terminalNode;
// removing arc, so we need to decrease the degree of the remaining node
@@ -1713,13 +1629,10 @@ static int filterCyclesReebGraph(ReebGraph *rg, float UNUSED(distance_threshold)
ReebArc *next2;
int filtered = 0;
- for (arc1 = rg->arcs.first; arc1; arc1 = arc1->next)
- {
- for (arc2 = arc1->next; arc2; arc2 = next2)
- {
+ for (arc1 = rg->arcs.first; arc1; arc1 = arc1->next) {
+ for (arc2 = arc1->next; arc2; arc2 = next2) {
next2 = arc2->next;
- if (arc1 != arc2 && arc1->head == arc2->head && arc1->tail == arc2->tail)
- {
+ if (arc1 != arc2 && arc1->head == arc2->head && arc1->tail == arc2->tail) {
mergeArcEdges(rg, arc1, arc2, MERGE_APPEND);
mergeArcFaces(rg, arc1, arc2);
mergeArcBuckets(arc1, arc2, arc1->head->weight, arc1->tail->weight);
@@ -1770,7 +1683,7 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
int merging = 0;
int total = BLI_ghash_size(arc->faces);
float avg_angle = 0;
- float avg_vec[3] = {0,0,0};
+ float avg_vec[3] = {0, 0, 0};
for (BLI_ghashIterator_init(&ghi, arc->faces);
!BLI_ghashIterator_isDone(&ghi);
@@ -1848,8 +1761,7 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
if (avg_angle > threshold)
merging = 1;
- if (merging)
- {
+ if (merging) {
ReebNode *terminalNode = NULL;
ReebNode *middleNode = NULL;
ReebNode *newNode = NULL;
@@ -1857,39 +1769,33 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
int merging = 0;
// Assign terminal and middle nodes
- if (arc->head->degree == 1)
- {
+ if (arc->head->degree == 1) {
terminalNode = arc->head;
middleNode = arc->tail;
}
- else
- {
+ else {
terminalNode = arc->tail;
middleNode = arc->head;
}
// If middle node is a normal node, merge to terminal node
- if (middleNode->degree == 2)
- {
+ if (middleNode->degree == 2) {
merging = 1;
newNode = terminalNode;
removedNode = middleNode;
}
// Otherwise, just plain remove of the arc
- else
- {
+ else {
merging = 0;
newNode = middleNode;
removedNode = terminalNode;
}
// Merging arc
- if (merging)
- {
+ if (merging) {
filterArc(rg, newNode, removedNode, arc, 1);
}
- else
- {
+ else {
// removing arc, so we need to decrease the degree of the remaining node
//newNode->degree--;
NodeDegreeDecrement(rg, newNode);
@@ -1920,29 +1826,24 @@ static void filterGraph(ReebGraph *rg, short options, float threshold_internal,
calculateGraphLength(rg);
- if ((options & SKGEN_FILTER_EXTERNAL) == 0)
- {
+ if ((options & SKGEN_FILTER_EXTERNAL) == 0) {
threshold_external = 0;
}
- if ((options & SKGEN_FILTER_INTERNAL) == 0)
- {
+ if ((options & SKGEN_FILTER_INTERNAL) == 0) {
threshold_internal = 0;
}
- if (threshold_internal > 0 || threshold_external > 0)
- {
+ if (threshold_internal > 0 || threshold_external > 0) {
/* filter until there's nothing more to do */
- while (done == 1)
- {
+ while (done == 1) {
done = 0; /* no work done yet */
done = filterInternalExternalReebGraph(rg, threshold_internal, threshold_external);
}
}
- if (options & SKGEN_FILTER_SMART)
- {
+ if (options & SKGEN_FILTER_SMART) {
filterSmartReebGraph(rg, 0.5);
filterCyclesReebGraph(rg, 0.5);
}
@@ -1963,8 +1864,7 @@ static void finalizeGraph(ReebGraph *rg, char passes, char method)
sortArcs(rg);
- for (i = 0; i < passes; i++)
- {
+ for (i = 0; i < passes; i++) {
postprocessGraph(rg, method);
}
@@ -1973,18 +1873,16 @@ static void finalizeGraph(ReebGraph *rg, char passes, char method)
/************************************** WEIGHT SPREADING ***********************************************/
-static int compareVerts( const void* a, const void* b )
+static int compareVerts(const void* a, const void* b)
{
EditVert *va = *(EditVert**)a;
EditVert *vb = *(EditVert**)b;
int value = 0;
- if (weightData(va) < weightData(vb))
- {
+ if (weightData(va) < weightData(vb)) {
value = -1;
}
- else if (weightData(va) > weightData(vb))
- {
+ else if (weightData(va) > weightData(vb)) {
value = 1;
}
@@ -2001,26 +1899,21 @@ static void spreadWeight(EditMesh *em)
verts = MEM_callocN(sizeof(EditVert*) * totvert, "verts array");
- for (eve = em->verts.first, i = 0; eve; eve = eve->next, i++)
- {
+ for (eve = em->verts.first, i = 0; eve; eve = eve->next, i++) {
verts[i] = eve;
}
- while (work_needed == 1)
- {
+ while (work_needed == 1) {
work_needed = 0;
qsort(verts, totvert, sizeof(EditVert*), compareVerts);
- for (i = 0; i < totvert; i++)
- {
+ for (i = 0; i < totvert; i++) {
eve = verts[i];
- if (i == 0 || (weightData(eve) - lastWeight) > FLT_EPSILON)
- {
+ if (i == 0 || (weightData(eve) - lastWeight) > FLT_EPSILON) {
lastWeight = weightData(eve);
}
- else
- {
+ else {
work_needed = 1;
weightSetData(eve, lastWeight + FLT_EPSILON * 2);
lastWeight = weightData(eve);
@@ -2044,8 +1937,7 @@ void REEB_exportGraph(ReebGraph *rg, int count)
char filename[128];
FILE *f;
- if (count == -1)
- {
+ if (count == -1) {
strcpy(filename, "test.txt");
}
else {
@@ -2053,15 +1945,13 @@ void REEB_exportGraph(ReebGraph *rg, int count)
}
f = BLI_fopen(filename, "w");
- for (arc = rg->arcs.first; arc; arc = arc->next)
- {
+ for (arc = rg->arcs.first; arc; arc = arc->next) {
int i;
float p[3];
exportNode(f, "v1", arc->head);
- for (i = 0; i < arc->bcount; i++)
- {
+ for (i = 0; i < arc->bcount; i++) {
fprintf(f, "b nv:%i %f %f %f\n", arc->buckets[i].nv, arc->buckets[i].p[0], arc->buckets[i].p[1], arc->buckets[i].p[2]);
}
@@ -2082,12 +1972,10 @@ static void removeZeroNodes(ReebGraph *rg)
{
ReebNode *node, *next_node;
- for (node = rg->nodes.first; node; node = next_node)
- {
+ for (node = rg->nodes.first; node; node = next_node) {
next_node = node->next;
- if (node->degree == 0)
- {
+ if (node->degree == 0) {
BLI_removeNode((BGraph*)rg, (BNode*)node);
}
}
@@ -2098,63 +1986,51 @@ void removeNormalNodes(ReebGraph *rg)
ReebArc *arc, *nextArc;
// Merge degree 2 nodes
- for (arc = rg->arcs.first; arc; arc = nextArc)
- {
+ for (arc = rg->arcs.first; arc; arc = nextArc) {
nextArc = arc->next;
- while (arc->head->degree == 2 || arc->tail->degree == 2)
- {
+ while (arc->head->degree == 2 || arc->tail->degree == 2) {
// merge at v1
- if (arc->head->degree == 2)
- {
+ if (arc->head->degree == 2) {
ReebArc *connectedArc = (ReebArc*)BLI_findConnectedArc((BGraph*)rg, (BArc*)arc, (BNode*)arc->head);
/* If arcs are one after the other */
- if (arc->head == connectedArc->tail)
- {
+ if (arc->head == connectedArc->tail) {
/* remove furthest arc */
- if (arc->tail->weight < connectedArc->head->weight)
- {
+ if (arc->tail->weight < connectedArc->head->weight) {
mergeConnectedArcs(rg, arc, connectedArc);
nextArc = arc->next;
}
- else
- {
+ else {
mergeConnectedArcs(rg, connectedArc, arc);
break; /* arc was removed, move to next */
}
}
/* Otherwise, arcs are side by side */
- else
- {
+ else {
/* Don't do anything, we need to keep the lowest node, even if degree 2 */
break;
}
}
- // merge at v2
- if (arc->tail->degree == 2)
- {
+ /* merge at v2 */
+ if (arc->tail->degree == 2) {
ReebArc *connectedArc = (ReebArc*)BLI_findConnectedArc((BGraph*)rg, (BArc*)arc, (BNode*)arc->tail);
/* If arcs are one after the other */
- if (arc->tail == connectedArc->head)
- {
+ if (arc->tail == connectedArc->head) {
/* remove furthest arc */
- if (arc->head->weight < connectedArc->tail->weight)
- {
+ if (arc->head->weight < connectedArc->tail->weight) {
mergeConnectedArcs(rg, arc, connectedArc);
nextArc = arc->next;
}
- else
- {
+ else {
mergeConnectedArcs(rg, connectedArc, arc);
break; /* arc was removed, move to next */
}
}
/* Otherwise, arcs are side by side */
- else
- {
+ else {
/* Don't do anything, we need to keep the lowest node, even if degree 2 */
break;
}
@@ -2176,13 +2052,11 @@ static ReebArc *nextArcMappedToEdge(ReebArc *arc, ReebEdge *e)
ReebArc *result = NULL;
/* Find the ReebEdge in the edge list */
- for (edge = arc->edges.first; edge && !edgeEquals(edge, e); edge = edge->next)
- { }
+ for (edge = arc->edges.first; edge && !edgeEquals(edge, e); edge = edge->next) { }
nextEdge = edge->nextEdge;
- if (nextEdge != NULL)
- {
+ if (nextEdge != NULL) {
result = nextEdge->arc;
}
@@ -2211,51 +2085,42 @@ void mergeArcEdges(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc, MergeDirection d
{
ReebEdge *e = NULL;
- if (direction == MERGE_APPEND)
- {
- for (e = aSrc->edges.first; e; e = e->next)
- {
+ if (direction == MERGE_APPEND) {
+ for (e = aSrc->edges.first; e; e = e->next) {
e->arc = aDst; // Edge is stolen by new arc
}
- BLI_movelisttolist(&aDst->edges , &aSrc->edges);
+ BLI_movelisttolist(&aDst->edges, &aSrc->edges);
}
- else
- {
- for (e = aSrc->edges.first; e; e = e->next)
- {
+ else {
+ for (e = aSrc->edges.first; e; e = e->next) {
ReebEdge *newEdge = copyEdge(e);
newEdge->arc = aDst;
BLI_addtail(&aDst->edges, newEdge);
- if (direction == MERGE_LOWER)
- {
+ if (direction == MERGE_LOWER) {
void **p = BLI_edgehash_lookup_p(rg->emap, e->v1->index, e->v2->index);
newEdge->nextEdge = e;
// if edge was the first in the list, point the edit edge to the new reeb edge instead.
- if (*p == e)
- {
+ if (*p == e) {
*p = (void*)newEdge;
}
// otherwise, advance in the list until the predecessor is found then insert it there
- else
- {
+ else {
ReebEdge *previous = (ReebEdge*)*p;
- while (previous->nextEdge != e)
- {
+ while (previous->nextEdge != e) {
previous = previous->nextEdge;
}
previous->nextEdge = newEdge;
}
}
- else
- {
+ else {
newEdge->nextEdge = e->nextEdge;
e->nextEdge = newEdge;
}
@@ -2275,13 +2140,11 @@ int mergeConnectedArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
mergeArcFaces(rg, a0, a1);
// Bring a0 to the combine length of both arcs
- if (a0->tail == a1->head)
- {
+ if (a0->tail == a1->head) {
removedNode = a0->tail;
a0->tail = a1->tail;
}
- else if (a0->head == a1->tail)
- {
+ else if (a0->head == a1->tail) {
removedNode = a0->head;
a0->head = a1->head;
}
@@ -2303,11 +2166,9 @@ int mergeConnectedArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
int mergeArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
{
int result = 0;
- // TRIANGLE POINTS DOWN
- if (a0->head->weight == a1->head->weight) // heads are the same
- {
- if (a0->tail->weight == a1->tail->weight) // tails also the same, arcs can be totally merge together
- {
+ /* TRIANGLE POINTS DOWN */
+ if (a0->head->weight == a1->head->weight) { /* heads are the same */
+ if (a0->tail->weight == a1->tail->weight) { /* tails also the same, arcs can be totally merge together */
mergeArcEdges(rg, a0, a1, MERGE_APPEND);
mergeArcFaces(rg, a0, a1);
@@ -2325,8 +2186,7 @@ int mergeArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
REEB_freeArc((BArc*)a1);
result = 1;
}
- else if (a0->tail->weight > a1->tail->weight) // a1->tail->weight is in the middle
- {
+ else if (a0->tail->weight > a1->tail->weight) { /* a1->tail->weight is in the middle */
mergeArcEdges(rg, a1, a0, MERGE_LOWER);
mergeArcFaces(rg, a1, a0);
@@ -2340,8 +2200,7 @@ int mergeArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
a0->head = a1->tail;
resizeArcBuckets(a0);
}
- else // a0>n2 is in the middle
- {
+ else { /* a0>n2 is in the middle */
mergeArcEdges(rg, a0, a1, MERGE_LOWER);
mergeArcFaces(rg, a0, a1);
@@ -2356,11 +2215,9 @@ int mergeArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
resizeArcBuckets(a1);
}
}
- // TRIANGLE POINTS UP
- else if (a0->tail->weight == a1->tail->weight) // tails are the same
- {
- if (a0->head->weight > a1->head->weight) // a0->head->weight is in the middle
- {
+ /* TRIANGLE POINTS UP */
+ else if (a0->tail->weight == a1->tail->weight) { /* tails are the same */
+ if (a0->head->weight > a1->head->weight) { /* a0->head->weight is in the middle */
mergeArcEdges(rg, a0, a1, MERGE_HIGHER);
mergeArcFaces(rg, a0, a1);
@@ -2374,8 +2231,7 @@ int mergeArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
a1->tail = a0->head;
resizeArcBuckets(a1);
}
- else // a1->head->weight is in the middle
- {
+ else { /* a1->head->weight is in the middle */
mergeArcEdges(rg, a1, a0, MERGE_HIGHER);
mergeArcFaces(rg, a1, a0);
@@ -2390,9 +2246,8 @@ int mergeArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
resizeArcBuckets(a0);
}
}
- else
- {
- // Need something here (OR NOT)
+ else {
+ /* Need something here (OR NOT) */
}
return result;
@@ -2401,18 +2256,14 @@ int mergeArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
static void glueByMergeSort(ReebGraph *rg, ReebArc *a0, ReebArc *a1, ReebEdge *e0, ReebEdge *e1)
{
int total = 0;
- while (total == 0 && a0 != a1 && a0 != NULL && a1 != NULL)
- {
+ while (total == 0 && a0 != a1 && a0 != NULL && a1 != NULL) {
total = mergeArcs(rg, a0, a1);
- if (total == 0) // if it wasn't a total merge, go forward
- {
- if (a0->tail->weight < a1->tail->weight)
- {
+ if (total == 0) // if it wasn't a total merge, go forward {
+ if (a0->tail->weight < a1->tail->weight) {
a0 = nextArcMappedToEdge(a0, e0);
}
- else
- {
+ else {
a1 = nextArcMappedToEdge(a1, e1);
}
}
@@ -2437,8 +2288,7 @@ static ReebEdge * createArc(ReebGraph *rg, ReebNode *node1, ReebNode *node2)
edge = BLI_edgehash_lookup(rg->emap, node1->index, node2->index);
// Only add existing edges that haven't been added yet
- if (edge == NULL)
- {
+ if (edge == NULL) {
ReebArc *arc;
ReebNode *v1, *v2;
float len, offset;
@@ -2451,13 +2301,11 @@ static ReebEdge * createArc(ReebGraph *rg, ReebNode *node1, ReebNode *node2)
arc->symmetry_level = 0;
arc->faces = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "createArc gh");
- if (node1->weight <= node2->weight)
- {
+ if (node1->weight <= node2->weight) {
v1 = node1;
v2 = node2;
}
- else
- {
+ else {
v1 = node2;
v2 = node1;
}
@@ -2497,8 +2345,7 @@ static ReebEdge * createArc(ReebGraph *rg, ReebNode *node1, ReebNode *node2)
addVertToBucket(&(arc->buckets[arc->bcount - 1]), arc->tail->co);
}
#else
- for (i = 0; i < arc->bcount; i++)
- {
+ for (i = 0; i < arc->bcount; i++) {
float co[3];
float f = (arc->buckets[i].val - offset) / len;
@@ -2532,20 +2379,17 @@ static void addTriangleToGraph(ReebGraph *rg, ReebNode * n1, ReebNode * n2, Reeb
/* The rest of the algorithm assumes that e1 is the longest edge */
- if (len1 >= len2 && len1 >= len3)
- {
+ if (len1 >= len2 && len1 >= len3) {
e1 = re1;
e2 = re2;
e3 = re3;
}
- else if (len2 >= len1 && len2 >= len3)
- {
+ else if (len2 >= len1 && len2 >= len3) {
e1 = re2;
e2 = re1;
e3 = re3;
}
- else
- {
+ else {
e1 = re3;
e2 = re2;
e3 = re1;
@@ -2554,8 +2398,7 @@ static void addTriangleToGraph(ReebGraph *rg, ReebNode * n1, ReebNode * n2, Reeb
/* And e2 is the lowest edge
* If e3 is lower than e2, swap them
*/
- if (e3->v1->weight < e2->v1->weight)
- {
+ if (e3->v1->weight < e2->v1->weight) {
ReebEdge *etmp = e2;
e2 = e3;
e3 = etmp;
@@ -2595,10 +2438,8 @@ ReebGraph * generateReebGraph(EditMesh *em, int subdivisions)
renormalizeWeight(em, (float)rg->resolution);
/* Adding vertice */
- for (index = 0, eve = em->verts.first; eve; eve = eve->next)
- {
- if (eve->h == 0)
- {
+ for (index = 0, eve = em->verts.first; eve; eve = eve->next) {
+ if (eve->h == 0) {
addNode(rg, eve);
eve->f2 = 0;
index++;
@@ -2606,10 +2447,8 @@ ReebGraph * generateReebGraph(EditMesh *em, int subdivisions)
}
/* Adding face, edge per edge */
- for (efa = em->faces.first; efa; efa = efa->next)
- {
- if (efa->h == 0)
- {
+ for (efa = em->faces.first; efa; efa = efa->next) {
+ if (efa->h == 0) {
ReebNode *n1, *n2, *n3;
n1 = nodeData(efa->v1);
@@ -2618,15 +2457,13 @@ ReebGraph * generateReebGraph(EditMesh *em, int subdivisions)
addTriangleToGraph(rg, n1, n2, n3, efa);
- if (efa->v4)
- {
+ if (efa->v4) {
ReebNode *n4 = nodeData(efa->v4);
addTriangleToGraph(rg, n1, n3, n4, efa);
}
#ifdef DEBUG_REEB
countfaces++;
- if (countfaces % 100 == 0)
- {
+ if (countfaces % 100 == 0) {
printf("\rface %i of %i", countfaces, totfaces);
}
#endif
@@ -2656,8 +2493,7 @@ void renormalizeWeight(EditMesh *em, float newmax)
eve = em->verts.first;
minimum = weightData(eve);
maximum = minimum;
- for (; eve; eve = eve->next)
- {
+ for (; eve; eve = eve->next) {
maximum = MAX2(maximum, weightData(eve));
minimum = MIN2(minimum, weightData(eve));
}
@@ -2665,8 +2501,7 @@ void renormalizeWeight(EditMesh *em, float newmax)
range = maximum - minimum;
/* Normalize weights */
- for (eve = em->verts.first; eve; eve = eve->next)
- {
+ for (eve = em->verts.first; eve; eve = eve->next) {
float weight = (weightData(eve) - minimum) / range * newmax;
weightSetData(eve, weight);
}
@@ -2681,8 +2516,7 @@ int weightFromLoc(EditMesh *em, int axis)
return 0;
/* Copy coordinate in weight */
- for (eve = em->verts.first; eve; eve = eve->next)
- {
+ for (eve = em->verts.first; eve; eve = eve->next) {
weightSetData(eve, eve->co[axis]);
}
@@ -2745,8 +2579,7 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
int rval;
/* Find local extrema */
- for (eve = em->verts.first; eve; eve = eve->next)
- {
+ for (eve = em->verts.first; eve; eve = eve->next) {
totvert++;
}
@@ -2759,52 +2592,42 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
nlBegin(NL_SYSTEM);
/* Find local extrema */
- for (index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
- {
- if (eve->h == 0)
- {
+ for (index = 0, eve = em->verts.first; eve; index++, eve = eve->next) {
+ if (eve->h == 0) {
EditEdge *eed;
int maximum = 1;
int minimum = 1;
NextEdgeForVert(indexed_edges, -1); /* Reset next edge */
- for (eed = NextEdgeForVert(indexed_edges, index); eed && (maximum || minimum); eed = NextEdgeForVert(indexed_edges, index))
- {
+ for (eed = NextEdgeForVert(indexed_edges, index); eed && (maximum || minimum); eed = NextEdgeForVert(indexed_edges, index)) {
EditVert *eve2;
- if (eed->v1 == eve)
- {
+ if (eed->v1 == eve) {
eve2 = eed->v2;
}
- else
- {
+ else {
eve2 = eed->v1;
}
- if (eve2->h == 0)
- {
+ if (eve2->h == 0) {
/* Adjacent vertex is bigger, not a local maximum */
- if (weightData(eve2) > weightData(eve))
- {
+ if (weightData(eve2) > weightData(eve)) {
maximum = 0;
}
/* Adjacent vertex is smaller, not a local minimum */
- else if (weightData(eve2) < weightData(eve))
- {
+ else if (weightData(eve2) < weightData(eve)) {
minimum = 0;
}
}
}
- if (maximum || minimum)
- {
+ if (maximum || minimum) {
float w = weightData(eve);
eve->f1 = 0;
nlSetVariable(0, index, w);
nlLockVariable(index);
}
- else
- {
+ else {
eve->f1 = 1;
}
}
@@ -2813,38 +2636,30 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
nlBegin(NL_MATRIX);
/* Zero edge weight */
- for (eed = em->edges.first; eed; eed = eed->next)
- {
+ for (eed = em->edges.first; eed; eed = eed->next) {
eed->tmp.l = 0;
}
/* Add faces count to the edge weight */
- for (efa = em->faces.first; efa; efa = efa->next)
- {
- if (efa->h == 0)
- {
+ for (efa = em->faces.first; efa; efa = efa->next) {
+ if (efa->h == 0) {
efa->e1->tmp.l++;
efa->e2->tmp.l++;
efa->e3->tmp.l++;
- if (efa->e4)
- {
+ if (efa->e4) {
efa->e4->tmp.l++;
}
}
}
/* Add faces angle to the edge weight */
- for (efa = em->faces.first; efa; efa = efa->next)
- {
- if (efa->h == 0)
- {
- if (efa->v4 == NULL)
- {
+ for (efa = em->faces.first; efa; efa = efa->next) {
+ if (efa->h == 0) {
+ if (efa->v4 == NULL) {
addTriangle(efa->v1, efa->v2, efa->v3, efa->e1->tmp.l, efa->e2->tmp.l, efa->e3->tmp.l);
}
- else
- {
+ else {
addTriangle(efa->v1, efa->v2, efa->v3, efa->e1->tmp.l, efa->e2->tmp.l, 2);
addTriangle(efa->v3, efa->v4, efa->v1, efa->e3->tmp.l, efa->e4->tmp.l, 2);
}
@@ -2857,16 +2672,13 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
success = nlSolveAdvanced(NULL, NL_TRUE);
- if (success)
- {
+ if (success) {
rval = 1;
- for (index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
- {
+ for (index = 0, eve = em->verts.first; eve; index++, eve = eve->next) {
weightSetData(eve, nlGetVariable(0, index));
}
}
- else
- {
+ else {
rval = 0;
}
@@ -2881,20 +2693,17 @@ EditEdge * NextEdgeForVert(EdgeIndex *indexed_edges, int index)
static int offset = -1;
/* Reset method, call with NULL mesh pointer */
- if (index == -1)
- {
+ if (index == -1) {
offset = -1;
return NULL;
}
/* first pass, start at the head of the list */
- if (offset == -1)
- {
+ if (offset == -1) {
offset = indexed_edges->offset[index];
}
/* subsequent passes, start on the next edge */
- else
- {
+ else {
offset++;
}
@@ -2916,23 +2725,19 @@ static void shortestPathsFromVert(EditMesh *em, EditVert *starting_vert, EdgeInd
BLI_heap_insert(edge_heap, FLT_MAX, NULL);
/* Initialize edge flag */
- for (eed= em->edges.first; eed; eed= eed->next)
- {
+ for (eed= em->edges.first; eed; eed= eed->next) {
eed->f1 = 0;
}
- while (BLI_heap_size(edge_heap) > 0)
- {
+ while (BLI_heap_size(edge_heap) > 0) {
float current_weight;
current_eve->f1 = 1; /* mark vertex as selected */
/* Add all new edges connected to current_eve to the list */
NextEdgeForVert(indexed_edges, -1); // Reset next edge
- for (eed = NextEdgeForVert(indexed_edges, indexData(current_eve)); eed; eed = NextEdgeForVert(indexed_edges, indexData(current_eve)))
- {
- if (eed->f1 == 0)
- {
+ for (eed = NextEdgeForVert(indexed_edges, indexData(current_eve)); eed; eed = NextEdgeForVert(indexed_edges, indexData(current_eve))) {
+ if (eed->f1 == 0) {
BLI_heap_insert(edge_heap, weightData(current_eve) + eed->tmp.fp, eed);
eed->f1 = 1;
}
@@ -2945,16 +2750,13 @@ static void shortestPathsFromVert(EditMesh *em, EditVert *starting_vert, EdgeInd
select_eed = BLI_heap_popmin(edge_heap);
} while (select_eed != NULL && select_eed->v1->f1 != 0 && select_eed->v2->f1);
- if (select_eed != NULL)
- {
+ if (select_eed != NULL) {
select_eed->f1 = 2;
- if (select_eed->v1->f1 == 0) /* v1 is the new vertex */
- {
+ if (select_eed->v1->f1 == 0) /* v1 is the new vertex */ {
current_eve = select_eed->v1;
}
- else /* otherwise, it's v2 */
- {
+ else { /* otherwise, it's v2 */
current_eve = select_eed->v2;
}
@@ -2983,10 +2785,8 @@ static void buildIndexedEdges(EditMesh *em, EdgeIndex *indexed_edges)
indexed_edges->offset = MEM_callocN(totvert * sizeof(int), "EdgeIndex offset");
- for (eed = em->edges.first; eed; eed = eed->next)
- {
- if (eed->v1->h == 0 && eed->v2->h == 0)
- {
+ for (eed = em->edges.first; eed; eed = eed->next) {
+ if (eed->v1->h == 0 && eed->v2->h == 0) {
tot_indexed += 2;
indexed_edges->offset[indexData(eed->v1)]++;
indexed_edges->offset[indexData(eed->v2)]++;
@@ -2998,10 +2798,8 @@ static void buildIndexedEdges(EditMesh *em, EdgeIndex *indexed_edges)
indexed_edges->edges = MEM_callocN(tot_indexed * sizeof(EditEdge*), "EdgeIndex edges");
/* setting vert offsets */
- for (eve = em->verts.first; eve; eve = eve->next)
- {
- if (eve->h == 0)
- {
+ for (eve = em->verts.first; eve; eve = eve->next) {
+ if (eve->h == 0) {
int d = indexed_edges->offset[indexData(eve)];
indexed_edges->offset[indexData(eve)] = offset;
offset += d + 1;
@@ -3009,24 +2807,18 @@ static void buildIndexedEdges(EditMesh *em, EdgeIndex *indexed_edges)
}
/* adding edges in array */
- for (eed = em->edges.first; eed; eed= eed->next)
- {
- if (eed->v1->h == 0 && eed->v2->h == 0)
- {
+ for (eed = em->edges.first; eed; eed= eed->next) {
+ if (eed->v1->h == 0 && eed->v2->h == 0) {
int i;
- for (i = indexed_edges->offset[indexData(eed->v1)]; i < tot_indexed; i++)
- {
- if (indexed_edges->edges[i] == NULL)
- {
+ for (i = indexed_edges->offset[indexData(eed->v1)]; i < tot_indexed; i++) {
+ if (indexed_edges->edges[i] == NULL) {
indexed_edges->edges[i] = eed;
break;
}
}
- for (i = indexed_edges->offset[indexData(eed->v2)]; i < tot_indexed; i++)
- {
- if (indexed_edges->edges[i] == NULL)
- {
+ for (i = indexed_edges->offset[indexData(eed->v2)]; i < tot_indexed; i++) {
+ if (indexed_edges->edges[i] == NULL) {
indexed_edges->edges[i] = eed;
break;
}
@@ -3044,80 +2836,64 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
totvert = BLI_countlist(&em->verts);
- if (em == NULL || totvert == 0)
- {
+ if (em == NULL || totvert == 0) {
return 0;
}
totedge = BLI_countlist(&em->edges);
- if (totedge == 0)
- {
+ if (totedge == 0) {
return 0;
}
/* Initialize vertice flag and find at least one selected vertex */
- for (eve = em->verts.first; eve; eve = eve->next)
- {
+ for (eve = em->verts.first; eve; eve = eve->next) {
eve->f1 = 0;
- if (eve->f & SELECT)
- {
+ if (eve->f & SELECT) {
vCount = 1;
}
}
- if (vCount == 0)
- {
+ if (vCount == 0) {
return 0; /* no selected vert, failure */
}
- else
- {
+ else {
EditEdge *eed;
int allDone = 0;
/* Calculate edge weight */
- for (eed = em->edges.first; eed; eed= eed->next)
- {
- if (eed->v1->h == 0 && eed->v2->h == 0)
- {
+ for (eed = em->edges.first; eed; eed= eed->next) {
+ if (eed->v1->h == 0 && eed->v2->h == 0) {
eed->tmp.fp = len_v3v3(eed->v1->co, eed->v2->co);
}
}
/* Apply dijkstra spf for each selected vert */
- for (eve = em->verts.first; eve; eve = eve->next)
- {
- if (eve->f & SELECT)
- {
+ for (eve = em->verts.first; eve; eve = eve->next) {
+ if (eve->f & SELECT) {
shortestPathsFromVert(em, eve, indexed_edges);
}
}
/* connect unselected islands */
- while (allDone == 0)
- {
+ while (allDone == 0) {
EditVert *selected_eve = NULL;
float selected_weight = 0;
float min_distance = FLT_MAX;
allDone = 1;
- for (eve = em->verts.first; eve; eve = eve->next)
- {
+ for (eve = em->verts.first; eve; eve = eve->next) {
/* for every vertex visible that hasn't been processed yet */
- if (eve->h == 0 && eve->f1 != 1)
- {
+ if (eve->h == 0 && eve->f1 != 1) {
EditVert *closest_eve;
/* find the closest processed vertex */
- for (closest_eve = em->verts.first; closest_eve; closest_eve = closest_eve->next)
- {
+ for (closest_eve = em->verts.first; closest_eve; closest_eve = closest_eve->next) {
/* vertex is already processed and distance is smaller than current minimum */
- if (closest_eve->f1 == 1)
- {
+ if (closest_eve->f1 == 1) {
float distance = len_v3v3(closest_eve->co, eve->co);
- if (distance < min_distance)
- {
+ if (distance < min_distance) {
min_distance = distance;
selected_eve = eve;
selected_weight = weightData(closest_eve);
@@ -3127,8 +2903,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
}
}
- if (selected_eve)
- {
+ if (selected_eve) {
allDone = 0;
weightSetData(selected_eve, selected_weight + min_distance);
@@ -3137,10 +2912,8 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
}
}
- for (eve = em->verts.first; eve && vCount == 0; eve = eve->next)
- {
- if (eve->f1 == 0)
- {
+ for (eve = em->verts.first; eve && vCount == 0; eve = eve->next) {
+ if (eve->f1 == 0) {
printf("vertex not reached\n");
break;
}
@@ -3173,13 +2946,11 @@ static void initIteratorFct(ReebArcIterator *iter)
static void setIteratorValues(ReebArcIterator *iter, EmbedBucket *bucket)
{
- if (bucket)
- {
+ if (bucket) {
iter->p = bucket->p;
iter->no = bucket->no;
}
- else
- {
+ else {
iter->p = NULL;
iter->no = NULL;
}
@@ -3193,14 +2964,12 @@ void initArcIterator(BArcIterator *arg, ReebArc *arc, ReebNode *head)
initIteratorFct(iter);
iter->arc = arc;
- if (head == arc->head)
- {
+ if (head == arc->head) {
iter->start = 0;
iter->end = arc->bcount - 1;
iter->stride = 1;
}
- else
- {
+ else {
iter->start = arc->bcount - 1;
iter->end = 0;
iter->stride = -1;
@@ -3218,14 +2987,12 @@ void initArcIteratorStart(BArcIterator *arg, struct ReebArc *arc, struct ReebNod
initIteratorFct(iter);
iter->arc = arc;
- if (head == arc->head)
- {
+ if (head == arc->head) {
iter->start = start;
iter->end = arc->bcount - 1;
iter->stride = 1;
}
- else
- {
+ else {
iter->start = arc->bcount - 1 - start;
iter->end = 0;
iter->stride = -1;
@@ -3235,8 +3002,7 @@ void initArcIteratorStart(BArcIterator *arg, struct ReebArc *arc, struct ReebNod
iter->length = arc->bcount - start;
- if (start >= arc->bcount)
- {
+ if (start >= arc->bcount) {
iter->start = iter->end; /* stop iterator since it's past its end */
}
}
@@ -3251,12 +3017,10 @@ void initArcIterator2(BArcIterator *arg, ReebArc *arc, int start, int end)
iter->start = start;
iter->end = end;
- if (end > start)
- {
+ if (end > start) {
iter->stride = 1;
}
- else
- {
+ else {
iter->stride = -1;
}
@@ -3270,12 +3034,10 @@ static void* headNode(void *arg)
ReebArcIterator *iter = (ReebArcIterator*)arg;
ReebNode *node;
- if (iter->start < iter->end)
- {
+ if (iter->start < iter->end) {
node = iter->arc->head;
}
- else
- {
+ else {
node = iter->arc->tail;
}
@@ -3291,12 +3053,10 @@ static void* tailNode(void *arg)
ReebArcIterator *iter = (ReebArcIterator*)arg;
ReebNode *node;
- if (iter->start < iter->end)
- {
+ if (iter->start < iter->end) {
node = iter->arc->tail;
}
- else
- {
+ else {
node = iter->arc->head;
}
@@ -3314,8 +3074,7 @@ static void* nextBucket(void *arg)
iter->index++;
- if (iter->index < iter->length)
- {
+ if (iter->index < iter->length) {
result = &(iter->arc->buckets[iter->start + (iter->stride * iter->index)]);
}
@@ -3331,8 +3090,7 @@ static void* nextNBucket(void *arg, int n)
iter->index += n;
/* check if passed end */
- if (iter->index < iter->length)
- {
+ if (iter->index < iter->length) {
result = &(iter->arc->buckets[iter->start + (iter->stride * iter->index)]);
}
@@ -3347,8 +3105,7 @@ static void* peekBucket(void *arg, int n)
int index = iter->index + n;
/* check if passed end */
- if (index < iter->length)
- {
+ if (index < iter->length) {
result = &(iter->arc->buckets[iter->start + (iter->stride * index)]);
}
@@ -3361,8 +3118,7 @@ static void* previousBucket(void *arg)
ReebArcIterator *iter = (ReebArcIterator*)arg;
EmbedBucket *result = NULL;
- if (iter->index > 0)
- {
+ if (iter->index > 0) {
iter->index--;
result = &(iter->arc->buckets[iter->start + (iter->stride * iter->index)]);
}
@@ -3375,12 +3131,10 @@ static int iteratorStopped(void *arg)
{
ReebArcIterator *iter = (ReebArcIterator*)arg;
- if (iter->index >= iter->length)
- {
+ if (iter->index >= iter->length) {
return 1;
}
- else
- {
+ else {
return 0;
}
}
@@ -3716,18 +3470,18 @@ void REEB_draw()
glColor3f(0, 1, 0);
glRasterPos3fv(vec);
- BMF_DrawString( G.fonts, text);
+ BMF_DrawString(G.fonts, text);
}
if (G.scene->toolsettings->skgen_options & SKGEN_DISP_INDEX)
{
sprintf(text, " %i", arc->head->index);
glRasterPos3fv(arc->head->p);
- BMF_DrawString( G.fonts, text);
+ BMF_DrawString(G.fonts, text);
sprintf(text, " %i", arc->tail->index);
glRasterPos3fv(arc->tail->p);
- BMF_DrawString( G.fonts, text);
+ BMF_DrawString(G.fonts, text);
}
}
glEnable(GL_DEPTH_TEST);
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index c19041b817e..15e2ad77fa9 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -108,7 +108,7 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu
static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short selstatus);
/* still need to eradicate a few :( */
-#define callocstructN(x,y,name) (x*)MEM_callocN((y)* sizeof(x),name)
+#define callocstructN(x, y, name) (x*)MEM_callocN((y)* sizeof(x), name)
static float nurbcircle[8][2]= {
{0.0, -1.0}, {-1.0, -1.0}, {-1.0, 0.0}, {-1.0, 1.0},
@@ -132,7 +132,7 @@ static void set_actNurb(Object *obedit, Nurb *nu)
if (nu==NULL)
cu->actnu = -1;
else {
- ListBase *nurbs= curve_editnurbs(cu);
+ ListBase *nurbs= BKE_curve_editNurbs_get(cu);
cu->actnu = BLI_findindex(nurbs, nu);
}
}
@@ -140,7 +140,7 @@ static void set_actNurb(Object *obedit, Nurb *nu)
static Nurb *get_actNurb(Object *obedit)
{
Curve *cu= obedit->data;
- ListBase *nurbs= curve_editnurbs(cu);
+ ListBase *nurbs= BKE_curve_editNurbs_get(cu);
return BLI_findlink(nurbs, cu->actnu);
}
@@ -736,7 +736,7 @@ static void calc_keyHandles(ListBase *nurb, float *key)
if (nextp) key_to_bezt(nextfp, nextp, &next);
if (prevp) key_to_bezt(prevfp, prevp, &prev);
- calchandleNurb(&cur, prevp ? &prev : NULL, nextp ? &next : NULL, 0);
+ BKE_nurb_handle_calc(&cur, prevp ? &prev : NULL, nextp ? &next : NULL, 0);
bezt_to_key(&cur, fp);
prevp= bezt;
@@ -782,7 +782,7 @@ static void calc_shapeKeys(Object *obedit)
BezTriple *bezt, *oldbezt;
BPoint *bp, *oldbp;
Nurb *nu;
- int totvert= count_curveverts(&editnurb->nurbs);
+ int totvert= BKE_nurbList_verts_count(&editnurb->nurbs);
float (*ofs)[3] = NULL;
float *oldkey, *newkey, *ofp;
@@ -1207,11 +1207,11 @@ void load_editNurb(Object *obedit)
ListBase newnurb= {NULL, NULL}, oldnurb= cu->nurb;
for (nu= editnurb->first; nu; nu= nu->next) {
- newnu= duplicateNurb(nu);
+ newnu= BKE_nurb_duplicate(nu);
BLI_addtail(&newnurb, newnu);
if (nu->type == CU_NURBS) {
- clamp_nurb_order_u(nu);
+ BKE_nurb_order_clamp_u(nu);
}
}
@@ -1220,7 +1220,7 @@ void load_editNurb(Object *obedit)
calc_shapeKeys(obedit);
ED_curve_updateAnimPaths(obedit->data);
- freeNurblist(&oldnurb);
+ BKE_nurbList_free(&oldnurb);
}
set_actNurb(obedit, NULL);
@@ -1247,8 +1247,8 @@ void make_editNurb(Object *obedit)
}
if (editnurb) {
- freeNurblist(&editnurb->nurbs);
- free_curve_editNurb_keyIndex(editnurb);
+ BKE_nurbList_free(&editnurb->nurbs);
+ BKE_curve_editNurb_keyIndex_free(editnurb);
editnurb->keyindex= NULL;
}
else {
@@ -1260,8 +1260,8 @@ void make_editNurb(Object *obedit)
cu->lastsel= NULL; /* for select row */
while (nu) {
- newnu= duplicateNurb(nu);
- test2DNurb(newnu); // after join, or any other creation of curve
+ newnu= BKE_nurb_duplicate(nu);
+ BKE_nurb_test2D(newnu); // after join, or any other creation of curve
BLI_addtail(&editnurb->nurbs, newnu);
if (nu_act == NULL && isNurbsel(nu)) {
@@ -1285,7 +1285,7 @@ void free_editNurb(Object *obedit)
{
Curve *cu= obedit->data;
- free_curve_editNurb(cu);
+ BKE_curve_editNurb_free(cu);
}
void CU_deselect_all(Object *obedit)
@@ -1377,15 +1377,15 @@ static int separate_exec(bContext *C, wmOperator *op)
ED_base_object_select(newbase, BA_DESELECT);
newob= newbase->object;
- newcu= newob->data= copy_curve(oldcu);
+ newcu= newob->data= BKE_curve_copy(oldcu);
newcu->editnurb= NULL;
oldcu->id.us--; /* because new curve is a copy: reduce user count */
/* 2. put new object in editmode and clear it */
make_editNurb(newob);
newedit= newcu->editnurb;
- freeNurblist(&newedit->nurbs);
- free_curve_editNurb_keyIndex(newedit);
+ BKE_nurbList_free(&newedit->nurbs);
+ BKE_curve_editNurb_keyIndex_free(newedit);
/* 3. move over parts from old object */
for (nu= oldedit->nurbs.first; nu; nu=nu1) {
@@ -1547,7 +1547,7 @@ static void translateflagNurb(ListBase *editnurb, short flag, const float vec[3]
}
}
- test2DNurb(nu);
+ BKE_nurb_test2D(nu);
}
}
@@ -1602,7 +1602,7 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
if (a==0) {
BLI_remlink(editnurb, nu);
keyIndex_delNurb(cu->editnurb, nu);
- freeNurb(nu); nu=NULL;
+ BKE_nurb_free(nu); nu=NULL;
}
else {
/* is nurb in U direction selected */
@@ -1640,9 +1640,9 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
nu->pntsv= newv;
MEM_freeN(nu->bp);
nu->bp= newbp;
- clamp_nurb_order_v(nu);
+ BKE_nurb_order_clamp_v(nu);
- nurbs_knot_calc_v(nu);
+ BKE_nurb_knot_calc_v(nu);
}
else {
/* is the nurb in V direction selected */
@@ -1684,15 +1684,15 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
nu->pntsu= nu->pntsv;
nu->pntsv= 1;
SWAP(short, nu->orderu, nu->orderv);
- clamp_nurb_order_u(nu);
+ BKE_nurb_order_clamp_u(nu);
if (nu->knotsv) MEM_freeN(nu->knotsv);
nu->knotsv= NULL;
}
else {
nu->pntsu= newu;
- clamp_nurb_order_u(nu);
+ BKE_nurb_order_clamp_u(nu);
}
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
}
}
@@ -1743,7 +1743,7 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
nu->pntsv= 2;
nu->orderv= 2;
- nurbs_knot_calc_v(nu);
+ BKE_nurb_knot_calc_v(nu);
}
}
else {
@@ -1786,7 +1786,7 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
MEM_freeN(nu->bp);
nu->bp= newbp;
nu->pntsv++;
- nurbs_knot_calc_v(nu);
+ BKE_nurb_knot_calc_v(nu);
}
else if (v==0 || v== nu->pntsu-1) { /* column in v-direction selected */
ok= 1;
@@ -1813,7 +1813,7 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
MEM_freeN(nu->bp);
nu->bp= newbp;
nu->pntsu++;
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
}
}
@@ -1911,7 +1911,7 @@ static void adduplicateflagNurb(Object *obedit, short flag)
/* knots */
newnu->knotsu= NULL;
- nurbs_knot_calc_u(newnu);
+ BKE_nurb_knot_calc_u(newnu);
}
bp++;
}
@@ -1956,8 +1956,8 @@ static void adduplicateflagNurb(Object *obedit, short flag)
newnu->pntsv= newv;
newnu->bp =
(BPoint*)MEM_mallocN(newu * newv * sizeof(BPoint), "adduplicateN6");
- clamp_nurb_order_u(newnu);
- clamp_nurb_order_v(newnu);
+ BKE_nurb_order_clamp_u(newnu);
+ BKE_nurb_order_clamp_v(newnu);
newnu->knotsu= newnu->knotsv= NULL;
@@ -1972,20 +1972,20 @@ static void adduplicateflagNurb(Object *obedit, short flag)
}
}
}
- if (check_valid_nurb_u(newnu)) {
+ if (BKE_nurb_check_valid_u(newnu)) {
if (nu->pntsu==newnu->pntsu && nu->knotsu) {
- newnu->knotsu= MEM_dupallocN( nu->knotsu );
+ newnu->knotsu= MEM_dupallocN(nu->knotsu);
}
else {
- nurbs_knot_calc_u(newnu);
+ BKE_nurb_knot_calc_u(newnu);
}
}
- if (check_valid_nurb_v(newnu)) {
+ if (BKE_nurb_check_valid_v(newnu)) {
if (nu->pntsv==newnu->pntsv && nu->knotsv) {
- newnu->knotsv= MEM_dupallocN( nu->knotsv );
+ newnu->knotsv= MEM_dupallocN(nu->knotsv);
}
else {
- nurbs_knot_calc_v(newnu);
+ BKE_nurb_knot_calc_v(newnu);
}
}
}
@@ -2010,7 +2010,7 @@ static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
for (nu= editnurb->nurbs.first; nu; nu= nu->next)
if (isNurbsel(nu)) {
- switchdirectionNurb(nu);
+ BKE_nurb_direction_switch(nu);
keyData_switchDirectionNurb(cu, nu);
}
@@ -2157,7 +2157,7 @@ static int smooth_exec(bContext *C, wmOperator *UNUSED(op))
for (nu= editnurb->first; nu; nu= nu->next) {
if (nu->bezt) {
change = 0;
- beztOrig = MEM_dupallocN( nu->bezt );
+ beztOrig = MEM_dupallocN(nu->bezt);
for (bezt=nu->bezt+1, a=1; a<nu->pntsu-1; a++, bezt++) {
if (bezt->f2 & SELECT) {
for (i=0; i<3; i++) {
@@ -2174,10 +2174,10 @@ static int smooth_exec(bContext *C, wmOperator *UNUSED(op))
}
MEM_freeN(beztOrig);
if (change)
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
else if (nu->bp) {
- bpOrig = MEM_dupallocN( nu->bp );
+ bpOrig = MEM_dupallocN(nu->bp);
/* Same as above, keep these the same! */
for (bp=nu->bp+1, a=1; a<nu->pntsu-1; a++, bp++) {
if (bp->f1 & SELECT) {
@@ -2893,7 +2893,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
nu->bezt= beztnew;
nu->pntsu+= amount;
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
} /* End of 'if (nu->type == CU_BEZIER)' */
else if (nu->pntsv==1) {
@@ -2965,7 +2965,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
nu->pntsu+= amount;
if (nu->type & CU_NURBS) {
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
}
} /* End of 'else if (nu->pntsv==1)' */
@@ -3039,7 +3039,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
/* total count of nodes after subdivision */
int tot= ((number_cuts+1)*nu->pntsu-number_cuts)*((number_cuts+1)*nu->pntsv-number_cuts);
- bpn=bpnew= MEM_mallocN( tot*sizeof(BPoint), "subdivideNurb4");
+ bpn=bpnew= MEM_mallocN(tot*sizeof(BPoint), "subdivideNurb4");
bp= nu->bp;
/* first subdivide rows */
for (a=0; a<nu->pntsv; a++) {
@@ -3086,8 +3086,8 @@ static void subdividenurb(Object *obedit, int number_cuts)
nu->bp= bpnew;
nu->pntsu= (number_cuts+1)*nu->pntsu-number_cuts;
nu->pntsv= (number_cuts+1)*nu->pntsv-number_cuts;
- nurbs_knot_calc_u(nu);
- nurbs_knot_calc_v(nu);
+ BKE_nurb_knot_calc_u(nu);
+ BKE_nurb_knot_calc_v(nu);
} /* End of 'if (sel== nu->pntsu*nu->pntsv)' (subdivide entire NURB) */
else {
/* subdivide in v direction? */
@@ -3097,7 +3097,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
}
if (sel) { /* V ! */
- bpn=bpnew= MEM_mallocN( (sel+nu->pntsv)*nu->pntsu*sizeof(BPoint), "subdivideNurb4");
+ bpn=bpnew= MEM_mallocN((sel+nu->pntsv)*nu->pntsu*sizeof(BPoint), "subdivideNurb4");
bp= nu->bp;
for (a=0; a<nu->pntsv; a++) {
for (b=0; b<nu->pntsu; b++) {
@@ -3132,7 +3132,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
MEM_freeN(nu->bp);
nu->bp= bpnew;
nu->pntsv+= sel;
- nurbs_knot_calc_v(nu);
+ BKE_nurb_knot_calc_v(nu);
}
else {
/* or in u direction? */
@@ -3144,7 +3144,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
if (sel) { /* U ! */
/* Inserting U points is sort of 'default' Flat curves only get */
/* U points inserted in them. */
- bpn=bpnew= MEM_mallocN( (sel+nu->pntsu)*nu->pntsv*sizeof(BPoint), "subdivideNurb4");
+ bpn=bpnew= MEM_mallocN((sel+nu->pntsu)*nu->pntsv*sizeof(BPoint), "subdivideNurb4");
bp= nu->bp;
for (a=0; a<nu->pntsv; a++) {
for (b=0; b<nu->pntsu; b++) {
@@ -3173,7 +3173,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
MEM_freeN(nu->bp);
nu->bp= bpnew;
nu->pntsu+= sel;
- nurbs_knot_calc_u(nu); /* shift knots forward */
+ BKE_nurb_knot_calc_u(nu); /* shift knots forward */
}
}
}
@@ -3373,13 +3373,13 @@ static int convertspline(short type, Nurb *nu)
nu->bp= NULL;
nu->pntsu= nr;
nu->type = CU_BEZIER;
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
else if (type==CU_NURBS) {
nu->type = CU_NURBS;
nu->orderu= 4;
nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
while (a--) {
@@ -3436,7 +3436,7 @@ static int convertspline(short type, Nurb *nu)
if (type== CU_NURBS) {
nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
nu->flagu |= CU_NURB_BEZIER;
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
}
}
@@ -3559,7 +3559,7 @@ static int set_handle_type_exec(bContext *C, wmOperator *op)
Object *obedit= CTX_data_edit_object(C);
ListBase *editnurb= object_editcurve_get(obedit);
- sethandlesNurb(editnurb, RNA_enum_get(op->ptr, "type"));
+ BKE_nurbList_handles_set(editnurb, RNA_enum_get(op->ptr, "type"));
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
DAG_id_tag_update(obedit->data, 0);
@@ -3651,7 +3651,7 @@ static void rotate_direction_nurb(Nurb *nu)
SWAP(short, nu->flagu, nu->flagv);
SWAP(float *, nu->knotsu, nu->knotsv);
- switchdirection_knots(nu->knotsv, KNOTSV(nu) );
+ switchdirection_knots(nu->knotsv, KNOTSV(nu));
temp= MEM_dupallocN(nu->bp);
bp1= nu->bp;
@@ -3719,7 +3719,7 @@ static void make_selection_list_nurb(ListBase *editnurb)
/* just add the first one */
nus= nbase.first;
BLI_remlink(&nbase, nus);
- BLI_addtail( &nsortbase, nus);
+ BLI_addtail(&nsortbase, nus);
/* now add, either at head or tail, the closest one */
while (nbase.first) {
@@ -3865,15 +3865,15 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
if (nu1->type == CU_NURBS) {
/* merge knots */
- nurbs_knot_calc_u(nu1);
+ BKE_nurb_knot_calc_u(nu1);
/* make knots, for merged curved for example */
- nurbs_knot_calc_v(nu1);
+ BKE_nurb_knot_calc_v(nu1);
}
MEM_freeN(temp);
BLI_remlink(editnurb, nu2);
- freeNurb(nu2);
+ BKE_nurb_free(nu2);
}
static int merge_nurb(bContext *C, wmOperator *op)
@@ -3976,7 +3976,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
else {
if ( BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu-1])) ) {
nu1= nu;
- switchdirectionNurb(nu);
+ BKE_nurb_direction_switch(nu);
keyData_switchDirectionNurb(cu, nu);
}
}
@@ -3984,7 +3984,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
else if (nu2==NULL) {
if ( BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) {
nu2= nu;
- switchdirectionNurb(nu);
+ BKE_nurb_direction_switch(nu);
keyData_switchDirectionNurb(cu, nu);
}
else {
@@ -4003,7 +4003,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
bp= bp+(nu->pntsu-1);
if ( bp->f1 & SELECT ) {
nu1= nu;
- switchdirectionNurb(nu);
+ BKE_nurb_direction_switch(nu);
keyData_switchDirectionNurb(cu, nu);
}
}
@@ -4011,7 +4011,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
else if (nu2==NULL) {
if ( bp->f1 & SELECT ) {
nu2= nu;
- switchdirectionNurb(nu);
+ BKE_nurb_direction_switch(nu);
keyData_switchDirectionNurb(cu, nu);
}
else {
@@ -4038,8 +4038,8 @@ static int make_segment_exec(bContext *C, wmOperator *op)
nu1->bezt= bezt;
nu1->pntsu+= nu2->pntsu;
BLI_remlink(nubase, nu2);
- freeNurb(nu2); nu2= NULL;
- calchandlesNurb(nu1);
+ BKE_nurb_free(nu2); nu2= NULL;
+ BKE_nurb_handles_calc(nu1);
}
else {
bp =
@@ -4057,7 +4057,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
/* now join the knots */
if (nu1->type == CU_NURBS) {
if (nu1->knotsu==NULL) {
- nurbs_knot_calc_u(nu1);
+ BKE_nurb_knot_calc_u(nu1);
}
else {
fp= MEM_mallocN(sizeof(float)*KNOTSU(nu1), "addsegment3");
@@ -4076,7 +4076,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
}
}
}
- freeNurb(nu2); nu2= NULL;
+ BKE_nurb_free(nu2); nu2= NULL;
}
set_actNurb(obedit, nu1); /* for selected */
@@ -4088,12 +4088,12 @@ static int make_segment_exec(bContext *C, wmOperator *op)
if (nu1->type == CU_BEZIER && BEZSELECTED_HIDDENHANDLES(cu, nu1->bezt) &&
BEZSELECTED_HIDDENHANDLES(cu, nu1->bezt+(nu1->pntsu-1))) {
nu1->flagu|= CU_NURB_CYCLIC;
- calchandlesNurb(nu1);
+ BKE_nurb_handles_calc(nu1);
ok= 1;
}
else if (nu1->type == CU_NURBS && nu1->bp->f1&SELECT && (nu1->bp+(nu1->pntsu-1))->f1&SELECT) {
nu1->flagu|= CU_NURB_CYCLIC;
- nurbs_knot_calc_u(nu1);
+ BKE_nurb_knot_calc_u(nu1);
ok= 1;
}
}
@@ -4224,10 +4224,10 @@ static int spin_nurb(float viewmat[][4], Object *obedit, float *axis, float *cen
Curve *cu= (Curve*)obedit->data;
ListBase *editnurb= object_editcurve_get(obedit);
Nurb *nu;
- float si,phi,n[3],q[4],cmat[3][3],tmat[3][3],imat[3][3];
+ float si, phi, n[3], q[4], cmat[3][3], tmat[3][3], imat[3][3];
float bmat[3][3], rotmat[3][3], scalemat1[3][3], scalemat2[3][3];
float persmat[3][3], persinv[3][3];
- short a,ok, changed= 0;
+ short a, ok, changed= 0;
copy_m3_m4(persmat, viewmat);
invert_m3_m3(persinv, persmat);
@@ -4244,7 +4244,7 @@ static int spin_nurb(float viewmat[][4], Object *obedit, float *axis, float *cen
q[1]= n[0]*si;
q[2]= n[1]*si;
q[3]= n[2]*si;
- quat_to_mat3( cmat,q);
+ quat_to_mat3(cmat, q);
mul_m3_m3m3(tmat, cmat, bmat);
mul_m3_m3m3(rotmat, imat, tmat);
@@ -4252,19 +4252,19 @@ static int spin_nurb(float viewmat[][4], Object *obedit, float *axis, float *cen
scalemat1[0][0]= M_SQRT2;
scalemat1[1][1]= M_SQRT2;
- mul_m3_m3m3(tmat,persmat,bmat);
- mul_m3_m3m3(cmat,scalemat1,tmat);
- mul_m3_m3m3(tmat,persinv,cmat);
- mul_m3_m3m3(scalemat1,imat,tmat);
+ mul_m3_m3m3(tmat, persmat, bmat);
+ mul_m3_m3m3(cmat, scalemat1, tmat);
+ mul_m3_m3m3(tmat, persinv, cmat);
+ mul_m3_m3m3(scalemat1, imat, tmat);
unit_m3(scalemat2);
- scalemat2[0][0]/= (float)M_SQRT2;
- scalemat2[1][1]/= (float)M_SQRT2;
+ scalemat2[0][0] /= (float)M_SQRT2;
+ scalemat2[1][1] /= (float)M_SQRT2;
- mul_m3_m3m3(tmat,persmat,bmat);
- mul_m3_m3m3(cmat,scalemat2,tmat);
- mul_m3_m3m3(tmat,persinv,cmat);
- mul_m3_m3m3(scalemat2,imat,tmat);
+ mul_m3_m3m3(tmat, persmat, bmat);
+ mul_m3_m3m3(cmat, scalemat2, tmat);
+ mul_m3_m3m3(tmat, persinv, cmat);
+ mul_m3_m3m3(scalemat2, imat, tmat);
ok= 1;
@@ -4293,7 +4293,7 @@ static int spin_nurb(float viewmat[][4], Object *obedit, float *axis, float *cen
if (isNurbsel(nu)) {
nu->orderv= 4;
nu->flagv |= CU_NURB_CYCLIC;
- nurbs_knot_calc_v(nu);
+ BKE_nurb_knot_calc_v(nu);
}
}
}
@@ -4446,7 +4446,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
newbp->vec[3]= 1.0;
newnu->knotsu= newnu->knotsv= NULL;
- nurbs_knot_calc_u(newnu);
+ BKE_nurb_knot_calc_u(newnu);
ok= 1;
nu= newnu;
@@ -4533,23 +4533,23 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
}
else {
mul_v3_m4v3(newbezt->vec[1], imat, location);
- sub_v3_v3v3(temp, newbezt->vec[1],temp);
+ sub_v3_v3v3(temp, newbezt->vec[1], temp);
if (bezt_recalc[1]) {
const char h1 = bezt_recalc[1]->h1, h2 = bezt_recalc[1]->h2;
bezt_recalc[1]->h1 = bezt_recalc[1]->h2 = HD_AUTO;
- calchandleNurb(bezt_recalc[1], bezt_recalc[0], bezt_recalc[2], 0);
+ BKE_nurb_handle_calc(bezt_recalc[1], bezt_recalc[0], bezt_recalc[2], 0);
bezt_recalc[1]->h1 = h1;
bezt_recalc[1]->h2 = h2;
}
else {
- add_v3_v3v3(newbezt->vec[0], bezt->vec[0],temp);
- add_v3_v3v3(newbezt->vec[2], bezt->vec[2],temp);
+ add_v3_v3v3(newbezt->vec[0], bezt->vec[0], temp);
+ add_v3_v3v3(newbezt->vec[2], bezt->vec[2], temp);
}
- if (newnu) calchandlesNurb(newnu);
- else calchandlesNurb(nu);
+ if (newnu) BKE_nurb_handles_calc(newnu);
+ else BKE_nurb_handles_calc(nu);
}
}
}
@@ -4617,14 +4617,14 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
if (!newnu) {
nu->pntsu++;
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
- else nurbs_knot_calc_u(newnu);
+ else BKE_nurb_knot_calc_u(newnu);
}
}
if (ok) {
- test2DNurb(nu);
+ BKE_nurb_test2D(nu);
if (ED_curve_updateAnimPaths(obedit->data))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
@@ -4783,7 +4783,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
}
bezt++;
}
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
else if (nu->pntsv==1 && nu->type == CU_NURBS) {
if (nu->knotsu) { /* if check_valid_nurb_u fails the knotsu can be NULL */
@@ -4792,7 +4792,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
while (a--) {
if ( bp->f1 & SELECT ) {
nu->flagu ^= CU_NURB_CYCLIC;
- nurbs_knot_calc_u(nu); /* 1==u type is ignored for cyclic curves */
+ BKE_nurb_knot_calc_u(nu); /* 1==u type is ignored for cyclic curves */
break;
}
bp++;
@@ -4807,11 +4807,11 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
if ( bp->f1 & SELECT) {
if (direction==0 && nu->pntsu>1) {
nu->flagu ^= CU_NURB_CYCLIC;
- nurbs_knot_calc_u(nu); /* 1==u type is ignored for cyclic curves */
+ BKE_nurb_knot_calc_u(nu); /* 1==u type is ignored for cyclic curves */
}
if (direction==1 && nu->pntsv>1) {
nu->flagv ^= CU_NURB_CYCLIC;
- nurbs_knot_calc_v(nu); /* 2==v type is ignored for cyclic curves */
+ BKE_nurb_knot_calc_v(nu); /* 2==v type is ignored for cyclic curves */
}
break;
}
@@ -5398,7 +5398,7 @@ static void selectrandom_curve(ListBase *editnurb, float randfac)
BPoint *bp;
int a;
- BLI_srand( BLI_rand() ); /* random seed */
+ BLI_srand(BLI_rand()); /* random seed */
for (nu= editnurb->first; nu; nu= nu->next) {
if (nu->type == CU_BEZIER) {
@@ -5472,7 +5472,7 @@ static int point_on_nurb(Nurb *nu, void *point)
static Nurb *get_lastsel_nurb(Curve *cu)
{
- ListBase *nubase= curve_editnurbs(cu);
+ ListBase *nubase= BKE_curve_editNurbs_get(cu);
Nurb *nu= nubase->first;
if (!cu->lastsel)
@@ -5638,7 +5638,7 @@ static int delete_exec(bContext *C, wmOperator *op)
}
else {
keyIndex_delNurbList(editnurb, nubase);
- freeNurblist(nubase);
+ BKE_nurbList_free(nubase);
if (ED_curve_updateAnimPaths(obedit->data))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
@@ -5672,7 +5672,7 @@ static int delete_exec(bContext *C, wmOperator *op)
BLI_remlink(nubase, nu);
keyIndex_delNurb(editnurb, nu);
- freeNurb(nu); nu= NULL;
+ BKE_nurb_free(nu); nu= NULL;
}
}
}
@@ -5692,7 +5692,7 @@ static int delete_exec(bContext *C, wmOperator *op)
BLI_remlink(nubase, nu);
keyIndex_delNurb(editnurb, nu);
- freeNurb(nu); nu= NULL;
+ BKE_nurb_free(nu); nu= NULL;
}
}
}
@@ -5730,11 +5730,11 @@ static int delete_exec(bContext *C, wmOperator *op)
if (type) {
bezt1 =
(BezTriple*)MEM_mallocN((nu->pntsu) * sizeof(BezTriple), "delNurb");
- memcpy(bezt1, nu->bezt, (nu->pntsu)*sizeof(BezTriple) );
+ memcpy(bezt1, nu->bezt, (nu->pntsu)*sizeof(BezTriple));
keyIndex_updateBezt(editnurb, nu->bezt, bezt1, nu->pntsu);
MEM_freeN(nu->bezt);
nu->bezt= bezt1;
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
}
else if (nu->pntsv==1) {
@@ -5757,7 +5757,7 @@ static int delete_exec(bContext *C, wmOperator *op)
}
if (type) {
bp1 = (BPoint*)MEM_mallocN(nu->pntsu * sizeof(BPoint), "delNurb2");
- memcpy(bp1, nu->bp, (nu->pntsu)*sizeof(BPoint) );
+ memcpy(bp1, nu->bp, (nu->pntsu)*sizeof(BPoint));
keyIndex_updateBP(editnurb, nu->bp, bp1, nu->pntsu);
MEM_freeN(nu->bp);
nu->bp= bp1;
@@ -5770,8 +5770,8 @@ static int delete_exec(bContext *C, wmOperator *op)
}
#endif
}
- clamp_nurb_order_u(nu);
- nurbs_knot_calc_u(nu);
+ BKE_nurb_order_clamp_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
nu= next;
}
@@ -5797,7 +5797,7 @@ static int delete_exec(bContext *C, wmOperator *op)
bezt2= bezt+(nu->pntsu-1);
if ( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) {
nu->flagu &= ~CU_NURB_CYCLIC;
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
DAG_id_tag_update(obedit->data, 0);
}
@@ -5850,7 +5850,7 @@ static int delete_exec(bContext *C, wmOperator *op)
cu->actnu= -1;
BLI_remlink(nubase, nu);
- freeNurb(nu); nu = NULL;
+ BKE_nurb_free(nu); nu = NULL;
}
else if (nu1->flagu & CU_NURB_CYCLIC) { /* cyclic */
bezt =
@@ -5862,7 +5862,7 @@ static int delete_exec(bContext *C, wmOperator *op)
nu1->flagu &= ~CU_NURB_CYCLIC;
MEM_freeN(bezt);
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
else { /* add new curve */
@@ -5886,8 +5886,8 @@ static int delete_exec(bContext *C, wmOperator *op)
nu->pntsu= cut+1;
- calchandlesNurb(nu);
- calchandlesNurb(nu1);
+ BKE_nurb_handles_calc(nu);
+ BKE_nurb_handles_calc(nu1);
}
}
else if (bp1) {
@@ -5896,7 +5896,7 @@ static int delete_exec(bContext *C, wmOperator *op)
cu->actnu= -1;
BLI_remlink(nubase, nu);
- freeNurb(nu); nu= NULL;
+ BKE_nurb_free(nu); nu= NULL;
}
else if (nu1->flagu & CU_NURB_CYCLIC) { /* cyclic */
bp =
@@ -5926,11 +5926,11 @@ static int delete_exec(bContext *C, wmOperator *op)
nu1->knotsu= NULL;
nu->pntsu= cut+1;
- clamp_nurb_order_u(nu);
- nurbs_knot_calc_u(nu);
+ BKE_nurb_order_clamp_u(nu);
+ BKE_nurb_knot_calc_u(nu);
- clamp_nurb_order_u(nu1);
- nurbs_knot_calc_u(nu1);
+ BKE_nurb_order_clamp_u(nu1);
+ BKE_nurb_knot_calc_u(nu1);
}
}
}
@@ -5938,7 +5938,7 @@ static int delete_exec(bContext *C, wmOperator *op)
else if (type==2) {
cu->actnu= -1;
keyIndex_delNurbList(editnurb, nubase);
- freeNurblist(nubase);
+ BKE_nurbList_free(nubase);
}
if (ED_curve_updateAnimPaths(obedit->data))
@@ -6071,7 +6071,7 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op))
/* trasnform all selected curves inverse in obact */
invert_m4_m4(imat, ob->obmat);
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base*, base, selected_editable_bases) {
if (base->object->type==ob->type) {
if (base->object != ob) {
@@ -6083,7 +6083,7 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op))
nu= cu->nurb.first;
while (nu) {
- newnu= duplicateNurb(nu);
+ newnu= BKE_nurb_duplicate(nu);
if (ob->totcol) { /* TODO, merge material lists */
CLAMP(newnu->mat_nr, 0, ob->totcol-1);
}
@@ -6098,7 +6098,7 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op))
mul_m4_v3(cmat, bezt->vec[2]);
bezt++;
}
- calchandlesNurb(newnu);
+ BKE_nurb_handles_calc(newnu);
}
if ( (bp= newnu->bp) ) {
a= newnu->pntsu*nu->pntsv;
@@ -6207,7 +6207,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
nu->resolv= cu->resolv;
}
- switch(stype) {
+ switch (stype) {
case CU_PRIM_CURVE: /* curve */
nu->resolu= cu->resolu;
if (cutype==CU_BEZIER) {
@@ -6240,7 +6240,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bezt->vec[2][1] = 0;
for (a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
else {
@@ -6268,11 +6268,11 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bp->vec[0]+= 1.5f*grid;
bp= nu->bp;
- for (a=0;a<4;a++, bp++) mul_m4_v3(mat,bp->vec);
+ for (a=0;a<4;a++, bp++) mul_m4_v3(mat, bp->vec);
if (cutype==CU_NURBS) {
nu->knotsu= NULL; /* nurbs_knot_calc_u allocates */
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
}
@@ -6302,11 +6302,11 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bp->vec[0]+= 2.0f*grid;
bp= nu->bp;
- for (a=0;a<5;a++, bp++) mul_m4_v3(mat,bp->vec);
+ for (a=0;a<5;a++, bp++) mul_m4_v3(mat, bp->vec);
if (cutype==CU_NURBS) {
nu->knotsu= NULL; /* nurbs_knot_calc_u allocates */
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
break;
@@ -6323,31 +6323,31 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bezt->h1= bezt->h2= HD_AUTO;
bezt->f1= bezt->f2= bezt->f3= SELECT;
bezt->vec[1][0]+= -grid;
- for (a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
+ for (a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
bezt->radius = bezt->weight = 1.0;
bezt++;
bezt->h1= bezt->h2= HD_AUTO;
bezt->f1= bezt->f2= bezt->f3= SELECT;
bezt->vec[1][1]+= grid;
- for (a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
+ for (a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
bezt->radius = bezt->weight = 1.0;
bezt++;
bezt->h1= bezt->h2= HD_AUTO;
bezt->f1= bezt->f2= bezt->f3= SELECT;
bezt->vec[1][0]+= grid;
- for (a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
+ for (a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
bezt->radius = bezt->weight = 1.0;
bezt++;
bezt->h1= bezt->h2= HD_AUTO;
bezt->f1= bezt->f2= bezt->f3= SELECT;
bezt->vec[1][1]+= -grid;
- for (a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
+ for (a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
bezt->radius = bezt->weight = 1.0;
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
else if ( cutype==CU_NURBS ) { /* nurb */
nu->pntsu= 8;
@@ -6369,13 +6369,13 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
}
if (a & 1) bp->vec[3]= 0.25*M_SQRT2;
else bp->vec[3]= 1.0;
- mul_m4_v3(mat,bp->vec);
+ mul_m4_v3(mat, bp->vec);
bp->radius = bp->weight = 1.0;
bp++;
}
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
break;
case CU_PRIM_PATCH: /* 4x4 patch */
@@ -6401,14 +6401,14 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
if (a==1 || a==2) if (b==1 || b==2) {
bp->vec[2]+= grid;
}
- mul_m4_v3(mat,bp->vec);
+ mul_m4_v3(mat, bp->vec);
bp->vec[3]= 1.0;
bp++;
}
}
- nurbs_knot_calc_u(nu);
- nurbs_knot_calc_v(nu);
+ BKE_nurb_knot_calc_u(nu);
+ BKE_nurb_knot_calc_v(nu);
}
break;
case CU_PRIM_TUBE: /* Cylinder */
@@ -6465,11 +6465,11 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bp->vec[2]+= nurbcircle[a][1]*grid;
if (a & 1) bp->vec[3]= 0.5*M_SQRT2;
else bp->vec[3]= 1.0;
- mul_m4_v3(mat,bp->vec);
+ mul_m4_v3(mat, bp->vec);
bp++;
}
nu->flagu= CU_NURB_BEZIER;
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
BLI_addtail(editnurb, nu); /* temporal for spin */
@@ -6477,7 +6477,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
else if ((U.flag & USER_ADD_VIEWALIGNED)) spin_nurb(viewmat, obedit, zvec, mat[3]);
else spin_nurb(umat, obedit, tmp_vec, mat[3]);
- nurbs_knot_calc_v(nu);
+ BKE_nurb_knot_calc_v(nu);
a= nu->pntsu*nu->pntsv;
bp= nu->bp;
@@ -6529,7 +6529,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
if (nu) { /* should always be set */
nu->flag |= CU_SMOOTH;
- test2DNurb(nu);
+ BKE_nurb_test2D(nu);
}
return nu;
@@ -6947,13 +6947,13 @@ static void undoCurve_to_editCurve(void *ucu, void *UNUSED(edata), void *cu_v)
Curve *cu= cu_v;
UndoCurve *undoCurve= ucu;
ListBase *undobase= &undoCurve->nubase;
- ListBase *editbase= curve_editnurbs(cu);
+ ListBase *editbase= BKE_curve_editNurbs_get(cu);
Nurb *nu, *newnu;
EditNurb *editnurb= cu->editnurb;
void *lastsel= NULL;
AnimData *ad= BKE_animdata_from_id(&cu->id);
- freeNurblist(editbase);
+ BKE_nurbList_free(editbase);
if (undoCurve->undoIndex) {
BLI_ghash_free(editnurb->keyindex, NULL, (GHashValFreeFP)MEM_freeN);
@@ -6972,7 +6972,7 @@ static void undoCurve_to_editCurve(void *ucu, void *UNUSED(edata), void *cu_v)
/* copy */
for (nu= undobase->first; nu; nu= nu->next) {
- newnu= duplicateNurb(nu);
+ newnu= BKE_nurb_duplicate(nu);
if (lastsel == NULL) {
lastsel= undo_check_lastsel(undoCurve->lastsel, nu, newnu);
@@ -6993,7 +6993,7 @@ static void undoCurve_to_editCurve(void *ucu, void *UNUSED(edata), void *cu_v)
static void *editCurve_to_undoCurve(void *UNUSED(edata), void *cu_v)
{
Curve *cu= cu_v;
- ListBase *nubase= curve_editnurbs(cu);
+ ListBase *nubase= BKE_curve_editNurbs_get(cu);
UndoCurve *undoCurve;
EditNurb *editnurb= cu->editnurb, tmpEditnurb;
Nurb *nu, *newnu;
@@ -7016,7 +7016,7 @@ static void *editCurve_to_undoCurve(void *UNUSED(edata), void *cu_v)
/* copy */
for (nu= nubase->first; nu; nu= nu->next) {
- newnu= duplicateNurb(nu);
+ newnu= BKE_nurb_duplicate(nu);
if (lastsel == NULL) {
lastsel= undo_check_lastsel(cu->lastsel, nu, newnu);
@@ -7039,7 +7039,7 @@ static void free_undoCurve(void *ucv)
{
UndoCurve *undoCurve= ucv;
- freeNurblist(&undoCurve->nubase);
+ BKE_nurbList_free(&undoCurve->nubase);
if (undoCurve->undoIndex)
BLI_ghash_free(undoCurve->undoIndex, NULL, (GHashValFreeFP)MEM_freeN);
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 1f1d1495276..cca5dd7a37b 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -520,13 +520,17 @@ void ED_text_to_object(bContext *C, Text *text, int split_lines)
}
/********************** utilities ***************************/
-
static short next_word(Curve *cu)
{
short s;
- for (s=cu->pos; (cu->str[s]) && (cu->str[s]!=' ') && (cu->str[s]!='\n') &&
- (cu->str[s]!=1) && (cu->str[s]!='\r'); s++);
- if (cu->str[s]) return(s+1); else return(s);
+ for (s=cu->pos; ((cu->str[s]) && (cu->str[s] != ' ') && (cu->str[s] != '\n') &&
+ (cu->str[s] != 1) && (cu->str[s] != '\r'));
+ s++)
+ {
+ /* pass */
+ }
+
+ return cu->str[s] ? (s + 1) : s;
}
static short prev_word(Curve *cu)
@@ -534,9 +538,14 @@ static short prev_word(Curve *cu)
short s;
if (cu->pos==0) return(0);
- for (s=cu->pos-2; (cu->str[s]) && (cu->str[s]!=' ') && (cu->str[s]!='\n') &&
- (cu->str[s]!=1) && (cu->str[s]!='\r'); s--);
- if (cu->str[s]) return(s+1); else return(s);
+ for (s = cu->pos - 2; ((cu->str[s]) && (cu->str[s] != ' ') && (cu->str[s] != '\n') &&
+ (cu->str[s] != 1) && (cu->str[s] != '\r'));
+ s--)
+ {
+ /* pass */
+ }
+
+ return cu->str[s] ? (s + 1) : s;
}
static int kill_selection(Object *obedit, int ins) /* 1 == new character */
@@ -816,7 +825,7 @@ static int move_cursor(bContext *C, int type, int select)
EditFont *ef= cu->editfont;
int cursmove= -1;
- switch(type) {
+ switch (type) {
case LINE_BEGIN:
if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
while (cu->pos>0) {
@@ -1121,7 +1130,7 @@ static int delete_exec(bContext *C, wmOperator *op)
else if (type == DEL_PREV_SEL) type= DEL_PREV_CHAR;
}
- switch(type) {
+ switch (type) {
case DEL_ALL:
cu->len = cu->pos = 0;
ef->textbuf[0]= 0;
@@ -1491,7 +1500,7 @@ void load_editText(Object *obedit)
void free_editText(Object *obedit)
{
- BKE_free_editfont((Curve *)obedit->data);
+ BKE_curve_editfont_free((Curve *)obedit->data);
}
/********************** set case operator *********************/
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 7726e707f08..12a54658f90 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -669,7 +669,7 @@ static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy
// ............................
/* draw grease-pencil sketches to specified 2d-view that uses ibuf corrections */
-void draw_gpencil_2dimage (bContext *C, ImBuf *ibuf)
+void draw_gpencil_2dimage(bContext *C, ImBuf *ibuf)
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= CTX_wm_region(C);
@@ -745,7 +745,7 @@ void draw_gpencil_2dimage (bContext *C, ImBuf *ibuf)
/* draw grease-pencil sketches to specified 2d-view assuming that matrices are already set correctly
* Note: this gets called twice - first time with onlyv2d=1 to draw 'canvas' strokes, second time with onlyv2d=0 for screen-aligned strokes
*/
-void draw_gpencil_view2d (bContext *C, short onlyv2d)
+void draw_gpencil_view2d(bContext *C, short onlyv2d)
{
ScrArea *sa= CTX_wm_area(C);
ARegion *ar= CTX_wm_region(C);
@@ -772,7 +772,7 @@ void draw_gpencil_view2d (bContext *C, short onlyv2d)
* Note: this gets called twice - first time with only3d=1 to draw 3d-strokes, second time with only3d=0 for screen-aligned strokes
*/
-void draw_gpencil_view3d (Scene *scene, View3D *v3d, ARegion *ar, short only3d)
+void draw_gpencil_view3d(Scene *scene, View3D *v3d, ARegion *ar, short only3d)
{
bGPdata *gpd;
int dflag = 0;
diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c
index 3b0847c2e0f..b79516ed25e 100644
--- a/source/blender/editors/gpencil/editaction_gpencil.c
+++ b/source/blender/editors/gpencil/editaction_gpencil.c
@@ -62,7 +62,7 @@
/* Generics - Loopers */
/* Loops over the gp-frames for a gp-layer, and applies the given callback */
-short gplayer_frames_looper (bGPDlayer *gpl, Scene *scene, short (*gpf_cb)(bGPDframe *, Scene *))
+short gplayer_frames_looper(bGPDlayer *gpl, Scene *scene, short (*gpf_cb)(bGPDframe *, Scene *))
{
bGPDframe *gpf;
@@ -85,7 +85,7 @@ short gplayer_frames_looper (bGPDlayer *gpl, Scene *scene, short (*gpf_cb)(bGPDf
/* Data Conversion Tools */
/* make a listing all the gp-frames in a layer as cfraelems */
-void gplayer_make_cfra_list (bGPDlayer *gpl, ListBase *elems, short onlysel)
+void gplayer_make_cfra_list(bGPDlayer *gpl, ListBase *elems, short onlysel)
{
bGPDframe *gpf;
CfraElem *ce;
@@ -111,7 +111,7 @@ void gplayer_make_cfra_list (bGPDlayer *gpl, ListBase *elems, short onlysel)
/* Selection Tools */
/* check if one of the frames in this layer is selected */
-short is_gplayer_frame_selected (bGPDlayer *gpl)
+short is_gplayer_frame_selected(bGPDlayer *gpl)
{
bGPDframe *gpf;
@@ -149,7 +149,7 @@ static void gpframe_select (bGPDframe *gpf, short select_mode)
}
/* set all/none/invert select (like above, but with SELECT_* modes) */
-void select_gpencil_frames (bGPDlayer *gpl, short select_mode)
+void select_gpencil_frames(bGPDlayer *gpl, short select_mode)
{
bGPDframe *gpf;
@@ -164,7 +164,7 @@ void select_gpencil_frames (bGPDlayer *gpl, short select_mode)
}
/* set all/none/invert select */
-void set_gplayer_frame_selection (bGPDlayer *gpl, short mode)
+void set_gplayer_frame_selection(bGPDlayer *gpl, short mode)
{
/* error checking */
if (gpl == NULL)
@@ -175,7 +175,7 @@ void set_gplayer_frame_selection (bGPDlayer *gpl, short mode)
}
/* select the frame in this layer that occurs on this frame (there should only be one at most) */
-void select_gpencil_frame (bGPDlayer *gpl, int selx, short select_mode)
+void select_gpencil_frame(bGPDlayer *gpl, int selx, short select_mode)
{
bGPDframe *gpf;
@@ -193,7 +193,7 @@ void select_gpencil_frame (bGPDlayer *gpl, int selx, short select_mode)
}
/* select the frames in this layer that occur within the bounds specified */
-void borderselect_gplayer_frames (bGPDlayer *gpl, float min, float max, short select_mode)
+void borderselect_gplayer_frames(bGPDlayer *gpl, float min, float max, short select_mode)
{
bGPDframe *gpf;
@@ -211,7 +211,7 @@ void borderselect_gplayer_frames (bGPDlayer *gpl, float min, float max, short se
/* Frame Editing Tools */
/* Delete selected frames */
-void delete_gplayer_frames (bGPDlayer *gpl)
+void delete_gplayer_frames(bGPDlayer *gpl)
{
bGPDframe *gpf, *gpfn;
@@ -229,7 +229,7 @@ void delete_gplayer_frames (bGPDlayer *gpl)
}
/* Duplicate selected frames from given gp-layer */
-void duplicate_gplayer_frames (bGPDlayer *gpl)
+void duplicate_gplayer_frames(bGPDlayer *gpl)
{
bGPDframe *gpf, *gpfn;
@@ -270,7 +270,7 @@ ListBase gpcopybuf = {NULL, NULL};
static int gpcopy_firstframe= 999999999;
/* This function frees any MEM_calloc'ed copy/paste buffer data */
-void free_gpcopybuf ()
+void free_gpcopybuf()
{
free_gpencil_layers(&gpcopybuf);
@@ -281,7 +281,7 @@ void free_gpcopybuf ()
/* This function adds data to the copy/paste buffer, freeing existing data first
* Only the selected GP-layers get their selected keyframes copied.
*/
-void copy_gpdata ()
+void copy_gpdata()
{
ListBase act_data = {NULL, NULL};
bActListElem *ale;
@@ -338,7 +338,7 @@ void copy_gpdata ()
BLI_freelistN(&act_data);
}
-void paste_gpdata (Scene *scene)
+void paste_gpdata(Scene *scene)
{
ListBase act_data = {NULL, NULL};
bActListElem *ale;
@@ -498,7 +498,7 @@ static short snap_gpf_nearmarker (bGPDframe *gpf, Scene *scene)
/* snap selected frames to ... */
-void snap_gplayer_frames (bGPDlayer *gpl, Scene *scene, short mode)
+void snap_gplayer_frames(bGPDlayer *gpl, Scene *scene, short mode)
{
switch (mode) {
case 1: /* snap to nearest frame */
@@ -600,7 +600,7 @@ static short mirror_gpf_marker (bGPDframe *gpf, Scene *scene)
/* mirror selected gp-frames on... */
-void mirror_gplayer_frames (bGPDlayer *gpl, Scene *scene, short mode)
+void mirror_gplayer_frames(bGPDlayer *gpl, Scene *scene, short mode)
{
switch (mode) {
case 1: /* mirror over current frame */
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index d48cfaab63c..34a95cd89bf 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -210,7 +210,7 @@ static int gp_data_add_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GPENCIL_OT_data_add (wmOperatorType *ot)
+void GPENCIL_OT_data_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Grease Pencil Add New";
@@ -258,7 +258,7 @@ static int gp_data_unlink_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GPENCIL_OT_data_unlink (wmOperatorType *ot)
+void GPENCIL_OT_data_unlink(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Grease Pencil Unlink";
@@ -295,7 +295,7 @@ static int gp_layer_add_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GPENCIL_OT_layer_add (wmOperatorType *ot)
+void GPENCIL_OT_layer_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add New Layer";
@@ -346,7 +346,7 @@ static int gp_actframe_delete_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GPENCIL_OT_active_frame_delete (wmOperatorType *ot)
+void GPENCIL_OT_active_frame_delete(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Active Frame";
@@ -534,7 +534,7 @@ static void gp_stroke_to_bezier (bContext *C, bGPDlayer *gpl, bGPDstroke *gps, C
}
/* must calculate handles or else we crash */
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
/* add nurb to curve */
BLI_addtail(&cu->nurb, nu);
@@ -629,7 +629,7 @@ static int gp_convert_layer_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GPENCIL_OT_convert (wmOperatorType *ot)
+void GPENCIL_OT_convert(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Convert Grease Pencil";
diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c
index 0afe791029f..baa6999f552 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -70,7 +70,7 @@ void ED_keymap_gpencil(wmKeyConfig *keyconf)
/* ****************************************** */
-void ED_operatortypes_gpencil (void)
+void ED_operatortypes_gpencil(void)
{
/* Drawing ----------------------- */
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index c366de6fa43..262d75a37b3 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1611,7 +1611,7 @@ static int gpencil_draw_exec (bContext *C, wmOperator *op)
/* loop over the stroke RNA elements recorded (i.e. progress of mouse movement),
* setting the relevant values in context at each step, then applying
*/
- RNA_BEGIN(op->ptr, itemptr, "stroke") {
+ RNA_BEGIN (op->ptr, itemptr, "stroke") {
float mousef[2];
//printf("\t\tGP - stroke elem\n");
@@ -1915,7 +1915,7 @@ static EnumPropertyItem prop_gpencil_drawmodes[] = {
{0, NULL, 0, NULL, NULL}
};
-void GPENCIL_OT_draw (wmOperatorType *ot)
+void GPENCIL_OT_draw(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Grease Pencil Draw";
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index a9affbcd342..391286a2a88 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -366,7 +366,7 @@ typedef struct bAnimChannelType {
/* drawing */
/* get RGB color that is used to draw the majority of the backdrop */
- void (*get_backdrop_color)(bAnimContext *ac, bAnimListElem *ale, float *color);
+ void (*get_backdrop_color)(bAnimContext *ac, bAnimListElem *ale, float r_color[3]);
/* draw backdrop strip for channel */
void (*draw_backdrop)(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc);
/* get depth of indention (relative to the depth channel is nested at) */
diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h
index 5e8ef618a42..dfd0f258fc0 100644
--- a/source/blender/editors/include/ED_clip.h
+++ b/source/blender/editors/include/ED_clip.h
@@ -41,6 +41,9 @@ struct wmEvent;
/* clip_editor.c */
int ED_space_clip_poll(struct bContext *C);
+int ED_space_clip_tracking_poll(struct bContext *C);
+int ED_space_clip_tracking_size_poll(struct bContext *C);
+int ED_space_clip_tracking_frame_poll(struct bContext *C);
void ED_space_clip_set(struct bContext *C, struct SpaceClip *sc, struct MovieClip *clip);
struct MovieClip *ED_space_clip(struct SpaceClip *sc);
@@ -58,6 +61,8 @@ void ED_clip_point_undistorted_pos(SpaceClip *sc, float co[2], float nco[2]);
void ED_clip_point_stable_pos(struct bContext *C, float x, float y, float *xr, float *yr);
void ED_clip_mouse_pos(struct bContext *C, struct wmEvent *event, float co[2]);
+int ED_space_clip_show_trackedit(struct SpaceClip *sc);
+
/* clip_ops.c */
void ED_operatormacros_clip(void);
diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h
index 50e43c46de5..73ff8e9304d 100644
--- a/source/blender/editors/include/ED_curve.h
+++ b/source/blender/editors/include/ED_curve.h
@@ -63,7 +63,7 @@ void load_editNurb (struct Object *obedit);
void make_editNurb (struct Object *obedit);
void free_editNurb (struct Object *obedit);
-void free_curve_editNurb (struct Curve *cu);
+void BKE_curve_editNurb_free (struct Curve *cu);
int mouse_nurb (struct bContext *C, const int mval[2], int extend);
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 4c503a2687c..71d37d5c6ea 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -71,7 +71,7 @@ struct Material;
struct Object;
struct rcti;
-intptr_t mesh_octree_table(struct Object *ob, struct BMEditMesh *em, float *co, char mode);
+intptr_t mesh_octree_table(struct Object *ob, struct BMEditMesh *em, const float co[3], char mode);
int mesh_mirrtopo_table(struct Object *ob, char mode);
/* editmesh_utils.c */
@@ -139,7 +139,7 @@ struct MTexPoly *EDBM_mtexpoly_active_get(struct BMEditMesh *em, struct BMFace *
void EDBM_uv_vert_map_free(struct UvVertMap *vmap);
struct UvMapVert *EDBM_uv_vert_map_at_index(struct UvVertMap *vmap, unsigned int v);
-struct UvVertMap *EDBM_uv_vert_map_create(struct BMEditMesh *em, int selected, int do_face_idx_array, float *limit);
+struct UvVertMap *EDBM_uv_vert_map_create(struct BMEditMesh *em, int selected, int do_face_idx_array, const float limit[2]);
void EDBM_data_layer_add(struct BMEditMesh *em, struct CustomData *data, int type, const char *name);
void EDBM_data_layer_free(struct BMEditMesh *em, struct CustomData *data, int type);
@@ -158,7 +158,7 @@ extern unsigned int bm_vertoffs, bm_solidoffs, bm_wireoffs;
int mouse_mesh(struct bContext *C, const int mval[2], short extend);
-struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em, struct BMVert *eve, float *co, int index);
+struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em, struct BMVert *eve, const float co[3], int index);
int mesh_get_x_mirror_vert(struct Object *ob, int index);
int *mesh_get_x_mirror_faces(struct Object *ob, struct BMEditMesh *em);
@@ -188,7 +188,7 @@ int paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval
int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, int select, int extend);
void paintface_deselect_all_visible(struct Object *ob, int action, short flush_flags);
void paintface_select_linked(struct bContext *C, struct Object *ob, int mval[2], int mode);
-int paintface_minmax(struct Object *ob, float *min, float *max);
+int paintface_minmax(struct Object *ob, float r_min[3], float r_max[3]);
void paintface_hide(struct Object *ob, const int unselected);
void paintface_reveal(struct Object *ob);
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index f0fffb34b73..f62befdaa31 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -66,6 +66,7 @@ void ED_region_header(const struct bContext *C, struct ARegion *ar);
void ED_region_toggle_hidden(struct bContext *C, struct ARegion *ar);
void region_scissor_winrct(struct ARegion *ar, struct rcti *winrct);
void ED_region_info_draw(struct ARegion *ar, const char *text, int block, float alpha);
+void ED_region_grid_draw(struct ARegion *ar, float zoomx, float zoomy);
/* spaces */
void ED_spacetypes_init(void);
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index 3569c0e8243..2427ed1a333 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -51,7 +51,7 @@ void ED_operatortypes_uvedit(void);
void ED_keymap_uvedit(struct wmKeyConfig *keyconf);
void ED_uvedit_assign_image(struct Main *bmain, struct Scene *scene, struct Object *obedit, struct Image *ima, struct Image *previma);
-int ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float *min, float *max);
+int ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float min[2], float max[2]);
int ED_object_get_active_image(struct Object *ob, int mat_nr, struct Image **ima, struct ImageUser **iuser, struct bNode **node);
void ED_object_assign_active_image(struct Main *bmain, struct Object *ob, int mat_nr, struct Image *ima);
@@ -71,7 +71,8 @@ void uvedit_edge_select_disable(struct BMEditMesh *em, struct Scene *scene, stru
void uvedit_uv_select_enable(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, const short do_history);
void uvedit_uv_select_disable(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l);
-int ED_uvedit_nearest_uv(struct Scene *scene, struct Object *obedit, struct Image *ima, float co[2], float uv[2]);
+int ED_uvedit_nearest_uv(struct Scene *scene, struct Object *obedit, struct Image *ima,
+ const float co[2], float r_uv[2]);
/* uvedit_unwrap_ops.c */
void ED_uvedit_live_unwrap_begin(struct Scene *scene, struct Object *obedit);
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index f886c01039e..4b614085f8e 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -269,8 +269,6 @@ void view3d_get_transformation(const struct ARegion *ar, struct RegionView3D *rv
/* XXX should move to BLI_math */
int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, short x2, short y2);
-int lasso_inside(int mcords[][2], short moves, int sx, int sy);
-int lasso_inside_edge(int mcords[][2], short moves, int x0, int y0, int x1, int y1);
/* get 3d region from context, also if mouse is in header or toolbar */
struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 226d9a3d493..302d5cc8a77 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -694,7 +694,7 @@ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but)
}
}
if (activate || found == 0) {
- ui_button_activate_do( (bContext *)C, CTX_wm_region(C), but);
+ ui_button_activate_do((bContext *)C, CTX_wm_region(C), but);
}
else if (found && isactive == 0) {
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index a7ff1565c3d..d848798cc63 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -781,9 +781,8 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to)
act_to = (bActuator *)(to->poin);
/* (1) get the object */
- CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects) {
- for (sens_iter = ob_iter->sensors.first; sens_iter; sens_iter = sens_iter->next)
- {
+ CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) {
+ for (sens_iter = ob_iter->sensors.first; sens_iter; sens_iter = sens_iter->next) {
if (&(sens_iter->links) == sens_from_links) {
ob = ob_iter;
break;
@@ -1207,7 +1206,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
but->poin = MEM_callocN(sizeof(ColorBand), "colorband");
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
- memcpy(data->coba, &but_copypaste_coba, sizeof(ColorBand) );
+ memcpy(data->coba, &but_copypaste_coba, sizeof(ColorBand));
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
}
@@ -1564,8 +1563,7 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste
len = strlen(str);
}
- for (y = 0; y < strlen(buf); y++)
- {
+ for (y = 0; y < strlen(buf); y++) {
/* add contents of buffer */
if (len + 1 < data->maxlen) {
for (x = data->maxlen; x > but->pos; x--)
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 67e295503c2..79b46fee359 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -857,7 +857,7 @@ void uiItemEnumO_value(uiLayout *layout, const char *name, int icon, const char
PointerRNA ptr;
PropertyRNA *prop;
- UI_OPERATOR_ERROR_RET(ot, opname, return );
+ UI_OPERATOR_ERROR_RET(ot, opname, return);
WM_operator_properties_create_ptr(&ptr, ot);
@@ -888,7 +888,7 @@ void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char
EnumPropertyItem *item;
int value, free;
- UI_OPERATOR_ERROR_RET(ot, opname, return );
+ UI_OPERATOR_ERROR_RET(ot, opname, return);
WM_operator_properties_create_ptr(&ptr, ot);
@@ -926,7 +926,7 @@ void uiItemBooleanO(uiLayout *layout, const char *name, int icon, const char *op
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
PointerRNA ptr;
- UI_OPERATOR_ERROR_RET(ot, opname, return );
+ UI_OPERATOR_ERROR_RET(ot, opname, return);
WM_operator_properties_create_ptr(&ptr, ot);
RNA_boolean_set(&ptr, propname, value);
@@ -939,7 +939,7 @@ void uiItemIntO(uiLayout *layout, const char *name, int icon, const char *opname
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
PointerRNA ptr;
- UI_OPERATOR_ERROR_RET(ot, opname, return );
+ UI_OPERATOR_ERROR_RET(ot, opname, return);
WM_operator_properties_create_ptr(&ptr, ot);
RNA_int_set(&ptr, propname, value);
@@ -952,7 +952,7 @@ void uiItemFloatO(uiLayout *layout, const char *name, int icon, const char *opna
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
PointerRNA ptr;
- UI_OPERATOR_ERROR_RET(ot, opname, return );
+ UI_OPERATOR_ERROR_RET(ot, opname, return);
WM_operator_properties_create_ptr(&ptr, ot);
RNA_float_set(&ptr, propname, value);
@@ -965,7 +965,7 @@ void uiItemStringO(uiLayout *layout, const char *name, int icon, const char *opn
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
PointerRNA ptr;
- UI_OPERATOR_ERROR_RET(ot, opname, return );
+ UI_OPERATOR_ERROR_RET(ot, opname, return);
WM_operator_properties_create_ptr(&ptr, ot);
RNA_string_set(&ptr, propname, value);
@@ -1265,7 +1265,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s
const int skip_filter = !but->changed;
/* build a temporary list of relevant items first */
- RNA_PROP_BEGIN(&but->rnasearchpoin, itemptr, but->rnasearchprop) {
+ RNA_PROP_BEGIN (&but->rnasearchpoin, itemptr, but->rnasearchprop) {
if (flag & PROP_ID_SELF_CHECK)
if (itemptr.data == but->rnapoin.id.data)
continue;
@@ -1333,7 +1333,7 @@ static void search_id_collection(StructRNA *ptype, PointerRNA *ptr, PropertyRNA
*prop = NULL;
- RNA_STRUCT_BEGIN(ptr, iprop) {
+ RNA_STRUCT_BEGIN (ptr, iprop) {
/* if it's a collection and has same pointer type, we've got it */
if (RNA_property_type(iprop) == PROP_COLLECTION) {
srna = RNA_property_pointer_type(ptr, iprop);
@@ -1609,7 +1609,7 @@ void uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname,
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
MenuItemLevel *lvl;
- UI_OPERATOR_ERROR_RET(ot, opname, return );
+ UI_OPERATOR_ERROR_RET(ot, opname, return);
if (!ot->srna) {
ui_item_disabled(layout, opname);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index d0f760d16fb..bafd85e9451 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2362,7 +2362,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
if (ptr->data && prop) {
/* create list items */
- RNA_PROP_BEGIN(ptr, itemptr, prop) {
+ RNA_PROP_BEGIN (ptr, itemptr, prop) {
/* create button */
if (!(i % 9))
row = uiLayoutRow(col, 0);
@@ -2384,7 +2384,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
if (ptr->data && prop) {
/* create list items */
- RNA_PROP_BEGIN(ptr, itemptr, prop) {
+ RNA_PROP_BEGIN (ptr, itemptr, prop) {
found = (activei == i);
if (found) {
@@ -2446,7 +2446,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
if (ptr->data && prop) {
/* create list items */
- RNA_PROP_BEGIN(ptr, itemptr, prop) {
+ RNA_PROP_BEGIN (ptr, itemptr, prop) {
if (i >= pa->list_scroll && i < pa->list_scroll + items)
list_item_row(C, col, ptr, &itemptr, i, rnaicon, activeptr, activeprop, prop_list);
@@ -2703,7 +2703,7 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title,
flow = uiLayoutColumnFlow(layout, 2, 0);
- RNA_STRUCT_BEGIN(ptr, prop) {
+ RNA_STRUCT_BEGIN (ptr, prop) {
int flag = RNA_property_flag(prop);
if (flag & PROP_HIDDEN)
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index c903040a6b9..9220491a60c 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -139,7 +139,7 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(Pointe
assert(ELEM3(label_align, '\0', 'H', 'V'));
- RNA_STRUCT_BEGIN(ptr, prop) {
+ RNA_STRUCT_BEGIN (ptr, prop) {
flag = RNA_property_flag(prop);
if (flag & PROP_HIDDEN || (check_prop && check_prop(ptr, prop) == FALSE))
continue;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index cce037822e3..fe7a4e85418 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1047,9 +1047,8 @@ static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
/* chop off the leading text, starting from the right */
while (but->strwidth > okwidth && cp2 > but->drawstr) {
- int bytes = BLI_str_utf8_size(cp2);
- if (bytes < 0)
- bytes = 1;
+ char *prev_utf8 = BLI_str_find_prev_char_utf8(but->drawstr, cp2);
+ int bytes = cp2 - prev_utf8;
/* shift the text after and including cp2 back by 1 char, +1 to include null terminator */
memmove(cp2 - bytes, cp2, strlen(cp2) + 1);
@@ -1061,8 +1060,7 @@ static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
/* after the leading text is gone, chop off the : and following space, with ofs */
- while ((but->strwidth > okwidth) && (but->ofs < 2))
- {
+ while ((but->strwidth > okwidth) && (but->ofs < 2)) {
ui_text_clip_give_next_off(but);
but->strwidth = BLF_width(fstyle->uifont_id, but->drawstr + but->ofs);
if (but->strwidth < 10) break;
@@ -2233,8 +2231,8 @@ int ui_link_bezier_points(rcti *rect, float coord_array[][2], int resol)
vec[2][0] = vec[3][0] - dist;
vec[2][1] = vec[3][1];
- forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0], resol, sizeof(float) * 2);
- forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0] + 1, resol, sizeof(float) * 2);
+ BKE_curve_forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0], resol, sizeof(float) * 2);
+ BKE_curve_forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0] + 1, resol, sizeof(float) * 2);
return 1;
}
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 9f4a351c66d..2d222059fc1 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1151,8 +1151,7 @@ void UI_ThemeClearColor(int colorid)
void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3], const char axis)
{
- switch (axis)
- {
+ switch (axis) {
case 'X':
dst_col[0] = src_col[0] > 219 ? 255 : src_col[0] + 36;
dst_col[1] = src_col[1] < 26 ? 0 : src_col[1] - 26;
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 294a39eddf8..cfc9e11879e 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -400,14 +400,14 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags)
}
}
-int paintface_minmax(Object *ob, float *min, float *max)
+int paintface_minmax(Object *ob, float r_min[3], float r_max[3])
{
Mesh *me;
MPoly *mp;
MTexPoly *tf;
MLoop *ml;
MVert *mvert;
- int a, b, ok = 0;
+ int a, b, ok = FALSE;
float vec[3], bmat[3][3];
me = get_mesh(ob);
@@ -427,10 +427,10 @@ int paintface_minmax(Object *ob, float *min, float *max)
copy_v3_v3(vec, (mvert[ml->v].co));
mul_m3_v3(bmat, vec);
add_v3_v3v3(vec, vec, ob->obmat[3]);
- DO_MINMAX(vec, min, max);
+ DO_MINMAX(vec, r_min, r_max);
}
- ok = 1;
+ ok = TRUE;
}
return ok;
diff --git a/source/blender/editors/mesh/editmesh_bvh.c b/source/blender/editors/mesh/editmesh_bvh.c
index 6155ad1be1c..6d740812f27 100644
--- a/source/blender/editors/mesh/editmesh_bvh.c
+++ b/source/blender/editors/mesh/editmesh_bvh.c
@@ -239,7 +239,8 @@ static void raycallback(void *userdata, int index, const BVHTreeRay *ray, BVHTre
}
}
-BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, float *cagehit)
+BMFace *BMBVH_RayCast(BMBVHTree *tree, const float co[3], const float dir[3],
+ float r_hitout[3], float r_cagehit[3])
{
BVHTreeRayHit hit;
@@ -250,10 +251,9 @@ BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, flo
BLI_bvhtree_ray_cast(tree->tree, co, dir, 0.0f, &hit, raycallback, tree);
if (hit.dist != FLT_MAX && hit.index != -1) {
- if (hitout) {
+ if (r_hitout) {
if (tree->flag & BMBVH_RETURN_ORIG) {
BMVert *v1, *v2, *v3;
- float co[3];
int i;
v1 = tree->em->looptris[hit.index][0]->v;
@@ -261,17 +261,17 @@ BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, flo
v3 = tree->em->looptris[hit.index][2]->v;
for (i = 0; i < 3; i++) {
- co[i] = v1->co[i] + ((v2->co[i] - v1->co[i]) * tree->uv[0]) +
- ((v3->co[i] - v1->co[i]) * tree->uv[1]);
+ r_hitout[i] = v1->co[i] + ((v2->co[i] - v1->co[i]) * tree->uv[0]) +
+ ((v3->co[i] - v1->co[i]) * tree->uv[1]);
}
- copy_v3_v3(hitout, co);
}
else {
- copy_v3_v3(hitout, hit.co);
+ copy_v3_v3(r_hitout, hit.co);
}
- if (cagehit)
- copy_v3_v3(cagehit, hit.co);
+ if (r_cagehit) {
+ copy_v3_v3(r_cagehit, hit.co);
+ }
}
return tree->em->looptris[hit.index][0]->f;
diff --git a/source/blender/editors/mesh/editmesh_bvh.h b/source/blender/editors/mesh/editmesh_bvh.h
index e2b45062e41..6512f054c1b 100644
--- a/source/blender/editors/mesh/editmesh_bvh.h
+++ b/source/blender/editors/mesh/editmesh_bvh.h
@@ -50,13 +50,12 @@ struct BMBVHTree *BMBVH_NewBVH(struct BMEditMesh *em, int flag, struct Scene *sc
void BMBVH_FreeBVH(struct BMBVHTree *tree);
struct BVHTree *BMBVH_BVHTree(struct BMBVHTree *tree);
-struct BMFace *BMBVH_RayCast(struct BMBVHTree *tree, float *co, float *dir, float *hitout, float *cagehit);
+struct BMFace *BMBVH_RayCast(struct BMBVHTree *tree, const float co[3], const float dir[3],
+ float r_hitout[3], float r_cagehit[3]);
int BMBVH_EdgeVisible(struct BMBVHTree *tree, struct BMEdge *e,
struct ARegion *ar, struct View3D *v3d, struct Object *obedit);
-#define BM_SEARCH_MAXDIST 0.4f
-
/*find a vert closest to co in a sphere of radius maxdist*/
struct BMVert *BMBVH_FindClosestVert(struct BMBVHTree *tree, float *co, float maxdist);
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index b3bc0a1ffa9..6f33fcd05b7 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -277,7 +277,7 @@ static void knife_add_to_vert_edges(KnifeTool_OpData *kcd, KnifeEdge *kfe)
knife_append_list(kcd, &kfe->v2->edges, kfe);
}
-static KnifeVert *new_knife_vert(KnifeTool_OpData *kcd, float *co, float *cageco)
+static KnifeVert *new_knife_vert(KnifeTool_OpData *kcd, const float co[3], float *cageco)
{
KnifeVert *kfv = BLI_mempool_calloc(kcd->kverts);
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index 12174d5b9fa..beb5345ca9b 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -240,7 +240,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select)
edgering_find_order(lasteed, eed, lastv1, v);
lastv1 = v[0][0];
- BLI_array_growitems(edges, previewlines);
+ BLI_array_grow_items(edges, previewlines);
for (i = 1; i <= previewlines; i++) {
co[0][0] = (v[0][1]->co[0] - v[0][0]->co[0]) * (i / ((float)previewlines + 1)) + v[0][0]->co[0];
@@ -265,7 +265,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select)
edgering_find_order(lasteed, startedge, lastv1, v);
- BLI_array_growitems(edges, previewlines);
+ BLI_array_grow_items(edges, previewlines);
for (i = 1; i <= previewlines; i++) {
if (!v[0][0] || !v[0][1] || !v[1][0] || !v[1][1])
diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c
index e755df1f076..b74e8797d72 100644
--- a/source/blender/editors/mesh/editmesh_rip.c
+++ b/source/blender/editors/mesh/editmesh_rip.c
@@ -56,7 +56,8 @@
#include "mesh_intern.h"
/* helper to find edge for edge_rip */
-static float edbm_rip_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *co2, const float mvalf[2])
+static float edbm_rip_rip_edgedist(ARegion *ar, float mat[][4],
+ const float co1[3], const float co2[2], const float mvalf[2])
{
float vec1[3], vec2[3];
@@ -111,9 +112,9 @@ static float edbm_rip_edge_side_measure(BMEdge *e, BMLoop *e_l,
score = len_v2v2(e_v1_co, e_v2_co);
if (dist_to_line_segment_v2(fmval_tweak, e_v1_co, e_v2_co) >
- dist_to_line_segment_v2(fmval, e_v1_co, e_v2_co))
+ dist_to_line_segment_v2(fmval, e_v1_co, e_v2_co))
{
- return score;
+ return score;
}
else {
return -score;
@@ -262,7 +263,7 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm)
uid_start = uid;
uid = uid_end + bm->totedge;
- BLI_array_growone(eloop_pairs);
+ BLI_array_grow_one(eloop_pairs);
lp = &eloop_pairs[BLI_array_count(eloop_pairs) - 1];
BM_edge_loop_pair(e_last, &lp->l_a, &lp->l_b); /* no need to check, we know this will be true */
@@ -276,7 +277,7 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm)
}
/* null terminate */
- BLI_array_growone(eloop_pairs);
+ BLI_array_grow_one(eloop_pairs);
lp = &eloop_pairs[BLI_array_count(eloop_pairs) - 1];
lp->l_a = lp->l_b = NULL;
@@ -347,7 +348,7 @@ static int edbm_rip_call_edgesplit(BMEditMesh *em, wmOperator *op)
BMOperator bmop;
if (!EDBM_op_init(em, &bmop, op, "edgesplit edges=%he verts=%hv use_verts=%b",
- BM_ELEM_TAG, BM_ELEM_SELECT, TRUE)) {
+ BM_ELEM_TAG, BM_ELEM_SELECT, TRUE)) {
return FALSE;
}
BMO_op_exec(em->bm, &bmop);
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 05352938aba..32e70e798fe 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -1512,7 +1512,7 @@ int mouse_mesh(bContext *C, const int mval[2], short extend)
vc.obedit->actcol = efa->mat_nr + 1;
vc.em->mat_nr = efa->mat_nr;
- WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, NULL);
+ WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING, NULL);
}
@@ -2307,7 +2307,7 @@ static int edbm_select_linked_flat_faces_exec(bContext *C, wmOperator *op)
BLI_array_empty(stack);
i = 1;
- BLI_array_growone(stack);
+ BLI_array_grow_one(stack);
stack[i - 1] = f;
while (i) {
@@ -2330,7 +2330,7 @@ static int edbm_select_linked_flat_faces_exec(bContext *C, wmOperator *op)
/* invalidate: edge too sharp */
if (angle < sharp) {
- BLI_array_growone(stack);
+ BLI_array_grow_one(stack);
stack[i] = l2->f;
i++;
}
diff --git a/source/blender/editors/mesh/editmesh_slide.c b/source/blender/editors/mesh/editmesh_slide.c
index 3cbb099a0a9..36ce610c64b 100644
--- a/source/blender/editors/mesh/editmesh_slide.c
+++ b/source/blender/editors/mesh/editmesh_slide.c
@@ -88,7 +88,7 @@ typedef struct VertexSlideOp {
int disk_edges;
/* Edges */
- BMEdge** edge_frame;
+ BMEdge **edge_frame;
/* Slide Frame Endpoints */
float (*vtx_frame)[3];
@@ -194,7 +194,7 @@ static void vtx_slide_confirm(bContext *C, wmOperator *op)
{
VertexSlideOp *vso = op->customdata;
BMEditMesh *em = BMEdit_FromObject(vso->obj);
- BMesh* bm = em->bm;
+ BMesh *bm = em->bm;
/* Select new edge */
BM_edge_select_set(bm, vso->sel_edge, TRUE);
@@ -204,7 +204,7 @@ static void vtx_slide_confirm(bContext *C, wmOperator *op)
if (vso->snap_n_merge) {
float other_d;
- BMVert* other = BM_edge_other_vert(vso->sel_edge, vso->start_vtx);
+ BMVert *other = BM_edge_other_vert(vso->sel_edge, vso->start_vtx);
other_d = len_v3v3(vso->interp, other->co);
/* Only snap if within threshold */
@@ -339,12 +339,12 @@ static void vtx_slide_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
}
}
-static BMEdge* vtx_slide_nrst_in_frame(VertexSlideOp *vso, const float mval[2])
+static BMEdge *vtx_slide_nrst_in_frame(VertexSlideOp *vso, const float mval[2])
{
- BMEdge* cl_edge = NULL;
+ BMEdge *cl_edge = NULL;
if (vso->disk_edges > 0) {
int i = 0;
- BMEdge* edge = NULL;
+ BMEdge *edge = NULL;
float v1_proj[3], v2_proj[3];
float dist = 0;
@@ -481,7 +481,7 @@ static int vtx_slide_set_frame(VertexSlideOp *vso)
{
BMEdge *edge;
float (*vtx_frame)[3] = NULL;
- BMEdge** edge_frame = NULL;
+ BMEdge **edge_frame = NULL;
BMVert *curr_vert = NULL;
BLI_array_declare(vtx_frame);
BLI_array_declare(edge_frame);
@@ -505,7 +505,7 @@ static int vtx_slide_set_frame(VertexSlideOp *vso)
BM_ITER_ELEM_INDEX (edge, &iter, sel_vtx, BM_EDGES_OF_VERT, idx) {
curr_vert = BM_edge_other_vert(edge, sel_vtx);
if (curr_vert) {
- BLI_array_growone(vtx_frame);
+ BLI_array_grow_one(vtx_frame);
copy_v3_v3(vtx_frame[idx], curr_vert->co);
@@ -577,6 +577,7 @@ static int edbm_vertex_slide_modal(bContext *C, wmOperator *op, wmEvent *event)
break;
}
case RIGHTMOUSE:
+ case ESCKEY:
{
/* Enforce redraw */
ED_region_tag_redraw(vso->active_region);
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index f3737925850..898e82c0660 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -927,7 +927,9 @@ static int edbm_delete_exec(bContext *C, wmOperator *op)
//"Erase Only Faces";
if (!EDBM_op_callf(em, op, "del geom=%hf context=%i",
BM_ELEM_SELECT, DEL_ONLYFACES))
+ {
return OPERATOR_CANCELLED;
+ }
}
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
@@ -1021,8 +1023,7 @@ static int edbm_add_edge_face__smooth_get(BMesh *bm)
unsigned int vote_on_smooth[2] = {0, 0};
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
- if (BM_elem_flag_test(e, BM_ELEM_SELECT) && e->l)
- {
+ if (BM_elem_flag_test(e, BM_ELEM_SELECT) && e->l) {
vote_on_smooth[BM_elem_flag_test_bool(e->l->f, BM_ELEM_SMOOTH)]++;
}
}
@@ -3122,10 +3123,22 @@ static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void MESH_OT_tris_convert_to_quads(wmOperatorType *ot)
+static void join_triangle_props(wmOperatorType *ot)
{
PropertyRNA *prop;
+ prop = RNA_def_float_rotation(ot->srna, "limit", 0, NULL, 0.0f, DEG2RADF(180.0f),
+ "Max Angle", "Angle Limit", 0.0f, DEG2RADF(180.0f));
+ RNA_def_property_float_default(prop, DEG2RADF(40.0f));
+
+ RNA_def_boolean(ot->srna, "uvs", 0, "Compare UVs", "");
+ RNA_def_boolean(ot->srna, "vcols", 0, "Compare VCols", "");
+ RNA_def_boolean(ot->srna, "sharp", 0, "Compare Sharp", "");
+ RNA_def_boolean(ot->srna, "materials", 0, "Compare Materials", "");
+}
+
+void MESH_OT_tris_convert_to_quads(wmOperatorType *ot)
+{
/* identifiers */
ot->name = "Tris to Quads";
ot->idname = "MESH_OT_tris_convert_to_quads";
@@ -3138,14 +3151,7 @@ void MESH_OT_tris_convert_to_quads(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- prop = RNA_def_float_rotation(ot->srna, "limit", 0, NULL, 0.0f, DEG2RADF(180.0f),
- "Max Angle", "Angle Limit", 0.0f, DEG2RADF(180.0f));
- RNA_def_property_float_default(prop, DEG2RADF(40.0f));
-
- RNA_def_boolean(ot->srna, "uvs", 0, "Compare UVs", "");
- RNA_def_boolean(ot->srna, "vcols", 0, "Compare VCols", "");
- RNA_def_boolean(ot->srna, "sharp", 0, "Compare Sharp", "");
- RNA_def_boolean(ot->srna, "materials", 0, "Compare Materials", "");
+ join_triangle_props(ot);
}
static int edbm_dissolve_exec(bContext *C, wmOperator *op)
@@ -3639,22 +3645,6 @@ static int vergxco(const void *v1, const void *v2)
return (x2->org_idx < 0) - (x1->org_idx < 0);
}
-#if 0 /* Unused */
-struct facesort {
- uintptr_t x;
- struct EditFace *efa;
-};
-
-static int vergface(const void *v1, const void *v2)
-{
- const struct facesort *x1 = v1, *x2 = v2;
-
- if (x1->x > x2->x) return 1;
- else if (x1->x < x2->x) return -1;
- return 0;
-}
-#endif
-
static void xsortvert_flag__doSetX(void *userData, BMVert *UNUSED(eve), int x, int UNUSED(y), int index)
{
xvertsort *sortblock = userData;
@@ -4280,3 +4270,163 @@ void MESH_OT_inset(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "use_outset", FALSE, "Outset", "Outset rather than inset");
RNA_def_boolean(ot->srna, "use_select_inset", TRUE, "Select Outer", "Select the new inset faces");
}
+
+static int edbm_wireframe_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit = CTX_data_edit_object(C);
+ BMEditMesh *em = BMEdit_FromObject(obedit);
+ BMOperator bmop;
+ const int use_boundary = RNA_boolean_get(op->ptr, "use_boundary");
+ const int use_even_offset = RNA_boolean_get(op->ptr, "use_even_offset");
+ const int use_replace = RNA_boolean_get(op->ptr, "use_replace");
+ const int use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset");
+ const int use_crease = RNA_boolean_get(op->ptr, "use_crease");
+ const float thickness = RNA_float_get(op->ptr, "thickness");
+
+ EDBM_op_init(em, &bmop, op,
+ "wireframe faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b use_crease=%b "
+ "thickness=%f",
+ BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset, use_crease,
+ thickness);
+
+ BMO_op_exec(em->bm, &bmop);
+
+ if (use_replace) {
+ BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, FALSE);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
+
+ BMO_op_callf(em->bm, "del geom=%hvef context=%i", BM_ELEM_TAG, DEL_FACES);
+ }
+
+ BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
+
+ if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ return OPERATOR_CANCELLED;
+ }
+ else {
+ EDBM_update_generic(C, em, TRUE);
+ return OPERATOR_FINISHED;
+ }
+}
+
+void MESH_OT_wireframe(wmOperatorType *ot)
+{
+ PropertyRNA *prop;
+
+ /* identifiers */
+ ot->name = "Wire Frame";
+ ot->idname = "MESH_OT_wireframe";
+ ot->description = "Inset new faces into selected faces";
+
+ /* api callbacks */
+ ot->exec = edbm_wireframe_exec;
+ ot->poll = ED_operator_editmesh;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ RNA_def_boolean(ot->srna, "use_boundary", TRUE, "Boundary", "Inset face boundaries");
+ RNA_def_boolean(ot->srna, "use_even_offset", TRUE, "Offset Even", "Scale the offset to give more even thickness");
+ RNA_def_boolean(ot->srna, "use_relative_offset", FALSE, "Offset Relative", "Scale the offset by surrounding geometry");
+ RNA_def_boolean(ot->srna, "use_crease", FALSE, "Crease", "Crease hub edges for improved subsurf");
+
+ prop = RNA_def_float(ot->srna, "thickness", 0.01f, 0.0f, FLT_MAX, "Thickness", "", 0.0f, 10.0f);
+ /* use 1 rather then 10 for max else dragging the button moves too far */
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4);
+
+
+ RNA_def_boolean(ot->srna, "use_replace", TRUE, "Replace", "Remove original faces");
+}
+
+static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit = CTX_data_edit_object(C);
+ BMEditMesh *em = BMEdit_FromObject(obedit);
+ BMOperator bmop;
+
+ EDBM_op_init(em, &bmop, op, "convex_hull input=%hvef "
+ "use_existing_faces=%b",
+ BM_ELEM_SELECT,
+ RNA_boolean_get(op->ptr, "use_existing_faces"));
+ BMO_op_exec(em->bm, &bmop);
+
+ /* Hull fails if input is coplanar */
+ if (BMO_error_occurred(em->bm)) {
+ EDBM_op_finish(em, &bmop, op, TRUE);
+ return OPERATOR_CANCELLED;
+ }
+
+
+ /* Delete unused vertices, edges, and faces */
+ if (RNA_boolean_get(op->ptr, "delete_unused")) {
+ if(!EDBM_op_callf(em, op, "del geom=%s context=%i",
+ &bmop, "unused_geom", DEL_ONLYTAGGED)) {
+ EDBM_op_finish(em, &bmop, op, TRUE);
+ return OPERATOR_CANCELLED;
+ }
+ }
+
+ /* Delete hole edges/faces */
+ if (RNA_boolean_get(op->ptr, "make_holes")) {
+ if(!EDBM_op_callf(em, op, "del geom=%s context=%i",
+ &bmop, "holes_geom", DEL_ONLYTAGGED)) {
+ EDBM_op_finish(em, &bmop, op, TRUE);
+ return OPERATOR_CANCELLED;
+ }
+ }
+
+ /* Merge adjacent triangles */
+ if (RNA_boolean_get(op->ptr, "join_triangles")) {
+ if(!EDBM_op_callf(em, op, "join_triangles faces=%s limit=%f",
+ &bmop, "geomout",
+ RNA_float_get(op->ptr, "limit"))) {
+ EDBM_op_finish(em, &bmop, op, TRUE);
+ return OPERATOR_CANCELLED;
+ }
+ }
+
+ if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ return OPERATOR_CANCELLED;
+ }
+ else {
+ EDBM_update_generic(C, em, TRUE);
+ EDBM_selectmode_flush(em);
+ return OPERATOR_FINISHED;
+ }
+}
+
+void MESH_OT_convex_hull(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Convex Hull";
+ ot->description = "Enclose selected vertices in a convex polyhedron";
+ ot->idname = "MESH_OT_convex_hull";
+
+ /* api callbacks */
+ ot->exec = edbm_convex_hull_exec;
+ ot->poll = EM_view3d_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* props */
+ RNA_def_boolean(ot->srna, "delete_unused", TRUE,
+ "Delete Unused",
+ "Delete selected elements that are not used by the hull");
+
+ RNA_def_boolean(ot->srna, "use_existing_faces", TRUE,
+ "Use Existing Faces",
+ "Skip hull triangles that are covered by a pre-existing face");
+
+ RNA_def_boolean(ot->srna, "make_holes", FALSE,
+ "Make Holes",
+ "Delete selected faces that are used by the hull");
+
+ RNA_def_boolean(ot->srna, "join_triangles", TRUE,
+ "Join Triangles",
+ "Merge adjacent triangles into quads");
+
+ join_triangle_props(ot);
+}
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 4ec3c22d1df..2ebeb9ca224 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -567,7 +567,7 @@ void undo_push_mesh(bContext *C, const char *name)
}
/* write comment here */
-UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, int do_face_idx_array, float *limit)
+UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, int do_face_idx_array, const float limit[2])
{
BMVert *ev;
BMFace *efa;
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 70ae9704d3e..31c130d20c9 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -106,7 +106,7 @@ void MESH_OT_duplicate(struct wmOperatorType *ot);
extern int EM_view3d_poll(struct bContext *C);
-struct wmKeyMap* knifetool_modal_keymap(struct wmKeyConfig *keyconf);
+struct wmKeyMap *knifetool_modal_keymap(struct wmKeyConfig *keyconf);
/* ******************* knifetool.c */
@@ -211,8 +211,11 @@ void MESH_OT_bevel(struct wmOperatorType *ot);
void MESH_OT_bridge_edge_loops(struct wmOperatorType *ot);
void MESH_OT_inset(struct wmOperatorType *ot);
+void MESH_OT_wireframe(struct wmOperatorType *ot);
void MESH_OT_vert_slide(struct wmOperatorType *ot);
+void MESH_OT_convex_hull(struct wmOperatorType *ot);
+
/* ******************* mesh_navmesh.c */
void MESH_OT_navmesh_make(struct wmOperatorType *ot);
void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c
index 71aaacb7e49..43cd89af3ac 100644
--- a/source/blender/editors/mesh/mesh_navmesh.c
+++ b/source/blender/editors/mesh/mesh_navmesh.c
@@ -430,7 +430,7 @@ static int navmesh_create_exec(bContext *C, wmOperator *op)
LinkNode *obs = NULL;
Base *navmeshBase = NULL;
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
if (base->object->type == OB_MESH) {
if (base->object->body_type == OB_BODY_TYPE_NAVMESH) {
if (!navmeshBase || base == scene->basact) {
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 4b4fef53275..1b87e7813db 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -164,8 +164,11 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_bridge_edge_loops);
WM_operatortype_append(MESH_OT_inset);
+ WM_operatortype_append(MESH_OT_wireframe);
WM_operatortype_append(MESH_OT_edge_split);
+ WM_operatortype_append(MESH_OT_convex_hull);
+
#ifdef WITH_GAMEENGINE
WM_operatortype_append(MESH_OT_navmesh_make);
WM_operatortype_append(MESH_OT_navmesh_face_copy);
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 7c02f26dbdc..1ebeea13782 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -122,7 +122,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
}
/* count & check */
- CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
if (base->object->type == OB_MESH) {
me = base->object->data;
@@ -198,8 +198,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
}
/* first pass over objects - copying materials and vertexgroups across */
- CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases)
- {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
/* only act if a mesh, and not the one we're joining to */
if ((ob != base->object) && (base->object->type == OB_MESH)) {
me = base->object->data;
@@ -299,8 +298,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
/* inverse transform for all selected meshes in this object */
invert_m4_m4(imat, ob->obmat);
- CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases)
- {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
/* only join if this is a mesh */
if (base->object->type == OB_MESH) {
me = base->object->data;
@@ -569,7 +567,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
KeyBlock *kb;
int ok = 0, nonequal_verts = 0;
- CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
if (base->object == ob) continue;
if (base->object->type == OB_MESH) {
@@ -601,8 +599,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
}
/* now ready to add new keys from selected meshes */
- CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases)
- {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
if (base->object == ob) continue;
if (base->object->type == OB_MESH) {
@@ -641,13 +638,13 @@ typedef struct MocNode {
intptr_t index[MOC_NODE_RES];
} MocNode;
-static int mesh_octree_get_base_offs(float *co, float *offs, float *div)
+static int mesh_octree_get_base_offs(const float co[3], const float offs[3], const float div[3])
{
int vx, vy, vz;
- vx = floor( (co[0] - offs[0]) / div[0]);
- vy = floor( (co[1] - offs[1]) / div[1]);
- vz = floor( (co[2] - offs[2]) / div[2]);
+ vx = floor((co[0] - offs[0]) / div[0]);
+ vy = floor((co[1] - offs[1]) / div[1]);
+ vz = floor((co[2] - offs[2]) / div[2]);
CLAMP(vx, 0, MOC_RES - 1);
CLAMP(vy, 0, MOC_RES - 1);
@@ -736,7 +733,7 @@ static void mesh_octree_add_nodes(MocNode **basetable, float *co, float *offs, f
}
-static intptr_t mesh_octree_find_index(MocNode **bt, MVert *mvert, float *co)
+static intptr_t mesh_octree_find_index(MocNode **bt, MVert *mvert, const float co[3])
{
float *vec;
int a;
@@ -773,7 +770,7 @@ static struct {
/* mode is 's' start, or 'e' end, or 'u' use */
/* if end, ob can be NULL */
-intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode)
+intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, const float co[3], char mode)
{
MocNode **bt;
@@ -920,7 +917,7 @@ int mesh_get_x_mirror_vert(Object *ob, int index)
return 0;
}
-static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, float *co)
+static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, const float co[3])
{
float vec[3];
intptr_t poinval;
@@ -928,9 +925,10 @@ static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, f
/* ignore nan verts */
if (!finite(co[0]) ||
!finite(co[1]) ||
- !finite(co[2])
- )
+ !finite(co[2]))
+ {
return NULL;
+ }
vec[0] = -co[0];
vec[1] = co[1];
@@ -971,7 +969,7 @@ static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob, struct BMEditMesh *e
return NULL;
}
-BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *eve, float *co, int index)
+BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *eve, const float co[3], int index)
{
if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_TOPO) {
return editbmesh_get_x_mirror_vert_topo(ob, em, eve, index);
@@ -1016,7 +1014,7 @@ static float *editmesh_get_mirror_uv(BMEditMesh *em, int axis, float *uv, float
BMFace *efa;
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- poly_uv_center(em, efa, cent);
+ uv_poly_center(em, efa, cent);
if ( (fabs(cent[0] - cent_vec[0]) < 0.001) && (fabs(cent[1] - cent_vec[1]) < 0.001) ) {
BMIter liter;
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index 713009d2a19..fd842ce4f7c 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -111,7 +111,7 @@ MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int UNU
ml= ml->next;
}
- ml= add_metaball_element(mball, type);
+ ml= BKE_metaball_element_add(mball, type);
copy_v3_v3(&ml->x, mat[3]);
ml->flag |= SELECT;
@@ -195,7 +195,7 @@ static int select_random_metaelems_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
ml= mb->editelems->first;
- BLI_srand( BLI_rand() ); /* Random seed */
+ BLI_srand(BLI_rand()); /* Random seed */
/* Stupid version of random selection. Should be improved. */
while (ml) {
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 3717591e412..9635b1b9b62 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -111,8 +111,8 @@
void ED_object_location_from_view(bContext *C, float *loc)
{
- View3D *v3d= CTX_wm_view3d(C);
- Scene *scene= CTX_data_scene(C);
+ View3D *v3d = CTX_wm_view3d(C);
+ Scene *scene = CTX_data_scene(C);
float *cursor;
cursor = give_cursor(scene, v3d);
@@ -122,11 +122,11 @@ void ED_object_location_from_view(bContext *C, float *loc)
void ED_object_rotation_from_view(bContext *C, float *rot)
{
- RegionView3D *rv3d= CTX_wm_region_view3d(C);
+ RegionView3D *rv3d = CTX_wm_region_view3d(C);
if (rv3d) {
float quat[4];
copy_qt_qt(quat, rv3d->viewquat);
- quat[0]= -quat[0];
+ quat[0] = -quat[0];
quat_to_eul(rot, quat);
}
else {
@@ -136,8 +136,8 @@ void ED_object_rotation_from_view(bContext *C, float *rot)
void ED_object_base_init_transform(bContext *C, Base *base, float *loc, float *rot)
{
- Object *ob= base->object;
- Scene *scene= CTX_data_scene(C);
+ Object *ob = base->object;
+ Scene *scene = CTX_data_scene(C);
if (!scene) return;
@@ -195,19 +195,19 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode)
if (do_editmode) {
prop = RNA_def_boolean(ot->srna, "enter_editmode", 0, "Enter Editmode",
- "Enter editmode when adding this object");
- RNA_def_property_flag(prop, PROP_HIDDEN|PROP_SKIP_SAVE);
+ "Enter editmode when adding this object");
+ RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
}
prop = RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location",
- "Location for the newly added object", -FLT_MAX, FLT_MAX);
+ "Location for the newly added object", -FLT_MAX, FLT_MAX);
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation",
- "Rotation for the newly added object", (float)-M_PI * 2.0f, (float)M_PI * 2.0f);
+ "Rotation for the newly added object", (float)-M_PI * 2.0f, (float)M_PI * 2.0f);
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", "");
- RNA_def_property_flag(prop, PROP_HIDDEN|PROP_SKIP_SAVE);
+ RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
}
static void object_add_generic_invoke_options(bContext *C, wmOperator *op)
@@ -229,14 +229,14 @@ static void object_add_generic_invoke_options(bContext *C, wmOperator *op)
int a, values[20], layer;
if (v3d) {
- layer = (v3d->scenelock && !v3d->localvd)? scene->layact: v3d->layact;
+ layer = (v3d->scenelock && !v3d->localvd) ? scene->layact : v3d->layact;
}
else {
layer = scene->layact;
}
- for (a=0; a<20; a++) {
- values[a]= (layer & (1<<a));
+ for (a = 0; a < 20; a++) {
+ values[a] = (layer & (1 << a));
}
RNA_boolean_set_array(op->ptr, "layers", values);
@@ -250,7 +250,7 @@ int ED_object_add_generic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
}
int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc,
- float *rot, int *enter_editmode, unsigned int *layer, int *is_view_aligned)
+ float *rot, int *enter_editmode, unsigned int *layer, int *is_view_aligned)
{
View3D *v3d = CTX_wm_view3d(C);
int a, layer_values[20];
@@ -263,8 +263,8 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc,
if (RNA_struct_property_is_set(op->ptr, "layers")) {
RNA_boolean_get_array(op->ptr, "layers", layer_values);
- *layer= 0;
- for (a=0; a<20; a++) {
+ *layer = 0;
+ for (a = 0; a < 20; a++) {
if (layer_values[a])
*layer |= (1 << a);
else
@@ -314,18 +314,18 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc,
/* for object add primitive operators */
/* do not call undo push in this function (users of this function have to) */
Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot,
- int enter_editmode, unsigned int layer)
+ int enter_editmode, unsigned int layer)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob;
/* for as long scene has editmode... */
if (CTX_data_edit_object(C))
- ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO); /* freedata, and undo */
+ ED_object_exit_editmode(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO); /* freedata, and undo */
/* deselects all, sets scene->basact */
- ob= add_object(scene, type);
+ ob = add_object(scene, type);
BASACT->lay = ob->lay = layer;
/* editor level activate, notifiers */
ED_base_object_activate(C, BASACT);
@@ -342,7 +342,7 @@ Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot,
if (enter_editmode)
ED_object_enter_editmode(C, EM_IGNORE_LAYER);
- WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
return ob;
}
@@ -376,7 +376,7 @@ void OBJECT_OT_add(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", object_type_items, 0, "Type", "");
@@ -414,23 +414,23 @@ static Object *effector_add_type(bContext *C, wmOperator *op, int type)
if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
return NULL;
- if (type==PFIELD_GUIDE) {
- ob= ED_object_add_type(C, OB_CURVE, loc, rot, FALSE, layer);
+ if (type == PFIELD_GUIDE) {
+ ob = ED_object_add_type(C, OB_CURVE, loc, rot, FALSE, layer);
rename_id(&ob->id, "CurveGuide");
- ((Curve*)ob->data)->flag |= CU_PATH|CU_3D;
+ ((Curve *)ob->data)->flag |= CU_PATH | CU_3D;
ED_object_enter_editmode(C, 0);
ED_object_new_primitive_matrix(C, ob, loc, rot, mat);
- BLI_addtail(object_editcurve_get(ob), add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_PATH, 1));
+ BLI_addtail(object_editcurve_get(ob), add_nurbs_primitive(C, mat, CU_NURBS | CU_PRIM_PATH, 1));
if (!enter_editmode)
ED_object_exit_editmode(C, EM_FREEDATA);
}
else {
- ob= ED_object_add_type(C, OB_EMPTY, loc, rot, FALSE, layer);
+ ob = ED_object_add_type(C, OB_EMPTY, loc, rot, FALSE, layer);
rename_id(&ob->id, "Field");
- switch(type) {
+ switch (type) {
case PFIELD_WIND:
case PFIELD_VORTEX:
ob->empty_drawtype = OB_SINGLE_ARROW;
@@ -438,7 +438,7 @@ static Object *effector_add_type(bContext *C, wmOperator *op, int type)
}
}
- ob->pd= object_add_collision_fields(type);
+ ob->pd = object_add_collision_fields(type);
DAG_scene_sort(CTX_data_main(C), CTX_data_scene(C));
@@ -468,7 +468,7 @@ void OBJECT_OT_effector_add(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ot->prop = RNA_def_enum(ot->srna, "type", field_type_items, 0, "Type", "");
@@ -480,7 +480,7 @@ void OBJECT_OT_effector_add(wmOperatorType *ot)
static int object_camera_add_exec(bContext *C, wmOperator *op)
{
View3D *v3d = CTX_wm_view3d(C);
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob;
int enter_editmode;
unsigned int layer;
@@ -494,12 +494,12 @@ static int object_camera_add_exec(bContext *C, wmOperator *op)
if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
return OPERATOR_CANCELLED;
- ob= ED_object_add_type(C, OB_CAMERA, loc, rot, FALSE, layer);
+ ob = ED_object_add_type(C, OB_CAMERA, loc, rot, FALSE, layer);
if (v3d) {
if (v3d->camera == NULL)
v3d->camera = ob;
- if (v3d->scenelock && scene->camera==NULL) {
+ if (v3d->scenelock && scene->camera == NULL) {
scene->camera = ob;
}
}
@@ -521,12 +521,12 @@ void OBJECT_OT_camera_add(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
/* hide this for cameras, default */
- prop= RNA_struct_type_find_property(ot->srna, "view_align");
+ prop = RNA_struct_type_find_property(ot->srna, "view_align");
RNA_def_property_flag(prop, PROP_HIDDEN);
}
@@ -535,9 +535,9 @@ void OBJECT_OT_camera_add(wmOperatorType *ot)
/* ***************** add primitives *************** */
static int object_metaball_add_exec(bContext *C, wmOperator *op)
{
- Object *obedit= CTX_data_edit_object(C);
+ Object *obedit = CTX_data_edit_object(C);
/*MetaElem *elem;*/ /*UNUSED*/
- int newob= 0;
+ int newob = 0;
int enter_editmode;
unsigned int layer;
float loc[3], rot[3];
@@ -548,8 +548,8 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op)
if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
return OPERATOR_CANCELLED;
- if (obedit==NULL || obedit->type!=OB_MBALL) {
- obedit= ED_object_add_type(C, OB_MBALL, loc, rot, TRUE, layer);
+ if (obedit == NULL || obedit->type != OB_MBALL) {
+ obedit = ED_object_add_type(C, OB_MBALL, loc, rot, TRUE, layer);
newob = 1;
}
else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
@@ -563,21 +563,21 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op)
ED_object_exit_editmode(C, EM_FREEDATA);
}
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
return OPERATOR_FINISHED;
}
static int object_metaball_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
- Object *obedit= CTX_data_edit_object(C);
+ Object *obedit = CTX_data_edit_object(C);
uiPopupMenu *pup;
uiLayout *layout;
object_add_generic_invoke_options(C, op);
- pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
- layout= uiPupMenuLayout(pup);
+ pup = uiPupMenuBegin(C, op->type->name, ICON_NONE);
+ layout = uiPupMenuLayout(pup);
if (!obedit || obedit->type == OB_MBALL)
uiItemsEnumO(layout, op->type->idname, "type");
else
@@ -600,7 +600,7 @@ void OBJECT_OT_metaball_add(wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", metaelem_type_items, 0, "Primitive", "");
ED_object_add_generic_props(ot, TRUE);
@@ -608,7 +608,7 @@ void OBJECT_OT_metaball_add(wmOperatorType *ot)
static int object_add_text_exec(bContext *C, wmOperator *op)
{
- Object *obedit= CTX_data_edit_object(C);
+ Object *obedit = CTX_data_edit_object(C);
int enter_editmode;
unsigned int layer;
float loc[3], rot[3];
@@ -617,12 +617,12 @@ static int object_add_text_exec(bContext *C, wmOperator *op)
if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
return OPERATOR_CANCELLED;
- if (obedit && obedit->type==OB_FONT)
+ if (obedit && obedit->type == OB_FONT)
return OPERATOR_CANCELLED;
- obedit= ED_object_add_type(C, OB_FONT, loc, rot, enter_editmode, layer);
+ obedit = ED_object_add_type(C, OB_FONT, loc, rot, enter_editmode, layer);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
return OPERATOR_FINISHED;
}
@@ -640,16 +640,16 @@ void OBJECT_OT_text_add(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
static int object_armature_add_exec(bContext *C, wmOperator *op)
{
- Object *obedit= CTX_data_edit_object(C);
- View3D *v3d= CTX_wm_view3d(C);
- RegionView3D *rv3d= CTX_wm_region_view3d(C);
- int newob= 0;
+ Object *obedit = CTX_data_edit_object(C);
+ View3D *v3d = CTX_wm_view3d(C);
+ RegionView3D *rv3d = CTX_wm_region_view3d(C);
+ int newob = 0;
int enter_editmode;
unsigned int layer;
float loc[3], rot[3];
@@ -658,14 +658,14 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
return OPERATOR_CANCELLED;
- if ((obedit==NULL) || (obedit->type != OB_ARMATURE)) {
- obedit= ED_object_add_type(C, OB_ARMATURE, loc, rot, TRUE, layer);
+ if ((obedit == NULL) || (obedit->type != OB_ARMATURE)) {
+ obedit = ED_object_add_type(C, OB_ARMATURE, loc, rot, TRUE, layer);
ED_object_enter_editmode(C, 0);
newob = 1;
}
else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
- if (obedit==NULL) {
+ if (obedit == NULL) {
BKE_report(op->reports, RPT_ERROR, "Cannot create editmode armature");
return OPERATOR_CANCELLED;
}
@@ -677,7 +677,7 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
if (newob && !enter_editmode)
ED_object_exit_editmode(C, EM_FREEDATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
return OPERATOR_FINISHED;
}
@@ -695,7 +695,7 @@ void OBJECT_OT_armature_add(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -714,10 +714,10 @@ static const char *get_lamp_defname(int type)
static int object_lamp_add_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob;
Lamp *la;
- int type= RNA_enum_get(op->ptr, "type");
+ int type = RNA_enum_get(op->ptr, "type");
int enter_editmode;
unsigned int layer;
float loc[3], rot[3];
@@ -726,16 +726,16 @@ static int object_lamp_add_exec(bContext *C, wmOperator *op)
if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
return OPERATOR_CANCELLED;
- ob= ED_object_add_type(C, OB_LAMP, loc, rot, FALSE, layer);
- la= (Lamp*)ob->data;
+ ob = ED_object_add_type(C, OB_LAMP, loc, rot, FALSE, layer);
+ la = (Lamp *)ob->data;
- la->type= type;
+ la->type = type;
rename_id(&ob->id, get_lamp_defname(type));
rename_id(&la->id, get_lamp_defname(type));
if (scene_use_new_shading_nodes(scene)) {
ED_node_shader_default(scene, &la->id);
- la->use_nodes= 1;
+ la->use_nodes = 1;
}
return OPERATOR_FINISHED;
@@ -762,7 +762,7 @@ void OBJECT_OT_lamp_add(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", lamp_type_items, 0, "Type", "");
@@ -772,7 +772,7 @@ void OBJECT_OT_lamp_add(wmOperatorType *ot)
static int group_instance_add_exec(bContext *C, wmOperator *op)
{
- Group *group= BLI_findlink(&CTX_data_main(C)->group, RNA_enum_get(op->ptr, "group"));
+ Group *group = BLI_findlink(&CTX_data_main(C)->group, RNA_enum_get(op->ptr, "group"));
int enter_editmode;
unsigned int layer;
@@ -783,18 +783,18 @@ static int group_instance_add_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
if (group) {
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_add_type(C, OB_EMPTY, loc, rot, FALSE, layer);
- rename_id(&ob->id, group->id.name+2);
- ob->dup_group= group;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = ED_object_add_type(C, OB_EMPTY, loc, rot, FALSE, layer);
+ rename_id(&ob->id, group->id.name + 2);
+ ob->dup_group = group;
ob->transflag |= OB_DUPLIGROUP;
id_lib_extern(&group->id);
/* works without this except if you try render right after, see: 22027 */
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -814,7 +814,7 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op)
if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
return OPERATOR_CANCELLED;
- ob= ED_object_add_type(C, OB_SPEAKER, loc, rot, FALSE, layer);
+ ob = ED_object_add_type(C, OB_SPEAKER, loc, rot, FALSE, layer);
/* to make it easier to start using this immediately in NLA, a default sound clip is created
* ready to be moved around to retime the sound and/or make new sound clips
@@ -834,7 +834,7 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op)
strcpy(nlt->name, "SoundTrack");
BKE_nlastrip_validate_name(adt, strip);
- WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
}
return OPERATOR_FINISHED;
@@ -852,7 +852,7 @@ void OBJECT_OT_speaker_add(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ED_object_add_generic_props(ot, TRUE);
}
@@ -874,10 +874,10 @@ void OBJECT_OT_group_instance_add(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "");
+ prop = RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "");
RNA_def_enum_funcs(prop, RNA_group_itemf);
ot->prop = prop;
ED_object_add_generic_props(ot, FALSE);
@@ -892,21 +892,21 @@ void ED_base_object_free_and_unlink(Main *bmain, Scene *scene, Base *base)
DAG_id_type_tag(bmain, ID_OB);
BLI_remlink(&scene->base, base);
free_libblock_us(&bmain->object, base->object);
- if (scene->basact==base) scene->basact= NULL;
+ if (scene->basact == base) scene->basact = NULL;
MEM_freeN(base);
}
static int object_delete_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- const short use_global= RNA_boolean_get(op->ptr, "use_global");
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ const short use_global = RNA_boolean_get(op->ptr, "use_global");
/* int islamp= 0; */ /* UNUSED */
if (CTX_data_edit_object(C))
return OPERATOR_CANCELLED;
- CTX_DATA_BEGIN(C, Base*, base, selected_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_bases) {
/* if (base->object->type==OB_LAMP) islamp= 1; */
@@ -920,9 +920,9 @@ static int object_delete_exec(bContext *C, wmOperator *op)
Scene *scene_iter;
Base *base_other;
- for (scene_iter= bmain->scene.first; scene_iter; scene_iter= scene_iter->id.next) {
+ for (scene_iter = bmain->scene.first; scene_iter; scene_iter = scene_iter->id.next) {
if (scene_iter != scene && !(scene_iter->id.lib)) {
- base_other= object_in_scene(base->object, scene_iter);
+ base_other = object_in_scene(base->object, scene_iter);
if (base_other) {
ED_base_object_free_and_unlink(bmain, scene_iter, base_other);
}
@@ -937,8 +937,8 @@ static int object_delete_exec(bContext *C, wmOperator *op)
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
- WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
return OPERATOR_FINISHED;
}
@@ -956,7 +956,7 @@ void OBJECT_OT_delete(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "use_global", 0, "Delete Globally", "Remove object from all scenes");
}
@@ -966,81 +966,81 @@ void OBJECT_OT_delete(wmOperatorType *ot)
/* after copying objects, copied data should get new pointers */
static void copy_object_set_idnew(bContext *C, int dupflag)
{
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
Material *ma, *mao;
ID *id;
int a;
/* XXX check object pointers */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
object_relink(ob);
}
CTX_DATA_END;
/* materials */
- if ( dupflag & USER_DUP_MAT) {
- mao= bmain->mat.first;
+ if (dupflag & USER_DUP_MAT) {
+ mao = bmain->mat.first;
while (mao) {
if (mao->id.newid) {
- ma= (Material *)mao->id.newid;
+ ma = (Material *)mao->id.newid;
if (dupflag & USER_DUP_TEX) {
- for (a=0; a<MAX_MTEX; a++) {
+ for (a = 0; a < MAX_MTEX; a++) {
if (ma->mtex[a]) {
- id= (ID *)ma->mtex[a]->tex;
+ id = (ID *)ma->mtex[a]->tex;
if (id) {
ID_NEW_US(ma->mtex[a]->tex)
- else ma->mtex[a]->tex= copy_texture(ma->mtex[a]->tex);
+ else ma->mtex[a]->tex = copy_texture(ma->mtex[a]->tex);
id->us--;
}
}
}
}
#if 0 // XXX old animation system
- id= (ID *)ma->ipo;
+ id = (ID *)ma->ipo;
if (id) {
ID_NEW_US(ma->ipo)
- else ma->ipo= copy_ipo(ma->ipo);
+ else ma->ipo = copy_ipo(ma->ipo);
id->us--;
}
#endif // XXX old animation system
}
- mao= mao->id.next;
+ mao = mao->id.next;
}
}
#if 0 // XXX old animation system
- /* lamps */
- if ( dupflag & USER_DUP_IPO) {
- Lamp *la= bmain->lamp.first;
+ /* lamps */
+ if (dupflag & USER_DUP_IPO) {
+ Lamp *la = bmain->lamp.first;
while (la) {
if (la->id.newid) {
- Lamp *lan= (Lamp *)la->id.newid;
- id= (ID *)lan->ipo;
+ Lamp *lan = (Lamp *)la->id.newid;
+ id = (ID *)lan->ipo;
if (id) {
ID_NEW_US(lan->ipo)
- else lan->ipo= copy_ipo(lan->ipo);
+ else lan->ipo = copy_ipo(lan->ipo);
id->us--;
}
}
- la= la->id.next;
+ la = la->id.next;
}
}
/* ipos */
- ipo= bmain->ipo.first;
+ ipo = bmain->ipo.first;
while (ipo) {
- if (ipo->id.lib==NULL && ipo->id.newid) {
- Ipo *ipon= (Ipo *)ipo->id.newid;
+ if (ipo->id.lib == NULL && ipo->id.newid) {
+ Ipo *ipon = (Ipo *)ipo->id.newid;
IpoCurve *icu;
- for (icu= ipon->curve.first; icu; icu= icu->next) {
+ for (icu = ipon->curve.first; icu; icu = icu->next) {
if (icu->driver) {
ID_NEW(icu->driver->ob);
}
}
}
- ipo= ipo->id.next;
+ ipo = ipo->id.next;
}
#endif // XXX old animation system
@@ -1057,42 +1057,42 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
{
ListBase *lb;
DupliObject *dob;
- GHash *dupli_gh= NULL, *parent_gh= NULL;
+ GHash *dupli_gh = NULL, *parent_gh = NULL;
if (!(base->object->transflag & OB_DUPLI))
return;
- lb= object_duplilist(scene, base->object);
+ lb = object_duplilist(scene, base->object);
if (use_hierarchy || use_base_parent) {
- dupli_gh= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "make_object_duplilist_real dupli_gh");
- parent_gh= BLI_ghash_new(BLI_ghashutil_pairhash, BLI_ghashutil_paircmp, "make_object_duplilist_real parent_gh");
+ dupli_gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "make_object_duplilist_real dupli_gh");
+ parent_gh = BLI_ghash_new(BLI_ghashutil_pairhash, BLI_ghashutil_paircmp, "make_object_duplilist_real parent_gh");
}
- for (dob= lb->first; dob; dob= dob->next) {
+ for (dob = lb->first; dob; dob = dob->next) {
Base *basen;
- Object *ob= copy_object(dob->ob);
+ Object *ob = copy_object(dob->ob);
/* font duplis can have a totcol without material, we get them from parent
* should be implemented better...
*/
- if (ob->mat==NULL) ob->totcol= 0;
+ if (ob->mat == NULL) ob->totcol = 0;
- basen= MEM_dupallocN(base);
- basen->flag &= ~(OB_FROMDUPLI|OB_FROMGROUP);
- ob->flag= basen->flag;
- basen->lay= base->lay;
- BLI_addhead(&scene->base, basen); /* addhead: othwise eternal loop */
- basen->object= ob;
+ basen = MEM_dupallocN(base);
+ basen->flag &= ~(OB_FROMDUPLI | OB_FROMGROUP);
+ ob->flag = basen->flag;
+ basen->lay = base->lay;
+ BLI_addhead(&scene->base, basen); /* addhead: othwise eternal loop */
+ basen->object = ob;
/* make sure apply works */
BKE_free_animdata(&ob->id);
ob->adt = NULL;
- ob->parent= NULL;
- ob->constraints.first= ob->constraints.last= NULL;
- ob->disp.first= ob->disp.last= NULL;
+ ob->parent = NULL;
+ ob->constraints.first = ob->constraints.last = NULL;
+ ob->disp.first = ob->disp.last = NULL;
ob->transflag &= ~OB_DUPLI;
- ob->lay= base->lay;
+ ob->lay = base->lay;
copy_m4_m4(ob->obmat, dob->mat);
object_apply_mat4(ob, ob->obmat, FALSE, FALSE);
@@ -1104,13 +1104,13 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
}
if (use_hierarchy) {
- for (dob= lb->first; dob; dob= dob->next) {
+ for (dob = lb->first; dob; dob = dob->next) {
/* original parents */
- Object *ob_src= dob->ob;
- Object *ob_src_par= ob_src->parent;
+ Object *ob_src = dob->ob;
+ Object *ob_src_par = ob_src->parent;
- Object *ob_dst= BLI_ghash_lookup(dupli_gh, dob);
- Object *ob_dst_par= NULL;
+ Object *ob_dst = BLI_ghash_lookup(dupli_gh, dob);
+ Object *ob_dst_par = NULL;
/* find parent that was also made real */
if (ob_src_par) {
@@ -1121,19 +1121,19 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
if (ob_dst_par) {
/* allow for all possible parent types */
- ob_dst->partype= ob_src->partype;
+ ob_dst->partype = ob_src->partype;
BLI_strncpy(ob_dst->parsubstr, ob_src->parsubstr, sizeof(ob_dst->parsubstr));
- ob_dst->par1= ob_src->par1;
- ob_dst->par2= ob_src->par2;
- ob_dst->par3= ob_src->par3;
+ ob_dst->par1 = ob_src->par1;
+ ob_dst->par2 = ob_src->par2;
+ ob_dst->par3 = ob_src->par3;
copy_m4_m4(ob_dst->parentinv, ob_src->parentinv);
- ob_dst->parent= ob_dst_par;
+ ob_dst->parent = ob_dst_par;
}
else if (use_base_parent) {
- ob_dst->parent= base->object;
- ob_dst->partype= PAROBJECT;
+ ob_dst->parent = base->object;
+ ob_dst->partype = PAROBJECT;
}
if (ob_dst->parent) {
@@ -1151,12 +1151,12 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
else if (use_base_parent) {
/* since we are ignoring the internal hierarchy - parent all to the
* base object */
- for (dob= lb->first; dob; dob= dob->next) {
+ for (dob = lb->first; dob; dob = dob->next) {
/* original parents */
- Object *ob_dst= BLI_ghash_lookup(dupli_gh, dob);
+ Object *ob_dst = BLI_ghash_lookup(dupli_gh, dob);
- ob_dst->parent= base->object;
- ob_dst->partype= PAROBJECT;
+ ob_dst->parent = base->object;
+ ob_dst->partype = PAROBJECT;
/* similer to the code above, see comments */
invert_m4_m4(ob_dst->parentinv, dob->mat);
@@ -1181,26 +1181,26 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
static int object_duplicates_make_real_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
- const short use_base_parent= RNA_boolean_get(op->ptr, "use_base_parent");
- const short use_hierarchy= RNA_boolean_get(op->ptr, "use_hierarchy");
+ const short use_base_parent = RNA_boolean_get(op->ptr, "use_base_parent");
+ const short use_hierarchy = RNA_boolean_get(op->ptr, "use_hierarchy");
clear_id_newpoins();
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
make_object_duplilist_real(C, scene, base, use_base_parent, use_hierarchy);
/* dependencies were changed */
- WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, base->object);
+ WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, base->object);
}
CTX_DATA_END;
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
WM_event_add_notifier(C, NC_SCENE, scene);
- WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
return OPERATOR_FINISHED;
}
@@ -1219,7 +1219,7 @@ void OBJECT_OT_duplicates_make_real(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "use_base_parent", 0, "Parent", "Parent newly created objects to the original duplicator");
RNA_def_boolean(ot->srna, "use_hierarchy", 0, "Keep Hierarchy", "Maintain parent child relationships");
@@ -1227,15 +1227,16 @@ void OBJECT_OT_duplicates_make_real(wmOperatorType *ot)
/**************************** Convert **************************/
-static EnumPropertyItem convert_target_items[]= {
+static EnumPropertyItem convert_target_items[] = {
{OB_CURVE, "CURVE", ICON_OUTLINER_OB_CURVE, "Curve from Mesh/Text", ""},
{OB_MESH, "MESH", ICON_OUTLINER_OB_MESH, "Mesh from Curve/Meta/Surf/Text", ""},
- {0, NULL, 0, NULL, NULL}};
+ {0, NULL, 0, NULL, NULL}
+};
static void curvetomesh(Scene *scene, Object *ob)
{
if (ob->disp.first == NULL)
- makeDispListCurveTypes(scene, ob, 0); /* force creation */
+ makeDispListCurveTypes(scene, ob, 0); /* force creation */
nurbs_to_mesh(ob); /* also does users */
@@ -1245,8 +1246,8 @@ static void curvetomesh(Scene *scene, Object *ob)
static int convert_poll(bContext *C)
{
- Object *obact= CTX_data_active_object(C);
- Scene *scene= CTX_data_scene(C);
+ Object *obact = CTX_data_active_object(C);
+ Scene *scene = CTX_data_scene(C);
return (!scene->id.lib && obact && scene->obedit != obact && (obact->flag & SELECT) && !(obact->id.lib));
}
@@ -1258,16 +1259,16 @@ static Base *duplibase_for_convert(Scene *scene, Base *base, Object *ob)
Base *basen;
if (ob == NULL) {
- ob= base->object;
+ ob = base->object;
}
- obn= copy_object(ob);
- obn->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ obn = copy_object(ob);
+ obn->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
- basen= MEM_mallocN(sizeof(Base), "duplibase");
- *basen= *base;
- BLI_addhead(&scene->base, basen); /* addhead: otherwise eternal loop */
- basen->object= obn;
+ basen = MEM_mallocN(sizeof(Base), "duplibase");
+ *basen = *base;
+ BLI_addhead(&scene->base, basen); /* addhead: otherwise eternal loop */
+ basen->object = obn;
basen->flag |= SELECT;
obn->flag |= SELECT;
base->flag &= ~SELECT;
@@ -1278,24 +1279,24 @@ static Base *duplibase_for_convert(Scene *scene, Base *base, Object *ob)
static int convert_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Base *basen=NULL, *basact=NULL, *basedel=NULL;
- Object *ob, *ob1, *newob, *obact= CTX_data_active_object(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Base *basen = NULL, *basact = NULL, *basedel = NULL;
+ Object *ob, *ob1, *newob, *obact = CTX_data_active_object(C);
DerivedMesh *dm;
Curve *cu;
Nurb *nu;
MetaBall *mb;
Mesh *me;
- const short target= RNA_enum_get(op->ptr, "target");
- const short keep_original= RNA_boolean_get(op->ptr, "keep_original");
- int a, mballConverted= 0;
+ const short target = RNA_enum_get(op->ptr, "target");
+ const short keep_original = RNA_boolean_get(op->ptr, "keep_original");
+ int a, mballConverted = 0;
/* don't forget multiple users! */
/* reset flags */
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
- ob= base->object;
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
+ ob = base->object;
ob->flag &= ~OB_DONE;
/* flag data thats not been edited (only needed for !keep_original) */
@@ -1305,8 +1306,8 @@ static int convert_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
- ob= base->object;
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
+ ob = base->object;
if (ob->flag & OB_DONE || !IS_TAGGED(ob->data)) {
if (ob->type != target) {
@@ -1319,23 +1320,23 @@ static int convert_exec(bContext *C, wmOperator *op)
/* When 2 objects with linked data are selected, converting both
* would keep modifiers on all but the converted object [#26003] */
if (ob->type == OB_MESH) {
- object_free_modifiers(ob); /* after derivedmesh calls! */
+ object_free_modifiers(ob); /* after derivedmesh calls! */
}
}
}
- else if (ob->type==OB_MESH && target == OB_CURVE) {
+ else if (ob->type == OB_MESH && target == OB_CURVE) {
ob->flag |= OB_DONE;
if (keep_original) {
- basen= duplibase_for_convert(scene, base, NULL);
- newob= basen->object;
+ basen = duplibase_for_convert(scene, base, NULL);
+ newob = basen->object;
/* decrement original mesh's usage count */
- me= newob->data;
+ me = newob->data;
me->id.us--;
/* make a new copy of the mesh */
- newob->data= copy_mesh(me);
+ newob->data = copy_mesh(me);
}
else {
newob = ob;
@@ -1343,33 +1344,33 @@ static int convert_exec(bContext *C, wmOperator *op)
mesh_to_curve(scene, newob);
- if (newob->type==OB_CURVE)
- object_free_modifiers(newob); /* after derivedmesh calls! */
+ if (newob->type == OB_CURVE)
+ object_free_modifiers(newob); /* after derivedmesh calls! */
}
- else if (ob->type==OB_MESH && ob->modifiers.first) { /* converting a mesh with no modifiers causes a segfault */
+ else if (ob->type == OB_MESH && ob->modifiers.first) { /* converting a mesh with no modifiers causes a segfault */
ob->flag |= OB_DONE;
if (keep_original) {
- basen= duplibase_for_convert(scene, base, NULL);
- newob= basen->object;
+ basen = duplibase_for_convert(scene, base, NULL);
+ newob = basen->object;
/* decrement original mesh's usage count */
- me= newob->data;
+ me = newob->data;
me->id.us--;
/* make a new copy of the mesh */
- newob->data= copy_mesh(me);
+ newob->data = copy_mesh(me);
}
else {
newob = ob;
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
}
/* make new mesh data from the original copy */
/* note: get the mesh from the original, not from the copy in some
* cases this doesnt give correct results (when MDEF is used for eg)
*/
- dm= mesh_get_derived_final(scene, newob, CD_MASK_MESH);
+ dm = mesh_get_derived_final(scene, newob, CD_MASK_MESH);
/* dm= mesh_create_derived_no_deform(ob1, NULL); this was called original (instead of get_derived). man o man why! (ton) */
DM_to_mesh(dm, newob->data, newob);
@@ -1377,64 +1378,64 @@ static int convert_exec(bContext *C, wmOperator *op)
/* re-tessellation is called by DM_to_mesh */
dm->release(dm);
- object_free_modifiers(newob); /* after derivedmesh calls! */
+ object_free_modifiers(newob); /* after derivedmesh calls! */
}
- else if (ob->type==OB_FONT) {
+ else if (ob->type == OB_FONT) {
ob->flag |= OB_DONE;
if (keep_original) {
- basen= duplibase_for_convert(scene, base, NULL);
- newob= basen->object;
+ basen = duplibase_for_convert(scene, base, NULL);
+ newob = basen->object;
/* decrement original curve's usage count */
((Curve *)newob->data)->id.us--;
/* make a new copy of the curve */
- newob->data= copy_curve(ob->data);
+ newob->data = BKE_curve_copy(ob->data);
}
else {
- newob= ob;
+ newob = ob;
}
- cu= newob->data;
+ cu = newob->data;
if (!newob->disp.first)
makeDispListCurveTypes(scene, newob, 0);
- newob->type= OB_CURVE;
- cu->type= OB_CURVE;
+ newob->type = OB_CURVE;
+ cu->type = OB_CURVE;
if (cu->vfont) {
cu->vfont->id.us--;
- cu->vfont= NULL;
+ cu->vfont = NULL;
}
if (cu->vfontb) {
cu->vfontb->id.us--;
- cu->vfontb= NULL;
+ cu->vfontb = NULL;
}
if (cu->vfonti) {
cu->vfonti->id.us--;
- cu->vfonti= NULL;
+ cu->vfonti = NULL;
}
if (cu->vfontbi) {
cu->vfontbi->id.us--;
- cu->vfontbi= NULL;
+ cu->vfontbi = NULL;
}
if (!keep_original) {
/* other users */
- if (cu->id.us>1) {
- for (ob1= bmain->object.first; ob1; ob1=ob1->id.next) {
- if (ob1->data==ob->data) {
- ob1->type= OB_CURVE;
- ob1->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ if (cu->id.us > 1) {
+ for (ob1 = bmain->object.first; ob1; ob1 = ob1->id.next) {
+ if (ob1->data == ob->data) {
+ ob1->type = OB_CURVE;
+ ob1->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
}
}
}
}
- for (nu=cu->nurb.first; nu; nu=nu->next)
- nu->charidx= 0;
+ for (nu = cu->nurb.first; nu; nu = nu->next)
+ nu->charidx = 0;
if (target == OB_MESH) {
curvetomesh(scene, newob);
@@ -1448,17 +1449,17 @@ static int convert_exec(bContext *C, wmOperator *op)
if (target == OB_MESH) {
if (keep_original) {
- basen= duplibase_for_convert(scene, base, NULL);
- newob= basen->object;
+ basen = duplibase_for_convert(scene, base, NULL);
+ newob = basen->object;
/* decrement original curve's usage count */
((Curve *)newob->data)->id.us--;
/* make a new copy of the curve */
- newob->data= copy_curve(ob->data);
+ newob->data = BKE_curve_copy(ob->data);
}
else {
- newob= ob;
+ newob = ob;
/* meshes doesn't use displist */
freedisplist(&newob->disp);
@@ -1467,13 +1468,13 @@ static int convert_exec(bContext *C, wmOperator *op)
curvetomesh(scene, newob);
}
}
- else if (ob->type==OB_MBALL && target == OB_MESH) {
+ else if (ob->type == OB_MBALL && target == OB_MESH) {
Object *baseob;
base->flag &= ~SELECT;
ob->flag &= ~SELECT;
- baseob= find_basis_mball(scene, ob);
+ baseob = BKE_metaball_basis_find(scene, ob);
if (ob != baseob) {
/* if motherball is converting it would be marked as done later */
@@ -1487,29 +1488,29 @@ static int convert_exec(bContext *C, wmOperator *op)
if (!(baseob->flag & OB_DONE)) {
baseob->flag |= OB_DONE;
- basen= duplibase_for_convert(scene, base, baseob);
- newob= basen->object;
+ basen = duplibase_for_convert(scene, base, baseob);
+ newob = basen->object;
- mb= newob->data;
+ mb = newob->data;
mb->id.us--;
- newob->data= add_mesh("Mesh");
- newob->type= OB_MESH;
+ newob->data = add_mesh("Mesh");
+ newob->type = OB_MESH;
- me= newob->data;
- me->totcol= mb->totcol;
+ me = newob->data;
+ me->totcol = mb->totcol;
if (newob->totcol) {
- me->mat= MEM_dupallocN(mb->mat);
- for (a=0; a<newob->totcol; a++) id_us_plus((ID *)me->mat[a]);
+ me->mat = MEM_dupallocN(mb->mat);
+ for (a = 0; a < newob->totcol; a++) id_us_plus((ID *)me->mat[a]);
}
mball_to_mesh(&baseob->disp, newob->data);
if (obact->type == OB_MBALL) {
- basact= basen;
+ basact = basen;
}
- mballConverted= 1;
+ mballConverted = 1;
}
}
else {
@@ -1522,10 +1523,10 @@ static int convert_exec(bContext *C, wmOperator *op)
if (basen) {
if (ob == obact) {
/* store new active base to update BASACT */
- basact= basen;
+ basact = basen;
}
- basen= NULL;
+ basen = NULL;
}
if (!keep_original && (ob->flag & OB_DONE)) {
@@ -1545,11 +1546,11 @@ static int convert_exec(bContext *C, wmOperator *op)
if (!keep_original) {
if (mballConverted) {
- Base *base= scene->base.first, *tmpbase;
+ Base *base = scene->base.first, *tmpbase;
while (base) {
- ob= base->object;
- tmpbase= base;
- base= base->next;
+ ob = base->object;
+ tmpbase = base;
+ base = base->next;
if (ob->type == OB_MBALL) {
ED_base_object_free_and_unlink(bmain, scene, tmpbase);
@@ -1567,16 +1568,16 @@ static int convert_exec(bContext *C, wmOperator *op)
if (basact) {
/* active base was changed */
ED_base_object_activate(C, basact);
- BASACT= basact;
+ BASACT = basact;
}
else if (BASACT->object->flag & OB_DONE) {
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, BASACT->object);
- WM_event_add_notifier(C, NC_OBJECT|ND_DATA, BASACT->object);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, BASACT->object);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DATA, BASACT->object);
}
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, scene);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
return OPERATOR_FINISHED;
}
@@ -1595,7 +1596,7 @@ void OBJECT_OT_convert(wmOperatorType *ot)
ot->poll = convert_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "target", convert_target_items, OB_MESH, "Target", "Type of object to convert to");
@@ -1614,28 +1615,28 @@ void OBJECT_OT_convert(wmOperatorType *ot)
/* leaves selection of base/object unaltered */
static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base, int dupflag)
{
- Base *basen= NULL;
+ Base *basen = NULL;
Material ***matarar;
Object *ob, *obn;
ID *id;
int a, didit;
- ob= base->object;
+ ob = base->object;
if (ob->mode & OB_MODE_POSE) {
; /* nothing? */
}
else {
- obn= copy_object(ob);
- obn->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ obn = copy_object(ob);
+ obn->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
- basen= MEM_mallocN(sizeof(Base), "duplibase");
- *basen= *base;
- BLI_addhead(&scene->base, basen); /* addhead: prevent eternal loop */
- basen->object= obn;
+ basen = MEM_mallocN(sizeof(Base), "duplibase");
+ *basen = *base;
+ BLI_addhead(&scene->base, basen); /* addhead: prevent eternal loop */
+ basen->object = obn;
if (basen->flag & OB_FROMGROUP) {
Group *group;
- for (group= bmain->group.first; group; group= group->id.next) {
+ for (group = bmain->group.first; group; group = group->id.next) {
if (object_in_group(ob, group))
add_to_group(group, obn, scene, basen);
}
@@ -1647,11 +1648,11 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
if (dupflag & USER_DUP_MAT) {
- for (a=0; a<obn->totcol; a++) {
- id= (ID *)obn->mat[a];
+ for (a = 0; a < obn->totcol; a++) {
+ id = (ID *)obn->mat[a];
if (id) {
ID_NEW_US(obn->mat[a])
- else obn->mat[a]= copy_material(obn->mat[a]);
+ else obn->mat[a] = copy_material(obn->mat[a]);
id->us--;
if (dupflag & USER_DUP_ACT) {
@@ -1662,11 +1663,11 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
if (dupflag & USER_DUP_PSYS) {
ParticleSystem *psys;
- for (psys=obn->particlesystem.first; psys; psys=psys->next) {
- id= (ID*) psys->part;
+ for (psys = obn->particlesystem.first; psys; psys = psys->next) {
+ id = (ID *) psys->part;
if (id) {
ID_NEW_US(psys->part)
- else psys->part= psys_copy_settings(psys->part);
+ else psys->part = psys_copy_settings(psys->part);
if (dupflag & USER_DUP_ACT) {
BKE_copy_animdata_id_action(&psys->part->id);
@@ -1677,71 +1678,71 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
}
- id= obn->data;
- didit= 0;
+ id = obn->data;
+ didit = 0;
- switch(obn->type) {
+ switch (obn->type) {
case OB_MESH:
if (dupflag & USER_DUP_MESH) {
- ID_NEW_US2( obn->data )
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_mesh(obn->data);
+ obn->data = copy_mesh(obn->data);
if (obn->fluidsimSettings) {
obn->fluidsimSettings->orgMesh = (Mesh *)obn->data;
}
- didit= 1;
+ didit = 1;
}
id->us--;
}
break;
case OB_CURVE:
if (dupflag & USER_DUP_CURVE) {
- ID_NEW_US2(obn->data )
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_curve(obn->data);
- didit= 1;
+ obn->data = BKE_curve_copy(obn->data);
+ didit = 1;
}
id->us--;
}
break;
case OB_SURF:
if (dupflag & USER_DUP_SURF) {
- ID_NEW_US2( obn->data )
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_curve(obn->data);
- didit= 1;
+ obn->data = BKE_curve_copy(obn->data);
+ didit = 1;
}
id->us--;
}
break;
case OB_FONT:
if (dupflag & USER_DUP_FONT) {
- ID_NEW_US2( obn->data )
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_curve(obn->data);
- didit= 1;
+ obn->data = BKE_curve_copy(obn->data);
+ didit = 1;
}
id->us--;
}
break;
case OB_MBALL:
if (dupflag & USER_DUP_MBALL) {
- ID_NEW_US2(obn->data )
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_mball(obn->data);
- didit= 1;
+ obn->data = BKE_metaball_copy(obn->data);
+ didit = 1;
}
id->us--;
}
break;
case OB_LAMP:
if (dupflag & USER_DUP_LAMP) {
- ID_NEW_US2(obn->data )
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_lamp(obn->data);
- didit= 1;
+ obn->data = copy_lamp(obn->data);
+ didit = 1;
}
id->us--;
}
@@ -1751,44 +1752,44 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
obn->recalc |= OB_RECALC_DATA;
if (obn->pose) obn->pose->flag |= POSE_RECALC;
- if (dupflag & USER_DUP_ARM) {
- ID_NEW_US2(obn->data )
- else {
- obn->data= copy_armature(obn->data);
- armature_rebuild_pose(obn, obn->data);
- didit= 1;
- }
- id->us--;
+ if (dupflag & USER_DUP_ARM) {
+ ID_NEW_US2(obn->data)
+ else {
+ obn->data = copy_armature(obn->data);
+ armature_rebuild_pose(obn, obn->data);
+ didit = 1;
}
+ id->us--;
+ }
- break;
+ break;
case OB_LATTICE:
- if (dupflag!=0) {
- ID_NEW_US2(obn->data )
+ if (dupflag != 0) {
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_lattice(obn->data);
- didit= 1;
+ obn->data = copy_lattice(obn->data);
+ didit = 1;
}
id->us--;
}
break;
case OB_CAMERA:
- if (dupflag!=0) {
- ID_NEW_US2(obn->data )
+ if (dupflag != 0) {
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_camera(obn->data);
- didit= 1;
+ obn->data = copy_camera(obn->data);
+ didit = 1;
}
id->us--;
}
break;
case OB_SPEAKER:
- if (dupflag!=0) {
- ID_NEW_US2(obn->data )
+ if (dupflag != 0) {
+ ID_NEW_US2(obn->data)
else {
- obn->data= copy_speaker(obn->data);
- didit= 1;
+ obn->data = copy_speaker(obn->data);
+ didit = 1;
}
id->us--;
}
@@ -1805,13 +1806,13 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
BKE_copy_animdata_id_action((ID *)obn->data);
if (key) {
- BKE_copy_animdata_id_action((ID*)key);
+ BKE_copy_animdata_id_action((ID *)key);
}
/* Update the duplicated action in the action actuators */
for (act = obn->actuators.first; act; act = act->next) {
if (act->type == ACT_ACTION) {
- bActionActuator* actact = (bActionActuator*) act->data;
+ bActionActuator *actact = (bActionActuator *) act->data;
if (ob->adt && actact->act == ob->adt->action) {
actact->act = obn->adt->action;
}
@@ -1820,13 +1821,13 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
}
if (dupflag & USER_DUP_MAT) {
- matarar= give_matarar(obn);
+ matarar = give_matarar(obn);
if (matarar) {
- for (a=0; a<obn->totcol; a++) {
- id= (ID *)(*matarar)[a];
+ for (a = 0; a < obn->totcol; a++) {
+ id = (ID *)(*matarar)[a];
if (id) {
- ID_NEW_US( (*matarar)[a] )
- else (*matarar)[a]= copy_material((*matarar)[a]);
+ ID_NEW_US((*matarar)[a])
+ else (*matarar)[a] = copy_material((*matarar)[a]);
id->us--;
}
@@ -1847,14 +1848,14 @@ Base *ED_object_add_duplicate(Main *bmain, Scene *scene, Base *base, int dupflag
Object *ob;
clear_id_newpoins();
- clear_sca_new_poins(); /* sensor/contr/act */
+ clear_sca_new_poins(); /* sensor/contr/act */
- basen= object_add_duplicate_internal(bmain, scene, base, dupflag);
+ basen = object_add_duplicate_internal(bmain, scene, base, dupflag);
if (basen == NULL) {
return NULL;
}
- ob= basen->object;
+ ob = basen->object;
/* link own references to the newly duplicated data [#26816] */
object_relink(ob);
@@ -1871,16 +1872,16 @@ Base *ED_object_add_duplicate(Main *bmain, Scene *scene, Base *base, int dupflag
/* contextual operator dupli */
static int duplicate_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- int linked= RNA_boolean_get(op->ptr, "linked");
- int dupflag= (linked)? 0: U.dupflag;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ int linked = RNA_boolean_get(op->ptr, "linked");
+ int dupflag = (linked) ? 0 : U.dupflag;
clear_id_newpoins();
- clear_sca_new_poins(); /* sensor/contr/act */
+ clear_sca_new_poins(); /* sensor/contr/act */
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
- Base *basen= object_add_duplicate_internal(bmain, scene, base, dupflag);
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
+ Base *basen = object_add_duplicate_internal(bmain, scene, base, dupflag);
/* note that this is safe to do with this context iterator,
* the list is made in advance */
@@ -1891,7 +1892,7 @@ static int duplicate_exec(bContext *C, wmOperator *op)
}
/* new object becomes active */
- if (BASACT==base)
+ if (BASACT == base)
ED_base_object_activate(C, basen);
if (basen->object->data) {
@@ -1905,7 +1906,7 @@ static int duplicate_exec(bContext *C, wmOperator *op)
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
return OPERATOR_FINISHED;
}
@@ -1924,11 +1925,11 @@ void OBJECT_OT_duplicate(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* to give to transform */
RNA_def_boolean(ot->srna, "linked", 0, "Linked", "Duplicate object but not object data, linking to the original data");
- prop= RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
+ prop = RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
RNA_def_property_flag(prop, PROP_HIDDEN);
}
@@ -1937,36 +1938,36 @@ void OBJECT_OT_duplicate(wmOperatorType *ot)
static int add_named_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
Base *basen, *base;
Object *ob;
- int linked= RNA_boolean_get(op->ptr, "linked");
- int dupflag= (linked)? 0: U.dupflag;
- char name[MAX_ID_NAME-2];
+ int linked = RNA_boolean_get(op->ptr, "linked");
+ int dupflag = (linked) ? 0 : U.dupflag;
+ char name[MAX_ID_NAME - 2];
/* find object, create fake base */
RNA_string_get(op->ptr, "name", name);
- ob= (Object *)find_id("OB", name);
- if (ob==NULL)
+ ob = (Object *)find_id("OB", name);
+ if (ob == NULL)
return OPERATOR_CANCELLED;
- base= MEM_callocN(sizeof(Base), "duplibase");
- base->object= ob;
- base->flag= ob->flag;
+ base = MEM_callocN(sizeof(Base), "duplibase");
+ base->object = ob;
+ base->flag = ob->flag;
/* prepare dupli */
clear_id_newpoins();
- clear_sca_new_poins(); /* sensor/contr/act */
+ clear_sca_new_poins(); /* sensor/contr/act */
- basen= object_add_duplicate_internal(bmain, scene, base, dupflag);
+ basen = object_add_duplicate_internal(bmain, scene, base, dupflag);
if (basen == NULL) {
MEM_freeN(base);
return OPERATOR_CANCELLED;
}
- basen->lay= basen->object->lay= scene->lay;
+ basen->lay = basen->object->lay = scene->lay;
ED_object_location_from_view(C, basen->object->loc);
ED_base_object_activate(C, basen);
@@ -1978,7 +1979,7 @@ static int add_named_exec(bContext *C, wmOperator *op)
MEM_freeN(base);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
return OPERATOR_FINISHED;
}
@@ -1995,10 +1996,10 @@ void OBJECT_OT_add_named(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "linked", 0, "Linked", "Duplicate object but not object data, linking to the original data");
- RNA_def_string(ot->srna, "name", "Cube", MAX_ID_NAME-2, "Name", "Object name to add");
+ RNA_def_string(ot->srna, "name", "Cube", MAX_ID_NAME - 2, "Name", "Object name to add");
}
@@ -2006,7 +2007,7 @@ void OBJECT_OT_add_named(wmOperatorType *ot)
/**************************** Join *************************/
static int join_poll(bContext *C)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob = CTX_data_active_object(C);
if (!ob || ob->id.lib) return 0;
@@ -2019,8 +2020,8 @@ static int join_poll(bContext *C)
static int join_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= CTX_data_active_object(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = CTX_data_active_object(C);
if (scene->obedit) {
BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode");
@@ -2053,13 +2054,13 @@ void OBJECT_OT_join(wmOperatorType *ot)
ot->poll = join_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/**************************** Join as Shape Key*************************/
static int join_shapes_poll(bContext *C)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob = CTX_data_active_object(C);
if (!ob || ob->id.lib) return 0;
@@ -2072,8 +2073,8 @@ static int join_shapes_poll(bContext *C)
static int join_shapes_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= CTX_data_active_object(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = CTX_data_active_object(C);
if (scene->obedit) {
BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode");
@@ -2102,5 +2103,5 @@ void OBJECT_OT_join_shapes(wmOperatorType *ot)
ot->poll = join_shapes_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index 1f012c6f0be..9e8381a72c6 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -115,9 +115,9 @@ typedef void (*MPassKnownData)(DerivedMesh *lores_dm, DerivedMesh *hires_dm, con
const int face_index, const int lvl, const float st[2],
float tangmat[3][3], const int x, const int y);
-typedef void* (*MInitBakeData)(MultiresBakeRender *bkr, Image* ima);
-typedef void (*MApplyBakeData)(void *bake_data);
-typedef void (*MFreeBakeData)(void *bake_data);
+typedef void * (*MInitBakeData)(MultiresBakeRender *bkr, Image *ima);
+typedef void (*MApplyBakeData)(void *bake_data);
+typedef void (*MFreeBakeData)(void *bake_data);
typedef struct {
MVert *mvert;
@@ -157,25 +157,25 @@ typedef struct {
static void multiresbake_get_normal(const MResolvePixelData *data, float norm[], const int face_num, const int vert_index)
{
- unsigned int indices[]= {data->mface[face_num].v1, data->mface[face_num].v2,
- data->mface[face_num].v3, data->mface[face_num].v4};
- const int smoothnormal= (data->mface[face_num].flag & ME_SMOOTH);
+ unsigned int indices[] = {data->mface[face_num].v1, data->mface[face_num].v2,
+ data->mface[face_num].v3, data->mface[face_num].v4};
+ const int smoothnormal = (data->mface[face_num].flag & ME_SMOOTH);
if (!smoothnormal) { /* flat */
if (data->precomputed_normals) {
- copy_v3_v3(norm, &data->precomputed_normals[3*face_num]);
+ copy_v3_v3(norm, &data->precomputed_normals[3 * face_num]);
}
else {
float nor[3];
float *p0, *p1, *p2;
- const int iGetNrVerts= data->mface[face_num].v4!=0 ? 4 : 3;
+ const int iGetNrVerts = data->mface[face_num].v4 != 0 ? 4 : 3;
- p0= data->mvert[indices[0]].co;
- p1= data->mvert[indices[1]].co;
- p2= data->mvert[indices[2]].co;
+ p0 = data->mvert[indices[0]].co;
+ p1 = data->mvert[indices[1]].co;
+ p2 = data->mvert[indices[2]].co;
- if (iGetNrVerts==4) {
- float *p3= data->mvert[indices[3]].co;
+ if (iGetNrVerts == 4) {
+ float *p3 = data->mvert[indices[3]].co;
normal_quad_v3(nor, p0, p1, p2, p3);
}
else {
@@ -186,7 +186,7 @@ static void multiresbake_get_normal(const MResolvePixelData *data, float norm[],
}
}
else {
- short *no= data->mvert[indices[vert_index]].no;
+ short *no = data->mvert[indices[vert_index]].no;
normal_short_to_float_v3(norm, no);
normalize_v3(norm);
@@ -198,15 +198,15 @@ static void init_bake_rast(MBakeRast *bake_rast, const ImBuf *ibuf, const MResol
memset(bake_rast, 0, sizeof(MBakeRast));
bake_rast->texels = ibuf->userdata;
- bake_rast->w= ibuf->x;
- bake_rast->h= ibuf->y;
- bake_rast->data= data;
- bake_rast->flush_pixel= flush_pixel;
+ bake_rast->w = ibuf->x;
+ bake_rast->h = ibuf->y;
+ bake_rast->data = data;
+ bake_rast->flush_pixel = flush_pixel;
}
static void flush_pixel(const MResolvePixelData *data, const int x, const int y)
{
- float st[2]= {(x+0.5f)/data->w, (y+0.5f)/data->h};
+ float st[2] = {(x + 0.5f) / data->w, (y + 0.5f) / data->h};
float *st0, *st1, *st2;
float *tang0, *tang1, *tang2;
float no0[3], no1[3], no2[3];
@@ -214,37 +214,37 @@ static void flush_pixel(const MResolvePixelData *data, const int x, const int y)
float u, v, w, sign;
int r;
- const int i0= data->i0;
- const int i1= data->i1;
- const int i2= data->i2;
+ const int i0 = data->i0;
+ const int i1 = data->i1;
+ const int i2 = data->i2;
- st0= data->mtface[data->face_index].uv[i0];
- st1= data->mtface[data->face_index].uv[i1];
- st2= data->mtface[data->face_index].uv[i2];
+ st0 = data->mtface[data->face_index].uv[i0];
+ st1 = data->mtface[data->face_index].uv[i1];
+ st2 = data->mtface[data->face_index].uv[i2];
- tang0= data->pvtangent + data->face_index*16 + i0*4;
- tang1= data->pvtangent + data->face_index*16 + i1*4;
- tang2= data->pvtangent + data->face_index*16 + i2*4;
+ tang0 = data->pvtangent + data->face_index * 16 + i0 * 4;
+ tang1 = data->pvtangent + data->face_index * 16 + i1 * 4;
+ tang2 = data->pvtangent + data->face_index * 16 + i2 * 4;
- multiresbake_get_normal(data, no0, data->face_index, i0); /* can optimize these 3 into one call */
+ multiresbake_get_normal(data, no0, data->face_index, i0); /* can optimize these 3 into one call */
multiresbake_get_normal(data, no1, data->face_index, i1);
multiresbake_get_normal(data, no2, data->face_index, i2);
resolve_tri_uv(fUV, st, st0, st1, st2);
- u= fUV[0];
- v= fUV[1];
- w= 1-u-v;
+ u = fUV[0];
+ v = fUV[1];
+ w = 1 - u - v;
/* the sign is the same at all face vertices for any non degenerate face.
* Just in case we clamp the interpolated value though. */
- sign= (tang0[3]*u + tang1[3]*v + tang2[3]*w)<0 ? (-1.0f) : 1.0f;
+ sign = (tang0[3] * u + tang1[3] * v + tang2[3] * w) < 0 ? (-1.0f) : 1.0f;
/* this sequence of math is designed specifically as is with great care
* to be compatible with our shader. Please don't change without good reason. */
- for (r= 0; r<3; r++) {
- from_tang[0][r]= tang0[r]*u + tang1[r]*v + tang2[r]*w;
- from_tang[2][r]= no0[r]*u + no1[r]*v + no2[r]*w;
+ for (r = 0; r < 3; r++) {
+ from_tang[0][r] = tang0[r] * u + tang1[r] * v + tang2[r] * w;
+ from_tang[2][r] = no0[r] * u + no1[r] * v + no2[r] * w;
}
cross_v3_v3v3(from_tang[1], from_tang[2], from_tang[0]); /* B = sign * cross(N, T) */
@@ -258,13 +258,13 @@ static void flush_pixel(const MResolvePixelData *data, const int x, const int y)
static void set_rast_triangle(const MBakeRast *bake_rast, const int x, const int y)
{
- const int w= bake_rast->w;
- const int h= bake_rast->h;
+ const int w = bake_rast->w;
+ const int h = bake_rast->h;
- if (x>=0 && x<w && y>=0 && y<h) {
- if ((bake_rast->texels[y*w+x])==0) {
+ if (x >= 0 && x < w && y >= 0 && y < h) {
+ if ((bake_rast->texels[y * w + x]) == 0) {
flush_pixel(bake_rast->data, x, y);
- bake_rast->texels[y*w+x]= FILTER_MASK_USED;
+ bake_rast->texels[y * w + x] = FILTER_MASK_USED;
}
}
}
@@ -274,35 +274,35 @@ static void rasterize_half(const MBakeRast *bake_rast,
const float s0_l, const float t0_l, const float s1_l, const float t1_l,
const int y0_in, const int y1_in, const int is_mid_right)
{
- const int s_stable= fabsf(t1_s-t0_s)>FLT_EPSILON ? 1 : 0;
- const int l_stable= fabsf(t1_l-t0_l)>FLT_EPSILON ? 1 : 0;
- const int w= bake_rast->w;
- const int h= bake_rast->h;
+ const int s_stable = fabsf(t1_s - t0_s) > FLT_EPSILON ? 1 : 0;
+ const int l_stable = fabsf(t1_l - t0_l) > FLT_EPSILON ? 1 : 0;
+ const int w = bake_rast->w;
+ const int h = bake_rast->h;
int y, y0, y1;
- if (y1_in<=0 || y0_in>=h)
+ if (y1_in <= 0 || y0_in >= h)
return;
- y0= y0_in<0 ? 0 : y0_in;
- y1= y1_in>=h ? h : y1_in;
+ y0 = y0_in < 0 ? 0 : y0_in;
+ y1 = y1_in >= h ? h : y1_in;
- for (y= y0; y<y1; y++) {
+ for (y = y0; y < y1; y++) {
/*-b(x-x0) + a(y-y0) = 0 */
int iXl, iXr, x;
- float x_l= s_stable!=0 ? (s0_s + (((s1_s-s0_s)*(y-t0_s))/(t1_s-t0_s))) : s0_s;
- float x_r= l_stable!=0 ? (s0_l + (((s1_l-s0_l)*(y-t0_l))/(t1_l-t0_l))) : s0_l;
+ float x_l = s_stable != 0 ? (s0_s + (((s1_s - s0_s) * (y - t0_s)) / (t1_s - t0_s))) : s0_s;
+ float x_r = l_stable != 0 ? (s0_l + (((s1_l - s0_l) * (y - t0_l)) / (t1_l - t0_l))) : s0_l;
- if (is_mid_right!=0)
+ if (is_mid_right != 0)
SWAP(float, x_l, x_r);
- iXl= (int)ceilf(x_l);
- iXr= (int)ceilf(x_r);
+ iXl = (int)ceilf(x_l);
+ iXr = (int)ceilf(x_r);
- if (iXr>0 && iXl<w) {
- iXl= iXl<0?0:iXl;
- iXr= iXr>=w?w:iXr;
+ if (iXr > 0 && iXl < w) {
+ iXl = iXl < 0 ? 0 : iXl;
+ iXr = iXr >= w ? w : iXr;
- for (x= iXl; x<iXr; x++)
+ for (x = iXl; x < iXr; x++)
set_rast_triangle(bake_rast, x, y);
}
}
@@ -310,40 +310,40 @@ static void rasterize_half(const MBakeRast *bake_rast,
static void bake_rasterize(const MBakeRast *bake_rast, const float st0_in[2], const float st1_in[2], const float st2_in[2])
{
- const int w= bake_rast->w;
- const int h= bake_rast->h;
- float slo= st0_in[0]*w - 0.5f;
- float tlo= st0_in[1]*h - 0.5f;
- float smi= st1_in[0]*w - 0.5f;
- float tmi= st1_in[1]*h - 0.5f;
- float shi= st2_in[0]*w - 0.5f;
- float thi= st2_in[1]*h - 0.5f;
- int is_mid_right= 0, ylo, yhi, yhi_beg;
+ const int w = bake_rast->w;
+ const int h = bake_rast->h;
+ float slo = st0_in[0] * w - 0.5f;
+ float tlo = st0_in[1] * h - 0.5f;
+ float smi = st1_in[0] * w - 0.5f;
+ float tmi = st1_in[1] * h - 0.5f;
+ float shi = st2_in[0] * w - 0.5f;
+ float thi = st2_in[1] * h - 0.5f;
+ int is_mid_right = 0, ylo, yhi, yhi_beg;
/* skip degenerates */
- if ((slo==smi && tlo==tmi) || (slo==shi && tlo==thi) || (smi==shi && tmi==thi))
+ if ((slo == smi && tlo == tmi) || (slo == shi && tlo == thi) || (smi == shi && tmi == thi))
return;
/* sort by T */
- if (tlo>tmi && tlo>thi) {
+ if (tlo > tmi && tlo > thi) {
SWAP(float, shi, slo);
SWAP(float, thi, tlo);
}
- else if (tmi>thi) {
+ else if (tmi > thi) {
SWAP(float, shi, smi);
SWAP(float, thi, tmi);
}
- if (tlo>tmi) {
+ if (tlo > tmi) {
SWAP(float, slo, smi);
SWAP(float, tlo, tmi);
}
/* check if mid point is to the left or to the right of the lo-hi edge */
- is_mid_right= (-(shi-slo)*(tmi-thi) + (thi-tlo)*(smi-shi))>0 ? 1 : 0;
- ylo= (int) ceilf(tlo);
- yhi_beg= (int) ceilf(tmi);
- yhi= (int) ceilf(thi);
+ is_mid_right = (-(shi - slo) * (tmi - thi) + (thi - tlo) * (smi - shi)) > 0 ? 1 : 0;
+ ylo = (int) ceilf(tlo);
+ yhi_beg = (int) ceilf(tmi);
+ yhi = (int) ceilf(thi);
/*if (fTmi>ceilf(fTlo))*/
rasterize_half(bake_rast, slo, tlo, smi, tmi, slo, tlo, shi, thi, ylo, yhi_beg, is_mid_right);
@@ -360,69 +360,69 @@ static int multiresbake_test_break(MultiresBakeRender *bkr)
return G.afbreek;
}
-static void do_multires_bake(MultiresBakeRender *bkr, Image* ima, MPassKnownData passKnownData,
+static void do_multires_bake(MultiresBakeRender *bkr, Image *ima, MPassKnownData passKnownData,
MInitBakeData initBakeData, MApplyBakeData applyBakeData, MFreeBakeData freeBakeData)
{
- DerivedMesh *dm= bkr->lores_dm;
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
- const int lvl= bkr->lvl;
- const int tot_face= dm->getNumTessFaces(dm);
- MVert *mvert= dm->getVertArray(dm);
- MFace *mface= dm->getTessFaceArray(dm);
- MTFace *mtface= dm->getTessFaceDataArray(dm, CD_MTFACE);
- float *pvtangent= NULL;
+ DerivedMesh *dm = bkr->lores_dm;
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+ const int lvl = bkr->lvl;
+ const int tot_face = dm->getNumTessFaces(dm);
+ MVert *mvert = dm->getVertArray(dm);
+ MFace *mface = dm->getTessFaceArray(dm);
+ MTFace *mtface = dm->getTessFaceDataArray(dm, CD_MTFACE);
+ float *pvtangent = NULL;
if (CustomData_get_layer_index(&dm->faceData, CD_TANGENT) == -1)
DM_add_tangent_layer(dm);
- pvtangent= DM_get_tessface_data_layer(dm, CD_TANGENT);
+ pvtangent = DM_get_tessface_data_layer(dm, CD_TANGENT);
if (tot_face > 0) { /* sanity check */
- int f= 0;
+ int f = 0;
MBakeRast bake_rast;
- MResolvePixelData data={NULL};
-
- data.mface= mface;
- data.mvert= mvert;
- data.mtface= mtface;
- data.pvtangent= pvtangent;
- data.precomputed_normals= dm->getTessFaceDataArray(dm, CD_NORMAL); /* don't strictly need this */
- data.w= ibuf->x;
- data.h= ibuf->y;
- data.lores_dm= dm;
- data.hires_dm= bkr->hires_dm;
- data.lvl= lvl;
- data.pass_data= passKnownData;
+ MResolvePixelData data = {NULL};
+
+ data.mface = mface;
+ data.mvert = mvert;
+ data.mtface = mtface;
+ data.pvtangent = pvtangent;
+ data.precomputed_normals = dm->getTessFaceDataArray(dm, CD_NORMAL); /* don't strictly need this */
+ data.w = ibuf->x;
+ data.h = ibuf->y;
+ data.lores_dm = dm;
+ data.hires_dm = bkr->hires_dm;
+ data.lvl = lvl;
+ data.pass_data = passKnownData;
if (initBakeData)
- data.bake_data= initBakeData(bkr, ima);
+ data.bake_data = initBakeData(bkr, ima);
init_bake_rast(&bake_rast, ibuf, &data, flush_pixel);
- for (f= 0; f<tot_face; f++) {
- MTFace *mtfate= &mtface[f];
+ for (f = 0; f < tot_face; f++) {
+ MTFace *mtfate = &mtface[f];
int verts[3][2], nr_tris, t;
if (multiresbake_test_break(bkr))
break;
- if (mtfate->tpage!=ima)
+ if (mtfate->tpage != ima)
continue;
- data.face_index= f;
+ data.face_index = f;
/* might support other forms of diagonal splits later on such as
* split by shortest diagonal.*/
- verts[0][0]=0;
- verts[1][0]=1;
- verts[2][0]=2;
+ verts[0][0] = 0;
+ verts[1][0] = 1;
+ verts[2][0] = 2;
- verts[0][1]=0;
- verts[1][1]=2;
- verts[2][1]=3;
+ verts[0][1] = 0;
+ verts[1][1] = 2;
+ verts[2][1] = 3;
- nr_tris= mface[f].v4!=0 ? 2 : 1;
- for (t= 0; t<nr_tris; t++) {
+ nr_tris = mface[f].v4 != 0 ? 2 : 1;
+ for (t = 0; t < nr_tris; t++) {
data.i0 = verts[0][t];
data.i1 = verts[1][t];
data.i2 = verts[2][t];
@@ -433,10 +433,10 @@ static void do_multires_bake(MultiresBakeRender *bkr, Image* ima, MPassKnownData
bkr->baked_faces++;
if (bkr->do_update)
- *bkr->do_update= 1;
+ *bkr->do_update = 1;
if (bkr->progress)
- *bkr->progress= ((float)bkr->baked_objects + (float)bkr->baked_faces / tot_face) / bkr->tot_obj;
+ *bkr->progress = ((float)bkr->baked_objects + (float)bkr->baked_faces / tot_face) / bkr->tot_obj;
}
if (applyBakeData)
@@ -452,13 +452,13 @@ static void interp_bilinear_quad_data(float data[4][3], float u, float v, float
float vec[3];
copy_v3_v3(res, data[0]);
- mul_v3_fl(res, (1-u)*(1-v));
+ mul_v3_fl(res, (1 - u) * (1 - v));
copy_v3_v3(vec, data[1]);
- mul_v3_fl(vec, u*(1-v)); add_v3_v3(res, vec);
+ mul_v3_fl(vec, u * (1 - v)); add_v3_v3(res, vec);
copy_v3_v3(vec, data[2]);
- mul_v3_fl(vec, u*v); add_v3_v3(res, vec);
+ mul_v3_fl(vec, u * v); add_v3_v3(res, vec);
copy_v3_v3(vec, data[3]);
- mul_v3_fl(vec, (1-u)*v); add_v3_v3(res, vec);
+ mul_v3_fl(vec, (1 - u) * v); add_v3_v3(res, vec);
}
static void interp_barycentric_tri_data(float data[3][3], float u, float v, float res[3])
@@ -470,7 +470,7 @@ static void interp_barycentric_tri_data(float data[3][3], float u, float v, floa
copy_v3_v3(vec, data[1]);
mul_v3_fl(vec, v); add_v3_v3(res, vec);
copy_v3_v3(vec, data[2]);
- mul_v3_fl(vec, 1.0f-u-v); add_v3_v3(res, vec);
+ mul_v3_fl(vec, 1.0f - u - v); add_v3_v3(res, vec);
}
/* mode = 0: interpolate normals,
@@ -481,14 +481,14 @@ static void interp_bilinear_grid(DMGridData *grid, int grid_size, float crn_x, f
float u, v;
float data[4][3];
- x0= (int) crn_x;
- x1= x0>=(grid_size-1) ? (grid_size-1) : (x0+1);
+ x0 = (int) crn_x;
+ x1 = x0 >= (grid_size - 1) ? (grid_size - 1) : (x0 + 1);
- y0= (int) crn_y;
- y1= y0>=(grid_size-1) ? (grid_size-1) : (y0+1);
+ y0 = (int) crn_y;
+ y1 = y0 >= (grid_size - 1) ? (grid_size - 1) : (y0 + 1);
- u= crn_x-x0;
- v= crn_y-y0;
+ u = crn_x - x0;
+ v = crn_y - y0;
if (mode == 0) {
copy_v3_v3(data[0], grid[y0 * grid_size + x0].no);
@@ -516,30 +516,30 @@ static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int *orig
lodm->getTessFace(lodm, face_index, &mface);
- grid_size= hidm->getGridSize(hidm);
- grid_data= hidm->getGridData(hidm);
- grid_offset= hidm->getGridOffset(hidm);
+ grid_size = hidm->getGridSize(hidm);
+ grid_data = hidm->getGridData(hidm);
+ grid_offset = hidm->getGridOffset(hidm);
- face_side= (grid_size<<1)-1;
+ face_side = (grid_size << 1) - 1;
- if (lvl==0) {
- g_index= grid_offset[face_index];
- S= mdisp_rot_face_to_crn(mface.v4 ? 4 : 3, face_side, u*(face_side-1), v*(face_side-1), &crn_x, &crn_y);
+ if (lvl == 0) {
+ g_index = grid_offset[face_index];
+ S = mdisp_rot_face_to_crn(mface.v4 ? 4 : 3, face_side, u * (face_side - 1), v * (face_side - 1), &crn_x, &crn_y);
}
else {
- int side= (1 << (lvl-1)) + 1;
- int grid_index= origindex[face_index];
- int loc_offs= face_index % (1<<(2*lvl));
- int cell_index= loc_offs % ((side-1)*(side-1));
- int cell_side= grid_size / (side-1);
- int row= cell_index / (side-1);
- int col= cell_index % (side-1);
-
- S= face_index / (1<<(2*(lvl-1))) - grid_offset[grid_index];
- g_index= grid_offset[grid_index];
-
- crn_y= (row * cell_side) + u * cell_side;
- crn_x= (col * cell_side) + v * cell_side;
+ int side = (1 << (lvl - 1)) + 1;
+ int grid_index = origindex[face_index];
+ int loc_offs = face_index % (1 << (2 * lvl));
+ int cell_index = loc_offs % ((side - 1) * (side - 1));
+ int cell_side = grid_size / (side - 1);
+ int row = cell_index / (side - 1);
+ int col = cell_index % (side - 1);
+
+ S = face_index / (1 << (2 * (lvl - 1))) - grid_offset[grid_index];
+ g_index = grid_offset[grid_index];
+
+ crn_y = (row * cell_side) + u * cell_side;
+ crn_x = (col * cell_side) + v * cell_side;
}
CLAMP(crn_x, 0.0f, grid_size);
@@ -597,95 +597,95 @@ static void interp_barycentric_mface(DerivedMesh *dm, MFace *mface, const float
static void *init_heights_data(MultiresBakeRender *bkr, Image *ima)
{
MHeightBakeData *height_data;
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
- DerivedMesh *lodm= bkr->lores_dm;
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+ DerivedMesh *lodm = bkr->lores_dm;
- height_data= MEM_callocN(sizeof(MHeightBakeData), "MultiresBake heightData");
+ height_data = MEM_callocN(sizeof(MHeightBakeData), "MultiresBake heightData");
- height_data->ima= ima;
- height_data->heights= MEM_callocN(sizeof(float)*ibuf->x*ibuf->y, "MultiresBake heights");
- height_data->height_max= -FLT_MAX;
- height_data->height_min= FLT_MAX;
+ height_data->ima = ima;
+ height_data->heights = MEM_callocN(sizeof(float) * ibuf->x * ibuf->y, "MultiresBake heights");
+ height_data->height_max = -FLT_MAX;
+ height_data->height_min = FLT_MAX;
if (!bkr->use_lores_mesh) {
- SubsurfModifierData smd= {{NULL}};
- int ss_lvl= bkr->tot_lvl - bkr->lvl;
+ SubsurfModifierData smd = {{NULL}};
+ int ss_lvl = bkr->tot_lvl - bkr->lvl;
CLAMP(ss_lvl, 0, 6);
- smd.levels= smd.renderLevels= ss_lvl;
- smd.flags|= eSubsurfModifierFlag_SubsurfUv;
+ smd.levels = smd.renderLevels = ss_lvl;
+ smd.flags |= eSubsurfModifierFlag_SubsurfUv;
if (bkr->simple)
- smd.subdivType= ME_SIMPLE_SUBSURF;
+ smd.subdivType = ME_SIMPLE_SUBSURF;
- height_data->ssdm= subsurf_make_derived_from_derived(bkr->lores_dm, &smd, 0, NULL, 0, 0, 0);
+ height_data->ssdm = subsurf_make_derived_from_derived(bkr->lores_dm, &smd, 0, NULL, 0, 0, 0);
}
- height_data->origindex= lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
+ height_data->origindex = lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
- return (void*)height_data;
+ return (void *)height_data;
}
static void *init_normal_data(MultiresBakeRender *bkr, Image *UNUSED(ima))
{
MNormalBakeData *normal_data;
- DerivedMesh *lodm= bkr->lores_dm;
+ DerivedMesh *lodm = bkr->lores_dm;
- normal_data= MEM_callocN(sizeof(MNormalBakeData), "MultiresBake normalData");
+ normal_data = MEM_callocN(sizeof(MNormalBakeData), "MultiresBake normalData");
- normal_data->origindex= lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
+ normal_data->origindex = lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
- return (void*)normal_data;
+ return (void *)normal_data;
}
static void free_normal_data(void *bake_data)
{
- MNormalBakeData *normal_data= (MNormalBakeData*)bake_data;
+ MNormalBakeData *normal_data = (MNormalBakeData *)bake_data;
MEM_freeN(normal_data);
}
static void apply_heights_data(void *bake_data)
{
- MHeightBakeData *height_data= (MHeightBakeData*)bake_data;
- ImBuf *ibuf= BKE_image_get_ibuf(height_data->ima, NULL);
+ MHeightBakeData *height_data = (MHeightBakeData *)bake_data;
+ ImBuf *ibuf = BKE_image_get_ibuf(height_data->ima, NULL);
int x, y, i;
- float height, *heights= height_data->heights;
- float min= height_data->height_min, max= height_data->height_max;
+ float height, *heights = height_data->heights;
+ float min = height_data->height_min, max = height_data->height_max;
- for (x= 0; x<ibuf->x; x++) {
- for (y =0; y<ibuf->y; y++) {
- i= ibuf->x*y + x;
+ for (x = 0; x < ibuf->x; x++) {
+ for (y = 0; y < ibuf->y; y++) {
+ i = ibuf->x * y + x;
- if (((char*)ibuf->userdata)[i] != FILTER_MASK_USED)
+ if (((char *)ibuf->userdata)[i] != FILTER_MASK_USED)
continue;
if (ibuf->rect_float) {
- float *rrgbf= ibuf->rect_float + i*4;
+ float *rrgbf = ibuf->rect_float + i * 4;
- if (max-min > 1e-5f) height= (heights[i]-min)/(max-min);
- else height= 0;
+ if (max - min > 1e-5f) height = (heights[i] - min) / (max - min);
+ else height = 0;
- rrgbf[0]=rrgbf[1]=rrgbf[2]= height;
+ rrgbf[0] = rrgbf[1] = rrgbf[2] = height;
}
else {
- char *rrgb= (char*)ibuf->rect + i*4;
+ char *rrgb = (char *)ibuf->rect + i * 4;
- if (max-min > 1e-5f) height= (heights[i]-min)/(max-min);
- else height= 0;
+ if (max - min > 1e-5f) height = (heights[i] - min) / (max - min);
+ else height = 0;
- rrgb[0]=rrgb[1]=rrgb[2]= FTOCHAR(height);
+ rrgb[0] = rrgb[1] = rrgb[2] = FTOCHAR(height);
}
}
}
- ibuf->userflags= IB_RECT_INVALID;
+ ibuf->userflags = IB_RECT_INVALID;
}
static void free_heights_data(void *bake_data)
{
- MHeightBakeData *height_data= (MHeightBakeData*)bake_data;
+ MHeightBakeData *height_data = (MHeightBakeData *)bake_data;
if (height_data->ssdm)
height_data->ssdm->release(height_data->ssdm);
@@ -704,23 +704,23 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
const int face_index, const int lvl, const float st[2],
float UNUSED(tangmat[3][3]), const int x, const int y)
{
- MTFace *mtface= CustomData_get_layer(&lores_dm->faceData, CD_MTFACE);
+ MTFace *mtface = CustomData_get_layer(&lores_dm->faceData, CD_MTFACE);
MFace mface;
- Image *ima= mtface[face_index].tpage;
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
- MHeightBakeData *height_data= (MHeightBakeData*)bake_data;
+ Image *ima = mtface[face_index].tpage;
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+ MHeightBakeData *height_data = (MHeightBakeData *)bake_data;
float uv[2], *st0, *st1, *st2, *st3;
- int pixel= ibuf->x*y + x;
+ int pixel = ibuf->x * y + x;
float vec[3], p0[3], p1[3], n[3], len;
lores_dm->getTessFace(lores_dm, face_index, &mface);
- st0= mtface[face_index].uv[0];
- st1= mtface[face_index].uv[1];
- st2= mtface[face_index].uv[2];
+ st0 = mtface[face_index].uv[0];
+ st1 = mtface[face_index].uv[1];
+ st2 = mtface[face_index].uv[2];
if (mface.v4) {
- st3= mtface[face_index].uv[3];
+ st3 = mtface[face_index].uv[3];
resolve_quad_uv(uv, st, st0, st1, st2, st3);
}
else
@@ -748,21 +748,21 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
}
sub_v3_v3v3(vec, p1, p0);
- len= dot_v3v3(n, vec);
+ len = dot_v3v3(n, vec);
- height_data->heights[pixel]= len;
- if (len<height_data->height_min) height_data->height_min= len;
- if (len>height_data->height_max) height_data->height_max= len;
+ height_data->heights[pixel] = len;
+ if (len < height_data->height_min) height_data->height_min = len;
+ if (len > height_data->height_max) height_data->height_max = len;
if (ibuf->rect_float) {
- float *rrgbf= ibuf->rect_float + pixel*4;
- rrgbf[3]= 1.0f;
+ float *rrgbf = ibuf->rect_float + pixel * 4;
+ rrgbf[3] = 1.0f;
- ibuf->userflags= IB_RECT_INVALID;
+ ibuf->userflags = IB_RECT_INVALID;
}
else {
- char *rrgb= (char*)ibuf->rect + pixel*4;
- rrgb[3]= 255;
+ char *rrgb = (char *)ibuf->rect + pixel * 4;
+ rrgb[3] = 255;
}
}
@@ -775,23 +775,23 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
const int face_index, const int lvl, const float st[2],
float tangmat[3][3], const int x, const int y)
{
- MTFace *mtface= CustomData_get_layer(&lores_dm->faceData, CD_MTFACE);
+ MTFace *mtface = CustomData_get_layer(&lores_dm->faceData, CD_MTFACE);
MFace mface;
- Image *ima= mtface[face_index].tpage;
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
- MNormalBakeData *normal_data= (MNormalBakeData*)bake_data;
+ Image *ima = mtface[face_index].tpage;
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+ MNormalBakeData *normal_data = (MNormalBakeData *)bake_data;
float uv[2], *st0, *st1, *st2, *st3;
- int pixel= ibuf->x*y + x;
- float n[3], vec[3], tmp[3]= {0.5, 0.5, 0.5};
+ int pixel = ibuf->x * y + x;
+ float n[3], vec[3], tmp[3] = {0.5, 0.5, 0.5};
lores_dm->getTessFace(lores_dm, face_index, &mface);
- st0= mtface[face_index].uv[0];
- st1= mtface[face_index].uv[1];
- st2= mtface[face_index].uv[2];
+ st0 = mtface[face_index].uv[0];
+ st1 = mtface[face_index].uv[1];
+ st2 = mtface[face_index].uv[2];
if (mface.v4) {
- st3= mtface[face_index].uv[3];
+ st3 = mtface[face_index].uv[3];
resolve_quad_uv(uv, st, st0, st1, st2, st3);
}
else
@@ -808,61 +808,61 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
add_v3_v3(vec, tmp);
if (ibuf->rect_float) {
- float *rrgbf= ibuf->rect_float + pixel*4;
- rrgbf[0]= vec[0];
- rrgbf[1]= vec[1];
- rrgbf[2]= vec[2];
- rrgbf[3]= 1.0f;
+ float *rrgbf = ibuf->rect_float + pixel * 4;
+ rrgbf[0] = vec[0];
+ rrgbf[1] = vec[1];
+ rrgbf[2] = vec[2];
+ rrgbf[3] = 1.0f;
- ibuf->userflags= IB_RECT_INVALID;
+ ibuf->userflags = IB_RECT_INVALID;
}
else {
- unsigned char *rrgb= (unsigned char *)ibuf->rect + pixel*4;
+ unsigned char *rrgb = (unsigned char *)ibuf->rect + pixel * 4;
rgb_float_to_uchar(rrgb, vec);
- rrgb[3]= 255;
+ rrgb[3] = 255;
}
}
static void count_images(MultiresBakeRender *bkr)
{
int a, totface;
- DerivedMesh *dm= bkr->lores_dm;
- MTFace *mtface= CustomData_get_layer(&dm->faceData, CD_MTFACE);
+ DerivedMesh *dm = bkr->lores_dm;
+ MTFace *mtface = CustomData_get_layer(&dm->faceData, CD_MTFACE);
- bkr->image.first= bkr->image.last= NULL;
- bkr->tot_image= 0;
+ bkr->image.first = bkr->image.last = NULL;
+ bkr->tot_image = 0;
- totface= dm->getNumTessFaces(dm);
+ totface = dm->getNumTessFaces(dm);
- for (a= 0; a<totface; a++)
- mtface[a].tpage->id.flag&= ~LIB_DOIT;
+ for (a = 0; a < totface; a++)
+ mtface[a].tpage->id.flag &= ~LIB_DOIT;
- for (a= 0; a<totface; a++) {
- Image *ima= mtface[a].tpage;
- if ((ima->id.flag&LIB_DOIT)==0) {
- LinkData *data= BLI_genericNodeN(ima);
+ for (a = 0; a < totface; a++) {
+ Image *ima = mtface[a].tpage;
+ if ((ima->id.flag & LIB_DOIT) == 0) {
+ LinkData *data = BLI_genericNodeN(ima);
BLI_addtail(&bkr->image, data);
bkr->tot_image++;
- ima->id.flag|= LIB_DOIT;
+ ima->id.flag |= LIB_DOIT;
}
}
- for (a= 0; a<totface; a++)
- mtface[a].tpage->id.flag&= ~LIB_DOIT;
+ for (a = 0; a < totface; a++)
+ mtface[a].tpage->id.flag &= ~LIB_DOIT;
}
static void bake_images(MultiresBakeRender *bkr)
{
LinkData *link;
- for (link= bkr->image.first; link; link= link->next) {
- Image *ima= (Image*)link->data;
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+ for (link = bkr->image.first; link; link = link->next) {
+ Image *ima = (Image *)link->data;
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
- if (ibuf->x>0 && ibuf->y>0) {
- ibuf->userdata= MEM_callocN(ibuf->y*ibuf->x, "MultiresBake imbuf mask");
+ if (ibuf->x > 0 && ibuf->y > 0) {
+ ibuf->userdata = MEM_callocN(ibuf->y * ibuf->x, "MultiresBake imbuf mask");
- switch(bkr->mode) {
+ switch (bkr->mode) {
case RE_BAKE_NORMALS:
do_multires_bake(bkr, ima, apply_tangmat_callback, init_normal_data, NULL, free_normal_data);
break;
@@ -873,7 +873,7 @@ static void bake_images(MultiresBakeRender *bkr)
}
}
- ima->id.flag|= LIB_DOIT;
+ ima->id.flag |= LIB_DOIT;
}
}
@@ -881,28 +881,28 @@ static void finish_images(MultiresBakeRender *bkr)
{
LinkData *link;
- for (link= bkr->image.first; link; link= link->next) {
- Image *ima= (Image*)link->data;
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+ for (link = bkr->image.first; link; link = link->next) {
+ Image *ima = (Image *)link->data;
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
- if (ibuf->x<=0 || ibuf->y<=0)
+ if (ibuf->x <= 0 || ibuf->y <= 0)
continue;
RE_bake_ibuf_filter(ibuf, (char *)ibuf->userdata, bkr->bake_filter);
- ibuf->userflags|= IB_BITMAPDIRTY;
+ ibuf->userflags |= IB_BITMAPDIRTY;
if (ibuf->rect_float)
- ibuf->userflags|= IB_RECT_INVALID;
+ ibuf->userflags |= IB_RECT_INVALID;
if (ibuf->mipmap[0]) {
- ibuf->userflags|= IB_MIPMAP_INVALID;
+ ibuf->userflags |= IB_MIPMAP_INVALID;
imb_freemipmapImBuf(ibuf);
}
if (ibuf->userdata) {
MEM_freeN(ibuf->userdata);
- ibuf->userdata= NULL;
+ ibuf->userdata = NULL;
}
}
}
@@ -916,38 +916,38 @@ static void multiresbake_start(MultiresBakeRender *bkr)
static int multiresbake_check(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob;
Mesh *me;
MultiresModifierData *mmd;
- int ok= 1, a;
+ int ok = 1, a;
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
- ob= base->object;
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
+ ob = base->object;
if (ob->type != OB_MESH) {
BKE_report(op->reports, RPT_ERROR, "Basking of multires data only works with active object which is a mesh");
- ok= 0;
+ ok = 0;
break;
}
- me= (Mesh*)ob->data;
- mmd= get_multires_modifier(scene, ob, 0);
+ me = (Mesh *)ob->data;
+ mmd = get_multires_modifier(scene, ob, 0);
/* Multi-resolution should be and be last in the stack */
if (ok && mmd) {
ModifierData *md;
- ok= mmd->totlvl>0;
+ ok = mmd->totlvl > 0;
- for (md = (ModifierData*)mmd->modifier.next; md && ok; md = md->next) {
+ for (md = (ModifierData *)mmd->modifier.next; md && ok; md = md->next) {
if (modifier_isEnabled(scene, md, eModifierMode_Realtime)) {
- ok= 0;
+ ok = 0;
}
}
}
- else ok= 0;
+ else ok = 0;
if (!ok) {
BKE_report(op->reports, RPT_ERROR, "Multires data baking requires multi-resolution object");
@@ -958,7 +958,7 @@ static int multiresbake_check(bContext *C, wmOperator *op)
if (!me->mtpoly) {
BKE_report(op->reports, RPT_ERROR, "Mesh should be unwrapped before multires data baking");
- ok= 0;
+ ok = 0;
}
else {
a = me->totpoly;
@@ -968,22 +968,22 @@ static int multiresbake_check(bContext *C, wmOperator *op)
if (!ima) {
BKE_report(op->reports, RPT_ERROR, "You should have active texture to use multires baker");
- ok= 0;
+ ok = 0;
}
else {
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
if (!ibuf) {
BKE_report(op->reports, RPT_ERROR, "Baking should happend to image with image buffer");
- ok= 0;
+ ok = 0;
}
else {
- if (ibuf->rect==NULL && ibuf->rect_float==NULL)
- ok= 0;
+ if (ibuf->rect == NULL && ibuf->rect_float == NULL)
+ ok = 0;
- if (ibuf->rect_float && !(ibuf->channels==0 || ibuf->channels==4))
- ok= 0;
+ if (ibuf->rect_float && !(ibuf->channels == 0 || ibuf->channels == 4))
+ ok = 0;
if (!ok)
BKE_report(op->reports, RPT_ERROR, "Baking to unsupported image type");
@@ -1003,23 +1003,23 @@ static int multiresbake_check(bContext *C, wmOperator *op)
static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *lvl)
{
DerivedMesh *dm;
- MultiresModifierData *mmd= get_multires_modifier(scene, ob, 0);
- Mesh *me= (Mesh*)ob->data;
+ MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0);
+ Mesh *me = (Mesh *)ob->data;
- *lvl= mmd->lvl;
+ *lvl = mmd->lvl;
- if (*lvl==0) {
- DerivedMesh *tmp_dm= CDDM_from_mesh(me, ob);
- dm= CDDM_copy(tmp_dm);
+ if (*lvl == 0) {
+ DerivedMesh *tmp_dm = CDDM_from_mesh(me, ob);
+ dm = CDDM_copy(tmp_dm);
tmp_dm->release(tmp_dm);
}
else {
- MultiresModifierData tmp_mmd= *mmd;
- DerivedMesh *cddm= CDDM_from_mesh(me, ob);
+ MultiresModifierData tmp_mmd = *mmd;
+ DerivedMesh *cddm = CDDM_from_mesh(me, ob);
- tmp_mmd.lvl= *lvl;
- tmp_mmd.sculptlvl= *lvl;
- dm= multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0);
+ tmp_mmd.lvl = *lvl;
+ tmp_mmd.sculptlvl = *lvl;
+ dm = multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0);
cddm->release(cddm);
}
@@ -1028,18 +1028,18 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l
static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *lvl, int *simple)
{
- Mesh *me= (Mesh*)ob->data;
- MultiresModifierData *mmd= get_multires_modifier(scene, ob, 0);
- MultiresModifierData tmp_mmd= *mmd;
- DerivedMesh *cddm= CDDM_from_mesh(me, ob);
+ Mesh *me = (Mesh *)ob->data;
+ MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0);
+ MultiresModifierData tmp_mmd = *mmd;
+ DerivedMesh *cddm = CDDM_from_mesh(me, ob);
DerivedMesh *dm;
- *lvl= mmd->totlvl;
- *simple= mmd->simple;
+ *lvl = mmd->totlvl;
+ *simple = mmd->simple;
- tmp_mmd.lvl= mmd->totlvl;
- tmp_mmd.sculptlvl= mmd->totlvl;
- dm= multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0);
+ tmp_mmd.lvl = mmd->totlvl;
+ tmp_mmd.sculptlvl = mmd->totlvl;
+ dm = multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0);
cddm->release(cddm);
return dm;
@@ -1048,67 +1048,67 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l
static void clear_images(MTFace *mtface, int totface)
{
int a;
- const float vec_alpha[4]= {0.0f, 0.0f, 0.0f, 0.0f};
- const float vec_solid[4]= {0.0f, 0.0f, 0.0f, 1.0f};
+ const float vec_alpha[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ const float vec_solid[4] = {0.0f, 0.0f, 0.0f, 1.0f};
- for (a= 0; a<totface; a++)
- mtface[a].tpage->id.flag&= ~LIB_DOIT;
+ for (a = 0; a < totface; a++)
+ mtface[a].tpage->id.flag &= ~LIB_DOIT;
- for (a= 0; a<totface; a++) {
- Image *ima= mtface[a].tpage;
+ for (a = 0; a < totface; a++) {
+ Image *ima = mtface[a].tpage;
- if ((ima->id.flag&LIB_DOIT)==0) {
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+ if ((ima->id.flag & LIB_DOIT) == 0) {
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid);
- ima->id.flag|= LIB_DOIT;
+ ima->id.flag |= LIB_DOIT;
}
}
- for (a= 0; a<totface; a++)
- mtface[a].tpage->id.flag&= ~LIB_DOIT;
+ for (a = 0; a < totface; a++)
+ mtface[a].tpage->id.flag &= ~LIB_DOIT;
}
static int multiresbake_image_exec_locked(bContext *C, wmOperator *op)
{
Object *ob;
- Scene *scene= CTX_data_scene(C);
- int objects_baked= 0;
+ Scene *scene = CTX_data_scene(C);
+ int objects_baked = 0;
if (!multiresbake_check(C, op))
return OPERATOR_CANCELLED;
- if (scene->r.bake_flag&R_BAKE_CLEAR) { /* clear images */
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ if (scene->r.bake_flag & R_BAKE_CLEAR) { /* clear images */
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
Mesh *me;
- ob= base->object;
- me= (Mesh*)ob->data;
+ ob = base->object;
+ me = (Mesh *)ob->data;
clear_images(me->mtface, me->totface);
}
CTX_DATA_END;
}
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
- MultiresBakeRender bkr= {0};
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
+ MultiresBakeRender bkr = {0};
- ob= base->object;
+ ob = base->object;
multires_force_update(ob);
/* copy data stored in job descriptor */
- bkr.bake_filter= scene->r.bake_filter;
- bkr.mode= scene->r.bake_mode;
- bkr.use_lores_mesh= scene->r.bake_flag&R_BAKE_LORES_MESH;
+ bkr.bake_filter = scene->r.bake_filter;
+ bkr.mode = scene->r.bake_mode;
+ bkr.use_lores_mesh = scene->r.bake_flag & R_BAKE_LORES_MESH;
/* create low-resolution DM (to bake to) and hi-resolution DM (to bake from) */
- bkr.lores_dm= multiresbake_create_loresdm(scene, ob, &bkr.lvl);
+ bkr.lores_dm = multiresbake_create_loresdm(scene, ob, &bkr.lvl);
if (!bkr.lores_dm)
continue;
- bkr.hires_dm= multiresbake_create_hiresdm(scene, ob, &bkr.tot_lvl, &bkr.simple);
+ bkr.hires_dm = multiresbake_create_hiresdm(scene, ob, &bkr.tot_lvl, &bkr.simple);
multiresbake_start(&bkr);
@@ -1130,20 +1130,20 @@ static int multiresbake_image_exec_locked(bContext *C, wmOperator *op)
/* Multiresbake adopted for job-system executing */
static void init_multiresbake_job(bContext *C, MultiresBakeJob *bkj)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob;
/* backup scene settings, so their changing in UI would take no effect on baker */
- bkj->bake_filter= scene->r.bake_filter;
- bkj->mode= scene->r.bake_mode;
- bkj->use_lores_mesh= scene->r.bake_flag&R_BAKE_LORES_MESH;
- bkj->bake_clear= scene->r.bake_flag&R_BAKE_CLEAR;
+ bkj->bake_filter = scene->r.bake_filter;
+ bkj->mode = scene->r.bake_mode;
+ bkj->use_lores_mesh = scene->r.bake_flag & R_BAKE_LORES_MESH;
+ bkj->bake_clear = scene->r.bake_flag & R_BAKE_CLEAR;
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
MultiresBakerJobData *data;
DerivedMesh *lores_dm;
int lvl;
- ob= base->object;
+ ob = base->object;
multires_force_update(ob);
@@ -1151,7 +1151,7 @@ static void init_multiresbake_job(bContext *C, MultiresBakeJob *bkj)
if (!lores_dm)
continue;
- data= MEM_callocN(sizeof(MultiresBakerJobData), "multiresBaker derivedMesh_data");
+ data = MEM_callocN(sizeof(MultiresBakerJobData), "multiresBaker derivedMesh_data");
data->lores_dm = lores_dm;
data->lvl = lvl;
data->hires_dm = multiresbake_create_hiresdm(scene, ob, &data->tot_lvl, &data->simple);
@@ -1164,42 +1164,42 @@ static void init_multiresbake_job(bContext *C, MultiresBakeJob *bkj)
static void multiresbake_startjob(void *bkv, short *stop, short *do_update, float *progress)
{
MultiresBakerJobData *data;
- MultiresBakeJob *bkj= bkv;
- int baked_objects= 0, tot_obj;
+ MultiresBakeJob *bkj = bkv;
+ int baked_objects = 0, tot_obj;
- tot_obj= BLI_countlist(&bkj->data);
+ tot_obj = BLI_countlist(&bkj->data);
if (bkj->bake_clear) { /* clear images */
- for (data= bkj->data.first; data; data= data->next) {
- DerivedMesh *dm= data->lores_dm;
- MTFace *mtface= CustomData_get_layer(&dm->faceData, CD_MTFACE);
+ for (data = bkj->data.first; data; data = data->next) {
+ DerivedMesh *dm = data->lores_dm;
+ MTFace *mtface = CustomData_get_layer(&dm->faceData, CD_MTFACE);
clear_images(mtface, dm->getNumTessFaces(dm));
}
}
- for (data= bkj->data.first; data; data= data->next) {
- MultiresBakeRender bkr= {0};
+ for (data = bkj->data.first; data; data = data->next) {
+ MultiresBakeRender bkr = {0};
/* copy data stored in job descriptor */
- bkr.bake_filter= bkj->bake_filter;
- bkr.mode= bkj->mode;
- bkr.use_lores_mesh= bkj->use_lores_mesh;
+ bkr.bake_filter = bkj->bake_filter;
+ bkr.mode = bkj->mode;
+ bkr.use_lores_mesh = bkj->use_lores_mesh;
/* create low-resolution DM (to bake to) and hi-resolution DM (to bake from) */
- bkr.lores_dm= data->lores_dm;
- bkr.hires_dm= data->hires_dm;
- bkr.tot_lvl= data->tot_lvl;
- bkr.lvl= data->lvl;
- bkr.simple= data->simple;
+ bkr.lores_dm = data->lores_dm;
+ bkr.hires_dm = data->hires_dm;
+ bkr.tot_lvl = data->tot_lvl;
+ bkr.lvl = data->lvl;
+ bkr.simple = data->simple;
/* needed for proper progress bar */
- bkr.tot_obj= tot_obj;
- bkr.baked_objects= baked_objects;
+ bkr.tot_obj = tot_obj;
+ bkr.baked_objects = baked_objects;
- bkr.stop= stop;
- bkr.do_update= do_update;
- bkr.progress= progress;
+ bkr.stop = stop;
+ bkr.do_update = do_update;
+ bkr.progress = progress;
multiresbake_start(&bkr);
@@ -1211,16 +1211,16 @@ static void multiresbake_startjob(void *bkv, short *stop, short *do_update, floa
static void multiresbake_freejob(void *bkv)
{
- MultiresBakeJob *bkj= bkv;
+ MultiresBakeJob *bkj = bkv;
MultiresBakerJobData *data, *next;
- data= bkj->data.first;
+ data = bkj->data.first;
while (data) {
- next= data->next;
+ next = data->next;
data->lores_dm->release(data->lores_dm);
data->hires_dm->release(data->hires_dm);
MEM_freeN(data);
- data= next;
+ data = next;
}
MEM_freeN(bkj);
@@ -1228,14 +1228,14 @@ static void multiresbake_freejob(void *bkv)
static int multiresbake_image_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
MultiresBakeJob *bkr;
wmJob *steve;
if (!multiresbake_check(C, op))
return OPERATOR_CANCELLED;
- bkr= MEM_callocN(sizeof(MultiresBakeJob), "MultiresBakeJob data");
+ bkr = MEM_callocN(sizeof(MultiresBakeJob), "MultiresBakeJob data");
init_multiresbake_job(C, bkr);
if (!bkr->data.first) {
@@ -1244,12 +1244,12 @@ static int multiresbake_image_exec(bContext *C, wmOperator *op)
}
/* setup job */
- steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Multires Bake", WM_JOB_EXCL_RENDER|WM_JOB_PRIORITY|WM_JOB_PROGRESS);
+ steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Multires Bake", WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS);
WM_jobs_customdata(steve, bkr, multiresbake_freejob);
WM_jobs_timer(steve, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
WM_jobs_callbacks(steve, multiresbake_startjob, NULL, NULL, NULL);
- G.afbreek= 0;
+ G.afbreek = 0;
WM_jobs_start(CTX_wm_manager(C), steve);
WM_cursor_wait(0);
@@ -1294,12 +1294,12 @@ typedef struct BakeRender {
/* use by exec and invoke */
static int test_bake_internal(bContext *C, ReportList *reports)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
- if ((scene->r.bake_flag & R_BAKE_TO_ACTIVE) && CTX_data_active_object(C)==NULL) {
+ if ((scene->r.bake_flag & R_BAKE_TO_ACTIVE) && CTX_data_active_object(C) == NULL) {
BKE_report(reports, RPT_ERROR, "No active object");
}
- else if (scene->r.bake_mode==RE_BAKE_AO && scene->world==NULL) {
+ else if (scene->r.bake_mode == RE_BAKE_AO && scene->world == NULL) {
BKE_report(reports, RPT_ERROR, "No world set up");
}
else {
@@ -1311,23 +1311,23 @@ static int test_bake_internal(bContext *C, ReportList *reports)
static void init_bake_internal(BakeRender *bkr, bContext *C)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
/* get editmode results */
ED_object_exit_editmode(C, 0); /* 0 = does not exit editmode */
- bkr->sa= BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_IMAGE, 10); /* can be NULL */
- bkr->main= CTX_data_main(C);
- bkr->scene= scene;
- bkr->actob= (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT : NULL;
- bkr->re= RE_NewRender("_Bake View_");
+ bkr->sa = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_IMAGE, 10); /* can be NULL */
+ bkr->main = CTX_data_main(C);
+ bkr->scene = scene;
+ bkr->actob = (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT : NULL;
+ bkr->re = RE_NewRender("_Bake View_");
- if (scene->r.bake_mode==RE_BAKE_AO) {
+ if (scene->r.bake_mode == RE_BAKE_AO) {
/* If raytracing or AO is disabled, switch it on temporarily for baking. */
bkr->prev_wo_amb_occ = (scene->world->mode & WO_AMB_OCC) != 0;
scene->world->mode |= WO_AMB_OCC;
}
- if (scene->r.bake_mode==RE_BAKE_AO || bkr->actob) {
+ if (scene->r.bake_mode == RE_BAKE_AO || bkr->actob) {
bkr->prev_r_raytrace = (scene->r.mode & R_RAYTRACE) != 0;
scene->r.mode |= R_RAYTRACE;
}
@@ -1338,20 +1338,20 @@ static void finish_bake_internal(BakeRender *bkr)
RE_Database_Free(bkr->re);
/* restore raytrace and AO */
- if (bkr->scene->r.bake_mode==RE_BAKE_AO)
+ if (bkr->scene->r.bake_mode == RE_BAKE_AO)
if (bkr->prev_wo_amb_occ == 0)
bkr->scene->world->mode &= ~WO_AMB_OCC;
- if (bkr->scene->r.bake_mode==RE_BAKE_AO || bkr->actob)
+ if (bkr->scene->r.bake_mode == RE_BAKE_AO || bkr->actob)
if (bkr->prev_r_raytrace == 0)
bkr->scene->r.mode &= ~R_RAYTRACE;
- if (bkr->result==BAKE_RESULT_OK) {
+ if (bkr->result == BAKE_RESULT_OK) {
Image *ima;
/* force OpenGL reload and mipmap recalc */
- for (ima= G.main->image.first; ima; ima= ima->id.next) {
- if (ima->ok==IMA_OK_LOADED) {
- ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+ for (ima = G.main->image.first; ima; ima = ima->id.next) {
+ if (ima->ok == IMA_OK_LOADED) {
+ ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
if (ibuf) {
if (ibuf->userflags & IB_BITMAPDIRTY) {
GPU_free_image(ima);
@@ -1361,7 +1361,7 @@ static void finish_bake_internal(BakeRender *bkr)
/* freed when baking is done, but if its canceled we need to free here */
if (ibuf->userdata) {
MEM_freeN(ibuf->userdata);
- ibuf->userdata= NULL;
+ ibuf->userdata = NULL;
}
}
}
@@ -1371,52 +1371,52 @@ static void finish_bake_internal(BakeRender *bkr)
static void *do_bake_render(void *bake_v)
{
- BakeRender *bkr= bake_v;
+ BakeRender *bkr = bake_v;
- bkr->result= RE_bake_shade_all_selected(bkr->re, bkr->scene->r.bake_mode, bkr->actob, NULL, bkr->progress);
- bkr->ready= 1;
+ bkr->result = RE_bake_shade_all_selected(bkr->re, bkr->scene->r.bake_mode, bkr->actob, NULL, bkr->progress);
+ bkr->ready = 1;
return NULL;
}
static void bake_startjob(void *bkv, short *stop, short *do_update, float *progress)
{
- BakeRender *bkr= bkv;
- Scene *scene= bkr->scene;
- Main *bmain= bkr->main;
+ BakeRender *bkr = bkv;
+ Scene *scene = bkr->scene;
+ Main *bmain = bkr->main;
- bkr->stop= stop;
- bkr->do_update= do_update;
- bkr->progress= progress;
+ bkr->stop = stop;
+ bkr->do_update = do_update;
+ bkr->progress = progress;
RE_test_break_cb(bkr->re, NULL, thread_break);
- G.afbreek= 0; /* blender_test_break uses this global */
+ G.afbreek = 0; /* blender_test_break uses this global */
RE_Database_Baking(bkr->re, bmain, scene, scene->lay, scene->r.bake_mode, bkr->actob);
/* baking itself is threaded, cannot use test_break in threads. we also update optional imagewindow */
- bkr->result= RE_bake_shade_all_selected(bkr->re, scene->r.bake_mode, bkr->actob, bkr->do_update, bkr->progress);
+ bkr->result = RE_bake_shade_all_selected(bkr->re, scene->r.bake_mode, bkr->actob, bkr->do_update, bkr->progress);
}
static void bake_update(void *bkv)
{
- BakeRender *bkr= bkv;
+ BakeRender *bkr = bkv;
- if (bkr->sa && bkr->sa->spacetype==SPACE_IMAGE) { /* in case the user changed while baking */
- SpaceImage *sima= bkr->sa->spacedata.first;
+ if (bkr->sa && bkr->sa->spacetype == SPACE_IMAGE) { /* in case the user changed while baking */
+ SpaceImage *sima = bkr->sa->spacedata.first;
if (sima)
- sima->image= RE_bake_shade_get_image();
+ sima->image = RE_bake_shade_get_image();
}
}
static void bake_freejob(void *bkv)
{
- BakeRender *bkr= bkv;
+ BakeRender *bkr = bkv;
finish_bake_internal(bkr);
- if (bkr->result==BAKE_RESULT_NO_OBJECTS)
+ if (bkr->result == BAKE_RESULT_NO_OBJECTS)
BKE_report(bkr->reports, RPT_ERROR, "No objects or images found to bake to");
- else if (bkr->result==BAKE_RESULT_FEEDBACK_LOOP)
+ else if (bkr->result == BAKE_RESULT_FEEDBACK_LOOP)
BKE_report(bkr->reports, RPT_WARNING, "Feedback loop detected");
MEM_freeN(bkr);
@@ -1427,8 +1427,8 @@ static void bake_freejob(void *bkv)
static int objects_bake_render_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
/* no running blender, remove handler and pass through */
- if (0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
- return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
+ if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
+ return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
/* running render */
switch (event->type) {
@@ -1441,7 +1441,7 @@ static int objects_bake_render_modal(bContext *C, wmOperator *UNUSED(op), wmEven
static int is_multires_bake(Scene *scene)
{
- if ( ELEM(scene->r.bake_mode, RE_BAKE_NORMALS, RE_BAKE_DISPLACEMENT))
+ if (ELEM(scene->r.bake_mode, RE_BAKE_NORMALS, RE_BAKE_DISPLACEMENT))
return scene->r.bake_flag & R_BAKE_MULTIRES;
return 0;
@@ -1449,34 +1449,34 @@ static int is_multires_bake(Scene *scene)
static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(_event))
{
- Scene *scene= CTX_data_scene(C);
- int result= OPERATOR_CANCELLED;
+ Scene *scene = CTX_data_scene(C);
+ int result = OPERATOR_CANCELLED;
if (is_multires_bake(scene)) {
- result= multiresbake_image_exec(C, op);
+ result = multiresbake_image_exec(C, op);
}
else {
/* only one render job at a time */
if (WM_jobs_test(CTX_wm_manager(C), scene))
return OPERATOR_CANCELLED;
- if (test_bake_internal(C, op->reports)==0) {
+ if (test_bake_internal(C, op->reports) == 0) {
return OPERATOR_CANCELLED;
}
else {
- BakeRender *bkr= MEM_callocN(sizeof(BakeRender), "render bake");
+ BakeRender *bkr = MEM_callocN(sizeof(BakeRender), "render bake");
wmJob *steve;
init_bake_internal(bkr, C);
- bkr->reports= op->reports;
+ bkr->reports = op->reports;
/* setup job */
- steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Texture Bake", WM_JOB_EXCL_RENDER|WM_JOB_PRIORITY|WM_JOB_PROGRESS);
+ steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Texture Bake", WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS);
WM_jobs_customdata(steve, bkr, bake_freejob);
WM_jobs_timer(steve, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
WM_jobs_callbacks(steve, bake_startjob, NULL, bake_update, NULL);
- G.afbreek= 0;
+ G.afbreek = 0;
G.rendering = 1;
WM_jobs_start(CTX_wm_manager(C), steve);
@@ -1487,10 +1487,10 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
WM_event_add_modal_handler(C, op);
}
- result= OPERATOR_RUNNING_MODAL;
+ result = OPERATOR_RUNNING_MODAL;
}
- WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, scene);
return result;
}
@@ -1498,35 +1498,35 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
static int bake_image_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- int result= OPERATOR_CANCELLED;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ int result = OPERATOR_CANCELLED;
if (is_multires_bake(scene)) {
- result= multiresbake_image_exec_locked(C, op);
+ result = multiresbake_image_exec_locked(C, op);
}
else {
- if (test_bake_internal(C, op->reports)==0) {
+ if (test_bake_internal(C, op->reports) == 0) {
return OPERATOR_CANCELLED;
}
else {
ListBase threads;
- BakeRender bkr= {NULL};
+ BakeRender bkr = {NULL};
init_bake_internal(&bkr, C);
- bkr.reports= op->reports;
+ bkr.reports = op->reports;
RE_test_break_cb(bkr.re, NULL, thread_break);
- G.afbreek= 0; /* blender_test_break uses this global */
+ G.afbreek = 0; /* blender_test_break uses this global */
- RE_Database_Baking(bkr.re, bmain, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE)? OBACT: NULL);
+ RE_Database_Baking(bkr.re, bmain, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT : NULL);
/* baking itself is threaded, cannot use test_break in threads */
BLI_init_threads(&threads, do_bake_render, 1);
- bkr.ready= 0;
+ bkr.ready = 0;
BLI_insert_thread(&threads, &bkr);
- while (bkr.ready==0) {
+ while (bkr.ready == 0) {
PIL_sleep_ms(50);
if (bkr.ready)
break;
@@ -1537,18 +1537,18 @@ static int bake_image_exec(bContext *C, wmOperator *op)
}
BLI_end_threads(&threads);
- if (bkr.result==BAKE_RESULT_NO_OBJECTS)
+ if (bkr.result == BAKE_RESULT_NO_OBJECTS)
BKE_report(op->reports, RPT_ERROR, "No valid images found to bake to");
- else if (bkr.result==BAKE_RESULT_FEEDBACK_LOOP)
+ else if (bkr.result == BAKE_RESULT_FEEDBACK_LOOP)
BKE_report(op->reports, RPT_ERROR, "Feedback loop detected");
finish_bake_internal(&bkr);
- result= OPERATOR_FINISHED;
+ result = OPERATOR_FINISHED;
}
}
- WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, scene);
return result;
}
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index ec3567454df..a865b1d015d 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -81,7 +81,7 @@
/* -------------- Get Active Constraint Data ---------------------- */
/* if object in posemode, active bone constraints, else object constraints */
-ListBase *get_active_constraints (Object *ob)
+ListBase *get_active_constraints(Object *ob)
{
if (ob == NULL)
return NULL;
@@ -100,10 +100,10 @@ ListBase *get_active_constraints (Object *ob)
}
/* Find the list that a given constraint belongs to, and/or also get the posechannel this is from (if applicable) */
-ListBase *get_constraint_lb (Object *ob, bConstraint *con, bPoseChannel **pchan_r)
+ListBase *get_constraint_lb(Object *ob, bConstraint *con, bPoseChannel **pchan_r)
{
if (pchan_r)
- *pchan_r= NULL;
+ *pchan_r = NULL;
if (ELEM(NULL, ob, con))
return NULL;
@@ -120,11 +120,11 @@ ListBase *get_constraint_lb (Object *ob, bConstraint *con, bPoseChannel **pchan_
/* try each bone in order
* NOTE: it's not possible to directly look up the active bone yet, so this will have to do
*/
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
if ((BLI_findindex(&pchan->constraints, con) != -1)) {
if (pchan_r)
- *pchan_r= pchan;
+ *pchan_r = pchan;
return &pchan->constraints;
}
@@ -136,7 +136,7 @@ ListBase *get_constraint_lb (Object *ob, bConstraint *con, bPoseChannel **pchan_
}
/* single constraint */
-bConstraint *get_active_constraint (Object *ob)
+bConstraint *get_active_constraint(Object *ob)
{
return constraints_get_active(get_active_constraints(ob));
}
@@ -146,25 +146,25 @@ bConstraint *get_active_constraint (Object *ob)
/* ------------- PyConstraints ------------------ */
/* this callback sets the text-file to be used for selected menu item */
-static void validate_pyconstraint_cb (void *arg1, void *arg2)
+static void validate_pyconstraint_cb(void *arg1, void *arg2)
{
bPythonConstraint *data = arg1;
- Text *text= NULL;
+ Text *text = NULL;
int index = *((int *)arg2);
int i;
/* exception for no script */
if (index) {
/* innovative use of a for...loop to search */
- for (text=G.main->text.first, i=1; text && index!=i; i++, text=text->id.next);
+ for (text = G.main->text.first, i = 1; text && index != i; i++, text = text->id.next) ;
}
data->text = text;
}
/* this returns a string for the list of usable pyconstraint script names */
-static char *buildmenu_pyconstraints (Text *con_text, int *pyconindex)
+static char *buildmenu_pyconstraints(Text *con_text, int *pyconindex)
{
- DynStr *pupds= BLI_dynstr_new();
+ DynStr *pupds = BLI_dynstr_new();
Text *text;
char *str;
char buf[64];
@@ -176,16 +176,16 @@ static char *buildmenu_pyconstraints (Text *con_text, int *pyconindex)
/* init active-index first */
if (con_text == NULL)
- *pyconindex= 0;
+ *pyconindex = 0;
/* loop through markers, adding them */
- for (text=G.main->text.first, i=1; text; i++, text=text->id.next) {
+ for (text = G.main->text.first, i = 1; text; i++, text = text->id.next) {
/* this is important to ensure that right script is shown as active */
if (text == con_text) *pyconindex = i;
/* only include valid pyconstraint scripts */
if (BPY_is_pyconstraint(text)) {
- BLI_dynstr_append(pupds, text->id.name+2);
+ BLI_dynstr_append(pupds, text->id.name + 2);
sprintf(buf, "%%x%d", i);
BLI_dynstr_append(pupds, buf);
@@ -196,7 +196,7 @@ static char *buildmenu_pyconstraints (Text *con_text, int *pyconindex)
}
/* convert to normal MEM_malloc'd string */
- str= BLI_dynstr_get_cstring(pupds);
+ str = BLI_dynstr_get_cstring(pupds);
BLI_dynstr_free(pupds);
return str;
@@ -205,14 +205,14 @@ static char *buildmenu_pyconstraints (Text *con_text, int *pyconindex)
#if 0 // UNUSED, until pyconstraints are added back.
/* this callback gets called when the 'refresh' button of a pyconstraint gets pressed */
-static void update_pyconstraint_cb (void *arg1, void *arg2)
+static void update_pyconstraint_cb(void *arg1, void *arg2)
{
#ifndef WITH_PYTHON
(void)arg1; /* unused */
(void)arg2; /* unused */
#else
- Object *owner= (Object *)arg1;
- bConstraint *con= (bConstraint *)arg2;
+ Object *owner = (Object *)arg1;
+ bConstraint *con = (bConstraint *)arg2;
if (owner && con)
BPY_pyconstraint_update(owner, con);
#endif
@@ -220,30 +220,30 @@ static void update_pyconstraint_cb (void *arg1, void *arg2)
#endif // UNUSED
/* helper function for add_constriant - sets the last target for the active constraint */
-static void set_constraint_nth_target (bConstraint *con, Object *target, const char subtarget[], int index)
+static void set_constraint_nth_target(bConstraint *con, Object *target, const char subtarget[], int index)
{
- bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
+ bConstraintTypeInfo *cti = constraint_get_typeinfo(con);
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
int num_targets, i;
if (cti && cti->get_constraint_targets) {
cti->get_constraint_targets(con, &targets);
- num_targets= BLI_countlist(&targets);
+ num_targets = BLI_countlist(&targets);
if (index < 0) {
if (abs(index) < num_targets)
- index= num_targets - abs(index);
+ index = num_targets - abs(index);
else
- index= num_targets - 1;
+ index = num_targets - 1;
}
else if (index >= num_targets) {
- index= num_targets - 1;
+ index = num_targets - 1;
}
- for (ct=targets.first, i=0; ct; ct= ct->next, i++) {
+ for (ct = targets.first, i = 0; ct; ct = ct->next, i++) {
if (i == index) {
- ct->tar= target;
+ ct->tar = target;
BLI_strncpy(ct->subtarget, subtarget, sizeof(ct->subtarget));
break;
}
@@ -259,13 +259,13 @@ static void set_constraint_nth_target (bConstraint *con, Object *target, const c
/* checks validity of object pointers, and NULLs,
* if Bone doesnt exist it sets the CONSTRAINT_DISABLE flag.
*/
-static void test_constraints (Object *owner, bPoseChannel *pchan)
+static void test_constraints(Object *owner, bPoseChannel *pchan)
{
bConstraint *curcon;
- ListBase *conlist= NULL;
+ ListBase *conlist = NULL;
int type;
- if (owner==NULL) return;
+ if (owner == NULL) return;
/* Check parents */
if (pchan) {
@@ -293,8 +293,8 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
/* Check all constraints - is constraint valid? */
if (conlist) {
- for (curcon = conlist->first; curcon; curcon=curcon->next) {
- bConstraintTypeInfo *cti= constraint_get_typeinfo(curcon);
+ for (curcon = conlist->first; curcon; curcon = curcon->next) {
+ bConstraintTypeInfo *cti = constraint_get_typeinfo(curcon);
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
@@ -339,7 +339,7 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
bPivotConstraint *data = curcon->data;
/* target doesn't have to exist, but if it is non-null, it must exist! */
- if (data->tar && exist_object(data->tar)==0) {
+ if (data->tar && exist_object(data->tar) == 0) {
data->tar = NULL;
curcon->flag |= CONSTRAINT_DISABLE;
}
@@ -363,26 +363,26 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
bFollowPathConstraint *data = curcon->data;
/* don't allow track/up axes to be the same */
- if (data->upflag==data->trackflag)
+ if (data->upflag == data->trackflag)
curcon->flag |= CONSTRAINT_DISABLE;
- if (data->upflag+3==data->trackflag)
+ if (data->upflag + 3 == data->trackflag)
curcon->flag |= CONSTRAINT_DISABLE;
}
else if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
bTrackToConstraint *data = curcon->data;
/* don't allow track/up axes to be the same */
- if (data->reserved2==data->reserved1)
+ if (data->reserved2 == data->reserved1)
curcon->flag |= CONSTRAINT_DISABLE;
- if (data->reserved2+3==data->reserved1)
+ if (data->reserved2 + 3 == data->reserved1)
curcon->flag |= CONSTRAINT_DISABLE;
}
else if (curcon->type == CONSTRAINT_TYPE_LOCKTRACK) {
bLockTrackConstraint *data = curcon->data;
- if (data->lockflag==data->trackflag)
+ if (data->lockflag == data->trackflag)
curcon->flag |= CONSTRAINT_DISABLE;
- if (data->lockflag+3==data->trackflag)
+ if (data->lockflag + 3 == data->trackflag)
curcon->flag |= CONSTRAINT_DISABLE;
}
else if (curcon->type == CONSTRAINT_TYPE_SPLINEIK) {
@@ -391,7 +391,7 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
/* if the number of points does not match the amount required by the chain length,
* free the points array and request a rebind...
*/
- if ((data->points == NULL) || (data->numpoints != data->chainlen+1)) {
+ if ((data->points == NULL) || (data->numpoints != data->chainlen + 1)) {
/* free the points array */
if (data->points) {
MEM_freeN(data->points);
@@ -405,15 +405,15 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
else if (curcon->type == CONSTRAINT_TYPE_FOLLOWTRACK) {
bFollowTrackConstraint *data = curcon->data;
- if ((data->flag&CAMERASOLVER_ACTIVECLIP)==0) {
+ if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0) {
if (data->clip != NULL && data->track[0]) {
- MovieTracking *tracking= &data->clip->tracking;
+ MovieTracking *tracking = &data->clip->tracking;
MovieTrackingObject *tracking_object;
if (data->object[0])
- tracking_object= BKE_tracking_named_object(tracking, data->object);
+ tracking_object = BKE_tracking_named_object(tracking, data->object);
else
- tracking_object= BKE_tracking_get_camera_object(tracking);
+ tracking_object = BKE_tracking_get_camera_object(tracking);
if (!tracking_object) {
curcon->flag |= CONSTRAINT_DISABLE;
@@ -429,13 +429,13 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
else if (curcon->type == CONSTRAINT_TYPE_CAMERASOLVER) {
bCameraSolverConstraint *data = curcon->data;
- if ((data->flag&CAMERASOLVER_ACTIVECLIP)==0 && data->clip == NULL)
+ if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && data->clip == NULL)
curcon->flag |= CONSTRAINT_DISABLE;
}
else if (curcon->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
bObjectSolverConstraint *data = curcon->data;
- if ((data->flag&CAMERASOLVER_ACTIVECLIP)==0 && data->clip == NULL)
+ if ((data->flag & CAMERASOLVER_ACTIVECLIP) == 0 && data->clip == NULL)
curcon->flag |= CONSTRAINT_DISABLE;
}
@@ -444,7 +444,7 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
cti->get_constraint_targets(curcon, &targets);
/* disable and clear constraints targets that are incorrect */
- for (ct= targets.first; ct; ct= ct->next) {
+ for (ct = targets.first; ct; ct = ct->next) {
/* general validity checks (for those constraints that need this) */
if (exist_object(ct->tar) == 0) {
/* object doesn't exist, but constraint requires target */
@@ -475,11 +475,11 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
if (ELEM3(curcon->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO, CONSTRAINT_TYPE_SPLINEIK)) {
if (ct->tar) {
if (ct->tar->type != OB_CURVE) {
- ct->tar= NULL;
+ ct->tar = NULL;
curcon->flag |= CONSTRAINT_DISABLE;
}
else {
- Curve *cu= ct->tar->data;
+ Curve *cu = ct->tar->data;
/* auto-set 'Path' setting on curve so this works */
cu->flag |= CU_PATH;
@@ -496,15 +496,15 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
}
}
-void object_test_constraints (Object *owner)
+void object_test_constraints(Object *owner)
{
if (owner->constraints.first)
test_constraints(owner, NULL);
- if (owner->type==OB_ARMATURE && owner->pose) {
+ if (owner->type == OB_ARMATURE && owner->pose) {
bPoseChannel *pchan;
- for (pchan= owner->pose->chanbase.first; pchan; pchan= pchan->next) {
+ for (pchan = owner->pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->constraints.first)
test_constraints(owner, pchan);
}
@@ -514,8 +514,8 @@ void object_test_constraints (Object *owner)
/************************ generic functions for operators using constraint names and data context *********************/
-#define EDIT_CONSTRAINT_OWNER_OBJECT 0
-#define EDIT_CONSTRAINT_OWNER_BONE 1
+#define EDIT_CONSTRAINT_OWNER_OBJECT 0
+#define EDIT_CONSTRAINT_OWNER_BONE 1
static EnumPropertyItem constraint_owner_items[] = {
{EDIT_CONSTRAINT_OWNER_OBJECT, "OBJECT", 0, "Object", "Edit a constraint on the active object"},
@@ -525,11 +525,11 @@ static EnumPropertyItem constraint_owner_items[] = {
static int edit_constraint_poll_generic(bContext *C, StructRNA *rna_type)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "constraint", rna_type);
- Object *ob= (ptr.id.data) ? ptr.id.data : ED_object_active_context(C);
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", rna_type);
+ Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C);
if (!ob || ob->id.lib) return 0;
- if (ptr.id.data && ((ID*)ptr.id.data)->lib) return 0;
+ if (ptr.id.data && ((ID *)ptr.id.data)->lib) return 0;
return 1;
}
@@ -547,8 +547,8 @@ static void edit_constraint_properties(wmOperatorType *ot)
static int edit_constraint_invoke_properties(bContext *C, wmOperator *op)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint);
- Object *ob= (ptr.id.data)?ptr.id.data:ED_object_active_context(C);
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint);
+ Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C);
bConstraint *con;
ListBase *list;
@@ -577,7 +577,7 @@ static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int
char constraint_name[MAX_NAME];
int owner = RNA_enum_get(op->ptr, "owner");
bConstraint *con;
- ListBase *list=NULL;
+ ListBase *list = NULL;
RNA_string_get(op->ptr, "constraint", constraint_name);
@@ -585,7 +585,7 @@ static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int
list = &ob->constraints;
}
else if (owner == EDIT_CONSTRAINT_OWNER_BONE) {
- bPoseChannel *pchan= get_active_posechannel(ob);
+ bPoseChannel *pchan = get_active_posechannel(ob);
if (pchan)
list = &pchan->constraints;
else {
@@ -615,11 +615,11 @@ static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int
/* ---------- Distance-Dependent Constraints ---------- */
/* StretchTo, Limit Distance */
-static int stretchto_reset_exec (bContext *C, wmOperator *op)
+static int stretchto_reset_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_STRETCHTO);
- bStretchToConstraint *data= (con) ? (bStretchToConstraint *)con->data : NULL;
+ bStretchToConstraint *data = (con) ? (bStretchToConstraint *)con->data : NULL;
/* despite 3 layers of checks, we may still not be able to find a constraint */
if (data == NULL)
@@ -629,7 +629,7 @@ static int stretchto_reset_exec (bContext *C, wmOperator *op)
data->orglength = 0.0f;
ED_object_constraint_update(ob);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, NULL);
return OPERATOR_FINISHED;
}
@@ -641,7 +641,7 @@ static int stretchto_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
return OPERATOR_CANCELLED;
}
-void CONSTRAINT_OT_stretchto_reset (wmOperatorType *ot)
+void CONSTRAINT_OT_stretchto_reset(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Reset Original Length";
@@ -653,16 +653,16 @@ void CONSTRAINT_OT_stretchto_reset (wmOperatorType *ot)
ot->poll = edit_constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_constraint_properties(ot);
}
-static int limitdistance_reset_exec (bContext *C, wmOperator *op)
+static int limitdistance_reset_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_DISTLIMIT);
- bDistLimitConstraint *data= (con) ? (bDistLimitConstraint *)con->data : NULL;
+ bDistLimitConstraint *data = (con) ? (bDistLimitConstraint *)con->data : NULL;
/* despite 3 layers of checks, we may still not be able to find a constraint */
if (data == NULL)
@@ -672,7 +672,7 @@ static int limitdistance_reset_exec (bContext *C, wmOperator *op)
data->dist = 0.0f;
ED_object_constraint_update(ob);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, NULL);
return OPERATOR_FINISHED;
}
@@ -684,7 +684,7 @@ static int limitdistance_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
return OPERATOR_CANCELLED;
}
-void CONSTRAINT_OT_limitdistance_reset (wmOperatorType *ot)
+void CONSTRAINT_OT_limitdistance_reset(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Reset Distance";
@@ -696,16 +696,16 @@ void CONSTRAINT_OT_limitdistance_reset (wmOperatorType *ot)
ot->poll = edit_constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_constraint_properties(ot);
}
/* ------------- Child-Of Constraint ------------------ */
-static void child_get_inverse_matrix (Scene *scene, Object *ob, bConstraint *con, float invmat[4][4])
+static void child_get_inverse_matrix(Scene *scene, Object *ob, bConstraint *con, float invmat[4][4])
{
bConstraint *lastcon = NULL;
- bPoseChannel *pchan= NULL;
+ bPoseChannel *pchan = NULL;
/* nullify inverse matrix first */
unit_m4(invmat);
@@ -713,13 +713,13 @@ static void child_get_inverse_matrix (Scene *scene, Object *ob, bConstraint *con
/* try to find a pose channel - assume that this is the constraint owner */
// TODO: get from context instead?
if (ob && ob->pose)
- pchan= get_active_posechannel(ob);
+ pchan = get_active_posechannel(ob);
/* calculate/set inverse matrix:
- * We just calculate all transform-stack eval up to but not including this constraint.
- * This is because inverse should just inverse correct for just the constraint's influence
- * when it gets applied; that is, at the time of application, we don't know anything about
- * what follows.
+ * We just calculate all transform-stack eval up to but not including this constraint.
+ * This is because inverse should just inverse correct for just the constraint's influence
+ * when it gets applied; that is, at the time of application, we don't know anything about
+ * what follows.
*/
if (pchan) {
float imat[4][4], tmat[4][4];
@@ -781,23 +781,23 @@ static void child_get_inverse_matrix (Scene *scene, Object *ob, bConstraint *con
}
/* ChildOf Constraint - set inverse callback */
-static int childof_set_inverse_exec (bContext *C, wmOperator *op)
+static int childof_set_inverse_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
- bChildOfConstraint *data= (con) ? (bChildOfConstraint *)con->data : NULL;
+ bChildOfConstraint *data = (con) ? (bChildOfConstraint *)con->data : NULL;
/* despite 3 layers of checks, we may still not be able to find a constraint */
if (data == NULL) {
- printf("DEBUG: Child-Of Set Inverse - object = '%s'\n", (ob)? ob->id.name+2 : "<None>");
+ printf("DEBUG: Child-Of Set Inverse - object = '%s'\n", (ob) ? ob->id.name + 2 : "<None>");
BKE_report(op->reports, RPT_ERROR, "Couldn't find constraint data for Child-Of Set Inverse");
return OPERATOR_CANCELLED;
}
child_get_inverse_matrix(scene, ob, con, data->invmat);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
return OPERATOR_FINISHED;
}
@@ -810,7 +810,7 @@ static int childof_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
return OPERATOR_CANCELLED;
}
-void CONSTRAINT_OT_childof_set_inverse (wmOperatorType *ot)
+void CONSTRAINT_OT_childof_set_inverse(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Inverse";
@@ -822,18 +822,18 @@ void CONSTRAINT_OT_childof_set_inverse (wmOperatorType *ot)
ot->poll = edit_constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_constraint_properties(ot);
}
/* ChildOf Constraint - clear inverse callback */
-static int childof_clear_inverse_exec (bContext *C, wmOperator *op)
+static int childof_clear_inverse_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
- bChildOfConstraint *data= (con) ? (bChildOfConstraint *)con->data : NULL;
+ bChildOfConstraint *data = (con) ? (bChildOfConstraint *)con->data : NULL;
- if (data==NULL) {
+ if (data == NULL) {
BKE_report(op->reports, RPT_ERROR, "Childof constraint not found");
return OPERATOR_CANCELLED;
}
@@ -841,7 +841,7 @@ static int childof_clear_inverse_exec (bContext *C, wmOperator *op)
/* simply clear the matrix */
unit_m4(data->invmat);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
return OPERATOR_FINISHED;
}
@@ -854,7 +854,7 @@ static int childof_clear_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UN
return OPERATOR_CANCELLED;
}
-void CONSTRAINT_OT_childof_clear_inverse (wmOperatorType *ot)
+void CONSTRAINT_OT_childof_clear_inverse(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear Inverse";
@@ -866,29 +866,29 @@ void CONSTRAINT_OT_childof_clear_inverse (wmOperatorType *ot)
ot->poll = edit_constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_constraint_properties(ot);
}
/* ------------- Object Solver Constraint ------------------ */
-static int objectsolver_set_inverse_exec (bContext *C, wmOperator *op)
+static int objectsolver_set_inverse_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_OBJECTSOLVER);
- bObjectSolverConstraint *data= (con) ? (bObjectSolverConstraint *)con->data : NULL;
+ bObjectSolverConstraint *data = (con) ? (bObjectSolverConstraint *)con->data : NULL;
/* despite 3 layers of checks, we may still not be able to find a constraint */
if (data == NULL) {
- printf("DEBUG: Child-Of Set Inverse - object = '%s'\n", (ob)? ob->id.name+2 : "<None>");
+ printf("DEBUG: Child-Of Set Inverse - object = '%s'\n", (ob) ? ob->id.name + 2 : "<None>");
BKE_report(op->reports, RPT_ERROR, "Couldn't find constraint data for Child-Of Set Inverse");
return OPERATOR_CANCELLED;
}
child_get_inverse_matrix(scene, ob, con, data->invmat);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
return OPERATOR_FINISHED;
}
@@ -901,7 +901,7 @@ static int objectsolver_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent
return OPERATOR_CANCELLED;
}
-void CONSTRAINT_OT_objectsolver_set_inverse (wmOperatorType *ot)
+void CONSTRAINT_OT_objectsolver_set_inverse(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Inverse";
@@ -913,17 +913,17 @@ void CONSTRAINT_OT_objectsolver_set_inverse (wmOperatorType *ot)
ot->poll = edit_constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_constraint_properties(ot);
}
-static int objectsolver_clear_inverse_exec (bContext *C, wmOperator *op)
+static int objectsolver_clear_inverse_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_OBJECTSOLVER);
- bObjectSolverConstraint *data= (con) ? (bObjectSolverConstraint *)con->data : NULL;
+ bObjectSolverConstraint *data = (con) ? (bObjectSolverConstraint *)con->data : NULL;
- if (data==NULL) {
+ if (data == NULL) {
BKE_report(op->reports, RPT_ERROR, "Childof constraint not found");
return OPERATOR_CANCELLED;
}
@@ -931,7 +931,7 @@ static int objectsolver_clear_inverse_exec (bContext *C, wmOperator *op)
/* simply clear the matrix */
unit_m4(data->invmat);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
return OPERATOR_FINISHED;
}
@@ -944,7 +944,7 @@ static int objectsolver_clear_inverse_invoke(bContext *C, wmOperator *op, wmEven
return OPERATOR_CANCELLED;
}
-void CONSTRAINT_OT_objectsolver_clear_inverse (wmOperatorType *ot)
+void CONSTRAINT_OT_objectsolver_clear_inverse(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear Inverse";
@@ -956,7 +956,7 @@ void CONSTRAINT_OT_objectsolver_clear_inverse (wmOperatorType *ot)
ot->poll = edit_constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_constraint_properties(ot);
}
@@ -981,7 +981,7 @@ void ED_object_constraint_update(Object *ob)
object_test_constraints(ob);
- if (ob->type==OB_ARMATURE) DAG_id_tag_update(&ob->id, OB_RECALC_DATA|OB_RECALC_OB);
+ if (ob->type == OB_ARMATURE) DAG_id_tag_update(&ob->id, OB_RECALC_DATA | OB_RECALC_OB);
else DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
@@ -989,23 +989,23 @@ void ED_object_constraint_dependency_update(Main *bmain, Scene *scene, Object *o
{
ED_object_constraint_update(ob);
- if (ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels
+ if (ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels
DAG_scene_sort(bmain, scene);
}
static int constraint_poll(bContext *C)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint);
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint);
return (ptr.id.data && ptr.data);
}
-static int constraint_delete_exec (bContext *C, wmOperator *UNUSED(op))
+static int constraint_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint);
- Object *ob= ptr.id.data;
- bConstraint *con= ptr.data;
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint);
+ Object *ob = ptr.id.data;
+ bConstraint *con = ptr.data;
ListBase *lb = get_constraint_lb(ob, con, NULL);
- const short is_ik= ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
+ const short is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
/* free the constraint */
if (remove_constraint(lb, con)) {
@@ -1020,7 +1020,7 @@ static int constraint_delete_exec (bContext *C, wmOperator *UNUSED(op))
}
/* notifiers */
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_REMOVED, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, ob);
return OPERATOR_FINISHED;
}
@@ -1030,7 +1030,7 @@ static int constraint_delete_exec (bContext *C, wmOperator *UNUSED(op))
}
}
-void CONSTRAINT_OT_delete (wmOperatorType *ot)
+void CONSTRAINT_OT_delete(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Constraint";
@@ -1042,23 +1042,23 @@ void CONSTRAINT_OT_delete (wmOperatorType *ot)
ot->poll = constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-static int constraint_move_down_exec (bContext *C, wmOperator *op)
+static int constraint_move_down_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, 0);
if (con && con->next) {
- ListBase *conlist= get_constraint_lb(ob, con, NULL);
- bConstraint *nextCon= con->next;
+ ListBase *conlist = get_constraint_lb(ob, con, NULL);
+ bConstraint *nextCon = con->next;
/* insert the nominated constraint after the one that used to be after it */
BLI_remlink(conlist, con);
BLI_insertlinkafter(conlist, nextCon, con);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
return OPERATOR_FINISHED;
}
@@ -1075,7 +1075,7 @@ static int constraint_move_down_invoke(bContext *C, wmOperator *op, wmEvent *UNU
}
-void CONSTRAINT_OT_move_down (wmOperatorType *ot)
+void CONSTRAINT_OT_move_down(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Move Constraint Down";
@@ -1088,25 +1088,25 @@ void CONSTRAINT_OT_move_down (wmOperatorType *ot)
ot->poll = edit_constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_constraint_properties(ot);
}
-static int constraint_move_up_exec (bContext *C, wmOperator *op)
+static int constraint_move_up_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, 0);
if (con && con->prev) {
- ListBase *conlist= get_constraint_lb(ob, con, NULL);
- bConstraint *prevCon= con->prev;
+ ListBase *conlist = get_constraint_lb(ob, con, NULL);
+ bConstraint *prevCon = con->prev;
/* insert the nominated constraint before the one that used to be before it */
BLI_remlink(conlist, con);
BLI_insertlinkbefore(conlist, prevCon, con);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
return OPERATOR_FINISHED;
}
@@ -1122,7 +1122,7 @@ static int constraint_move_up_invoke(bContext *C, wmOperator *op, wmEvent *UNUSE
return OPERATOR_CANCELLED;
}
-void CONSTRAINT_OT_move_up (wmOperatorType *ot)
+void CONSTRAINT_OT_move_up(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Move Constraint Up";
@@ -1135,7 +1135,7 @@ void CONSTRAINT_OT_move_up (wmOperatorType *ot)
ot->poll = edit_constraint_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_constraint_properties(ot);
}
@@ -1145,26 +1145,25 @@ void CONSTRAINT_OT_move_up (wmOperatorType *ot)
static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Object *ob= object_pose_armature_get(CTX_data_active_object(C));
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = object_pose_armature_get(CTX_data_active_object(C));
/* free constraints for all selected bones */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
free_constraints(&pchan->constraints);
- pchan->constflag &= ~(PCHAN_HAS_IK|PCHAN_HAS_SPLINEIK|PCHAN_HAS_CONST);
+ pchan->constflag &= ~(PCHAN_HAS_IK | PCHAN_HAS_SPLINEIK | PCHAN_HAS_CONST);
}
CTX_DATA_END;
/* force depsgraph to get recalculated since relationships removed */
- DAG_scene_sort(bmain, scene); /* sort order of objects */
+ DAG_scene_sort(bmain, scene); /* sort order of objects */
/* note, calling BIK_clear_data() isn't needed here */
/* do updates */
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
return OPERATOR_FINISHED;
}
@@ -1184,22 +1183,21 @@ void POSE_OT_constraints_clear(wmOperatorType *ot)
static int object_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
/* do freeing */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
free_constraints(&ob->constraints);
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
CTX_DATA_END;
/* force depsgraph to get recalculated since relationships removed */
- DAG_scene_sort(bmain, scene); /* sort order of objects */
+ DAG_scene_sort(bmain, scene); /* sort order of objects */
/* do updates */
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, NULL);
return OPERATOR_FINISHED;
}
@@ -1220,7 +1218,7 @@ void OBJECT_OT_constraints_clear(wmOperatorType *ot)
static int pose_constraint_copy_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
bPoseChannel *pchan = CTX_data_active_pose_bone(C);
@@ -1231,8 +1229,7 @@ static int pose_constraint_copy_exec(bContext *C, wmOperator *op)
}
/* copy all constraints from active posebone to all selected posebones */
- CTX_DATA_BEGIN(C, bPoseChannel*, chan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, chan, selected_pose_bones) {
/* if we're not handling the object we're copying from, copy all constraints over */
if (pchan != chan) {
copy_constraints(&chan->constraints, &pchan->constraints, TRUE);
@@ -1243,9 +1240,9 @@ static int pose_constraint_copy_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
/* force depsgraph to get recalculated since new relationships added */
- DAG_scene_sort(bmain, scene); /* sort order of objects/bones */
+ DAG_scene_sort(bmain, scene); /* sort order of objects/bones */
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, NULL);
return OPERATOR_FINISHED;
}
@@ -1262,18 +1259,17 @@ void POSE_OT_constraints_copy(wmOperatorType *ot)
ot->poll = ED_operator_posemode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Object *obact = ED_object_active_context(C);
/* copy all constraints from active object to all selected objects */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
/* if we're not handling the object we're copying from, copy all constraints over */
if (obact != ob) {
copy_constraints(&ob->constraints, &obact->constraints, TRUE);
@@ -1283,10 +1279,10 @@ static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op))
CTX_DATA_END;
/* force depsgraph to get recalculated since new relationships added */
- DAG_scene_sort(bmain, scene); /* sort order of objects */
+ DAG_scene_sort(bmain, scene); /* sort order of objects */
/* notifiers for updates */
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_ADDED, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_ADDED, NULL);
return OPERATOR_FINISHED;
}
@@ -1303,7 +1299,7 @@ void OBJECT_OT_constraints_copy(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/************************ add constraint operators *********************/
@@ -1311,25 +1307,25 @@ void OBJECT_OT_constraints_copy(wmOperatorType *ot)
/* get the Object and/or PoseChannel to use as target */
static short get_new_constraint_target(bContext *C, int con_type, Object **tar_ob, bPoseChannel **tar_pchan, short add)
{
- Object *obact= ED_object_active_context(C);
- bPoseChannel *pchanact= get_active_posechannel(obact);
- short only_curve= 0, only_mesh= 0, only_ob= 0;
- short found= 0;
+ Object *obact = ED_object_active_context(C);
+ bPoseChannel *pchanact = get_active_posechannel(obact);
+ short only_curve = 0, only_mesh = 0, only_ob = 0;
+ short found = 0;
/* clear tar_ob and tar_pchan fields before use
* - assume for now that both always exist...
*/
- *tar_ob= NULL;
- *tar_pchan= NULL;
+ *tar_ob = NULL;
+ *tar_pchan = NULL;
/* check if constraint type doesn't requires a target
* - if so, no need to get any targets
*/
switch (con_type) {
/* no-target constraints --------------------------- */
- /* null constraint - shouldn't even be added! */
+ /* null constraint - shouldn't even be added! */
case CONSTRAINT_TYPE_NULL:
- /* limit constraints - no targets needed */
+ /* limit constraints - no targets needed */
case CONSTRAINT_TYPE_LOCLIMIT:
case CONSTRAINT_TYPE_ROTLIMIT:
case CONSTRAINT_TYPE_SIZELIMIT:
@@ -1338,38 +1334,37 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o
/* restricted target-type constraints -------------- */
/* NOTE: for these, we cannot try to add a target object if no valid ones are found, since that doesn't work */
- /* curve-based constraints - set the only_curve and only_ob flags */
+ /* curve-based constraints - set the only_curve and only_ob flags */
case CONSTRAINT_TYPE_CLAMPTO:
case CONSTRAINT_TYPE_FOLLOWPATH:
case CONSTRAINT_TYPE_SPLINEIK:
- only_curve= 1;
- only_ob= 1;
- add= 0;
+ only_curve = 1;
+ only_ob = 1;
+ add = 0;
break;
- /* mesh only? */
+ /* mesh only? */
case CONSTRAINT_TYPE_SHRINKWRAP:
- only_mesh= 1;
- only_ob= 1;
- add= 0;
+ only_mesh = 1;
+ only_ob = 1;
+ add = 0;
break;
- /* object only - add here is ok? */
+ /* object only - add here is ok? */
case CONSTRAINT_TYPE_RIGIDBODYJOINT:
- only_ob= 1;
+ only_ob = 1;
break;
}
/* if the active Object is Armature, and we can search for bones, do so... */
if ((obact->type == OB_ARMATURE) && (only_ob == 0)) {
/* search in list of selected Pose-Channels for target */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
/* just use the first one that we encounter, as long as it is not the active one */
if (pchan != pchanact) {
- *tar_ob= obact;
- *tar_pchan= pchan;
- found= 1;
+ *tar_ob = obact;
+ *tar_pchan = pchan;
+ found = 1;
break;
}
@@ -1380,23 +1375,22 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o
/* if not yet found, try selected Objects... */
if (found == 0) {
/* search in selected objects context */
- CTX_DATA_BEGIN(C, Object*, ob, selected_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
/* just use the first object we encounter (that isn't the active object)
* and which fulfills the criteria for the object-target that we've got
*/
if ( (ob != obact) &&
- ((!only_curve) || (ob->type == OB_CURVE)) &&
- ((!only_mesh) || (ob->type == OB_MESH)) )
+ ((!only_curve) || (ob->type == OB_CURVE)) &&
+ ((!only_mesh) || (ob->type == OB_MESH)) )
{
/* set target */
- *tar_ob= ob;
- found= 1;
+ *tar_ob = ob;
+ found = 1;
/* perform some special operations on the target */
if (only_curve) {
/* Curve-Path option must be enabled for follow-path constraints to be able to work */
- Curve *cu= (Curve *)ob->data;
+ Curve *cu = (Curve *)ob->data;
cu->flag |= CU_PATH;
}
@@ -1408,17 +1402,17 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o
/* if still not found, add a new empty to act as a target (if allowed) */
if ((found == 0) && (add)) {
- Scene *scene= CTX_data_scene(C);
- Base *base= BASACT, *newbase=NULL;
+ Scene *scene = CTX_data_scene(C);
+ Base *base = BASACT, *newbase = NULL;
Object *obt;
/* add new target object */
- obt= add_object(scene, OB_EMPTY);
+ obt = add_object(scene, OB_EMPTY);
/* set layers OK */
- newbase= BASACT;
- newbase->lay= base->lay;
- obt->lay= newbase->lay;
+ newbase = BASACT;
+ newbase->lay = base->lay;
+ obt->lay = newbase->lay;
/* transform cent to global coords for loc */
if (pchanact) {
@@ -1435,12 +1429,12 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o
}
/* restore, add_object sets active */
- BASACT= base;
+ BASACT = base;
base->flag |= SELECT;
/* make our new target the new object */
- *tar_ob= obt;
- found= 1;
+ *tar_ob = obt;
+ found = 1;
}
/* return whether there's any target */
@@ -1450,16 +1444,16 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o
/* used by add constraint operators to add the constraint required */
static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase *list, int type, short setTarget)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
bPoseChannel *pchan;
bConstraint *con;
if (list == &ob->constraints) {
- pchan= NULL;
+ pchan = NULL;
}
else {
- pchan= get_active_posechannel(ob);
+ pchan = get_active_posechannel(ob);
/* ensure not to confuse object/pose adding */
if (pchan == NULL) {
@@ -1494,8 +1488,8 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
* - apart from the buttons-window add buttons, we shouldn't add in this way
*/
if (setTarget) {
- Object *tar_ob= NULL;
- bPoseChannel *tar_pchan= NULL;
+ Object *tar_ob = NULL;
+ bPoseChannel *tar_pchan = NULL;
/* get the target objects, adding them as need be */
if (get_new_constraint_target(C, type, &tar_ob, &tar_pchan, 1)) {
@@ -1515,7 +1509,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
{
#ifdef WITH_PYTHON
char *menustr;
- int scriptint= 0;
+ int scriptint = 0;
/* popup a list of usable scripts */
menustr = buildmenu_pyconstraints(NULL, &scriptint);
// XXX scriptint = pupmenu(menustr);
@@ -1545,17 +1539,17 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
/* force depsgraph to get recalculated since new relationships added */
- DAG_scene_sort(bmain, scene); /* sort order of objects */
+ DAG_scene_sort(bmain, scene); /* sort order of objects */
- if ((ob->type==OB_ARMATURE) && (pchan)) {
- ob->pose->flag |= POSE_RECALC; /* sort pose channels */
- DAG_id_tag_update(&ob->id, OB_RECALC_DATA|OB_RECALC_OB);
+ if ((ob->type == OB_ARMATURE) && (pchan)) {
+ ob->pose->flag |= POSE_RECALC; /* sort pose channels */
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA | OB_RECALC_OB);
}
else
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
/* notifiers for updates */
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_ADDED, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_ADDED, ob);
return OPERATOR_FINISHED;
}
@@ -1565,9 +1559,9 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
/* dummy operator callback */
static int object_constraint_add_exec(bContext *C, wmOperator *op)
{
- Object *ob=ED_object_active_context(C);
- int type= RNA_enum_get(op->ptr, "type");
- short with_targets= 0;
+ Object *ob = ED_object_active_context(C);
+ int type = RNA_enum_get(op->ptr, "type");
+ short with_targets = 0;
if (!ob) {
BKE_report(op->reports, RPT_ERROR, "No active object to add constraint to");
@@ -1578,7 +1572,7 @@ static int object_constraint_add_exec(bContext *C, wmOperator *op)
* operator name included 'with_targets', since the menu doesn't allow multiple properties
*/
if (strstr(op->idname, "with_targets"))
- with_targets= 1;
+ with_targets = 1;
return constraint_add_exec(C, op, ob, &ob->constraints, type, with_targets);
}
@@ -1586,9 +1580,9 @@ static int object_constraint_add_exec(bContext *C, wmOperator *op)
/* dummy operator callback */
static int pose_constraint_add_exec(bContext *C, wmOperator *op)
{
- Object *ob= object_pose_armature_get(ED_object_active_context(C));
- int type= RNA_enum_get(op->ptr, "type");
- short with_targets= 0;
+ Object *ob = object_pose_armature_get(ED_object_active_context(C));
+ int type = RNA_enum_get(op->ptr, "type");
+ short with_targets = 0;
if (!ob) {
BKE_report(op->reports, RPT_ERROR, "No active object to add constraint to");
@@ -1599,7 +1593,7 @@ static int pose_constraint_add_exec(bContext *C, wmOperator *op)
* operator name included 'with_targets', since the menu doesn't allow multiple properties
*/
if (strstr(op->idname, "with_targets"))
- with_targets= 1;
+ with_targets = 1;
return constraint_add_exec(C, op, ob, get_active_constraints(ob), type, with_targets);
}
@@ -1619,7 +1613,7 @@ void OBJECT_OT_constraint_add(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
@@ -1638,7 +1632,7 @@ void OBJECT_OT_constraint_add_with_targets(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
@@ -1657,7 +1651,7 @@ void POSE_OT_constraint_add(wmOperatorType *ot)
ot->poll = ED_operator_posemode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
@@ -1676,7 +1670,7 @@ void POSE_OT_constraint_add_with_targets(wmOperatorType *ot)
ot->poll = ED_operator_posemode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
@@ -1689,14 +1683,14 @@ void POSE_OT_constraint_add_with_targets(wmOperatorType *ot)
/* present menu with options + validation for targets to use */
static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
{
- Object *ob= object_pose_armature_get(CTX_data_active_object(C));
- bPoseChannel *pchan= get_active_posechannel(ob);
- bConstraint *con= NULL;
+ Object *ob = object_pose_armature_get(CTX_data_active_object(C));
+ bPoseChannel *pchan = get_active_posechannel(ob);
+ bConstraint *con = NULL;
uiPopupMenu *pup;
uiLayout *layout;
- Object *tar_ob= NULL;
- bPoseChannel *tar_pchan= NULL;
+ Object *tar_ob = NULL;
+ bPoseChannel *tar_pchan = NULL;
/* must have active bone */
if (ELEM(NULL, ob, pchan)) {
@@ -1705,8 +1699,8 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
}
/* bone must not have any constraints already */
- for (con= pchan->constraints.first; con; con= con->next) {
- if (con->type==CONSTRAINT_TYPE_KINEMATIC) break;
+ for (con = pchan->constraints.first; con; con = con->next) {
+ if (con->type == CONSTRAINT_TYPE_KINEMATIC) break;
}
if (con) {
BKE_report(op->reports, RPT_ERROR, "Bone already has IK Constraint");
@@ -1714,8 +1708,8 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
}
/* prepare popup menu to choose targetting options */
- pup= uiPupMenuBegin(C, "Add IK", ICON_NONE);
- layout= uiPupMenuLayout(pup);
+ pup = uiPupMenuBegin(C, "Add IK", ICON_NONE);
+ layout = uiPupMenuLayout(pup);
/* the type of targets we'll set determines the menu entries to show... */
if (get_new_constraint_target(C, CONSTRAINT_TYPE_KINEMATIC, &tar_ob, &tar_pchan, 0)) {
@@ -1742,8 +1736,8 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt))
/* call constraint_add_exec() to add the IK constraint */
static int pose_ik_add_exec(bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
- int with_targets= RNA_boolean_get(op->ptr, "with_targets");
+ Object *ob = CTX_data_active_object(C);
+ int with_targets = RNA_boolean_get(op->ptr, "with_targets");
/* add the constraint - all necessary checks should have been done by the invoke() callback already... */
return constraint_add_exec(C, op, ob, get_active_constraints(ob), CONSTRAINT_TYPE_KINEMATIC, with_targets);
@@ -1762,7 +1756,7 @@ void POSE_OT_ik_add(wmOperatorType *ot)
ot->poll = ED_operator_posemode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "with_targets", 1, "With Targets", "Assign IK Constraint with targets derived from the select bones/objects");
@@ -1773,21 +1767,20 @@ void POSE_OT_ik_add(wmOperatorType *ot)
/* remove IK constraints from selected bones */
static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= object_pose_armature_get(CTX_data_active_object(C));
+ Object *ob = object_pose_armature_get(CTX_data_active_object(C));
/* only remove IK Constraints */
- CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
- {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) {
bConstraint *con, *next;
// TODO: should we be checking if these contraints were local before we try and remove them?
- for (con= pchan->constraints.first; con; con= next) {
- next= con->next;
- if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
+ for (con = pchan->constraints.first; con; con = next) {
+ next = con->next;
+ if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
remove_constraint(&pchan->constraints, con);
}
}
- pchan->constflag &= ~(PCHAN_HAS_IK|PCHAN_HAS_TARGET);
+ pchan->constflag &= ~(PCHAN_HAS_IK | PCHAN_HAS_TARGET);
}
CTX_DATA_END;
@@ -1795,7 +1788,7 @@ static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op))
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
/* note, notifier might evolve */
- WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT|NA_REMOVED, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, ob);
return OPERATOR_FINISHED;
}
@@ -1812,6 +1805,6 @@ void POSE_OT_ik_clear(wmOperatorType *ot)
ot->poll = ED_operator_posemode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 2fbc2966bc8..d5385d00c8a 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -101,7 +101,7 @@
#include "WM_api.h"
#include "WM_types.h"
-#include "object_intern.h" // own include
+#include "object_intern.h" // own include
/* ************* XXX **************** */
static void error(const char *UNUSED(arg)) {}
@@ -109,7 +109,8 @@ static void waitcursor(int UNUSED(val)) {}
static int pupmenu(const char *UNUSED(msg)) {return 0;}
/* port over here */
-static void error_libdata(void) {}
+static void error_libdata(void) {
+}
Object *ED_object_context(bContext *C)
{
@@ -120,10 +121,10 @@ Object *ED_object_context(bContext *C)
* note: context can be NULL when called from a enum with PROP_ENUM_NO_CONTEXT */
Object *ED_object_active_context(bContext *C)
{
- Object *ob= NULL;
+ Object *ob = NULL;
if (C) {
- ob= ED_object_context(C);
- if (!ob) ob= CTX_data_active_object(C);
+ ob = ED_object_context(C);
+ if (!ob) ob = CTX_data_active_object(C);
}
return ob;
}
@@ -132,15 +133,15 @@ Object *ED_object_active_context(bContext *C)
/* ********* clear/set restrict view *********/
static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
- ScrArea *sa= CTX_wm_area(C);
- View3D *v3d= sa->spacedata.first;
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ ScrArea *sa = CTX_wm_area(C);
+ View3D *v3d = sa->spacedata.first;
+ Scene *scene = CTX_data_scene(C);
Base *base;
int changed = 0;
/* XXX need a context loop to handle such cases */
- for (base = FIRSTBASE; base; base=base->next) {
+ for (base = FIRSTBASE; base; base = base->next) {
if ((base->lay & v3d->lay) && base->object->restrictflag & OB_RESTRICT_VIEW) {
base->flag |= SELECT;
base->object->flag = base->flag;
@@ -151,7 +152,7 @@ static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
if (changed) {
DAG_id_type_tag(bmain, ID_OB);
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
return OPERATOR_FINISHED;
@@ -170,24 +171,24 @@ void OBJECT_OT_hide_view_clear(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int object_hide_view_set_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
short changed = 0;
- const int unselected= RNA_boolean_get(op->ptr, "unselected");
+ const int unselected = RNA_boolean_get(op->ptr, "unselected");
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
if (!unselected) {
if (base->flag & SELECT) {
base->flag &= ~SELECT;
base->object->flag = base->flag;
base->object->restrictflag |= OB_RESTRICT_VIEW;
changed = 1;
- if (base==BASACT) {
+ if (base == BASACT) {
ED_base_object_activate(C, NULL);
}
}
@@ -205,7 +206,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
DAG_id_type_tag(bmain, ID_OB);
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
}
@@ -224,7 +225,7 @@ void OBJECT_OT_hide_view_set(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects");
@@ -233,19 +234,19 @@ void OBJECT_OT_hide_view_set(wmOperatorType *ot)
/* 99% same as above except no need for scene refreshing (TODO, update render preview) */
static int object_hide_render_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- short changed= 0;
+ short changed = 0;
/* XXX need a context loop to handle such cases */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob->restrictflag & OB_RESTRICT_RENDER) {
ob->restrictflag &= ~OB_RESTRICT_RENDER;
- changed= 1;
+ changed = 1;
}
}
CTX_DATA_END;
if (changed)
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_OUTLINER, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, NULL);
return OPERATOR_FINISHED;
}
@@ -263,14 +264,14 @@ void OBJECT_OT_hide_render_clear(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int object_hide_render_set_exec(bContext *C, wmOperator *op)
{
- const int unselected= RNA_boolean_get(op->ptr, "unselected");
+ const int unselected = RNA_boolean_get(op->ptr, "unselected");
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
if (!unselected) {
if (base->flag & SELECT) {
base->object->restrictflag |= OB_RESTRICT_RENDER;
@@ -283,7 +284,7 @@ static int object_hide_render_set_exec(bContext *C, wmOperator *op)
}
}
CTX_DATA_END;
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_OUTLINER, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, NULL);
return OPERATOR_FINISHED;
}
@@ -299,7 +300,7 @@ void OBJECT_OT_hide_render_set(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects");
}
@@ -310,19 +311,19 @@ void ED_object_exit_editmode(bContext *C, int flag)
{
/* Note! only in exceptional cases should 'EM_DO_UNDO' NOT be in the flag */
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
int freedata = flag & EM_FREEDATA;
- if (obedit==NULL) return;
+ if (obedit == NULL) return;
if (flag & EM_WAITCURSOR) waitcursor(1);
- if (obedit->type==OB_MESH) {
- Mesh *me= obedit->data;
+ if (obedit->type == OB_MESH) {
+ Mesh *me = obedit->data;
// if (EM_texFaceCheck())
- if (me->edit_btmesh->bm->totvert>MESH_MAX_VERTS) {
+ if (me->edit_btmesh->bm->totvert > MESH_MAX_VERTS) {
error("Too many vertices");
return;
}
@@ -332,14 +333,14 @@ void ED_object_exit_editmode(bContext *C, int flag)
if (freedata) {
EDBM_mesh_free(me->edit_btmesh);
MEM_freeN(me->edit_btmesh);
- me->edit_btmesh= NULL;
+ me->edit_btmesh = NULL;
}
if (obedit->restore_mode & OB_MODE_WEIGHT_PAINT) {
mesh_octree_table(NULL, NULL, NULL, 'e');
mesh_mirrtopo_table(NULL, 'e');
}
}
- else if (obedit->type==OB_ARMATURE) {
+ else if (obedit->type == OB_ARMATURE) {
ED_armature_from_edit(obedit);
if (freedata)
ED_armature_edit_free(obedit);
@@ -348,15 +349,15 @@ void ED_object_exit_editmode(bContext *C, int flag)
load_editNurb(obedit);
if (freedata) free_editNurb(obedit);
}
- else if (obedit->type==OB_FONT && freedata) {
+ else if (obedit->type == OB_FONT && freedata) {
load_editText(obedit);
if (freedata) free_editText(obedit);
}
- else if (obedit->type==OB_LATTICE) {
+ else if (obedit->type == OB_LATTICE) {
load_editLatt(obedit);
if (freedata) free_editLatt(obedit);
}
- else if (obedit->type==OB_MBALL) {
+ else if (obedit->type == OB_MBALL) {
load_editMball(obedit);
if (freedata) free_editMball(obedit);
}
@@ -367,11 +368,11 @@ void ED_object_exit_editmode(bContext *C, int flag)
PTCacheID *pid;
/* for example; displist make is different in editmode */
- scene->obedit= NULL; // XXX for context
+ scene->obedit = NULL; // XXX for context
/* flag object caches as outdated */
BKE_ptcache_ids_from_object(&pidlist, obedit, NULL, 0);
- for (pid=pidlist.first; pid; pid=pid->next) {
+ for (pid = pidlist.first; pid; pid = pid->next) {
if (pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */
pid->cache->flag |= PTCACHE_OUTDATED;
}
@@ -380,14 +381,14 @@ void ED_object_exit_editmode(bContext *C, int flag)
BKE_ptcache_object_reset(scene, obedit, PTCACHE_RESET_OUTDATED);
/* also flush ob recalc, doesn't take much overhead, but used for particles */
- DAG_id_tag_update(&obedit->id, OB_RECALC_OB|OB_RECALC_DATA);
+ DAG_id_tag_update(&obedit->id, OB_RECALC_OB | OB_RECALC_DATA);
if (flag & EM_DO_UNDO)
ED_undo_push(C, "Editmode");
if (flag & EM_WAITCURSOR) waitcursor(0);
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, scene);
obedit->mode &= ~OB_MODE_EDIT;
}
@@ -396,27 +397,27 @@ void ED_object_exit_editmode(bContext *C, int flag)
void ED_object_enter_editmode(bContext *C, int flag)
{
- Scene *scene= CTX_data_scene(C);
- Base *base= NULL;
+ Scene *scene = CTX_data_scene(C);
+ Base *base = NULL;
Object *ob;
- ScrArea *sa= CTX_wm_area(C);
- View3D *v3d= NULL;
- int ok= 0;
+ ScrArea *sa = CTX_wm_area(C);
+ View3D *v3d = NULL;
+ int ok = 0;
if (scene->id.lib) return;
- if (sa && sa->spacetype==SPACE_VIEW3D)
- v3d= sa->spacedata.first;
+ if (sa && sa->spacetype == SPACE_VIEW3D)
+ v3d = sa->spacedata.first;
- if ((flag & EM_IGNORE_LAYER)==0) {
- base= CTX_data_active_base(C); /* active layer checked here for view3d */
+ if ((flag & EM_IGNORE_LAYER) == 0) {
+ base = CTX_data_active_base(C); /* active layer checked here for view3d */
- if (base==NULL) return;
- else if (v3d && (base->lay & v3d->lay)==0) return;
- else if (!v3d && (base->lay & scene->lay)==0) return;
+ if (base == NULL) return;
+ else if (v3d && (base->lay & v3d->lay) == 0) return;
+ else if (!v3d && (base->lay & scene->lay) == 0) return;
}
else {
- base= scene->basact;
+ base = scene->basact;
}
if (ELEM3(NULL, base, base->object, base->object->data)) return;
@@ -434,14 +435,14 @@ void ED_object_enter_editmode(bContext *C, int flag)
/* note, when switching scenes the object can have editmode data but
* not be scene->obedit: bug 22954, this avoids calling self eternally */
- if ((ob->restore_mode & OB_MODE_EDIT)==0)
+ if ((ob->restore_mode & OB_MODE_EDIT) == 0)
ED_object_toggle_modes(C, ob->mode);
- ob->mode= OB_MODE_EDIT;
+ ob->mode = OB_MODE_EDIT;
- if (ob->type==OB_MESH) {
+ if (ob->type == OB_MESH) {
BMEditMesh *em;
- ok= 1;
+ ok = 1;
scene->obedit = ob; /* context sees this */
EDBM_mesh_make(CTX_data_tool_settings(C), scene, ob);
@@ -455,10 +456,10 @@ void ED_object_enter_editmode(bContext *C, int flag)
BM_mesh_select_mode_flush(em->bm);
}
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_MESH, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_MESH, scene);
}
- else if (ob->type==OB_ARMATURE) {
- bArmature *arm= base->object->data;
+ else if (ob->type == OB_ARMATURE) {
+ bArmature *arm = base->object->data;
if (!arm) return;
/*
* The function object_data_is_libdata make a problem here, the
@@ -472,50 +473,50 @@ void ED_object_enter_editmode(bContext *C, int flag)
error_libdata();
return;
}
- ok=1;
- scene->obedit= ob;
+ ok = 1;
+ scene->obedit = ob;
ED_armature_to_edit(ob);
/* to ensure all goes in restposition and without striding */
- DAG_id_tag_update(&ob->id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME); // XXX: should this be OB_RECALC_DATA?
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); // XXX: should this be OB_RECALC_DATA?
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_ARMATURE, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_ARMATURE, scene);
}
- else if (ob->type==OB_FONT) {
- scene->obedit= ob; // XXX for context
- ok= 1;
+ else if (ob->type == OB_FONT) {
+ scene->obedit = ob; // XXX for context
+ ok = 1;
make_editText(ob);
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_TEXT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_TEXT, scene);
}
- else if (ob->type==OB_MBALL) {
- scene->obedit= ob; // XXX for context
- ok= 1;
+ else if (ob->type == OB_MBALL) {
+ scene->obedit = ob; // XXX for context
+ ok = 1;
make_editMball(ob);
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_MBALL, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_MBALL, scene);
}
- else if (ob->type==OB_LATTICE) {
- scene->obedit= ob; // XXX for context
- ok= 1;
+ else if (ob->type == OB_LATTICE) {
+ scene->obedit = ob; // XXX for context
+ ok = 1;
make_editLatt(ob);
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_LATTICE, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_LATTICE, scene);
}
- else if (ob->type==OB_SURF || ob->type==OB_CURVE) {
- ok= 1;
- scene->obedit= ob; // XXX for context
+ else if (ob->type == OB_SURF || ob->type == OB_CURVE) {
+ ok = 1;
+ scene->obedit = ob; // XXX for context
make_editNurb(ob);
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_CURVE, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_EDITMODE_CURVE, scene);
}
if (ok) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
else {
- scene->obedit= NULL; // XXX for context
+ scene->obedit = NULL; // XXX for context
ob->mode &= ~OB_MODE_EDIT;
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, scene);
}
if (flag & EM_DO_UNDO) ED_undo_push(C, "Enter Editmode");
@@ -529,7 +530,7 @@ static int editmode_toggle_exec(bContext *C, wmOperator *UNUSED(op))
if (!CTX_data_edit_object(C))
ED_object_enter_editmode(C, EM_WAITCURSOR);
else
- ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* had EM_DO_UNDO but op flag calls undo too [#24685] */
+ ED_object_exit_editmode(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR); /* had EM_DO_UNDO but op flag calls undo too [#24685] */
ED_space_image_uv_sculpt_update(CTX_wm_manager(C), toolsettings);
@@ -567,18 +568,18 @@ void OBJECT_OT_editmode_toggle(wmOperatorType *ot)
ot->poll = editmode_toggle_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* *************************** */
static int posemode_exec(bContext *C, wmOperator *UNUSED(op))
{
- Base *base= CTX_data_active_base(C);
+ Base *base = CTX_data_active_base(C);
- if (base->object->type==OB_ARMATURE) {
- if (base->object==CTX_data_edit_object(C)) {
- ED_object_exit_editmode(C, EM_FREEDATA|EM_DO_UNDO);
+ if (base->object->type == OB_ARMATURE) {
+ if (base->object == CTX_data_edit_object(C)) {
+ ED_object_exit_editmode(C, EM_FREEDATA | EM_DO_UNDO);
ED_armature_enter_posemode(C, base);
}
else if (base->object->mode & OB_MODE_POSE)
@@ -604,7 +605,7 @@ void OBJECT_OT_posemode_toggle(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flag */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob)
@@ -612,53 +613,53 @@ static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob)
//XXX no longer used - to be removed - replaced by game_properties_copy_exec
bProperty *prop;
Base *base;
- int nr, tot=0;
+ int nr, tot = 0;
char *str;
- prop= ob->prop.first;
+ prop = ob->prop.first;
while (prop) {
tot++;
- prop= prop->next;
+ prop = prop->next;
}
- str= MEM_callocN(50 + 33*tot, "copymenu prop");
+ str = MEM_callocN(50 + 33 * tot, "copymenu prop");
if (tot)
strcpy(str, "Copy Property %t|Replace All|Merge All|%l");
else
strcpy(str, "Copy Property %t|Clear All (no properties on active)");
- tot= 0;
- prop= ob->prop.first;
+ tot = 0;
+ prop = ob->prop.first;
while (prop) {
tot++;
strcat(str, "|");
strcat(str, prop->name);
- prop= prop->next;
+ prop = prop->next;
}
- nr= pupmenu(str);
+ nr = pupmenu(str);
- if ( nr==1 || nr==2 ) {
- for (base= FIRSTBASE; base; base= base->next) {
- if ((base != BASACT) &&(TESTBASELIB(v3d, base))) {
- if (nr==1) { /* replace */
- copy_properties( &base->object->prop, &ob->prop );
+ if (nr == 1 || nr == 2) {
+ for (base = FIRSTBASE; base; base = base->next) {
+ if ((base != BASACT) && (TESTBASELIB(v3d, base))) {
+ if (nr == 1) { /* replace */
+ copy_properties(&base->object->prop, &ob->prop);
}
else {
- for (prop = ob->prop.first; prop; prop= prop->next ) {
+ for (prop = ob->prop.first; prop; prop = prop->next) {
set_ob_property(base->object, prop);
}
}
}
}
}
- else if (nr>0) {
- prop = BLI_findlink(&ob->prop, nr-4); /* account for first 3 menu items & menu index starting at 1*/
+ else if (nr > 0) {
+ prop = BLI_findlink(&ob->prop, nr - 4); /* account for first 3 menu items & menu index starting at 1*/
if (prop) {
- for (base= FIRSTBASE; base; base= base->next) {
- if ((base != BASACT) &&(TESTBASELIB(v3d, base))) {
+ for (base = FIRSTBASE; base; base = base->next) {
+ if ((base != BASACT) && (TESTBASELIB(v3d, base))) {
set_ob_property(base->object, prop);
}
}
@@ -673,7 +674,7 @@ static void copymenu_logicbricks(Scene *scene, View3D *v3d, Object *ob)
//XXX no longer used - to be removed - replaced by logicbricks_copy_exec
Base *base;
- for (base= FIRSTBASE; base; base= base->next) {
+ for (base = FIRSTBASE; base; base = base->next) {
if (base->object != ob) {
if (TESTBASELIB(v3d, base)) {
@@ -692,12 +693,12 @@ static void copymenu_logicbricks(Scene *scene, View3D *v3d, Object *ob)
set_sca_new_poins_ob(base->object);
/* some menu settings */
- base->object->scavisflag= ob->scavisflag;
- base->object->scaflag= ob->scaflag;
+ base->object->scavisflag = ob->scavisflag;
+ base->object->scaflag = ob->scaflag;
/* set the initial state */
- base->object->state= ob->state;
- base->object->init_state= ob->init_state;
+ base->object->state = ob->state;
+ base->object->init_state = ob->init_state;
}
}
}
@@ -706,49 +707,49 @@ static void copymenu_logicbricks(Scene *scene, View3D *v3d, Object *ob)
/* both pointers should exist */
static void copy_texture_space(Object *to, Object *ob)
{
- float *poin1= NULL, *poin2= NULL;
- short texflag= 0;
+ float *poin1 = NULL, *poin2 = NULL;
+ short texflag = 0;
- if (ob->type==OB_MESH) {
- texflag= ((Mesh *)ob->data)->texflag;
- poin2= ((Mesh *)ob->data)->loc;
+ if (ob->type == OB_MESH) {
+ texflag = ((Mesh *)ob->data)->texflag;
+ poin2 = ((Mesh *)ob->data)->loc;
}
else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
- texflag= ((Curve *)ob->data)->texflag;
- poin2= ((Curve *)ob->data)->loc;
+ texflag = ((Curve *)ob->data)->texflag;
+ poin2 = ((Curve *)ob->data)->loc;
}
- else if (ob->type==OB_MBALL) {
- texflag= ((MetaBall *)ob->data)->texflag;
- poin2= ((MetaBall *)ob->data)->loc;
+ else if (ob->type == OB_MBALL) {
+ texflag = ((MetaBall *)ob->data)->texflag;
+ poin2 = ((MetaBall *)ob->data)->loc;
}
else
return;
- if (to->type==OB_MESH) {
- ((Mesh *)to->data)->texflag= texflag;
- poin1= ((Mesh *)to->data)->loc;
+ if (to->type == OB_MESH) {
+ ((Mesh *)to->data)->texflag = texflag;
+ poin1 = ((Mesh *)to->data)->loc;
}
else if (ELEM3(to->type, OB_CURVE, OB_SURF, OB_FONT)) {
- ((Curve *)to->data)->texflag= texflag;
- poin1= ((Curve *)to->data)->loc;
+ ((Curve *)to->data)->texflag = texflag;
+ poin1 = ((Curve *)to->data)->loc;
}
- else if (to->type==OB_MBALL) {
- ((MetaBall *)to->data)->texflag= texflag;
- poin1= ((MetaBall *)to->data)->loc;
+ else if (to->type == OB_MBALL) {
+ ((MetaBall *)to->data)->texflag = texflag;
+ poin1 = ((MetaBall *)to->data)->loc;
}
else
return;
- memcpy(poin1, poin2, 9*sizeof(float)); /* this was noted in DNA_mesh, curve, mball */
+ memcpy(poin1, poin2, 9 * sizeof(float)); /* this was noted in DNA_mesh, curve, mball */
- if (to->type==OB_MESH) {
+ if (to->type == OB_MESH) {
/* pass */
}
else if (to->type == OB_MBALL) {
- tex_space_mball(to);
+ BKE_metaball_tex_space_calc(to);
}
else {
- tex_space_curve(to->data);
+ BKE_curve_tex_space_calc(to->data);
}
}
@@ -760,125 +761,125 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
Base *base;
Curve *cu, *cu1;
Nurb *nu;
- int do_scene_sort= 0;
+ int do_scene_sort = 0;
if (scene->id.lib) return;
- if (!(ob=OBACT)) return;
+ if (!(ob = OBACT)) return;
if (scene->obedit) { // XXX get from context
/* obedit_copymenu(); */
return;
}
- if (event==9) {
+ if (event == 9) {
copymenu_properties(scene, v3d, ob);
return;
}
- else if (event==10) {
+ else if (event == 10) {
copymenu_logicbricks(scene, v3d, ob);
return;
}
- else if (event==24) {
+ else if (event == 24) {
/* moved to object_link_modifiers */
/* copymenu_modifiers(bmain, scene, v3d, ob); */
return;
}
- for (base= FIRSTBASE; base; base= base->next) {
+ for (base = FIRSTBASE; base; base = base->next) {
if (base != BASACT) {
if (TESTBASELIB(v3d, base)) {
base->object->recalc |= OB_RECALC_OB;
- if (event==1) { /* loc */
+ if (event == 1) { /* loc */
copy_v3_v3(base->object->loc, ob->loc);
copy_v3_v3(base->object->dloc, ob->dloc);
}
- else if (event==2) { /* rot */
+ else if (event == 2) { /* rot */
copy_v3_v3(base->object->rot, ob->rot);
copy_v3_v3(base->object->drot, ob->drot);
copy_qt_qt(base->object->quat, ob->quat);
copy_qt_qt(base->object->dquat, ob->dquat);
}
- else if (event==3) { /* size */
+ else if (event == 3) { /* size */
copy_v3_v3(base->object->size, ob->size);
copy_v3_v3(base->object->dscale, ob->dscale);
}
- else if (event==4) { /* drawtype */
- base->object->dt= ob->dt;
- base->object->dtx= ob->dtx;
- base->object->empty_drawtype= ob->empty_drawtype;
- base->object->empty_drawsize= ob->empty_drawsize;
+ else if (event == 4) { /* drawtype */
+ base->object->dt = ob->dt;
+ base->object->dtx = ob->dtx;
+ base->object->empty_drawtype = ob->empty_drawtype;
+ base->object->empty_drawsize = ob->empty_drawsize;
}
- else if (event==5) { /* time offs */
- base->object->sf= ob->sf;
+ else if (event == 5) { /* time offs */
+ base->object->sf = ob->sf;
}
- else if (event==6) { /* dupli */
- base->object->dupon= ob->dupon;
- base->object->dupoff= ob->dupoff;
- base->object->dupsta= ob->dupsta;
- base->object->dupend= ob->dupend;
+ else if (event == 6) { /* dupli */
+ base->object->dupon = ob->dupon;
+ base->object->dupoff = ob->dupoff;
+ base->object->dupsta = ob->dupsta;
+ base->object->dupend = ob->dupend;
base->object->transflag &= ~OB_DUPLI;
base->object->transflag |= (ob->transflag & OB_DUPLI);
- base->object->dup_group= ob->dup_group;
+ base->object->dup_group = ob->dup_group;
if (ob->dup_group)
id_lib_extern(&ob->dup_group->id);
}
- else if (event==7) { /* mass */
- base->object->mass= ob->mass;
+ else if (event == 7) { /* mass */
+ base->object->mass = ob->mass;
}
- else if (event==8) { /* damping */
- base->object->damping= ob->damping;
- base->object->rdamping= ob->rdamping;
+ else if (event == 8) { /* damping */
+ base->object->damping = ob->damping;
+ base->object->rdamping = ob->rdamping;
}
- else if (event==11) { /* all physical attributes */
+ else if (event == 11) { /* all physical attributes */
base->object->gameflag = ob->gameflag;
base->object->inertia = ob->inertia;
base->object->formfactor = ob->formfactor;
- base->object->damping= ob->damping;
- base->object->rdamping= ob->rdamping;
- base->object->min_vel= ob->min_vel;
- base->object->max_vel= ob->max_vel;
+ base->object->damping = ob->damping;
+ base->object->rdamping = ob->rdamping;
+ base->object->min_vel = ob->min_vel;
+ base->object->max_vel = ob->max_vel;
if (ob->gameflag & OB_BOUNDS) {
base->object->collision_boundtype = ob->collision_boundtype;
}
- base->object->margin= ob->margin;
- base->object->bsoft= copy_bulletsoftbody(ob->bsoft);
+ base->object->margin = ob->margin;
+ base->object->bsoft = copy_bulletsoftbody(ob->bsoft);
}
- else if (event==17) { /* tex space */
+ else if (event == 17) { /* tex space */
copy_texture_space(base->object, ob);
}
- else if (event==18) { /* font settings */
+ else if (event == 18) { /* font settings */
- if (base->object->type==ob->type) {
- cu= ob->data;
- cu1= base->object->data;
-
- cu1->spacemode= cu->spacemode;
- cu1->spacing= cu->spacing;
- cu1->linedist= cu->linedist;
- cu1->shear= cu->shear;
- cu1->fsize= cu->fsize;
- cu1->xof= cu->xof;
- cu1->yof= cu->yof;
- cu1->textoncurve= cu->textoncurve;
- cu1->wordspace= cu->wordspace;
- cu1->ulpos= cu->ulpos;
- cu1->ulheight= cu->ulheight;
+ if (base->object->type == ob->type) {
+ cu = ob->data;
+ cu1 = base->object->data;
+
+ cu1->spacemode = cu->spacemode;
+ cu1->spacing = cu->spacing;
+ cu1->linedist = cu->linedist;
+ cu1->shear = cu->shear;
+ cu1->fsize = cu->fsize;
+ cu1->xof = cu->xof;
+ cu1->yof = cu->yof;
+ cu1->textoncurve = cu->textoncurve;
+ cu1->wordspace = cu->wordspace;
+ cu1->ulpos = cu->ulpos;
+ cu1->ulheight = cu->ulheight;
if (cu1->vfont) cu1->vfont->id.us--;
- cu1->vfont= cu->vfont;
+ cu1->vfont = cu->vfont;
id_us_plus((ID *)cu1->vfont);
if (cu1->vfontb) cu1->vfontb->id.us--;
- cu1->vfontb= cu->vfontb;
+ cu1->vfontb = cu->vfontb;
id_us_plus((ID *)cu1->vfontb);
if (cu1->vfonti) cu1->vfonti->id.us--;
- cu1->vfonti= cu->vfonti;
+ cu1->vfonti = cu->vfonti;
id_us_plus((ID *)cu1->vfonti);
if (cu1->vfontbi) cu1->vfontbi->id.us--;
- cu1->vfontbi= cu->vfontbi;
+ cu1->vfontbi = cu->vfontbi;
id_us_plus((ID *)cu1->vfontbi);
BKE_text_to_curve(bmain, scene, base->object, 0); /* needed? */
@@ -889,43 +890,43 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
base->object->recalc |= OB_RECALC_DATA;
}
}
- else if (event==19) { /* bevel settings */
+ else if (event == 19) { /* bevel settings */
if (ELEM(base->object->type, OB_CURVE, OB_FONT)) {
- cu= ob->data;
- cu1= base->object->data;
+ cu = ob->data;
+ cu1 = base->object->data;
- cu1->bevobj= cu->bevobj;
- cu1->taperobj= cu->taperobj;
- cu1->width= cu->width;
- cu1->bevresol= cu->bevresol;
- cu1->ext1= cu->ext1;
- cu1->ext2= cu->ext2;
+ cu1->bevobj = cu->bevobj;
+ cu1->taperobj = cu->taperobj;
+ cu1->width = cu->width;
+ cu1->bevresol = cu->bevresol;
+ cu1->ext1 = cu->ext1;
+ cu1->ext2 = cu->ext2;
base->object->recalc |= OB_RECALC_DATA;
}
}
- else if (event==25) { /* curve resolution */
+ else if (event == 25) { /* curve resolution */
if (ELEM(base->object->type, OB_CURVE, OB_FONT)) {
- cu= ob->data;
- cu1= base->object->data;
+ cu = ob->data;
+ cu1 = base->object->data;
- cu1->resolu= cu->resolu;
- cu1->resolu_ren= cu->resolu_ren;
+ cu1->resolu = cu->resolu;
+ cu1->resolu_ren = cu->resolu_ren;
- nu= cu1->nurb.first;
+ nu = cu1->nurb.first;
while (nu) {
- nu->resolu= cu1->resolu;
- nu= nu->next;
+ nu->resolu = cu1->resolu;
+ nu = nu->next;
}
base->object->recalc |= OB_RECALC_DATA;
}
}
- else if (event==21) {
- if (base->object->type==OB_MESH) {
+ else if (event == 21) {
+ if (base->object->type == OB_MESH) {
ModifierData *md = modifiers_findByType(ob, eModifierType_Subsurf);
if (md) {
@@ -941,42 +942,42 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
}
}
}
- else if (event==22) {
+ else if (event == 22) {
/* Copy the constraint channels over */
copy_constraints(&base->object->constraints, &ob->constraints, TRUE);
- do_scene_sort= 1;
+ do_scene_sort = 1;
}
- else if (event==23) {
- base->object->softflag= ob->softflag;
+ else if (event == 23) {
+ base->object->softflag = ob->softflag;
if (base->object->soft) sbFree(base->object->soft);
- base->object->soft= copy_softbody(ob->soft);
+ base->object->soft = copy_softbody(ob->soft);
if (!modifiers_findByType(base->object, eModifierType_Softbody)) {
BLI_addhead(&base->object->modifiers, modifier_new(eModifierType_Softbody));
}
}
- else if (event==26) {
+ else if (event == 26) {
#if 0 // XXX old animation system
copy_nlastrips(&base->object->nlastrips, &ob->nlastrips);
#endif // XXX old animation system
}
- else if (event==27) { /* autosmooth */
- if (base->object->type==OB_MESH) {
- Mesh *me= ob->data;
- Mesh *cme= base->object->data;
- cme->smoothresh= me->smoothresh;
+ else if (event == 27) { /* autosmooth */
+ if (base->object->type == OB_MESH) {
+ Mesh *me = ob->data;
+ Mesh *cme = base->object->data;
+ cme->smoothresh = me->smoothresh;
if (me->flag & ME_AUTOSMOOTH)
cme->flag |= ME_AUTOSMOOTH;
else
cme->flag &= ~ME_AUTOSMOOTH;
}
}
- else if (event==28) { /* UV orco */
+ else if (event == 28) { /* UV orco */
if (ELEM(base->object->type, OB_CURVE, OB_SURF)) {
- cu= ob->data;
- cu1= base->object->data;
+ cu = ob->data;
+ cu1 = base->object->data;
if (cu->flag & CU_UV_ORCO)
cu1->flag |= CU_UV_ORCO;
@@ -984,13 +985,13 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
cu1->flag &= ~CU_UV_ORCO;
}
}
- else if (event==29) { /* protected bits */
- base->object->protectflag= ob->protectflag;
+ else if (event == 29) { /* protected bits */
+ base->object->protectflag = ob->protectflag;
}
- else if (event==30) { /* index object */
- base->object->index= ob->index;
+ else if (event == 30) { /* index object */
+ base->object->index = ob->index;
}
- else if (event==31) { /* object color */
+ else if (event == 31) { /* object color */
copy_v4_v4(base->object->col, ob->col);
}
}
@@ -1003,13 +1004,13 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
DAG_ids_flush_update(bmain, 0);
}
-static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v3d)
+static void UNUSED_FUNCTION(copy_attr_menu) (Main * bmain, Scene * scene, View3D * v3d)
{
Object *ob;
short event;
char str[512];
- if (!(ob=OBACT)) return;
+ if (!(ob = OBACT)) return;
if (scene->obedit) { // XXX get from context
// if (ob->type == OB_MESH)
@@ -1028,8 +1029,8 @@ static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v
"Time Offset%x5|Dupli%x6|Object Color%x31|%l|Mass%x7|Damping%x8|All Physical Attributes%x11|Properties%x9|"
"Logic Bricks%x10|Protected Transform%x29|%l");
- strcat (str, "|Object Constraints%x22");
- strcat (str, "|NLA Strips%x26");
+ strcat(str, "|Object Constraints%x22");
+ strcat(str, "|NLA Strips%x26");
// XXX if (OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
// strcat(str, "|Texture Space%x17");
@@ -1039,10 +1040,10 @@ static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v
if (ob->type == OB_CURVE) strcat(str, "|Bevel Settings%x19|UV Orco%x28");
if ((ob->type == OB_FONT) || (ob->type == OB_CURVE)) {
- strcat(str, "|Curve Resolution%x25");
+ strcat(str, "|Curve Resolution%x25");
}
- if (ob->type==OB_MESH) {
+ if (ob->type == OB_MESH) {
strcat(str, "|Subsurf Settings%x21|AutoSmooth%x27");
}
@@ -1050,12 +1051,12 @@ static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v
strcat(str, "|Pass Index%x30");
- if (ob->type==OB_MESH || ob->type==OB_CURVE || ob->type==OB_LATTICE || ob->type==OB_SURF) {
+ if (ob->type == OB_MESH || ob->type == OB_CURVE || ob->type == OB_LATTICE || ob->type == OB_SURF) {
strcat(str, "|Modifiers ...%x24");
}
- event= pupmenu(str);
- if (event<= 0) return;
+ event = pupmenu(str);
+ if (event <= 0) return;
copy_attr(bmain, scene, v3d, event);
}
@@ -1074,7 +1075,7 @@ static int forcefield_toggle_exec(bContext *C, wmOperator *UNUSED(op))
else
ob->pd->forcefield = 0;
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL);
return OPERATOR_FINISHED;
}
@@ -1092,7 +1093,7 @@ void OBJECT_OT_forcefield_toggle(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ********************************************** */
@@ -1108,8 +1109,7 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene)
ListBase targets = {NULL, NULL};
/* loop over objects in scene */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
/* set flag to force recalc, then grab the relevant bones to target */
ob->avs.recalc |= ANIMVIZ_RECALC_PATHS;
animviz_get_object_motionpaths(ob, &targets);
@@ -1124,12 +1124,12 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene)
/* For the object with pose/action: create path curves for selected bones
* This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range
*/
-static int object_calculate_paths_exec (bContext *C, wmOperator *op)
+static int object_calculate_paths_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
/* set up path data for bones being calculated */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{
/* verify makes sure that the selected bone has a bone with the appropriate settings */
animviz_verify_motionpaths(op->reports, scene, ob, NULL);
@@ -1141,12 +1141,12 @@ static int object_calculate_paths_exec (bContext *C, wmOperator *op)
ED_objects_recalculate_paths(C, scene);
/* notifiers for updates */
- WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
return OPERATOR_FINISHED;
}
-void OBJECT_OT_paths_calculate (wmOperatorType *ot)
+void OBJECT_OT_paths_calculate(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Calculate Object Paths";
@@ -1158,7 +1158,7 @@ void OBJECT_OT_paths_calculate (wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* --------- */
@@ -1167,11 +1167,11 @@ void OBJECT_OT_paths_calculate (wmOperatorType *ot)
void ED_objects_clear_paths(bContext *C)
{
/* loop over objects in scene */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{
if (ob->mpath) {
animviz_free_motionpath(ob->mpath);
- ob->mpath= NULL;
+ ob->mpath = NULL;
ob->avs.path_bakeflag &= ~MOTIONPATH_BAKE_HAS_PATHS;
}
}
@@ -1179,18 +1179,18 @@ void ED_objects_clear_paths(bContext *C)
}
/* operator callback for this */
-static int object_clear_paths_exec (bContext *C, wmOperator *UNUSED(op))
+static int object_clear_paths_exec(bContext *C, wmOperator *UNUSED(op))
{
/* use the backend function for this */
ED_objects_clear_paths(C);
/* notifiers for updates */
- WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
return OPERATOR_FINISHED;
}
-void OBJECT_OT_paths_clear (wmOperatorType *ot)
+void OBJECT_OT_paths_clear(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear Object Paths";
@@ -1202,7 +1202,7 @@ void OBJECT_OT_paths_clear (wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@@ -1212,36 +1212,36 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
{
Curve *cu;
Nurb *nu;
- int clear= (strcmp(op->idname, "OBJECT_OT_shade_flat") == 0);
- int done= 0;
+ int clear = (strcmp(op->idname, "OBJECT_OT_shade_flat") == 0);
+ int done = 0;
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
- if (ob->type==OB_MESH) {
+ if (ob->type == OB_MESH) {
mesh_set_smooth_flag(ob, !clear);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
- done= 1;
+ done = 1;
}
else if (ELEM(ob->type, OB_SURF, OB_CURVE)) {
- cu= ob->data;
+ cu = ob->data;
- for (nu=cu->nurb.first; nu; nu=nu->next) {
+ for (nu = cu->nurb.first; nu; nu = nu->next) {
if (!clear) nu->flag |= ME_SMOOTH;
else nu->flag &= ~ME_SMOOTH;
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
- done= 1;
+ done = 1;
}
}
CTX_DATA_END;
- return (done)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
+ return (done) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
static int shade_poll(bContext *C)
@@ -1261,7 +1261,7 @@ void OBJECT_OT_shade_flat(wmOperatorType *ot)
ot->exec = shade_smooth_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
void OBJECT_OT_shade_smooth(wmOperatorType *ot)
@@ -1276,12 +1276,12 @@ void OBJECT_OT_shade_smooth(wmOperatorType *ot)
ot->exec = shade_smooth_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ********************** */
-static void UNUSED_FUNCTION(image_aspect)(Scene *scene, View3D *v3d)
+static void UNUSED_FUNCTION(image_aspect) (Scene * scene, View3D * v3d)
{
/* all selected objects with an image map: scale in image aspect */
Base *base;
@@ -1291,42 +1291,42 @@ static void UNUSED_FUNCTION(image_aspect)(Scene *scene, View3D *v3d)
float x, y, space;
int a, b, done;
- if (scene->obedit) return; // XXX get from context
+ if (scene->obedit) return; // XXX get from context
if (scene->id.lib) return;
- for (base= FIRSTBASE; base; base= base->next) {
+ for (base = FIRSTBASE; base; base = base->next) {
if (TESTBASELIB(v3d, base)) {
- ob= base->object;
- done= 0;
+ ob = base->object;
+ done = 0;
- for (a=1; a<=ob->totcol; a++) {
- ma= give_current_material(ob, a);
+ for (a = 1; a <= ob->totcol; a++) {
+ ma = give_current_material(ob, a);
if (ma) {
- for (b=0; b<MAX_MTEX; b++) {
+ for (b = 0; b < MAX_MTEX; b++) {
if (ma->mtex[b] && ma->mtex[b]->tex) {
- tex= ma->mtex[b]->tex;
- if (tex->type==TEX_IMAGE && tex->ima) {
- ImBuf *ibuf= BKE_image_get_ibuf(tex->ima, NULL);
+ tex = ma->mtex[b]->tex;
+ if (tex->type == TEX_IMAGE && tex->ima) {
+ ImBuf *ibuf = BKE_image_get_ibuf(tex->ima, NULL);
/* texturespace */
- space= 1.0;
- if (ob->type==OB_MESH) {
+ space = 1.0;
+ if (ob->type == OB_MESH) {
float size[3];
mesh_get_texspace(ob->data, NULL, NULL, size);
- space= size[0]/size[1];
+ space = size[0] / size[1];
}
else if (ELEM3(ob->type, OB_CURVE, OB_FONT, OB_SURF)) {
- Curve *cu= ob->data;
- space= cu->size[0]/cu->size[1];
+ Curve *cu = ob->data;
+ space = cu->size[0] / cu->size[1];
}
- x= ibuf->x/space;
- y= ibuf->y;
+ x = ibuf->x / space;
+ y = ibuf->y;
- if (x>y) ob->size[0]= ob->size[1]*x/y;
- else ob->size[1]= ob->size[0]*y/x;
+ if (x > y) ob->size[0] = ob->size[1] * x / y;
+ else ob->size[1] = ob->size[0] * y / x;
- done= 1;
+ done = 1;
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
}
@@ -1344,30 +1344,32 @@ static void UNUSED_FUNCTION(image_aspect)(Scene *scene, View3D *v3d)
static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
EnumPropertyItem *input = object_mode_items;
- EnumPropertyItem *item= NULL;
+ EnumPropertyItem *item = NULL;
Object *ob;
- int totitem= 0;
+ int totitem = 0;
if (!C) /* needed for docs */
return object_mode_items;
+
+
ob = CTX_data_active_object(C);
while (ob && input->identifier) {
- if ((input->value == OB_MODE_EDIT && ((ob->type == OB_MESH) || (ob->type == OB_ARMATURE) ||
- (ob->type == OB_CURVE) || (ob->type == OB_SURF) ||
- (ob->type == OB_FONT) || (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) ||
- (input->value == OB_MODE_POSE && (ob->type == OB_ARMATURE)) ||
- (input->value == OB_MODE_PARTICLE_EDIT && ob->particlesystem.first) ||
- ((input->value == OB_MODE_SCULPT || input->value == OB_MODE_VERTEX_PAINT ||
- input->value == OB_MODE_WEIGHT_PAINT || input->value == OB_MODE_TEXTURE_PAINT) && (ob->type == OB_MESH)) ||
- (input->value == OB_MODE_OBJECT))
+ if ((input->value == OB_MODE_EDIT && OB_TYPE_SUPPORT_EDITMODE(ob->type)) ||
+ (input->value == OB_MODE_POSE && (ob->type == OB_ARMATURE)) ||
+ (input->value == OB_MODE_PARTICLE_EDIT && ob->particlesystem.first) ||
+ ((input->value == OB_MODE_SCULPT || input->value == OB_MODE_VERTEX_PAINT ||
+ input->value == OB_MODE_WEIGHT_PAINT || input->value == OB_MODE_TEXTURE_PAINT) && (ob->type == OB_MESH)) ||
+ (input->value == OB_MODE_OBJECT))
+ {
RNA_enum_item_add(&item, &totitem, input);
+ }
++input;
}
RNA_enum_item_end(&item, &totitem);
- *free= 1;
+ *free = 1;
return item;
}
@@ -1401,24 +1403,24 @@ static int object_mode_set_compat(bContext *UNUSED(C), wmOperator *op, Object *o
if (mode == OB_MODE_OBJECT)
return 1;
- switch(ob->type) {
- case OB_MESH:
- if (mode & (OB_MODE_EDIT|OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT|OB_MODE_PARTICLE_EDIT))
- return 1;
- return 0;
- case OB_CURVE:
- case OB_SURF:
- case OB_FONT:
- case OB_MBALL:
- if (mode & (OB_MODE_EDIT))
- return 1;
- return 0;
- case OB_LATTICE:
- if (mode & (OB_MODE_EDIT|OB_MODE_WEIGHT_PAINT))
- return 1;
- case OB_ARMATURE:
- if (mode & (OB_MODE_EDIT|OB_MODE_POSE))
- return 1;
+ switch (ob->type) {
+ case OB_MESH:
+ if (mode & (OB_MODE_EDIT | OB_MODE_SCULPT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT | OB_MODE_PARTICLE_EDIT))
+ return 1;
+ return 0;
+ case OB_CURVE:
+ case OB_SURF:
+ case OB_FONT:
+ case OB_MBALL:
+ if (mode & (OB_MODE_EDIT))
+ return 1;
+ return 0;
+ case OB_LATTICE:
+ if (mode & (OB_MODE_EDIT | OB_MODE_WEIGHT_PAINT))
+ return 1;
+ case OB_ARMATURE:
+ if (mode & (OB_MODE_EDIT | OB_MODE_POSE))
+ return 1;
}
}
@@ -1427,7 +1429,7 @@ static int object_mode_set_compat(bContext *UNUSED(C), wmOperator *op, Object *o
static int object_mode_set_exec(bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob = CTX_data_active_object(C);
ObjectMode mode = RNA_enum_get(op->ptr, "mode");
ObjectMode restore_mode = (ob) ? ob->mode : OB_MODE_OBJECT;
int toggle = RNA_boolean_get(op->ptr, "toggle");
@@ -1474,7 +1476,7 @@ void OBJECT_OT_mode_set(wmOperatorType *ot)
/* flags */
ot->flag = 0; /* no register/undo here, leave it to operators being called */
- prop= RNA_def_enum(ot->srna, "mode", object_mode_items, OB_MODE_OBJECT, "Mode", "");
+ prop = RNA_def_enum(ot->srna, "mode", object_mode_items, OB_MODE_OBJECT, "Mode", "");
RNA_def_enum_funcs(prop, object_mode_set_itemsf);
RNA_def_boolean(ot->srna, "toggle", 0, "Toggle", "");
@@ -1504,12 +1506,12 @@ void ED_object_toggle_modes(bContext *C, int mode)
static int game_property_new(bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob = CTX_data_active_object(C);
bProperty *prop;
char name[MAX_NAME];
- int type= RNA_enum_get(op->ptr, "type");
+ int type = RNA_enum_get(op->ptr, "type");
- prop= new_property(type);
+ prop = new_property(type);
BLI_addtail(&ob->prop, prop);
RNA_string_get(op->ptr, "name", name);
@@ -1536,7 +1538,7 @@ void OBJECT_OT_game_property_new(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", gameproperty_type_items, GPROP_FLOAT, "Type", "Type of game property to add");
RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the game property to add");
@@ -1544,14 +1546,14 @@ void OBJECT_OT_game_property_new(wmOperatorType *ot)
static int game_property_remove(bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob = CTX_data_active_object(C);
bProperty *prop;
- int index= RNA_int_get(op->ptr, "index");
+ int index = RNA_int_get(op->ptr, "index");
if (!ob)
return OPERATOR_CANCELLED;
- prop= BLI_findlink(&ob->prop, index);
+ prop = BLI_findlink(&ob->prop, index);
if (prop) {
BLI_remlink(&ob->prop, prop);
@@ -1577,16 +1579,16 @@ void OBJECT_OT_game_property_remove(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Property index to remove ", 0, INT_MAX);
}
-#define COPY_PROPERTIES_REPLACE 1
-#define COPY_PROPERTIES_MERGE 2
-#define COPY_PROPERTIES_COPY 3
+#define COPY_PROPERTIES_REPLACE 1
+#define COPY_PROPERTIES_MERGE 2
+#define COPY_PROPERTIES_COPY 3
-static EnumPropertyItem game_properties_copy_operations[] ={
+static EnumPropertyItem game_properties_copy_operations[] = {
{COPY_PROPERTIES_REPLACE, "REPLACE", 0, "Replace Properties", ""},
{COPY_PROPERTIES_MERGE, "MERGE", 0, "Merge Properties", ""},
{COPY_PROPERTIES_COPY, "COPY", 0, "Copy a Property", ""},
@@ -1597,40 +1599,40 @@ static EnumPropertyItem gameprops_items[]= {
static EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
- Object *ob= ED_object_active_context(C);
+ Object *ob = ED_object_active_context(C);
EnumPropertyItem tmp = {0, "", 0, "", ""};
- EnumPropertyItem *item= NULL;
+ EnumPropertyItem *item = NULL;
bProperty *prop;
- int a, totitem= 0;
+ int a, totitem = 0;
if (!ob)
return gameprops_items;
- for (a=1, prop= ob->prop.first; prop; prop=prop->next, a++) {
- tmp.value= a;
- tmp.identifier= prop->name;
- tmp.name= prop->name;
+ for (a = 1, prop = ob->prop.first; prop; prop = prop->next, a++) {
+ tmp.value = a;
+ tmp.identifier = prop->name;
+ tmp.name = prop->name;
RNA_enum_item_add(&item, &totitem, &tmp);
}
RNA_enum_item_end(&item, &totitem);
- *free= 1;
+ *free = 1;
return item;
}
static int game_property_copy_exec(bContext *C, wmOperator *op)
{
- Object *ob=ED_object_active_context(C);
+ Object *ob = ED_object_active_context(C);
bProperty *prop;
int type = RNA_enum_get(op->ptr, "operation");
- int propid= RNA_enum_get(op->ptr, "property");
+ int propid = RNA_enum_get(op->ptr, "property");
if (propid > 0) { /* copy */
- prop = BLI_findlink(&ob->prop, propid-1);
+ prop = BLI_findlink(&ob->prop, propid - 1);
if (prop) {
- CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) {
if (ob != ob_iter)
set_ob_property(ob_iter, prop);
} CTX_DATA_END;
@@ -1638,14 +1640,14 @@ static int game_property_copy_exec(bContext *C, wmOperator *op)
}
else {
- CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) {
if (ob != ob_iter) {
if (type == COPY_PROPERTIES_REPLACE)
copy_properties(&ob_iter->prop, &ob->prop);
/* merge - the default when calling with no argument */
else
- for (prop = ob->prop.first; prop; prop= prop->next)
+ for (prop = ob->prop.first; prop; prop = prop->next)
set_ob_property(ob_iter, prop);
}
}
@@ -1667,17 +1669,17 @@ void OBJECT_OT_game_property_copy(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "operation", game_properties_copy_operations, 3, "Operation", "");
- prop=RNA_def_enum(ot->srna, "property", gameprops_items, 0, "Property", "Properties to copy");
+ prop = RNA_def_enum(ot->srna, "property", gameprops_items, 0, "Property", "Properties to copy");
RNA_def_enum_funcs(prop, gameprops_itemf);
ot->prop = prop;
}
static int game_property_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) {
free_properties(&ob_iter->prop);
}
CTX_DATA_END;
@@ -1696,16 +1698,16 @@ void OBJECT_OT_game_property_clear(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/************************ Copy Logic Bricks ***********************/
static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob=ED_object_active_context(C);
+ Object *ob = ED_object_active_context(C);
- CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) {
if (ob != ob_iter) {
/* first: free all logic */
free_sensors(&ob_iter->sensors);
@@ -1722,16 +1724,16 @@ static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op))
set_sca_new_poins_ob(ob_iter);
/* some menu settings */
- ob_iter->scavisflag= ob->scavisflag;
- ob_iter->scaflag= ob->scaflag;
+ ob_iter->scavisflag = ob->scavisflag;
+ ob_iter->scaflag = ob->scaflag;
/* set the initial state */
- ob_iter->state= ob->state;
- ob_iter->init_state= ob->init_state;
+ ob_iter->state = ob->state;
+ ob_iter->init_state = ob->init_state;
- if (ob_iter->totcol==ob->totcol) {
- ob_iter->actcol= ob->actcol;
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob_iter);
+ if (ob_iter->totcol == ob->totcol) {
+ ob_iter->actcol = ob->actcol;
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob_iter);
}
}
}
@@ -1754,14 +1756,14 @@ void OBJECT_OT_logic_bricks_copy(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob=ED_object_active_context(C);
+ Object *ob = ED_object_active_context(C);
- CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) {
if (ob != ob_iter) {
ob_iter->gameflag = ob->gameflag;
ob_iter->gameflag2 = ob->gameflag2;
@@ -1781,7 +1783,7 @@ static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
ob_iter->bsoft = copy_bulletsoftbody(ob->bsoft);
if (ob->restrictflag & OB_RESTRICT_RENDER)
ob_iter->restrictflag |= OB_RESTRICT_RENDER;
- else
+ else
ob_iter->restrictflag &= ~OB_RESTRICT_RENDER;
}
}
@@ -1802,5 +1804,5 @@ void OBJECT_OT_game_physics_copy(struct wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index 3867b1e34cb..702671d8d9b 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -61,9 +61,9 @@
static int objects_add_active_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Object *ob= OBACT;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = OBACT;
Group *group;
int ok = 0, cycle = 0;
@@ -72,10 +72,10 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
/* linking to same group requires its own loop so we can avoid
* looking up the active objects groups each time */
- for (group= bmain->group.first; group; group=group->id.next) {
+ for (group = bmain->group.first; group; group = group->id.next) {
if (object_in_group(ob, group)) {
/* Assign groups to selected objects */
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
if (base->object->dup_group != group)
add_to_group(group, base->object, scene, base);
else
@@ -91,7 +91,7 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "Skipped some groups because of cycle detected");
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -108,14 +108,14 @@ void GROUP_OT_objects_add_active(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int objects_remove_active_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Object *ob= OBACT;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = OBACT;
Group *group;
int ok = 0;
@@ -124,10 +124,10 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op)
/* linking to same group requires its own loop so we can avoid
* looking up the active objects groups each time */
- for (group= bmain->group.first; group; group=group->id.next) {
+ for (group = bmain->group.first; group; group = group->id.next) {
if (object_in_group(ob, group)) {
/* Assign groups to selected objects */
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
rem_from_group(group, base->object, scene, base);
ok = 1;
}
@@ -138,7 +138,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op)
if (!ok) BKE_report(op->reports, RPT_ERROR, "Active Object contains no groups");
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -155,16 +155,16 @@ void GROUP_OT_objects_remove_active(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int group_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Group *group= NULL;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Group *group = NULL;
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
group = NULL;
while ((group = find_group(base->object, group)))
rem_from_group(group, base->object, scene, base);
@@ -172,7 +172,7 @@ static int group_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
CTX_DATA_END;
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -189,27 +189,27 @@ void GROUP_OT_objects_remove(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int group_create_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Group *group= NULL;
- char name[MAX_ID_NAME-2]; /* id name */
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Group *group = NULL;
+ char name[MAX_ID_NAME - 2]; /* id name */
RNA_string_get(op->ptr, "name", name);
- group= add_group(name);
+ group = add_group(name);
- CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
add_to_group(group, base->object, scene, base);
}
CTX_DATA_END;
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
@@ -226,26 +226,26 @@ void GROUP_OT_create(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- RNA_def_string(ot->srna, "name", "Group", MAX_ID_NAME-2, "Name", "Name of the new group");
+ RNA_def_string(ot->srna, "name", "Group", MAX_ID_NAME - 2, "Name", "Name of the new group");
}
/****************** properties window operators *********************/
static int group_add_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_context(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = ED_object_context(C);
Group *group;
if (ob == NULL)
return OPERATOR_CANCELLED;
- group= add_group("Group");
+ group = add_group("Group");
add_to_group(group, ob, scene, NULL);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
}
@@ -261,21 +261,21 @@ void OBJECT_OT_group_add(wmOperatorType *ot)
ot->exec = group_add_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int group_link_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_context(C);
- Group *group= BLI_findlink(&CTX_data_main(C)->group, RNA_enum_get(op->ptr, "group"));
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = ED_object_context(C);
+ Group *group = BLI_findlink(&CTX_data_main(C)->group, RNA_enum_get(op->ptr, "group"));
if (ELEM(NULL, ob, group))
return OPERATOR_CANCELLED;
add_to_group(group, ob, scene, NULL);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
}
@@ -294,26 +294,26 @@ void OBJECT_OT_group_link(wmOperatorType *ot)
ot->invoke = WM_enum_search_invoke;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "");
+ prop = RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "");
RNA_def_enum_funcs(prop, RNA_group_local_itemf);
ot->prop = prop;
}
static int group_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_context(C);
- Group *group= CTX_data_pointer_get_type(C, "group", &RNA_Group).data;
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = ED_object_context(C);
+ Group *group = CTX_data_pointer_get_type(C, "group", &RNA_Group).data;
if (!ob || !group)
return OPERATOR_CANCELLED;
rem_from_group(group, ob, scene, NULL); /* base will be used if found */
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
}
@@ -328,6 +328,6 @@ void OBJECT_OT_group_remove(wmOperatorType *ot)
ot->exec = group_remove_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index ef428b5b1b7..4ffc3e8c19f 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -76,27 +76,27 @@ static int return_editmesh_indexar(BMEditMesh *em, int *tot, int **indexar, floa
{
BMVert *eve;
BMIter iter;
- int *index, nr, totvert=0;
+ int *index, nr, totvert = 0;
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) totvert++;
}
- if (totvert==0) return 0;
+ if (totvert == 0) return 0;
- *indexar= index= MEM_mallocN(4*totvert, "hook indexar");
- *tot= totvert;
- nr= 0;
+ *indexar = index = MEM_mallocN(4 * totvert, "hook indexar");
+ *tot = totvert;
+ nr = 0;
zero_v3(cent);
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
- *index= nr; index++;
+ *index = nr; index++;
add_v3_v3(cent, eve->co);
}
nr++;
}
- mul_v3_fl(cent, 1.0f/(float)totvert);
+ mul_v3_fl(cent, 1.0f / (float)totvert);
return totvert;
}
@@ -106,8 +106,8 @@ static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, fl
zero_v3(cent);
if (obedit->actdef) {
- const int defgrp_index= obedit->actdef-1;
- int totvert=0;
+ const int defgrp_index = obedit->actdef - 1;
+ int totvert = 0;
MDeformVert *dvert;
BMVert *eve;
@@ -115,7 +115,7 @@ static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, fl
/* find the vertices */
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
- dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+ dvert = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
if (dvert) {
if (defvert_find_weight(dvert, defgrp_index) > 0.0f) {
@@ -127,7 +127,7 @@ static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, fl
if (totvert) {
bDeformGroup *dg = BLI_findlink(&obedit->defbase, defgrp_index);
BLI_strncpy(name, dg->name, sizeof(dg->name));
- mul_v3_fl(cent, 1.0f/(float)totvert);
+ mul_v3_fl(cent, 1.0f / (float)totvert);
return 1;
}
}
@@ -137,19 +137,19 @@ static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, fl
static void select_editbmesh_hook(Object *ob, HookModifierData *hmd)
{
- Mesh *me= ob->data;
- BMEditMesh *em= me->edit_btmesh;
+ Mesh *me = ob->data;
+ BMEditMesh *em = me->edit_btmesh;
BMVert *eve;
BMIter iter;
- int index=0, nr=0;
+ int index = 0, nr = 0;
if (hmd->indexar == NULL)
return;
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
- if (nr==hmd->indexar[index]) {
+ if (nr == hmd->indexar[index]) {
BM_vert_select_set(em->bm, eve, TRUE);
- if (index < hmd->totindex-1) index++;
+ if (index < hmd->totindex - 1) index++;
}
nr++;
@@ -161,31 +161,31 @@ static void select_editbmesh_hook(Object *ob, HookModifierData *hmd)
static int return_editlattice_indexar(Lattice *editlatt, int *tot, int **indexar, float *cent)
{
BPoint *bp;
- int *index, nr, totvert=0, a;
+ int *index, nr, totvert = 0, a;
/* count */
- a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw;
- bp= editlatt->def;
+ a = editlatt->pntsu * editlatt->pntsv * editlatt->pntsw;
+ bp = editlatt->def;
while (a--) {
if (bp->f1 & SELECT) {
- if (bp->hide==0) totvert++;
+ if (bp->hide == 0) totvert++;
}
bp++;
}
- if (totvert==0) return 0;
+ if (totvert == 0) return 0;
- *indexar= index= MEM_mallocN(4*totvert, "hook indexar");
- *tot= totvert;
- nr= 0;
+ *indexar = index = MEM_mallocN(4 * totvert, "hook indexar");
+ *tot = totvert;
+ nr = 0;
zero_v3(cent);
- a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw;
- bp= editlatt->def;
+ a = editlatt->pntsu * editlatt->pntsv * editlatt->pntsw;
+ bp = editlatt->def;
while (a--) {
if (bp->f1 & SELECT) {
- if (bp->hide==0) {
- *index= nr; index++;
+ if (bp->hide == 0) {
+ *index = nr; index++;
add_v3_v3(cent, bp->vec);
}
}
@@ -193,25 +193,25 @@ static int return_editlattice_indexar(Lattice *editlatt, int *tot, int **indexar
nr++;
}
- mul_v3_fl(cent, 1.0f/(float)totvert);
+ mul_v3_fl(cent, 1.0f / (float)totvert);
return totvert;
}
static void select_editlattice_hook(Object *obedit, HookModifierData *hmd)
{
- Lattice *lt= obedit->data, *editlt;
+ Lattice *lt = obedit->data, *editlt;
BPoint *bp;
- int index=0, nr=0, a;
+ int index = 0, nr = 0, a;
- editlt= lt->editlatt->latt;
+ editlt = lt->editlatt->latt;
/* count */
- a= editlt->pntsu*editlt->pntsv*editlt->pntsw;
- bp= editlt->def;
+ a = editlt->pntsu * editlt->pntsv * editlt->pntsw;
+ bp = editlt->def;
while (a--) {
- if (hmd->indexar[index]==nr) {
+ if (hmd->indexar[index] == nr) {
bp->f1 |= SELECT;
- if (index < hmd->totindex-1) index++;
+ if (index < hmd->totindex - 1) index++;
}
nr++;
bp++;
@@ -220,16 +220,16 @@ static void select_editlattice_hook(Object *obedit, HookModifierData *hmd)
static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, float *cent)
{
- ListBase *editnurb= object_editcurve_get(obedit);
+ ListBase *editnurb = object_editcurve_get(obedit);
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
- int *index, a, nr, totvert=0;
+ int *index, a, nr, totvert = 0;
- for (nu= editnurb->first; nu; nu= nu->next) {
+ for (nu = editnurb->first; nu; nu = nu->next) {
if (nu->type == CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
+ bezt = nu->bezt;
+ a = nu->pntsu;
while (a--) {
if (bezt->f1 & SELECT) totvert++;
if (bezt->f2 & SELECT) totvert++;
@@ -238,38 +238,38 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
}
}
else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
+ bp = nu->bp;
+ a = nu->pntsu * nu->pntsv;
while (a--) {
if (bp->f1 & SELECT) totvert++;
bp++;
}
}
}
- if (totvert==0) return 0;
+ if (totvert == 0) return 0;
- *indexar= index= MEM_mallocN(4*totvert, "hook indexar");
- *tot= totvert;
- nr= 0;
+ *indexar = index = MEM_mallocN(4 * totvert, "hook indexar");
+ *tot = totvert;
+ nr = 0;
zero_v3(cent);
- for (nu= editnurb->first; nu; nu= nu->next) {
+ for (nu = editnurb->first; nu; nu = nu->next) {
if (nu->type == CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
+ bezt = nu->bezt;
+ a = nu->pntsu;
while (a--) {
if (bezt->f1 & SELECT) {
- *index= nr; index++;
+ *index = nr; index++;
add_v3_v3(cent, bezt->vec[0]);
}
nr++;
if (bezt->f2 & SELECT) {
- *index= nr; index++;
+ *index = nr; index++;
add_v3_v3(cent, bezt->vec[1]);
}
nr++;
if (bezt->f3 & SELECT) {
- *index= nr; index++;
+ *index = nr; index++;
add_v3_v3(cent, bezt->vec[2]);
}
nr++;
@@ -277,11 +277,11 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
}
}
else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
+ bp = nu->bp;
+ a = nu->pntsu * nu->pntsv;
while (a--) {
if (bp->f1 & SELECT) {
- *index= nr; index++;
+ *index = nr; index++;
add_v3_v3(cent, bp->vec);
}
nr++;
@@ -290,21 +290,21 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
}
}
- mul_v3_fl(cent, 1.0f/(float)totvert);
+ mul_v3_fl(cent, 1.0f / (float)totvert);
return totvert;
}
static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int **indexar, char *name, float *cent_r)
{
- *indexar= NULL;
- *tot= 0;
- name[0]= 0;
+ *indexar = NULL;
+ *tot = 0;
+ name[0] = 0;
- switch(obedit->type) {
+ switch (obedit->type) {
case OB_MESH:
{
- Mesh *me= obedit->data;
+ Mesh *me = obedit->data;
BMEditMesh *em;
@@ -314,7 +314,7 @@ static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int *
em = me->edit_btmesh;
/* check selected vertices first */
- if ( return_editmesh_indexar(em, tot, indexar, cent_r)) {
+ if (return_editmesh_indexar(em, tot, indexar, cent_r)) {
return 1;
}
else {
@@ -327,7 +327,7 @@ static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int *
return return_editcurve_indexar(obedit, tot, indexar, cent_r);
case OB_LATTICE:
{
- Lattice *lt= obedit->data;
+ Lattice *lt = obedit->data;
return return_editlattice_indexar(lt->editlatt->latt, tot, indexar, cent_r);
}
default:
@@ -337,30 +337,30 @@ static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int *
static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
{
- ListBase *editnurb= object_editcurve_get(obedit);
+ ListBase *editnurb = object_editcurve_get(obedit);
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
- int index=0, a, nr=0;
+ int index = 0, a, nr = 0;
- for (nu= editnurb->first; nu; nu= nu->next) {
+ for (nu = editnurb->first; nu; nu = nu->next) {
if (nu->type == CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
+ bezt = nu->bezt;
+ a = nu->pntsu;
while (a--) {
if (nr == hmd->indexar[index]) {
bezt->f1 |= SELECT;
- if (index<hmd->totindex-1) index++;
+ if (index < hmd->totindex - 1) index++;
}
nr++;
if (nr == hmd->indexar[index]) {
bezt->f2 |= SELECT;
- if (index<hmd->totindex-1) index++;
+ if (index < hmd->totindex - 1) index++;
}
nr++;
if (nr == hmd->indexar[index]) {
bezt->f3 |= SELECT;
- if (index<hmd->totindex-1) index++;
+ if (index < hmd->totindex - 1) index++;
}
nr++;
@@ -368,12 +368,12 @@ static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
}
}
else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
+ bp = nu->bp;
+ a = nu->pntsu * nu->pntsv;
while (a--) {
if (nr == hmd->indexar[index]) {
bp->f1 |= SELECT;
- if (index<hmd->totindex-1) index++;
+ if (index < hmd->totindex - 1) index++;
}
nr++;
bp++;
@@ -387,17 +387,17 @@ static void object_hook_select(Object *ob, HookModifierData *hmd)
if (hmd->indexar == NULL)
return;
- if (ob->type==OB_MESH) select_editbmesh_hook(ob, hmd);
- else if (ob->type==OB_LATTICE) select_editlattice_hook(ob, hmd);
- else if (ob->type==OB_CURVE) select_editcurve_hook(ob, hmd);
- else if (ob->type==OB_SURF) select_editcurve_hook(ob, hmd);
+ if (ob->type == OB_MESH) select_editbmesh_hook(ob, hmd);
+ else if (ob->type == OB_LATTICE) select_editlattice_hook(ob, hmd);
+ else if (ob->type == OB_CURVE) select_editcurve_hook(ob, hmd);
+ else if (ob->type == OB_SURF) select_editcurve_hook(ob, hmd);
}
/* special poll operators for hook operators */
// TODO: check for properties window modifier context too as alternative?
static int hook_op_edit_poll(bContext *C)
{
- Object *obedit= CTX_data_edit_object(C);
+ Object *obedit = CTX_data_edit_object(C);
if (obedit) {
if (ED_operator_editmesh(C)) return 1;
@@ -414,7 +414,7 @@ static Object *add_hook_object_new(Scene *scene, Object *obedit)
Base *base, *basedit;
Object *ob;
- ob= add_object(scene, OB_EMPTY);
+ ob = add_object(scene, OB_EMPTY);
basedit = object_in_scene(obedit, scene);
base = object_in_scene(ob, scene);
@@ -429,7 +429,7 @@ static Object *add_hook_object_new(Scene *scene, Object *obedit)
static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob, int mode)
{
- ModifierData *md=NULL;
+ ModifierData *md = NULL;
HookModifierData *hmd = NULL;
float cent[3];
int tot, ok, *indexar;
@@ -437,9 +437,9 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o
ok = object_hook_index_array(scene, obedit, &tot, &indexar, name, cent);
- if (!ok) return; // XXX error("Requires selected vertices or active Vertex Group");
+ if (!ok) return; // XXX error("Requires selected vertices or active Vertex Group");
- if (mode==OBJECT_ADDHOOK_NEWOB && !ob) {
+ if (mode == OBJECT_ADDHOOK_NEWOB && !ob) {
ob = add_hook_object_new(scene, obedit);
@@ -448,19 +448,19 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o
}
md = obedit->modifiers.first;
- while (md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform) {
+ while (md && modifierType_getInfo(md->type)->type == eModifierTypeType_OnlyDeform) {
md = md->next;
}
- hmd = (HookModifierData*) modifier_new(eModifierType_Hook);
+ hmd = (HookModifierData *) modifier_new(eModifierType_Hook);
BLI_insertlinkbefore(&obedit->modifiers, md, hmd);
- BLI_snprintf(hmd->modifier.name, sizeof(hmd->modifier.name), "Hook-%s", ob->id.name+2);
- modifier_unique_name(&obedit->modifiers, (ModifierData*)hmd);
+ BLI_snprintf(hmd->modifier.name, sizeof(hmd->modifier.name), "Hook-%s", ob->id.name + 2);
+ modifier_unique_name(&obedit->modifiers, (ModifierData *)hmd);
- hmd->object= ob;
- hmd->indexar= indexar;
+ hmd->object = ob;
+ hmd->indexar = indexar;
copy_v3_v3(hmd->cent, cent);
- hmd->totindex= tot;
+ hmd->totindex = tot;
BLI_strncpy(hmd->name, name, sizeof(hmd->name));
/* matrix calculus */
@@ -478,13 +478,12 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o
static int object_add_hook_selob_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
- Object *obsel=NULL;
+ Object *obsel = NULL;
- CTX_DATA_BEGIN(C, Object*, ob, selected_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
if (ob != obedit) {
obsel = ob;
break;
@@ -499,7 +498,7 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op)
add_hook_object(bmain, scene, obedit, obsel, OBJECT_ADDHOOK_SELOB);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, obedit);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obedit);
return OPERATOR_FINISHED;
}
@@ -515,19 +514,19 @@ void OBJECT_OT_hook_add_selobj(wmOperatorType *ot)
ot->poll = hook_op_edit_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int object_add_hook_newob_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
add_hook_object(bmain, scene, obedit, NULL, OBJECT_ADDHOOK_NEWOB);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, obedit);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obedit);
return OPERATOR_FINISHED;
}
@@ -543,14 +542,14 @@ void OBJECT_OT_hook_add_newobj(wmOperatorType *ot)
ot->poll = hook_op_edit_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int object_hook_remove_exec(bContext *C, wmOperator *op)
{
- int num= RNA_enum_get(op->ptr, "modifier");
- Object *ob=NULL;
- HookModifierData *hmd=NULL;
+ int num = RNA_enum_get(op->ptr, "modifier");
+ Object *ob = NULL;
+ HookModifierData *hmd = NULL;
ob = CTX_data_edit_object(C);
hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
@@ -566,7 +565,7 @@ static int object_hook_remove_exec(bContext *C, wmOperator *op)
modifier_free((ModifierData *)hmd);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -575,25 +574,25 @@ static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *UNUSED(ptr), Pr
{
Object *ob = CTX_data_edit_object(C);
EnumPropertyItem tmp = {0, "", 0, "", ""};
- EnumPropertyItem *item= NULL;
+ EnumPropertyItem *item = NULL;
ModifierData *md = NULL;
- int a, totitem= 0;
+ int a, totitem = 0;
if (!ob)
return DummyRNA_NULL_items;
- for (a=0, md=ob->modifiers.first; md; md= md->next, a++) {
- if (md->type==eModifierType_Hook) {
- tmp.value= a;
+ for (a = 0, md = ob->modifiers.first; md; md = md->next, a++) {
+ if (md->type == eModifierType_Hook) {
+ tmp.value = a;
tmp.icon = ICON_HOOK;
- tmp.identifier= md->name;
- tmp.name= md->name;
+ tmp.identifier = md->name;
+ tmp.name = md->name;
RNA_enum_item_add(&item, &totitem, &tmp);
}
}
RNA_enum_item_end(&item, &totitem);
- *free= 1;
+ *free = 1;
return item;
}
@@ -615,26 +614,26 @@ void OBJECT_OT_hook_remove(wmOperatorType *ot)
/* flags */
/* this operator removes modifier which isn't stored in local undo stack,
* so redoing it from redo panel gives totally weird results */
- ot->flag = /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
+ ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove");
+ prop = RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove");
RNA_def_enum_funcs(prop, hook_mod_itemf);
ot->prop = prop;
}
static int object_hook_reset_exec(bContext *C, wmOperator *op)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
- int num= RNA_enum_get(op->ptr, "modifier");
- Object *ob=NULL;
- HookModifierData *hmd=NULL;
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
+ int num = RNA_enum_get(op->ptr, "modifier");
+ Object *ob = NULL;
+ HookModifierData *hmd = NULL;
- if (ptr.data) { /* if modifier context is available, use that */
+ if (ptr.data) { /* if modifier context is available, use that */
ob = ptr.id.data;
- hmd= ptr.data;
+ hmd = ptr.data;
}
- else { /* use the provided property */
+ else { /* use the provided property */
ob = CTX_data_edit_object(C);
hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
}
@@ -645,7 +644,7 @@ static int object_hook_reset_exec(bContext *C, wmOperator *op)
/* reset functionality */
if (hmd->object) {
- bPoseChannel *pchan= get_pose_channel(hmd->object->pose, hmd->subtarget);
+ bPoseChannel *pchan = get_pose_channel(hmd->object->pose, hmd->subtarget);
if (hmd->subtarget[0] && pchan) {
float imat[4][4], mat[4][4];
@@ -663,7 +662,7 @@ static int object_hook_reset_exec(bContext *C, wmOperator *op)
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -682,27 +681,27 @@ void OBJECT_OT_hook_reset(wmOperatorType *ot)
ot->poll = hook_op_edit_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to");
+ prop = RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to");
RNA_def_enum_funcs(prop, hook_mod_itemf);
}
static int object_hook_recenter_exec(bContext *C, wmOperator *op)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
- int num= RNA_enum_get(op->ptr, "modifier");
- Object *ob=NULL;
- HookModifierData *hmd=NULL;
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
+ int num = RNA_enum_get(op->ptr, "modifier");
+ Object *ob = NULL;
+ HookModifierData *hmd = NULL;
Scene *scene = CTX_data_scene(C);
float bmat[3][3], imat[3][3];
- if (ptr.data) { /* if modifier context is available, use that */
+ if (ptr.data) { /* if modifier context is available, use that */
ob = ptr.id.data;
- hmd= ptr.data;
+ hmd = ptr.data;
}
- else { /* use the provided property */
+ else { /* use the provided property */
ob = CTX_data_edit_object(C);
hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
}
@@ -719,7 +718,7 @@ static int object_hook_recenter_exec(bContext *C, wmOperator *op)
mul_m3_v3(imat, hmd->cent);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -738,29 +737,29 @@ void OBJECT_OT_hook_recenter(wmOperatorType *ot)
ot->poll = hook_op_edit_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to");
+ prop = RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to");
RNA_def_enum_funcs(prop, hook_mod_itemf);
}
static int object_hook_assign_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
- int num= RNA_enum_get(op->ptr, "modifier");
- Object *ob=NULL;
- HookModifierData *hmd=NULL;
+ Scene *scene = CTX_data_scene(C);
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
+ int num = RNA_enum_get(op->ptr, "modifier");
+ Object *ob = NULL;
+ HookModifierData *hmd = NULL;
float cent[3];
char name[MAX_NAME];
int *indexar, tot;
- if (ptr.data) { /* if modifier context is available, use that */
+ if (ptr.data) { /* if modifier context is available, use that */
ob = ptr.id.data;
- hmd= ptr.data;
+ hmd = ptr.data;
}
- else { /* use the provided property */
+ else { /* use the provided property */
ob = CTX_data_edit_object(C);
hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
}
@@ -779,11 +778,11 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op)
MEM_freeN(hmd->indexar);
copy_v3_v3(hmd->cent, cent);
- hmd->indexar= indexar;
- hmd->totindex= tot;
+ hmd->indexar = indexar;
+ hmd->totindex = tot;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -804,25 +803,25 @@ void OBJECT_OT_hook_assign(wmOperatorType *ot)
/* flags */
/* this operator changes data stored in modifier which doesn't get pushed to undo stack,
* so redoing it from redo panel gives totally weird results */
- ot->flag = /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
+ ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to");
+ prop = RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to");
RNA_def_enum_funcs(prop, hook_mod_itemf);
}
static int object_hook_select_exec(bContext *C, wmOperator *op)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
- int num= RNA_enum_get(op->ptr, "modifier");
- Object *ob=NULL;
- HookModifierData *hmd=NULL;
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
+ int num = RNA_enum_get(op->ptr, "modifier");
+ Object *ob = NULL;
+ HookModifierData *hmd = NULL;
- if (ptr.data) { /* if modifier context is available, use that */
+ if (ptr.data) { /* if modifier context is available, use that */
ob = ptr.id.data;
- hmd= ptr.data;
+ hmd = ptr.data;
}
- else { /* use the provided property */
+ else { /* use the provided property */
ob = CTX_data_edit_object(C);
hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
}
@@ -834,7 +833,7 @@ static int object_hook_select_exec(bContext *C, wmOperator *op)
/* select functionality */
object_hook_select(ob, hmd);
- WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
return OPERATOR_FINISHED;
}
@@ -853,10 +852,10 @@ void OBJECT_OT_hook_select(wmOperatorType *ot)
ot->poll = hook_op_edit_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove");
+ prop = RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove");
RNA_def_enum_funcs(prop, hook_mod_itemf);
}
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 8ba64e66025..28de0b4b33f 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -185,7 +185,7 @@ void CONSTRAINT_OT_limitdistance_reset(struct wmOperatorType *ot);
void CONSTRAINT_OT_childof_set_inverse(struct wmOperatorType *ot);
void CONSTRAINT_OT_childof_clear_inverse(struct wmOperatorType *ot);
void CONSTRAINT_OT_objectsolver_set_inverse(struct wmOperatorType *ot);
-void CONSTRAINT_OT_objectsolver_clear_inverse (struct wmOperatorType *ot);
+void CONSTRAINT_OT_objectsolver_clear_inverse(struct wmOperatorType *ot);
/* object_vgroup.c */
void OBJECT_OT_vertex_group_add(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c
index 4ba62541c60..648f530881a 100644
--- a/source/blender/editors/object/object_lattice.c
+++ b/source/blender/editors/object/object_lattice.c
@@ -68,45 +68,45 @@
void free_editLatt(Object *ob)
{
- Lattice *lt= ob->data;
+ Lattice *lt = ob->data;
if (lt->editlatt) {
- Lattice *editlt= lt->editlatt->latt;
+ Lattice *editlt = lt->editlatt->latt;
if (editlt->def)
MEM_freeN(editlt->def);
if (editlt->dvert)
- free_dverts(editlt->dvert, editlt->pntsu*editlt->pntsv*editlt->pntsw);
+ free_dverts(editlt->dvert, editlt->pntsu * editlt->pntsv * editlt->pntsw);
MEM_freeN(editlt);
MEM_freeN(lt->editlatt);
- lt->editlatt= NULL;
+ lt->editlatt = NULL;
}
}
void make_editLatt(Object *obedit)
{
- Lattice *lt= obedit->data;
+ Lattice *lt = obedit->data;
KeyBlock *actkey;
free_editLatt(obedit);
- actkey= ob_get_keyblock(obedit);
+ actkey = ob_get_keyblock(obedit);
if (actkey)
key_to_latt(actkey, lt);
- lt->editlatt= MEM_callocN(sizeof(EditLatt), "editlatt");
- lt->editlatt->latt= MEM_dupallocN(lt);
- lt->editlatt->latt->def= MEM_dupallocN(lt->def);
+ lt->editlatt = MEM_callocN(sizeof(EditLatt), "editlatt");
+ lt->editlatt->latt = MEM_dupallocN(lt);
+ lt->editlatt->latt->def = MEM_dupallocN(lt->def);
if (lt->dvert) {
- int tot= lt->pntsu*lt->pntsv*lt->pntsw;
- lt->editlatt->latt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
+ int tot = lt->pntsu * lt->pntsv * lt->pntsw;
+ lt->editlatt->latt->dvert = MEM_mallocN(sizeof (MDeformVert) * tot, "Lattice MDeformVert");
copy_dverts(lt->editlatt->latt->dvert, lt->dvert, tot);
}
- if (lt->key) lt->editlatt->shapenr= obedit->shapenr;
+ if (lt->key) lt->editlatt->shapenr = obedit->shapenr;
}
void load_editLatt(Object *obedit)
@@ -117,52 +117,52 @@ void load_editLatt(Object *obedit)
float *fp;
int tot;
- lt= obedit->data;
- editlt= lt->editlatt->latt;
+ lt = obedit->data;
+ editlt = lt->editlatt->latt;
if (lt->editlatt->shapenr) {
- actkey= BLI_findlink(&lt->key->block, lt->editlatt->shapenr-1);
+ actkey = BLI_findlink(&lt->key->block, lt->editlatt->shapenr - 1);
/* active key: vertices */
- tot= editlt->pntsu*editlt->pntsv*editlt->pntsw;
+ tot = editlt->pntsu * editlt->pntsv * editlt->pntsw;
if (actkey->data) MEM_freeN(actkey->data);
- fp=actkey->data= MEM_callocN(lt->key->elemsize*tot, "actkey->data");
- actkey->totelem= tot;
+ fp = actkey->data = MEM_callocN(lt->key->elemsize * tot, "actkey->data");
+ actkey->totelem = tot;
- bp= editlt->def;
+ bp = editlt->def;
while (tot--) {
copy_v3_v3(fp, bp->vec);
- fp+= 3;
+ fp += 3;
bp++;
}
}
else {
MEM_freeN(lt->def);
- lt->def= MEM_dupallocN(editlt->def);
+ lt->def = MEM_dupallocN(editlt->def);
- lt->flag= editlt->flag;
+ lt->flag = editlt->flag;
- lt->pntsu= editlt->pntsu;
- lt->pntsv= editlt->pntsv;
- lt->pntsw= editlt->pntsw;
+ lt->pntsu = editlt->pntsu;
+ lt->pntsv = editlt->pntsv;
+ lt->pntsw = editlt->pntsw;
- lt->typeu= editlt->typeu;
- lt->typev= editlt->typev;
- lt->typew= editlt->typew;
+ lt->typeu = editlt->typeu;
+ lt->typev = editlt->typev;
+ lt->typew = editlt->typew;
}
if (lt->dvert) {
- free_dverts(lt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
- lt->dvert= NULL;
+ free_dverts(lt->dvert, lt->pntsu * lt->pntsv * lt->pntsw);
+ lt->dvert = NULL;
}
if (editlt->dvert) {
- tot= lt->pntsu*lt->pntsv*lt->pntsw;
+ tot = lt->pntsu * lt->pntsv * lt->pntsw;
- lt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
+ lt->dvert = MEM_mallocN(sizeof (MDeformVert) * tot, "Lattice MDeformVert");
copy_dverts(lt->dvert, editlt->dvert, tot);
}
}
@@ -171,17 +171,17 @@ void load_editLatt(Object *obedit)
void ED_setflagsLatt(Object *obedit, int flag)
{
- Lattice *lt= obedit->data;
+ Lattice *lt = obedit->data;
BPoint *bp;
int a;
- bp= lt->editlatt->latt->def;
+ bp = lt->editlatt->latt->def;
- a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
+ a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
while (a--) {
- if (bp->hide==0) {
- bp->f1= flag;
+ if (bp->hide == 0) {
+ bp->f1 = flag;
}
bp++;
}
@@ -189,8 +189,8 @@ void ED_setflagsLatt(Object *obedit, int flag)
static int lattice_select_all_exec(bContext *C, wmOperator *op)
{
- Object *obedit= CTX_data_edit_object(C);
- Lattice *lt= obedit->data;
+ Object *obedit = CTX_data_edit_object(C);
+ Lattice *lt = obedit->data;
BPoint *bp;
int a;
int action = RNA_enum_get(op->ptr, "action");
@@ -198,11 +198,11 @@ static int lattice_select_all_exec(bContext *C, wmOperator *op)
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
- bp= lt->editlatt->latt->def;
- a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
+ bp = lt->editlatt->latt->def;
+ a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
while (a--) {
- if (bp->hide==0) {
+ if (bp->hide == 0) {
if (bp->f1) {
action = SEL_DESELECT;
break;
@@ -213,26 +213,26 @@ static int lattice_select_all_exec(bContext *C, wmOperator *op)
}
switch (action) {
- case SEL_SELECT:
- ED_setflagsLatt(obedit, 1);
- break;
- case SEL_DESELECT:
- ED_setflagsLatt(obedit, 0);
- break;
- case SEL_INVERT:
- bp= lt->editlatt->latt->def;
- a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
-
- while (a--) {
- if (bp->hide==0) {
- bp->f1 ^= 1;
+ case SEL_SELECT:
+ ED_setflagsLatt(obedit, 1);
+ break;
+ case SEL_DESELECT:
+ ED_setflagsLatt(obedit, 0);
+ break;
+ case SEL_INVERT:
+ bp = lt->editlatt->latt->def;
+ a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
+
+ while (a--) {
+ if (bp->hide == 0) {
+ bp->f1 ^= 1;
+ }
+ bp++;
}
- bp++;
- }
- break;
+ break;
}
- WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
}
@@ -249,7 +249,7 @@ void LATTICE_OT_select_all(wmOperatorType *ot)
ot->poll = ED_operator_editlattice;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
@@ -260,27 +260,27 @@ static int make_regular_poll(bContext *C)
if (ED_operator_editlattice(C)) return 1;
- ob= CTX_data_active_object(C);
- return (ob && ob->type==OB_LATTICE);
+ ob = CTX_data_active_object(C);
+ return (ob && ob->type == OB_LATTICE);
}
static int make_regular_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= CTX_data_edit_object(C);
+ Object *ob = CTX_data_edit_object(C);
Lattice *lt;
if (ob) {
- lt= ob->data;
+ lt = ob->data;
resizelattice(lt->editlatt->latt, lt->pntsu, lt->pntsv, lt->pntsw, NULL);
}
else {
- ob= CTX_data_active_object(C);
- lt= ob->data;
+ ob = CTX_data_active_object(C);
+ lt = ob->data;
resizelattice(lt, lt->pntsu, lt->pntsv, lt->pntsw, NULL);
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -297,7 +297,7 @@ void LATTICE_OT_make_regular(wmOperatorType *ot)
ot->poll = make_regular_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/****************************** Mouse Selection *************************/
@@ -305,12 +305,12 @@ void LATTICE_OT_make_regular(wmOperatorType *ot)
static void findnearestLattvert__doClosest(void *userData, BPoint *bp, int x, int y)
{
struct { BPoint *bp; short dist, select; int mval[2]; } *data = userData;
- float temp = abs(data->mval[0]-x) + abs(data->mval[1]-y);
+ float temp = abs(data->mval[0] - x) + abs(data->mval[1] - y);
- if ((bp->f1 & SELECT)==data->select)
+ if ((bp->f1 & SELECT) == data->select)
temp += 5;
- if (temp<data->dist) {
+ if (temp < data->dist) {
data->dist = temp;
data->bp = bp;
@@ -319,15 +319,15 @@ static void findnearestLattvert__doClosest(void *userData, BPoint *bp, int x, in
static BPoint *findnearestLattvert(ViewContext *vc, const int mval[2], int sel)
{
- /* sel==1: selected gets a disadvantage */
- /* in nurb and bezt or bp the nearest is written */
- /* return 0 1 2: handlepunt */
+ /* sel==1: selected gets a disadvantage */
+ /* in nurb and bezt or bp the nearest is written */
+ /* return 0 1 2: handlepunt */
struct { BPoint *bp; short dist, select; int mval[2]; } data = {NULL};
data.dist = 100;
data.select = sel;
- data.mval[0]= mval[0];
- data.mval[1]= mval[1];
+ data.mval[0] = mval[0];
+ data.mval[1] = mval[1];
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
lattice_foreachScreenVert(vc, findnearestLattvert__doClosest, &data);
@@ -338,20 +338,20 @@ static BPoint *findnearestLattvert(ViewContext *vc, const int mval[2], int sel)
int mouse_lattice(bContext *C, const int mval[2], int extend)
{
ViewContext vc;
- BPoint *bp= NULL;
+ BPoint *bp = NULL;
view3d_set_viewcontext(C, &vc);
- bp= findnearestLattvert(&vc, mval, 1);
+ bp = findnearestLattvert(&vc, mval, 1);
if (bp) {
- if (extend==0) {
+ if (extend == 0) {
ED_setflagsLatt(vc.obedit, 0);
bp->f1 |= SELECT;
}
else
- bp->f1 ^= SELECT; /* swap */
+ bp->f1 ^= SELECT; /* swap */
- WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data);
return 1;
}
@@ -368,29 +368,29 @@ typedef struct UndoLattice {
static void undoLatt_to_editLatt(void *data, void *edata, void *UNUSED(obdata))
{
- UndoLattice *ult= (UndoLattice*)data;
- EditLatt *editlatt= (EditLatt *)edata;
- int a= editlatt->latt->pntsu*editlatt->latt->pntsv*editlatt->latt->pntsw;
+ UndoLattice *ult = (UndoLattice *)data;
+ EditLatt *editlatt = (EditLatt *)edata;
+ int a = editlatt->latt->pntsu * editlatt->latt->pntsv * editlatt->latt->pntsw;
- memcpy(editlatt->latt->def, ult->def, a*sizeof(BPoint));
+ memcpy(editlatt->latt->def, ult->def, a * sizeof(BPoint));
}
static void *editLatt_to_undoLatt(void *edata, void *UNUSED(obdata))
{
- UndoLattice *ult= MEM_callocN(sizeof(UndoLattice), "UndoLattice");
- EditLatt *editlatt= (EditLatt *)edata;
+ UndoLattice *ult = MEM_callocN(sizeof(UndoLattice), "UndoLattice");
+ EditLatt *editlatt = (EditLatt *)edata;
- ult->def= MEM_dupallocN(editlatt->latt->def);
- ult->pntsu= editlatt->latt->pntsu;
- ult->pntsv= editlatt->latt->pntsv;
- ult->pntsw= editlatt->latt->pntsw;
+ ult->def = MEM_dupallocN(editlatt->latt->def);
+ ult->pntsu = editlatt->latt->pntsu;
+ ult->pntsv = editlatt->latt->pntsv;
+ ult->pntsw = editlatt->latt->pntsw;
return ult;
}
static void free_undoLatt(void *data)
{
- UndoLattice *ult= (UndoLattice*)data;
+ UndoLattice *ult = (UndoLattice *)data;
if (ult->def) MEM_freeN(ult->def);
MEM_freeN(ult);
@@ -398,20 +398,20 @@ static void free_undoLatt(void *data)
static int validate_undoLatt(void *data, void *edata)
{
- UndoLattice *ult= (UndoLattice*)data;
- EditLatt *editlatt= (EditLatt *)edata;
+ UndoLattice *ult = (UndoLattice *)data;
+ EditLatt *editlatt = (EditLatt *)edata;
return (ult->pntsu == editlatt->latt->pntsu &&
- ult->pntsv == editlatt->latt->pntsv &&
- ult->pntsw == editlatt->latt->pntsw);
+ ult->pntsv == editlatt->latt->pntsv &&
+ ult->pntsw == editlatt->latt->pntsw);
}
static void *get_editlatt(bContext *C)
{
- Object *obedit= CTX_data_edit_object(C);
+ Object *obedit = CTX_data_edit_object(C);
- if (obedit && obedit->type==OB_LATTICE) {
- Lattice *lt= obedit->data;
+ if (obedit && obedit->type == OB_LATTICE) {
+ Lattice *lt = obedit->data;
return lt->editlatt;
}
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index cd2fa4f93b6..f2d682cd0cb 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -87,16 +87,16 @@
ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *scene, Object *ob, const char *name, int type)
{
- ModifierData *md=NULL, *new_md=NULL;
+ ModifierData *md = NULL, *new_md = NULL;
ModifierTypeInfo *mti = modifierType_getInfo(type);
/* only geometry objects should be able to get modifiers [#25291] */
if (!ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) {
- BKE_reportf(reports, RPT_WARNING, "Modifiers cannot be added to Object '%s'", ob->id.name+2);
+ BKE_reportf(reports, RPT_WARNING, "Modifiers cannot be added to Object '%s'", ob->id.name + 2);
return NULL;
}
- if (mti->flags&eModifierTypeFlag_Single) {
+ if (mti->flags & eModifierTypeFlag_Single) {
if (modifiers_findByType(ob, type)) {
BKE_report(reports, RPT_WARNING, "Only one modifier of this type allowed");
return NULL;
@@ -111,12 +111,12 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
}
else {
/* get new modifier data to add */
- new_md= modifier_new(type);
+ new_md = modifier_new(type);
- if (mti->flags&eModifierTypeFlag_RequiresOriginalData) {
+ if (mti->flags & eModifierTypeFlag_RequiresOriginalData) {
md = ob->modifiers.first;
- while (md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform)
+ while (md && modifierType_getInfo(md->type)->type == eModifierTypeType_OnlyDeform)
md = md->next;
BLI_insertlinkbefore(&ob->modifiers, md, new_md);
@@ -134,15 +134,15 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
/* special cases */
if (type == eModifierType_Softbody) {
if (!ob->soft) {
- ob->soft= sbNew(scene);
- ob->softflag |= OB_SB_GOAL|OB_SB_EDGES;
+ ob->soft = sbNew(scene);
+ ob->softflag |= OB_SB_GOAL | OB_SB_EDGES;
}
}
else if (type == eModifierType_Collision) {
if (!ob->pd)
- ob->pd= object_add_collision_fields(0);
+ ob->pd = object_add_collision_fields(0);
- ob->pd->deflect= 1;
+ ob->pd->deflect = 1;
DAG_scene_sort(bmain, scene);
}
else if (type == eModifierType_Surface)
@@ -164,8 +164,8 @@ static int object_modifier_remove(Object *ob, ModifierData *md, int *sort_depsgr
/* It seems on rapid delete it is possible to
* get called twice on same modifier, so make
* sure it is in list. */
- for (obmd=ob->modifiers.first; obmd; obmd=obmd->next)
- if (obmd==md)
+ for (obmd = ob->modifiers.first; obmd; obmd = obmd->next)
+ if (obmd == md)
break;
if (!obmd)
@@ -173,22 +173,22 @@ static int object_modifier_remove(Object *ob, ModifierData *md, int *sort_depsgr
/* special cases */
if (md->type == eModifierType_ParticleSystem) {
- ParticleSystemModifierData *psmd=(ParticleSystemModifierData*)md;
+ ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
BLI_remlink(&ob->particlesystem, psmd->psys);
psys_free(ob, psmd->psys);
- psmd->psys= NULL;
+ psmd->psys = NULL;
}
else if (md->type == eModifierType_Softbody) {
if (ob->soft) {
sbFree(ob->soft);
- ob->soft= NULL;
- ob->softflag= 0;
+ ob->soft = NULL;
+ ob->softflag = 0;
}
}
else if (md->type == eModifierType_Collision) {
if (ob->pd)
- ob->pd->deflect= 0;
+ ob->pd->deflect = 0;
*sort_depsgraph = 1;
}
@@ -202,13 +202,13 @@ static int object_modifier_remove(Object *ob, ModifierData *md, int *sort_depsgr
ob->dt = OB_TEXTURE;
}
else if (md->type == eModifierType_Multires) {
- int ok= 1;
+ int ok = 1;
ModifierData *tmpmd;
/* ensure MDISPS CustomData layer isn't used by another multires modifiers */
- for (tmpmd= ob->modifiers.first; tmpmd; tmpmd= tmpmd->next)
- if (tmpmd!=md && tmpmd->type == eModifierType_Multires) {
- ok= 0;
+ for (tmpmd = ob->modifiers.first; tmpmd; tmpmd = tmpmd->next)
+ if (tmpmd != md && tmpmd->type == eModifierType_Multires) {
+ ok = 0;
break;
}
@@ -218,7 +218,7 @@ static int object_modifier_remove(Object *ob, ModifierData *md, int *sort_depsgr
}
if (ELEM(md->type, eModifierType_Softbody, eModifierType_Cloth) &&
- ob->particlesystem.first == NULL) {
+ ob->particlesystem.first == NULL) {
ob->mode &= ~OB_MODE_PARTICLE_EDIT;
}
@@ -233,7 +233,7 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob
int sort_depsgraph = 0;
int ok;
- ok= object_modifier_remove(ob, md, &sort_depsgraph);
+ ok = object_modifier_remove(ob, md, &sort_depsgraph);
if (!ok) {
BKE_reportf(reports, RPT_ERROR, "Modifier '%s' not in object '%s'", ob->id.name, md->name);
@@ -260,11 +260,11 @@ void ED_object_modifier_clear(Main *bmain, Scene *scene, Object *ob)
while (md) {
ModifierData *next_md;
- next_md= md->next;
+ next_md = md->next;
object_modifier_remove(ob, md, &sort_depsgraph);
- md= next_md;
+ md = next_md;
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -279,10 +279,10 @@ int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md
if (md->prev) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- if (mti->type!=eModifierTypeType_OnlyDeform) {
+ if (mti->type != eModifierTypeType_OnlyDeform) {
ModifierTypeInfo *nmti = modifierType_getInfo(md->prev->type);
- if (nmti->flags&eModifierTypeFlag_RequiresOriginalData) {
+ if (nmti->flags & eModifierTypeFlag_RequiresOriginalData) {
BKE_report(reports, RPT_WARNING, "Cannot move above a modifier requiring original data");
return 0;
}
@@ -300,10 +300,10 @@ int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData *
if (md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- if (mti->flags&eModifierTypeFlag_RequiresOriginalData) {
+ if (mti->flags & eModifierTypeFlag_RequiresOriginalData) {
ModifierTypeInfo *nmti = modifierType_getInfo(md->next->type);
- if (nmti->type!=eModifierTypeType_OnlyDeform) {
+ if (nmti->type != eModifierTypeType_OnlyDeform) {
BKE_report(reports, RPT_WARNING, "Cannot move beyond a non-deforming modifier");
return 0;
}
@@ -326,72 +326,72 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
MVert *mvert;
MEdge *medge;
int a, k, kmax;
- int totvert=0, totedge=0, cvert=0;
- int totpart=0, totchild=0;
+ int totvert = 0, totedge = 0, cvert = 0;
+ int totpart = 0, totchild = 0;
if (md->type != eModifierType_ParticleSystem) return 0;
if (ob && ob->mode & OB_MODE_PARTICLE_EDIT) return 0;
- psys=((ParticleSystemModifierData *)md)->psys;
- part= psys->part;
+ psys = ((ParticleSystemModifierData *)md)->psys;
+ part = psys->part;
if (part->ren_as != PART_DRAW_PATH || psys->pathcache == NULL)
return 0;
- totpart= psys->totcached;
- totchild= psys->totchildcache;
+ totpart = psys->totcached;
+ totchild = psys->totchildcache;
- if (totchild && (part->draw&PART_DRAW_PARENT)==0)
- totpart= 0;
+ if (totchild && (part->draw & PART_DRAW_PARENT) == 0)
+ totpart = 0;
/* count */
- cache= psys->pathcache;
- for (a=0; a<totpart; a++) {
- key= cache[a];
+ cache = psys->pathcache;
+ for (a = 0; a < totpart; a++) {
+ key = cache[a];
if (key->steps > 0) {
- totvert+= key->steps+1;
- totedge+= key->steps;
+ totvert += key->steps + 1;
+ totedge += key->steps;
}
}
- cache= psys->childcache;
- for (a=0; a<totchild; a++) {
- key= cache[a];
+ cache = psys->childcache;
+ for (a = 0; a < totchild; a++) {
+ key = cache[a];
if (key->steps > 0) {
- totvert+= key->steps+1;
- totedge+= key->steps;
+ totvert += key->steps + 1;
+ totedge += key->steps;
}
}
- if (totvert==0) return 0;
+ if (totvert == 0) return 0;
/* add new mesh */
- obn= add_object(scene, OB_MESH);
- me= obn->data;
+ obn = add_object(scene, OB_MESH);
+ me = obn->data;
- me->totvert= totvert;
- me->totedge= totedge;
+ me->totvert = totvert;
+ me->totedge = totedge;
- me->mvert= CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, totvert);
- me->medge= CustomData_add_layer(&me->edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
- me->mface= CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, 0);
+ me->mvert = CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, totvert);
+ me->medge = CustomData_add_layer(&me->edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
+ me->mface = CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, 0);
- mvert= me->mvert;
- medge= me->medge;
+ mvert = me->mvert;
+ medge = me->medge;
/* copy coordinates */
- cache= psys->pathcache;
- for (a=0; a<totpart; a++) {
- key= cache[a];
- kmax= key->steps;
- for (k=0; k<=kmax; k++,key++,cvert++,mvert++) {
- copy_v3_v3(mvert->co,key->co);
+ cache = psys->pathcache;
+ for (a = 0; a < totpart; a++) {
+ key = cache[a];
+ kmax = key->steps;
+ for (k = 0; k <= kmax; k++, key++, cvert++, mvert++) {
+ copy_v3_v3(mvert->co, key->co);
if (k) {
- medge->v1= cvert-1;
- medge->v2= cvert;
- medge->flag= ME_EDGEDRAW|ME_EDGERENDER|ME_LOOSEEDGE;
+ medge->v1 = cvert - 1;
+ medge->v2 = cvert;
+ medge->flag = ME_EDGEDRAW | ME_EDGERENDER | ME_LOOSEEDGE;
medge++;
}
else {
@@ -401,16 +401,16 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
}
}
- cache=psys->childcache;
- for (a=0; a<totchild; a++) {
- key=cache[a];
- kmax=key->steps;
- for (k=0; k<=kmax; k++,key++,cvert++,mvert++) {
- copy_v3_v3(mvert->co,key->co);
+ cache = psys->childcache;
+ for (a = 0; a < totchild; a++) {
+ key = cache[a];
+ kmax = key->steps;
+ for (k = 0; k <= kmax; k++, key++, cvert++, mvert++) {
+ copy_v3_v3(mvert->co, key->co);
if (k) {
- medge->v1=cvert-1;
- medge->v2=cvert;
- medge->flag= ME_EDGEDRAW|ME_EDGERENDER|ME_LOOSEEDGE;
+ medge->v1 = cvert - 1;
+ medge->v2 = cvert;
+ medge->flag = ME_EDGEDRAW | ME_EDGERENDER | ME_LOOSEEDGE;
medge++;
}
else {
@@ -427,9 +427,9 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, ModifierData *md)
{
- ModifierTypeInfo *mti= modifierType_getInfo(md->type);
+ ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- md->scene= scene;
+ md->scene = scene;
if (mti->isDisabled && mti->isDisabled(md, 0)) {
BKE_report(reports, RPT_ERROR, "Modifier is disabled, skipping apply");
@@ -447,10 +447,10 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M
* and then predominantly stated in comments in a half dozen headers.
*/
- if (ob->type==OB_MESH) {
+ if (ob->type == OB_MESH) {
DerivedMesh *dm;
- Mesh *me= ob->data;
- Key *key=me->key;
+ Mesh *me = ob->data;
+ Key *key = me->key;
KeyBlock *kb;
if (!modifier_sameTopology(md) || mti->type == eModifierTypeType_NonGeometrical) {
@@ -465,15 +465,15 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M
}
if (key == NULL) {
- key= me->key= add_key((ID *)me);
- key->type= KEY_RELATIVE;
+ key = me->key = add_key((ID *)me);
+ key->type = KEY_RELATIVE;
/* if that was the first key block added, then it was the basis.
* Initialize it with the mesh, and add another for the modifier */
- kb= add_keyblock(key, NULL);
+ kb = add_keyblock(key, NULL);
mesh_to_key(me, kb);
}
- kb= add_keyblock(key, md->name);
+ kb = add_keyblock(key, md->name);
DM_to_meshkey(dm, me, kb);
dm->release(dm);
@@ -487,19 +487,19 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M
static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob, ModifierData *md)
{
- ModifierTypeInfo *mti= modifierType_getInfo(md->type);
+ ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- md->scene= scene;
+ md->scene = scene;
if (mti->isDisabled && mti->isDisabled(md, 0)) {
BKE_report(reports, RPT_ERROR, "Modifier is disabled, skipping apply");
return 0;
}
- if (ob->type==OB_MESH) {
+ if (ob->type == OB_MESH) {
DerivedMesh *dm;
Mesh *me = ob->data;
- MultiresModifierData *mmd= find_multires_modifier_before(scene, md);
+ MultiresModifierData *mmd = find_multires_modifier_before(scene, md);
if (me->key && mti->type != eModifierTypeType_NonGeometrical) {
BKE_report(reports, RPT_ERROR, "Modifier cannot be applied to Mesh with Shape Keys");
@@ -510,8 +510,8 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
if (md->type == eModifierType_Multires)
multires_force_update(ob);
- if (mmd && mmd->totlvl && mti->type==eModifierTypeType_OnlyDeform) {
- if (!multiresModifier_reshapeFromDeformMod (scene, mmd, ob, md)) {
+ if (mmd && mmd->totlvl && mti->type == eModifierTypeType_OnlyDeform) {
+ if (!multiresModifier_reshapeFromDeformMod(scene, mmd, ob, md)) {
BKE_report(reports, RPT_ERROR, "Multires modifier returned error, skipping apply");
return 0;
}
@@ -544,9 +544,9 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
cu = ob->data;
BKE_report(reports, RPT_INFO, "Applied modifier only changed CV points, not tessellated/bevel vertices");
- vertexCos = curve_getVertexCos(cu, &cu->nurb, &numVerts);
+ vertexCos = BKE_curve_vertexCos_get(cu, &cu->nurb, &numVerts);
mti->deformVerts(md, ob, NULL, vertexCos, numVerts, 0, 0);
- curve_applyVertexCos(cu, &cu->nurb, vertexCos);
+ BK_curve_vertexCos_apply(cu, &cu->nurb, vertexCos);
MEM_freeN(vertexCos);
@@ -562,7 +562,7 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
ParticleSystem *psys = ob->particlesystem.first;
- for (; psys; psys=psys->next) {
+ for (; psys; psys = psys->next) {
if (psys->part->type != PART_HAIR)
continue;
@@ -582,27 +582,27 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi
BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied in editmode");
return 0;
}
- else if (((ID*) ob->data)->us>1) {
+ else if (((ID *) ob->data)->us > 1) {
BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied to multi-user data");
return 0;
}
- if (md!=ob->modifiers.first)
+ if (md != ob->modifiers.first)
BKE_report(reports, RPT_INFO, "Applied modifier was not first, result may not be as expected");
/* allow apply of a not-realtime modifier, by first re-enabling realtime. */
- prev_mode= md->mode;
+ prev_mode = md->mode;
md->mode |= eModifierMode_Realtime;
if (mode == MODIFIER_APPLY_SHAPE) {
if (!modifier_apply_shape(reports, scene, ob, md)) {
- md->mode= prev_mode;
+ md->mode = prev_mode;
return 0;
}
}
else {
if (!modifier_apply_obdata(reports, scene, ob, md)) {
- md->mode= prev_mode;
+ md->mode = prev_mode;
return 0;
}
}
@@ -629,34 +629,34 @@ int ED_object_modifier_copy(ReportList *UNUSED(reports), Object *ob, ModifierDat
static int modifier_add_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
- int type= RNA_enum_get(op->ptr, "type");
+ int type = RNA_enum_get(op->ptr, "type");
if (!ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, type))
return OPERATOR_CANCELLED;
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
- Object *ob= ED_object_active_context(C);
- EnumPropertyItem *item= NULL, *md_item, *group_item= NULL;
+ Object *ob = ED_object_active_context(C);
+ EnumPropertyItem *item = NULL, *md_item, *group_item = NULL;
ModifierTypeInfo *mti;
- int totitem= 0, a;
+ int totitem = 0, a;
if (!ob)
return modifier_type_items;
- for (a=0; modifier_type_items[a].identifier; a++) {
- md_item= &modifier_type_items[a];
+ for (a = 0; modifier_type_items[a].identifier; a++) {
+ md_item = &modifier_type_items[a];
if (md_item->identifier[0]) {
- mti= modifierType_getInfo(md_item->value);
+ mti = modifierType_getInfo(md_item->value);
if (mti->flags & eModifierTypeFlag_NoUserAdd)
continue;
@@ -665,22 +665,22 @@ static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr)
continue;
}
else {
- group_item= md_item;
- md_item= NULL;
+ group_item = md_item;
+ md_item = NULL;
continue;
}
if (group_item) {
RNA_enum_item_add(&item, &totitem, group_item);
- group_item= NULL;
+ group_item = NULL;
}
RNA_enum_item_add(&item, &totitem, md_item);
}
RNA_enum_item_end(&item, &totitem);
- *free= 1;
+ *free = 1;
return item;
}
@@ -700,10 +700,10 @@ void OBJECT_OT_modifier_add(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "type", modifier_type_items, eModifierType_Subsurf, "Type", "");
+ prop = RNA_def_enum(ot->srna, "type", modifier_type_items, eModifierType_Subsurf, "Type", "");
RNA_def_enum_funcs(prop, modifier_add_itemf);
ot->prop = prop;
}
@@ -712,12 +712,12 @@ void OBJECT_OT_modifier_add(wmOperatorType *ot)
static int edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", rna_type);
- Object *ob= (ptr.id.data)?ptr.id.data:ED_object_active_context(C);
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", rna_type);
+ Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C);
if (!ob || ob->id.lib) return 0;
- if (obtype_flag && ((1<<ob->type) & obtype_flag)==0) return 0;
- if (ptr.id.data && ((ID*)ptr.id.data)->lib) return 0;
+ if (obtype_flag && ((1 << ob->type) & obtype_flag) == 0) return 0;
+ if (ptr.id.data && ((ID *)ptr.id.data)->lib) return 0;
return 1;
}
@@ -734,7 +734,7 @@ static void edit_modifier_properties(wmOperatorType *ot)
static int edit_modifier_invoke_properties(bContext *C, wmOperator *op)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
ModifierData *md;
if (RNA_struct_property_is_set(op->ptr, "modifier"))
@@ -767,8 +767,8 @@ static ModifierData *edit_modifier_property_get(wmOperator *op, Object *ob, int
static int modifier_remove_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
int mode_orig = ob ? ob->mode : 0;
@@ -776,13 +776,13 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
if (!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md))
return OPERATOR_CANCELLED;
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
/* if cloth/softbody was removed, particle mode could be cleared */
if (mode_orig & OB_MODE_PARTICLE_EDIT)
- if ((ob->mode & OB_MODE_PARTICLE_EDIT)==0)
- if (scene->basact && scene->basact->object==ob)
- WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL);
+ if ((ob->mode & OB_MODE_PARTICLE_EDIT) == 0)
+ if (scene->basact && scene->basact->object == ob)
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL);
return OPERATOR_FINISHED;
}
@@ -806,7 +806,7 @@ void OBJECT_OT_modifier_remove(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -821,7 +821,7 @@ static int modifier_move_up_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -845,7 +845,7 @@ void OBJECT_OT_modifier_move_up(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -860,7 +860,7 @@ static int modifier_move_down_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -884,7 +884,7 @@ void OBJECT_OT_modifier_move_down(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -892,17 +892,17 @@ void OBJECT_OT_modifier_move_down(wmOperatorType *ot)
static int modifier_apply_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
- int apply_as= RNA_enum_get(op->ptr, "apply_as");
+ int apply_as = RNA_enum_get(op->ptr, "apply_as");
if (!ob || !md || !ED_object_modifier_apply(op->reports, scene, ob, md, apply_as)) {
return OPERATOR_CANCELLED;
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -931,7 +931,7 @@ void OBJECT_OT_modifier_apply(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "apply_as", modifier_apply_as_items, MODIFIER_APPLY_DATA, "Apply as", "How to apply the modifier to the geometry");
edit_modifier_properties(ot);
@@ -941,8 +941,8 @@ void OBJECT_OT_modifier_apply(wmOperatorType *ot)
static int modifier_convert_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
@@ -950,7 +950,7 @@ static int modifier_convert_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -974,7 +974,7 @@ void OBJECT_OT_modifier_convert(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -989,7 +989,7 @@ static int modifier_copy_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -1013,7 +1013,7 @@ void OBJECT_OT_modifier_copy(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1021,7 +1021,7 @@ void OBJECT_OT_modifier_copy(wmOperatorType *ot)
static int multires_poll(bContext *C)
{
- return edit_modifier_poll_generic(C, &RNA_MultiresModifier, (1<<OB_MESH));
+ return edit_modifier_poll_generic(C, &RNA_MultiresModifier, (1 << OB_MESH));
}
static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op)
@@ -1034,7 +1034,7 @@ static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op)
multiresModifier_del_levels(mmd, ob, 1);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -1058,7 +1058,7 @@ void OBJECT_OT_multires_higher_levels_delete(wmOperatorType *ot)
ot->exec = multires_higher_levels_delete_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1075,7 +1075,7 @@ static int multires_subdivide_exec(bContext *C, wmOperator *op)
multiresModifier_subdivide(mmd, ob, 0, mmd->simple);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -1099,7 +1099,7 @@ void OBJECT_OT_multires_subdivide(wmOperatorType *ot)
ot->exec = multires_subdivide_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1107,21 +1107,21 @@ void OBJECT_OT_multires_subdivide(wmOperatorType *ot)
static int multires_reshape_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_active_context(C), *secondob= NULL;
- Scene *scene= CTX_data_scene(C);
+ Object *ob = ED_object_active_context(C), *secondob = NULL;
+ Scene *scene = CTX_data_scene(C);
MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires);
if (!mmd)
return OPERATOR_CANCELLED;
- if (mmd->lvl==0) {
+ if (mmd->lvl == 0) {
BKE_report(op->reports, RPT_ERROR, "Reshape can work only with higher levels of subdivisions");
return OPERATOR_CANCELLED;
}
- CTX_DATA_BEGIN(C, Object*, selob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, selob, selected_editable_objects) {
if (selob->type == OB_MESH && selob != ob) {
- secondob= selob;
+ secondob = selob;
break;
}
}
@@ -1138,7 +1138,7 @@ static int multires_reshape_exec(bContext *C, wmOperator *op)
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -1162,7 +1162,7 @@ void OBJECT_OT_multires_reshape(wmOperatorType *ot)
ot->exec = multires_reshape_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1173,9 +1173,9 @@ void OBJECT_OT_multires_reshape(wmOperatorType *ot)
static int multires_external_save_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
- Mesh *me= (ob)? ob->data: op->customdata;
+ Mesh *me = (ob) ? ob->data : op->customdata;
char path[FILE_MAX];
- int relative= RNA_boolean_get(op->ptr, "relative_path");
+ int relative = RNA_boolean_get(op->ptr, "relative_path");
if (!me)
return OPERATOR_CANCELLED;
@@ -1198,7 +1198,7 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *U
{
Object *ob = ED_object_active_context(C);
MultiresModifierData *mmd;
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
char path[FILE_MAX];
if (!edit_modifier_invoke_properties(C, op))
@@ -1215,9 +1215,9 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *U
if (RNA_struct_property_is_set(op->ptr, "filepath"))
return multires_external_save_exec(C, op);
- op->customdata= me;
+ op->customdata = me;
- BLI_snprintf(path, sizeof(path), "//%s.btx", me->id.name+2);
+ BLI_snprintf(path, sizeof(path), "//%s.btx", me->id.name + 2);
RNA_string_set(op->ptr, "filepath", path);
WM_event_add_fileselect(C, op);
@@ -1237,9 +1237,9 @@ void OBJECT_OT_multires_external_save(wmOperatorType *ot)
ot->poll = multires_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- WM_operator_properties_filesel(ot, FOLDERFILE|BTXFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+ WM_operator_properties_filesel(ot, FOLDERFILE | BTXFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
edit_modifier_properties(ot);
}
@@ -1248,7 +1248,7 @@ void OBJECT_OT_multires_external_save(wmOperatorType *ot)
static int multires_external_pack_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = ED_object_active_context(C);
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
if (!CustomData_external_test(&me->ldata, CD_MDISPS))
return OPERATOR_CANCELLED;
@@ -1269,7 +1269,7 @@ void OBJECT_OT_multires_external_pack(wmOperatorType *ot)
ot->exec = multires_external_pack_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/********************* multires apply base ***********************/
@@ -1284,7 +1284,7 @@ static int multires_base_apply_exec(bContext *C, wmOperator *op)
multiresModifier_base_apply(mmd, ob);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -1309,7 +1309,7 @@ void OBJECT_OT_multires_base_apply(wmOperatorType *ot)
ot->exec = multires_base_apply_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1318,12 +1318,12 @@ void OBJECT_OT_multires_base_apply(wmOperatorType *ot)
static int meshdeform_poll(bContext *C)
{
- return edit_modifier_poll_generic(C, &RNA_MeshDeformModifier, (1<<OB_MESH));
+ return edit_modifier_poll_generic(C, &RNA_MeshDeformModifier, (1 << OB_MESH));
}
static int meshdeform_bind_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
MeshDeformModifierData *mmd = (MeshDeformModifierData *)edit_modifier_property_get(op, ob, eModifierType_MeshDeform);
@@ -1337,47 +1337,48 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op)
if (mmd->bindinfluences) MEM_freeN(mmd->bindinfluences);
if (mmd->bindoffsets) MEM_freeN(mmd->bindoffsets);
if (mmd->dynverts) MEM_freeN(mmd->dynverts);
- if (mmd->bindweights) MEM_freeN(mmd->bindweights); /* deprecated */
- if (mmd->bindcos) MEM_freeN(mmd->bindcos); /* deprecated */
-
- mmd->bindcagecos= NULL;
- mmd->dyngrid= NULL;
- mmd->dyninfluences= NULL;
- mmd->bindoffsets= NULL;
- mmd->dynverts= NULL;
- mmd->bindweights= NULL; /* deprecated */
- mmd->bindcos= NULL; /* deprecated */
- mmd->totvert= 0;
- mmd->totcagevert= 0;
- mmd->totinfluence= 0;
+ if (mmd->bindweights) MEM_freeN(mmd->bindweights); /* deprecated */
+ if (mmd->bindcos) MEM_freeN(mmd->bindcos); /* deprecated */
+
+ mmd->bindcagecos = NULL;
+ mmd->dyngrid = NULL;
+ mmd->dyninfluences = NULL;
+ mmd->bindinfluences = NULL;
+ mmd->bindoffsets = NULL;
+ mmd->dynverts = NULL;
+ mmd->bindweights = NULL; /* deprecated */
+ mmd->bindcos = NULL; /* deprecated */
+ mmd->totvert = 0;
+ mmd->totcagevert = 0;
+ mmd->totinfluence = 0;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
}
else {
DerivedMesh *dm;
- int mode= mmd->modifier.mode;
+ int mode = mmd->modifier.mode;
/* force modifier to run, it will call binding routine */
- mmd->bindfunc= mesh_deform_bind;
+ mmd->bindfunc = mesh_deform_bind;
mmd->modifier.mode |= eModifierMode_Realtime;
if (ob->type == OB_MESH) {
- dm= mesh_create_derived_view(scene, ob, 0);
+ dm = mesh_create_derived_view(scene, ob, 0);
dm->release(dm);
}
else if (ob->type == OB_LATTICE) {
lattice_calc_modifiers(scene, ob);
}
- else if (ob->type==OB_MBALL) {
+ else if (ob->type == OB_MBALL) {
makeDispListMBall(scene, ob);
}
else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
makeDispListCurveTypes(scene, ob, 0);
}
- mmd->bindfunc= NULL;
- mmd->modifier.mode= mode;
+ mmd->bindfunc = NULL;
+ mmd->modifier.mode = mode;
}
return OPERATOR_FINISHED;
@@ -1404,7 +1405,7 @@ void OBJECT_OT_meshdeform_bind(wmOperatorType *ot)
ot->exec = meshdeform_bind_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1426,7 +1427,7 @@ static int explode_refresh_exec(bContext *C, wmOperator *op)
emd->flag |= eExplodeFlag_CalcFaces;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -1451,7 +1452,7 @@ void OBJECT_OT_explode_refresh(wmOperatorType *ot)
ot->exec = explode_refresh_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
}
@@ -1475,11 +1476,11 @@ static void init_ocean_modifier_bake(struct Ocean *oc, struct OceanModifierData
do_normals = (omd->flag & MOD_OCEAN_GENERATE_NORMALS);
do_jacobian = (omd->flag & MOD_OCEAN_GENERATE_FOAM);
- BKE_init_ocean(oc, omd->resolution*omd->resolution, omd->resolution*omd->resolution, omd->spatial_size, omd->spatial_size,
- omd->wind_velocity, omd->smallest_wave, 1.0, omd->wave_direction, omd->damp, omd->wave_alignment,
- omd->depth, omd->time,
- do_heightfield, do_chop, do_normals, do_jacobian,
- omd->seed);
+ BKE_init_ocean(oc, omd->resolution * omd->resolution, omd->resolution * omd->resolution, omd->spatial_size, omd->spatial_size,
+ omd->wind_velocity, omd->smallest_wave, 1.0, omd->wave_direction, omd->damp, omd->wave_alignment,
+ omd->depth, omd->time,
+ do_heightfield, do_chop, do_normals, do_jacobian,
+ omd->seed);
}
typedef struct OceanBakeJob {
@@ -1495,7 +1496,7 @@ typedef struct OceanBakeJob {
static void oceanbake_free(void *customdata)
{
- OceanBakeJob *oj= customdata;
+ OceanBakeJob *oj = customdata;
MEM_freeN(oj);
}
@@ -1514,34 +1515,34 @@ static int oceanbake_breakjob(void *UNUSED(customdata))
/* called by oceanbake, wmJob sends notifier */
static void oceanbake_update(void *customdata, float progress, int *cancel)
{
- OceanBakeJob *oj= customdata;
+ OceanBakeJob *oj = customdata;
if (oceanbake_breakjob(oj))
*cancel = 1;
- *(oj->do_update)= 1;
- *(oj->progress)= progress;
+ *(oj->do_update) = 1;
+ *(oj->progress) = progress;
}
static void oceanbake_startjob(void *customdata, short *stop, short *do_update, float *progress)
{
- OceanBakeJob *oj= customdata;
+ OceanBakeJob *oj = customdata;
- oj->stop= stop;
+ oj->stop = stop;
oj->do_update = do_update;
oj->progress = progress;
- G.afbreek= 0; /* XXX shared with render - replace with job 'stop' switch */
+ G.afbreek = 0; /* XXX shared with render - replace with job 'stop' switch */
BKE_bake_ocean(oj->ocean, oj->och, oceanbake_update, (void *)oj);
- *do_update= 1;
+ *do_update = 1;
*stop = 0;
}
static void oceanbake_endjob(void *customdata)
{
- OceanBakeJob *oj= customdata;
+ OceanBakeJob *oj = customdata;
if (oj->ocean) {
BKE_free_ocean(oj->ocean);
@@ -1559,8 +1560,8 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
OceanCache *och;
struct Ocean *ocean;
- int f, cfra, i=0;
- int free= RNA_boolean_get(op->ptr, "free");
+ int f, cfra, i = 0;
+ int free = RNA_boolean_get(op->ptr, "free");
wmJob *steve;
OceanBakeJob *oj;
@@ -1571,7 +1572,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
if (free) {
omd->refresh |= MOD_OCEAN_REFRESH_CLEAR_CACHE;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
@@ -1579,12 +1580,12 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
omd->bakestart, omd->bakeend, omd->wave_scale,
omd->chop_amount, omd->foam_coverage, omd->foam_fade, omd->resolution);
- och->time = MEM_mallocN(och->duration*sizeof(float), "foam bake time");
+ och->time = MEM_mallocN(och->duration * sizeof(float), "foam bake time");
cfra = scene->r.cfra;
/* precalculate time variable before baking */
- for (f=omd->bakestart; f<=omd->bakeend; f++) {
+ for (f = omd->bakestart; f <= omd->bakeend; f++) {
/* from physics_fluid.c:
*
* XXX: This can't be used due to an anim sys optimization that ignores recalc object animation,
@@ -1613,7 +1614,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
init_ocean_modifier_bake(ocean, omd);
#if 0
- BKE_bake_ocean(ocean, och);
+ BKE_bake_ocean(ocean, och);
omd->oceancache = och;
omd->cached = TRUE;
@@ -1621,7 +1622,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
scene->r.cfra = cfra;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
#endif
/* job stuff */
@@ -1629,14 +1630,14 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
scene->r.cfra = cfra;
/* setup job */
- steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Ocean Simulation", WM_JOB_PROGRESS);
- oj= MEM_callocN(sizeof(OceanBakeJob), "ocean bake job");
+ steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Ocean Simulation", WM_JOB_PROGRESS);
+ oj = MEM_callocN(sizeof(OceanBakeJob), "ocean bake job");
oj->ocean = ocean;
oj->och = och;
oj->omd = omd;
WM_jobs_customdata(steve, oj, oceanbake_free);
- WM_jobs_timer(steve, 0.1, NC_OBJECT|ND_MODIFIER, NC_OBJECT|ND_MODIFIER);
+ WM_jobs_timer(steve, 0.1, NC_OBJECT | ND_MODIFIER, NC_OBJECT | ND_MODIFIER);
WM_jobs_callbacks(steve, oceanbake_startjob, NULL, NULL, oceanbake_endjob);
WM_jobs_start(CTX_wm_manager(C), steve);
@@ -1666,7 +1667,7 @@ void OBJECT_OT_ocean_bake(wmOperatorType *ot)
ot->exec = ocean_bake_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
edit_modifier_properties(ot);
RNA_def_boolean(ot->srna, "free", FALSE, "Free", "Free the bake, rather than generating it");
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 43385ea80a3..72f23177946 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -223,7 +223,7 @@ void ED_operatormacros_object(void)
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
- ot = WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Duplicate Objects", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Duplicate Objects", OPTYPE_UNDO | OPTYPE_REGISTER);
if (ot) {
ot->description = "Duplicate selected objects and move them";
WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate");
@@ -232,7 +232,7 @@ void ED_operatormacros_object(void)
}
/* grr, should be able to pass options on... */
- ot = WM_operatortype_append_macro("OBJECT_OT_duplicate_move_linked", "Duplicate Linked", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("OBJECT_OT_duplicate_move_linked", "Duplicate Linked", OPTYPE_UNDO | OPTYPE_REGISTER);
if (ot) {
ot->description = "Duplicate selected objects and move them";
otmacro = WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate");
@@ -242,10 +242,10 @@ void ED_operatormacros_object(void)
}
/* XXX */
- ot = WM_operatortype_append_macro("OBJECT_OT_add_named_cursor", "Add named object at cursor", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot = WM_operatortype_append_macro("OBJECT_OT_add_named_cursor", "Add named object at cursor", OPTYPE_UNDO | OPTYPE_REGISTER);
if (ot) {
ot->description = "Add named object at cursor";
- RNA_def_string(ot->srna, "name", "Cube", MAX_ID_NAME-2, "Name", "Object name to add");
+ RNA_def_string(ot->srna, "name", "Cube", MAX_ID_NAME - 2, "Name", "Object name to add");
WM_operatortype_macro_define(ot, "VIEW3D_OT_cursor3d");
WM_operatortype_macro_define(ot, "OBJECT_OT_add_named");
@@ -254,7 +254,7 @@ void ED_operatormacros_object(void)
static int object_mode_poll(bContext *C)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob = CTX_data_active_object(C);
return (!ob || ob->mode == OB_MODE_OBJECT);
}
@@ -284,7 +284,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
RNA_enum_set(kmi->ptr, "mode", OB_MODE_WEIGHT_PAINT);
RNA_boolean_set(kmi->ptr, "toggle", TRUE);
- WM_keymap_add_item(keymap, "OBJECT_OT_origin_set", CKEY, KM_PRESS, KM_ALT|KM_SHIFT|KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "OBJECT_OT_origin_set", CKEY, KM_PRESS, KM_ALT | KM_SHIFT | KM_CTRL, 0);
/* Object Mode ---------------------------------------------------------------- */
/* Note: this keymap gets disabled in non-objectmode, */
@@ -303,7 +303,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "OBJECT_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_select_grouped", GKEY, KM_PRESS, KM_SHIFT, 0);
- WM_keymap_add_item(keymap, "OBJECT_OT_select_mirror", MKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "OBJECT_OT_select_mirror", MKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
RNA_enum_set_identifier(kmi->ptr, "direction", "PARENT");
@@ -322,13 +322,13 @@ void ED_keymap_object(wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "extend", TRUE);
WM_keymap_verify_item(keymap, "OBJECT_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
- WM_keymap_verify_item(keymap, "OBJECT_OT_parent_no_inverse_set", PKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+ WM_keymap_verify_item(keymap, "OBJECT_OT_parent_no_inverse_set", PKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
WM_keymap_verify_item(keymap, "OBJECT_OT_parent_clear", PKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_verify_item(keymap, "OBJECT_OT_track_set", TKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_verify_item(keymap, "OBJECT_OT_track_clear", TKEY, KM_PRESS, KM_ALT, 0);
- WM_keymap_verify_item(keymap, "OBJECT_OT_constraint_add_with_targets", CKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
- WM_keymap_verify_item(keymap, "OBJECT_OT_constraints_clear", CKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
+ WM_keymap_verify_item(keymap, "OBJECT_OT_constraint_add_with_targets", CKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
+ WM_keymap_verify_item(keymap, "OBJECT_OT_constraints_clear", CKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
WM_keymap_verify_item(keymap, "OBJECT_OT_location_clear", GKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_verify_item(keymap, "OBJECT_OT_rotation_clear", RKEY, KM_PRESS, KM_ALT, 0);
@@ -343,13 +343,13 @@ void ED_keymap_object(wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "unselected", TRUE);
/* same as above but for rendering */
- WM_keymap_add_item(keymap, "OBJECT_OT_hide_render_clear", HKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "OBJECT_OT_hide_render_clear", HKEY, KM_PRESS, KM_ALT | KM_CTRL, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_hide_render_set", HKEY, KM_PRESS, KM_CTRL, 0);
/* conflicts, removing */
#if 0
- kmi = WM_keymap_add_item(keymap, "OBJECT_OT_hide_render_set", HKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)
- RNA_boolean_set(kmi->ptr, "unselected", TRUE);
+ kmi = WM_keymap_add_item(keymap, "OBJECT_OT_hide_render_set", HKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0)
+ RNA_boolean_set(kmi->ptr, "unselected", TRUE);
#endif
WM_keymap_add_item(keymap, "OBJECT_OT_move_to_layer", MKEY, KM_PRESS, 0, 0);
@@ -367,7 +367,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
WM_keymap_add_menu(keymap, "INFO_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0);
- WM_keymap_add_item(keymap, "OBJECT_OT_duplicates_make_real", AKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "OBJECT_OT_duplicates_make_real", AKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
WM_keymap_add_menu(keymap, "VIEW3D_MT_object_apply", AKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_menu(keymap, "VIEW3D_MT_make_single_user", UKEY, KM_PRESS, 0, 0);
@@ -378,23 +378,23 @@ void ED_keymap_object(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "OBJECT_OT_join", JKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_convert", CKEY, KM_PRESS, KM_ALT, 0);
- WM_keymap_add_item(keymap, "OBJECT_OT_proxy_make", PKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
+ WM_keymap_add_item(keymap, "OBJECT_OT_proxy_make", PKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_make_local", LKEY, KM_PRESS, 0, 0);
// XXX this should probably be in screen instead... here for testing purposes in the meantime... - Aligorith
WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_insert_menu", IKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_delete_v3d", IKEY, KM_PRESS, KM_ALT, 0);
- WM_keymap_verify_item(keymap, "ANIM_OT_keying_set_active_set", IKEY, KM_PRESS, KM_CTRL|KM_SHIFT|KM_ALT, 0);
+ WM_keymap_verify_item(keymap, "ANIM_OT_keying_set_active_set", IKEY, KM_PRESS, KM_CTRL | KM_SHIFT | KM_ALT, 0);
WM_keymap_verify_item(keymap, "GROUP_OT_create", GKEY, KM_PRESS, KM_CTRL, 0);
- WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove", GKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
- WM_keymap_verify_item(keymap, "GROUP_OT_objects_add_active", GKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
- WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove_active", GKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
+ WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove", GKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
+ WM_keymap_verify_item(keymap, "GROUP_OT_objects_add_active", GKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
+ WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove_active", GKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0);
WM_keymap_add_menu(keymap, "VIEW3D_MT_object_specials", WKEY, KM_PRESS, 0, 0);
- for (i=0; i<=5; i++) {
- kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY+i, KM_PRESS, KM_CTRL, 0);
+ for (i = 0; i <= 5; i++) {
+ kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY + i, KM_PRESS, KM_CTRL, 0);
RNA_int_set(kmi->ptr, "level", i);
}
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index a666f04034b..751cd751224 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -110,9 +110,9 @@ static int vertex_parent_set_poll(bContext *C)
static int vertex_parent_set_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
BMVert *eve;
BMIter iter;
Curve *cu;
@@ -120,18 +120,18 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
BezTriple *bezt;
BPoint *bp;
Object *par;
- int a, v1=0, v2=0, v3=0, v4=0, nr=1;
+ int a, v1 = 0, v2 = 0, v3 = 0, v4 = 0, nr = 1;
/* we need 1 to 3 selected vertices */
- if (obedit->type==OB_MESH) {
- Mesh *me= obedit->data;
+ if (obedit->type == OB_MESH) {
+ Mesh *me = obedit->data;
BMEditMesh *em;
EDBM_mesh_load(obedit);
EDBM_mesh_make(scene->toolsettings, scene, obedit);
- em= me->edit_btmesh;
+ em = me->edit_btmesh;
/* derivedMesh might be needed for solving parenting,
* so re-create it here */
@@ -139,31 +139,31 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
- if (v1==0) v1= nr;
- else if (v2==0) v2= nr;
- else if (v3==0) v3= nr;
- else if (v4==0) v4= nr;
+ if (v1 == 0) v1 = nr;
+ else if (v2 == 0) v2 = nr;
+ else if (v3 == 0) v3 = nr;
+ else if (v4 == 0) v4 = nr;
else break;
}
nr++;
}
}
else if (ELEM(obedit->type, OB_SURF, OB_CURVE)) {
- ListBase *editnurb= object_editcurve_get(obedit);
+ ListBase *editnurb = object_editcurve_get(obedit);
- cu= obedit->data;
+ cu = obedit->data;
- nu= editnurb->first;
+ nu = editnurb->first;
while (nu) {
if (nu->type == CU_BEZIER) {
- bezt= nu->bezt;
- a= nu->pntsu;
+ bezt = nu->bezt;
+ a = nu->pntsu;
while (a--) {
if (BEZSELECTED_HIDDENHANDLES(cu, bezt)) {
- if (v1==0) v1= nr;
- else if (v2==0) v2= nr;
- else if (v3==0) v3= nr;
- else if (v4==0) v4= nr;
+ if (v1 == 0) v1 = nr;
+ else if (v2 == 0) v2 = nr;
+ else if (v3 == 0) v3 = nr;
+ else if (v4 == 0) v4 = nr;
else break;
}
nr++;
@@ -171,34 +171,34 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
}
}
else {
- bp= nu->bp;
- a= nu->pntsu*nu->pntsv;
+ bp = nu->bp;
+ a = nu->pntsu * nu->pntsv;
while (a--) {
if (bp->f1 & SELECT) {
- if (v1==0) v1= nr;
- else if (v2==0) v2= nr;
- else if (v3==0) v3= nr;
- else if (v4==0) v4= nr;
+ if (v1 == 0) v1 = nr;
+ else if (v2 == 0) v2 = nr;
+ else if (v3 == 0) v3 = nr;
+ else if (v4 == 0) v4 = nr;
else break;
}
nr++;
bp++;
}
}
- nu= nu->next;
+ nu = nu->next;
}
}
- else if (obedit->type==OB_LATTICE) {
- Lattice *lt= obedit->data;
+ else if (obedit->type == OB_LATTICE) {
+ Lattice *lt = obedit->data;
- a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
- bp= lt->editlatt->latt->def;
+ a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
+ bp = lt->editlatt->latt->def;
while (a--) {
if (bp->f1 & SELECT) {
- if (v1==0) v1= nr;
- else if (v2==0) v2= nr;
- else if (v3==0) v3= nr;
- else if (v4==0) v4= nr;
+ if (v1 == 0) v1 = nr;
+ else if (v2 == 0) v2 = nr;
+ else if (v3 == 0) v3 = nr;
+ else if (v4 == 0) v4 = nr;
else break;
}
nr++;
@@ -206,19 +206,19 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
}
}
- if (v4 || !((v1 && v2==0 && v3==0) || (v1 && v2 && v3)) ) {
+ if (v4 || !((v1 && v2 == 0 && v3 == 0) || (v1 && v2 && v3)) ) {
BKE_report(op->reports, RPT_ERROR, "Select either 1 or 3 vertices to parent to");
return OPERATOR_CANCELLED;
}
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob != obedit) {
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
- par= obedit->parent;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ par = obedit->parent;
while (par) {
- if (par==ob) break;
- par= par->parent;
+ if (par == ob) break;
+ par = par->parent;
}
if (par) {
BKE_report(op->reports, RPT_ERROR, "Loop in parents");
@@ -226,20 +226,20 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
else {
Object workob;
- ob->parent= BASACT->object;
+ ob->parent = BASACT->object;
if (v3) {
- ob->partype= PARVERT3;
- ob->par1= v1-1;
- ob->par2= v2-1;
- ob->par3= v3-1;
+ ob->partype = PARVERT3;
+ ob->par1 = v1 - 1;
+ ob->par2 = v2 - 1;
+ ob->par3 = v3 - 1;
/* inverse parent matrix */
what_does_parent(scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
}
else {
- ob->partype= PARVERT1;
- ob->par1= v1-1;
+ ob->partype = PARVERT1;
+ ob->par1 = v1 - 1;
/* inverse parent matrix */
what_does_parent(scene, ob, &workob);
@@ -270,16 +270,16 @@ void OBJECT_OT_vertex_parent_set(wmOperatorType *ot)
ot->exec = vertex_parent_set_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/********************** Make Proxy Operator *************************/
/* set the object to proxify */
-static int make_proxy_invoke (bContext *C, wmOperator *op, wmEvent *evt)
+static int make_proxy_invoke(bContext *C, wmOperator *op, wmEvent *evt)
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_active_context(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = ED_object_active_context(C);
/* sanity checks */
if (!scene || scene->id.lib || !ob)
@@ -294,8 +294,8 @@ static int make_proxy_invoke (bContext *C, wmOperator *op, wmEvent *evt)
}
else if (ob->id.lib) {
- uiPopupMenu *pup= uiPupMenuBegin(C, "OK?", ICON_QUESTION);
- uiLayout *layout= uiPupMenuLayout(pup);
+ uiPopupMenu *pup = uiPupMenuBegin(C, "OK?", ICON_QUESTION);
+ uiLayout *layout = uiPupMenuLayout(pup);
/* create operator menu item with relevant properties filled in */
uiItemFullO_ptr(layout, op->type, op->type->name, ICON_NONE, NULL, WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS);
@@ -312,41 +312,41 @@ static int make_proxy_invoke (bContext *C, wmOperator *op, wmEvent *evt)
return OPERATOR_CANCELLED;
}
-static int make_proxy_exec (bContext *C, wmOperator *op)
+static int make_proxy_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Object *ob, *gob= ED_object_active_context(C);
+ Main *bmain = CTX_data_main(C);
+ Object *ob, *gob = ED_object_active_context(C);
GroupObject *go;
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
if (gob->dup_group != NULL) {
- go= BLI_findlink(&gob->dup_group->gobject, RNA_enum_get(op->ptr, "object"));
- ob= go->ob;
+ go = BLI_findlink(&gob->dup_group->gobject, RNA_enum_get(op->ptr, "object"));
+ ob = go->ob;
}
else {
- ob= gob;
+ ob = gob;
gob = NULL;
}
if (ob) {
Object *newob;
- Base *newbase, *oldbase= BASACT;
- char name[MAX_ID_NAME+4];
+ Base *newbase, *oldbase = BASACT;
+ char name[MAX_ID_NAME + 4];
/* Add new object for the proxy */
- newob= add_object(scene, OB_EMPTY);
+ newob = add_object(scene, OB_EMPTY);
- BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name+2);
+ BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name + 2);
rename_id(&newob->id, name);
/* set layers OK */
- newbase= BASACT; /* add_object sets active... */
- newbase->lay= oldbase->lay;
- newob->lay= newbase->lay;
+ newbase = BASACT; /* add_object sets active... */
+ newbase->lay = oldbase->lay;
+ newob->lay = newbase->lay;
/* remove base, leave user count of object, it gets linked in object_make_proxy */
- if (gob==NULL) {
+ if (gob == NULL) {
BLI_remlink(&scene->base, oldbase);
MEM_freeN(oldbase);
}
@@ -355,8 +355,8 @@ static int make_proxy_exec (bContext *C, wmOperator *op)
/* depsgraph flushes are needed for the new data */
DAG_scene_sort(bmain, scene);
- DAG_id_tag_update(&newob->id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, newob);
+ DAG_id_tag_update(&newob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, newob);
}
else {
BKE_report(op->reports, RPT_ERROR, "No object to make proxy for");
@@ -369,29 +369,29 @@ static int make_proxy_exec (bContext *C, wmOperator *op)
/* Generic itemf's for operators that take library args */
static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
- EnumPropertyItem item_tmp= {0}, *item= NULL;
- int totitem= 0;
- int i= 0;
- Object *ob= ED_object_active_context(C);
+ EnumPropertyItem item_tmp = {0}, *item = NULL;
+ int totitem = 0;
+ int i = 0;
+ Object *ob = ED_object_active_context(C);
GroupObject *go;
if (!ob || !ob->dup_group)
return DummyRNA_DEFAULT_items;
/* find the object to affect */
- for (go= ob->dup_group->gobject.first; go; go= go->next) {
- item_tmp.identifier= item_tmp.name= go->ob->id.name+2;
- item_tmp.value= i++;
+ for (go = ob->dup_group->gobject.first; go; go = go->next) {
+ item_tmp.identifier = item_tmp.name = go->ob->id.name + 2;
+ item_tmp.value = i++;
RNA_enum_item_add(&item, &totitem, &item_tmp);
}
RNA_enum_item_end(&item, &totitem);
- *free= 1;
+ *free = 1;
return item;
}
-void OBJECT_OT_proxy_make (wmOperatorType *ot)
+void OBJECT_OT_proxy_make(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -406,10 +406,10 @@ void OBJECT_OT_proxy_make (wmOperatorType *ot)
ot->poll = ED_operator_object_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "object", DummyRNA_DEFAULT_items, 0, "Proxy Object", "Name of lib-linked/grouped object to make a proxy for"); /* XXX, relies on hard coded ID at the moment */
+ prop = RNA_def_enum(ot->srna, "object", DummyRNA_DEFAULT_items, 0, "Proxy Object", "Name of lib-linked/grouped object to make a proxy for"); /* XXX, relies on hard coded ID at the moment */
RNA_def_enum_funcs(prop, proxy_group_object_itemf);
ot->prop = prop;
}
@@ -425,32 +425,31 @@ EnumPropertyItem prop_clear_parent_types[] = {
void ED_object_parent_clear(bContext *C, int type)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob->parent == NULL)
continue;
if (type == 0) {
- ob->parent= NULL;
+ ob->parent = NULL;
}
else if (type == 1) {
- ob->parent= NULL;
+ ob->parent = NULL;
object_apply_mat4(ob, ob->obmat, TRUE, FALSE);
}
else if (type == 2)
unit_m4(ob->parentinv);
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
}
CTX_DATA_END;
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
- WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL);
}
/* note, poll should check for editable scene */
@@ -475,7 +474,7 @@ void OBJECT_OT_parent_clear(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ot->prop = RNA_def_enum(ot->srna, "type", prop_clear_parent_types, 0, "Type", "");
}
@@ -485,15 +484,15 @@ void OBJECT_OT_parent_clear(wmOperatorType *ot)
void ED_object_parent(Object *ob, Object *par, int type, const char *substr)
{
if (!par || BKE_object_parent_loop_check(par, ob)) {
- ob->parent= NULL;
- ob->partype= PAROBJECT;
- ob->parsubstr[0]= 0;
+ ob->parent = NULL;
+ ob->partype = PAROBJECT;
+ ob->parsubstr[0] = 0;
return;
}
/* this could use some more checks */
- ob->parent= par;
+ ob->parent = par;
ob->partype &= ~PARTYPE;
ob->partype |= type;
BLI_strncpy(ob->parsubstr, substr, sizeof(ob->parsubstr));
@@ -518,20 +517,20 @@ EnumPropertyItem prop_make_parent_types[] = {
int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object *ob, Object *par, int partype)
{
- bPoseChannel *pchan= NULL;
- int pararm= ELEM4(partype, PAR_ARMATURE, PAR_ARMATURE_NAME, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO);
+ bPoseChannel *pchan = NULL;
+ int pararm = ELEM4(partype, PAR_ARMATURE, PAR_ARMATURE_NAME, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO);
par->recalc |= OB_RECALC_OB;
/* preconditions */
- if (partype==PAR_FOLLOW || partype==PAR_PATH_CONST) {
- if (par->type!=OB_CURVE)
+ if (partype == PAR_FOLLOW || partype == PAR_PATH_CONST) {
+ if (par->type != OB_CURVE)
return 0;
else {
- Curve *cu= par->data;
+ Curve *cu = par->data;
- if ((cu->flag & CU_PATH)==0) {
- cu->flag |= CU_PATH|CU_FOLLOW;
+ if ((cu->flag & CU_PATH) == 0) {
+ cu->flag |= CU_PATH | CU_FOLLOW;
makeDispListCurveTypes(scene, par, 0); /* force creation of path data */
}
else cu->flag |= CU_FOLLOW;
@@ -549,19 +548,19 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
/* fall back on regular parenting now (for follow only) */
if (partype == PAR_FOLLOW)
- partype= PAR_OBJECT;
+ partype = PAR_OBJECT;
}
}
- else if (partype==PAR_BONE) {
- pchan= get_active_posechannel(par);
+ else if (partype == PAR_BONE) {
+ pchan = get_active_posechannel(par);
- if (pchan==NULL) {
+ if (pchan == NULL) {
BKE_report(reports, RPT_ERROR, "No active Bone");
return 0;
}
}
- if (ob!=par) {
+ if (ob != par) {
if (BKE_object_parent_loop_check(par, ob)) {
BKE_report(reports, RPT_ERROR, "Loop in parents");
return 0;
@@ -574,14 +573,14 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
/* set the parent (except for follow-path constraint option) */
if (partype != PAR_PATH_CONST) {
- ob->parent= par;
+ ob->parent = par;
}
/* handle types */
if (pchan)
BLI_strncpy(ob->parsubstr, pchan->name, sizeof(ob->parsubstr));
else
- ob->parsubstr[0]= 0;
+ ob->parsubstr[0] = 0;
if (partype == PAR_PATH_CONST) {
/* don't do anything here, since this is not technically "parenting" */
@@ -590,7 +589,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
/* partype is now set to PAROBJECT so that invisible 'virtual' modifiers don't need to be created
* NOTE: the old (2.4x) method was to set ob->partype = PARSKEL, creating the virtual modifiers
*/
- ob->partype= PAROBJECT; /* note, dna define, not operator property */
+ ob->partype = PAROBJECT; /* note, dna define, not operator property */
//ob->partype= PARSKEL; /* note, dna define, not operator property */
/* BUT, to keep the deforms, we need a modifier, and then we need to set the object that it uses */
@@ -599,25 +598,25 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
ModifierData *md;
switch (partype) {
- case PAR_CURVE: /* curve deform */
- md= ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Curve);
- ((CurveModifierData *)md)->object= par;
- break;
- case PAR_LATTICE: /* lattice deform */
- md= ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Lattice);
- ((LatticeModifierData *)md)->object= par;
- break;
- default: /* armature deform */
- md= ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Armature);
- ((ArmatureModifierData *)md)->object= par;
- break;
+ case PAR_CURVE: /* curve deform */
+ md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Curve);
+ ((CurveModifierData *)md)->object = par;
+ break;
+ case PAR_LATTICE: /* lattice deform */
+ md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Lattice);
+ ((LatticeModifierData *)md)->object = par;
+ break;
+ default: /* armature deform */
+ md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Armature);
+ ((ArmatureModifierData *)md)->object = par;
+ break;
}
}
}
else if (partype == PAR_BONE)
- ob->partype= PARBONE; /* note, dna define, not operator property */
+ ob->partype = PARBONE; /* note, dna define, not operator property */
else
- ob->partype= PAROBJECT; /* note, dna define, not operator property */
+ ob->partype = PAROBJECT; /* note, dna define, not operator property */
/* constraint */
if (partype == PAR_PATH_CONST) {
@@ -637,7 +636,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
ob->loc[1] = vec[1];
ob->loc[2] = vec[2];
}
- else if (pararm && ob->type==OB_MESH && par->type == OB_ARMATURE) {
+ else if (pararm && ob->type == OB_MESH && par->type == OB_ARMATURE) {
if (partype == PAR_ARMATURE_NAME)
create_vgroups_from_armature(reports, scene, ob, par, ARM_GROUPS_NAME, 0);
else if (partype == PAR_ARMATURE_ENVELOPE)
@@ -648,7 +647,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
WM_cursor_wait(0);
}
/* get corrected inverse */
- ob->partype= PAROBJECT;
+ ob->partype = PAROBJECT;
what_does_parent(scene, ob, &workob);
invert_m4_m4(ob->parentinv, workob.obmat);
@@ -659,7 +658,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
invert_m4_m4(ob->parentinv, workob.obmat);
}
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA;
}
}
@@ -668,14 +667,13 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
static int parent_set_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Object *par= ED_object_active_context(C);
- int partype= RNA_enum_get(op->ptr, "type");
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *par = ED_object_active_context(C);
+ int partype = RNA_enum_get(op->ptr, "type");
int ok = 1;
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (!ED_object_parent_set(op->reports, bmain, scene, ob, par, partype)) {
ok = 0;
break;
@@ -688,8 +686,8 @@ static int parent_set_exec(bContext *C, wmOperator *op)
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
- WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL);
return OPERATOR_FINISHED;
}
@@ -697,22 +695,22 @@ static int parent_set_exec(bContext *C, wmOperator *op)
static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
- Object *ob= ED_object_active_context(C);
- uiPopupMenu *pup= uiPupMenuBegin(C, "Set Parent To", ICON_NONE);
- uiLayout *layout= uiPupMenuLayout(pup);
+ Object *ob = ED_object_active_context(C);
+ uiPopupMenu *pup = uiPupMenuBegin(C, "Set Parent To", ICON_NONE);
+ uiLayout *layout = uiPupMenuLayout(pup);
uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_OBJECT);
/* ob becomes parent, make the associated menus */
- if (ob->type==OB_ARMATURE) {
+ if (ob->type == OB_ARMATURE) {
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_ARMATURE);
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_ARMATURE_NAME);
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_ARMATURE_ENVELOPE);
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_ARMATURE_AUTO);
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_BONE);
}
- else if (ob->type==OB_CURVE) {
+ else if (ob->type == OB_CURVE) {
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_CURVE);
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_FOLLOW);
uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_PATH_CONST);
@@ -741,7 +739,7 @@ void OBJECT_OT_parent_set(wmOperatorType *ot)
ot->poll = ED_operator_object_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", prop_make_parent_types, 0, "Type", "");
}
@@ -750,13 +748,13 @@ void OBJECT_OT_parent_set(wmOperatorType *ot)
static int parent_noinv_set_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Object *par= ED_object_active_context(C);
+ Main *bmain = CTX_data_main(C);
+ Object *par = ED_object_active_context(C);
par->recalc |= OB_RECALC_OB;
/* context iterator */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob != par) {
if (BKE_object_parent_loop_check(par, ob)) {
BKE_report(op->reports, RPT_ERROR, "Loop in parents");
@@ -764,14 +762,14 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op)
else {
/* clear inverse matrix and also the object location */
unit_m4(ob->parentinv);
- memset(ob->loc, 0, 3*sizeof(float));
+ memset(ob->loc, 0, 3 * sizeof(float));
/* set recalc flags */
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA;
/* set parenting type for object - object only... */
- ob->parent= par;
- ob->partype= PAROBJECT; /* note, dna define, not operator property */
+ ob->parent = par;
+ ob->partype = PAROBJECT; /* note, dna define, not operator property */
}
}
}
@@ -779,7 +777,7 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op)
DAG_scene_sort(bmain, CTX_data_scene(C));
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
}
@@ -797,17 +795,17 @@ void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/************************ Clear Slow Parent Operator *********************/
static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob->parent) {
if (ob->partype & PARSLOW) {
ob->partype -= PARSLOW;
@@ -839,17 +837,17 @@ void OBJECT_OT_slow_parent_clear(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/********************** Make Slow Parent Operator *********************/
static int object_slow_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob->parent)
ob->partype |= PARSLOW;
@@ -878,7 +876,7 @@ void OBJECT_OT_slow_parent_set(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Clear Track Operator ******************* */
@@ -892,24 +890,24 @@ static EnumPropertyItem prop_clear_track_types[] = {
/* note, poll should check for editable scene */
static int object_track_clear_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- int type= RNA_enum_get(op->ptr, "type");
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ int type = RNA_enum_get(op->ptr, "type");
if (CTX_data_edit_object(C)) {
BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in EditMode");
return OPERATOR_CANCELLED;
}
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
bConstraint *con, *pcon;
/* remove track-object for old track */
- ob->track= NULL;
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ ob->track = NULL;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
/* also remove all tracking constraints */
- for (con= ob->constraints.last; con; con= pcon) {
- pcon= con->prev;
+ for (con = ob->constraints.last; con; con = pcon) {
+ pcon = con->prev;
if (ELEM3(con->type, CONSTRAINT_TYPE_TRACKTO, CONSTRAINT_TYPE_LOCKTRACK, CONSTRAINT_TYPE_DAMPTRACK))
remove_constraint(&ob->constraints, con);
}
@@ -921,7 +919,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
DAG_ids_flush_update(bmain, 0);
DAG_scene_sort(bmain, scene);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
}
@@ -940,7 +938,7 @@ void OBJECT_OT_track_clear(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ot->prop = RNA_def_enum(ot->srna, "type", prop_clear_track_types, 0, "Type", "");
}
@@ -956,23 +954,23 @@ static EnumPropertyItem prop_make_track_types[] = {
static int track_set_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Object *obact= ED_object_active_context(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *obact = ED_object_active_context(C);
- int type= RNA_enum_get(op->ptr, "type");
+ int type = RNA_enum_get(op->ptr, "type");
if (type == 1) {
bConstraint *con;
bDampTrackConstraint *data;
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if (ob!=obact) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
+ if (ob != obact) {
con = add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_DAMPTRACK);
data = con->data;
data->tar = obact;
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
/* Lamp, Camera and Speaker track differently by default */
if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER)
@@ -985,13 +983,13 @@ static int track_set_exec(bContext *C, wmOperator *op)
bConstraint *con;
bTrackToConstraint *data;
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if (ob!=obact) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
+ if (ob != obact) {
con = add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_TRACKTO);
data = con->data;
data->tar = obact;
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
/* Lamp, Camera and Speaker track differently by default */
if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER) {
@@ -1006,13 +1004,13 @@ static int track_set_exec(bContext *C, wmOperator *op)
bConstraint *con;
bLockTrackConstraint *data;
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if (ob!=obact) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
+ if (ob != obact) {
con = add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_LOCKTRACK);
data = con->data;
data->tar = obact;
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+ ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
/* Lamp, Camera and Speaker track differently by default */
if (ob->type == OB_LAMP || ob->type == OB_CAMERA || ob->type == OB_SPEAKER) {
@@ -1026,7 +1024,7 @@ static int track_set_exec(bContext *C, wmOperator *op)
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
}
@@ -1045,7 +1043,7 @@ void OBJECT_OT_track_set(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", prop_make_track_types, 0, "Type", "");
@@ -1056,24 +1054,24 @@ void OBJECT_OT_track_set(wmOperatorType *ot)
static unsigned int move_to_layer_init(bContext *C, wmOperator *op)
{
int values[20], a;
- unsigned int lay= 0;
+ unsigned int lay = 0;
if (!RNA_struct_property_is_set(op->ptr, "layers")) {
/* note: layers are set in bases, library objects work for this */
- CTX_DATA_BEGIN(C, Base*, base, selected_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_bases) {
lay |= base->lay;
}
CTX_DATA_END;
- for (a=0; a<20; a++)
- values[a]= (lay & (1<<a));
+ for (a = 0; a < 20; a++)
+ values[a] = (lay & (1 << a));
RNA_boolean_set_array(op->ptr, "layers", values);
}
else {
RNA_boolean_get_array(op->ptr, "layers", values);
- for (a=0; a<20; a++)
+ for (a = 0; a < 20; a++)
if (values[a])
lay |= (1 << a);
}
@@ -1083,7 +1081,7 @@ static unsigned int move_to_layer_init(bContext *C, wmOperator *op)
static int move_to_layer_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- View3D *v3d= CTX_wm_view3d(C);
+ View3D *v3d = CTX_wm_view3d(C);
if (v3d && v3d->localvd) {
return WM_operator_confirm_message(C, op, "Move from localview");
}
@@ -1095,24 +1093,24 @@ static int move_to_layer_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int move_to_layer_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- View3D *v3d= CTX_wm_view3d(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ View3D *v3d = CTX_wm_view3d(C);
unsigned int lay, local;
/* int islamp= 0; */ /* UNUSED */
- lay= move_to_layer_init(C, op);
+ lay = move_to_layer_init(C, op);
lay &= 0xFFFFFF;
- if (lay==0) return OPERATOR_CANCELLED;
+ if (lay == 0) return OPERATOR_CANCELLED;
if (v3d && v3d->localvd) {
/* now we can move out of localview. */
/* note: layers are set in bases, library objects work for this */
- CTX_DATA_BEGIN(C, Base*, base, selected_bases) {
- lay= base->lay & ~v3d->lay;
- base->lay= lay;
- base->object->lay= lay;
+ CTX_DATA_BEGIN (C, Base *, base, selected_bases) {
+ lay = base->lay & ~v3d->lay;
+ base->lay = lay;
+ base->object->lay = lay;
base->object->flag &= ~SELECT;
base->flag &= ~SELECT;
/* if (base->object->type==OB_LAMP) islamp= 1; */
@@ -1122,11 +1120,11 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
else {
/* normal non localview operation */
/* note: layers are set in bases, library objects work for this */
- CTX_DATA_BEGIN(C, Base*, base, selected_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selected_bases) {
/* upper byte is used for local view */
- local= base->lay & 0xFF000000;
- base->lay= lay + local;
- base->object->lay= lay;
+ local = base->lay & 0xFF000000;
+ base->lay = lay + local;
+ base->object->lay = lay;
/* if (base->object->type==OB_LAMP) islamp= 1; */
}
CTX_DATA_END;
@@ -1134,8 +1132,8 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
/* warning, active object may be hidden now */
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, scene);
- WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
DAG_scene_sort(bmain, scene);
@@ -1155,7 +1153,7 @@ void OBJECT_OT_move_to_layer(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", "");
@@ -1166,18 +1164,18 @@ void OBJECT_OT_move_to_layer(wmOperatorType *ot)
#if 0
static void link_to_scene(Main *UNUSED(bmain), unsigned short UNUSED(nr))
{
- Scene *sce= (Scene*) BLI_findlink(&bmain->scene, G.curscreen->scenenr-1);
+ Scene *sce = (Scene *) BLI_findlink(&bmain->scene, G.curscreen->scenenr - 1);
Base *base, *nbase;
- if (sce==0) return;
+ if (sce == 0) return;
if (sce->id.lib) return;
- for (base= FIRSTBASE; base; base= base->next) {
+ for (base = FIRSTBASE; base; base = base->next) {
if (TESTBASE(v3d, base)) {
- nbase= MEM_mallocN( sizeof(Base), "newbase");
- *nbase= *base;
- BLI_addhead( &(sce->base), nbase);
+ nbase = MEM_mallocN(sizeof(Base), "newbase");
+ *nbase = *base;
+ BLI_addhead(&(sce->base), nbase);
id_us_plus((ID *)base->object);
}
}
@@ -1186,10 +1184,10 @@ static void link_to_scene(Main *UNUSED(bmain), unsigned short UNUSED(nr))
static int make_links_scene_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene_to= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
+ Main *bmain = CTX_data_main(C);
+ Scene *scene_to = BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
- if (scene_to==NULL) {
+ if (scene_to == NULL) {
BKE_report(op->reports, RPT_ERROR, "Scene not found");
return OPERATOR_CANCELLED;
}
@@ -1204,12 +1202,11 @@ static int make_links_scene_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- CTX_DATA_BEGIN(C, Base*, base, selected_bases)
- {
+ CTX_DATA_BEGIN (C, Base *, base, selected_bases) {
if (!object_in_scene(base->object, scene_to)) {
- Base *nbase= MEM_mallocN( sizeof(Base), "newbase");
- *nbase= *base;
- BLI_addhead( &(scene_to->base), nbase);
+ Base *nbase = MEM_mallocN(sizeof(Base), "newbase");
+ *nbase = *base;
+ BLI_addhead(&(scene_to->base), nbase);
id_us_plus((ID *)base->object);
}
}
@@ -1232,14 +1229,14 @@ enum {
/* Return 1 if make link data is allow, zero otherwise */
static int allow_make_links_data(int ev, Object *ob, Object *obt)
{
- switch(ev) {
+ switch (ev) {
case MAKE_LINKS_OBDATA:
if (ob->type == obt->type && ob->type != OB_EMPTY)
return 1;
break;
case MAKE_LINKS_MATERIALS:
if (OB_TYPE_SUPPORT_MATERIAL(ob->type) &&
- OB_TYPE_SUPPORT_MATERIAL(obt->type))
+ OB_TYPE_SUPPORT_MATERIAL(obt->type))
{
return 1;
}
@@ -1257,53 +1254,53 @@ static int allow_make_links_data(int ev, Object *ob, Object *obt)
static int make_links_data_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
int event = RNA_enum_get(op->ptr, "type");
Object *ob;
ID *id;
int a;
- ob= ED_object_active_context(C);
+ ob = ED_object_active_context(C);
- CTX_DATA_BEGIN(C, Object*, obt, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, obt, selected_editable_objects) {
if (ob != obt) {
if (allow_make_links_data(event, ob, obt)) {
- switch(event) {
- case MAKE_LINKS_OBDATA: /* obdata */
- id= obt->data;
- id->us--;
-
- id= ob->data;
- id_us_plus(id);
- obt->data= id;
-
- /* if amount of material indices changed: */
- test_object_materials(obt->data);
-
- obt->recalc |= OB_RECALC_DATA;
- break;
- case MAKE_LINKS_MATERIALS:
- /* new approach, using functions from kernel */
- for (a=0; a<ob->totcol; a++) {
- Material *ma= give_current_material(ob, a+1);
- assign_material(obt, ma, a+1); /* also works with ma==NULL */
- }
- break;
- case MAKE_LINKS_ANIMDATA:
- BKE_copy_animdata_id((ID *)obt, (ID *)ob, FALSE);
- BKE_copy_animdata_id((ID *)obt->data, (ID *)ob->data, FALSE);
- break;
- case MAKE_LINKS_DUPLIGROUP:
- obt->dup_group= ob->dup_group;
- if (obt->dup_group) {
- id_lib_extern(&obt->dup_group->id);
- obt->transflag |= OB_DUPLIGROUP;
- }
- break;
- case MAKE_LINKS_MODIFIERS:
- object_link_modifiers(obt, ob);
- obt->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
- break;
+ switch (event) {
+ case MAKE_LINKS_OBDATA: /* obdata */
+ id = obt->data;
+ id->us--;
+
+ id = ob->data;
+ id_us_plus(id);
+ obt->data = id;
+
+ /* if amount of material indices changed: */
+ test_object_materials(obt->data);
+
+ obt->recalc |= OB_RECALC_DATA;
+ break;
+ case MAKE_LINKS_MATERIALS:
+ /* new approach, using functions from kernel */
+ for (a = 0; a < ob->totcol; a++) {
+ Material *ma = give_current_material(ob, a + 1);
+ assign_material(obt, ma, a + 1); /* also works with ma==NULL */
+ }
+ break;
+ case MAKE_LINKS_ANIMDATA:
+ BKE_copy_animdata_id((ID *)obt, (ID *)ob, FALSE);
+ BKE_copy_animdata_id((ID *)obt->data, (ID *)ob->data, FALSE);
+ break;
+ case MAKE_LINKS_DUPLIGROUP:
+ obt->dup_group = ob->dup_group;
+ if (obt->dup_group) {
+ id_lib_extern(&obt->dup_group->id);
+ obt->transflag |= OB_DUPLIGROUP;
+ }
+ break;
+ case MAKE_LINKS_MODIFIERS:
+ object_link_modifiers(obt, ob);
+ obt->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
+ break;
}
}
}
@@ -1313,7 +1310,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
DAG_scene_sort(bmain, CTX_data_scene(C));
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C));
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
return OPERATOR_FINISHED;
}
@@ -1333,22 +1330,22 @@ void OBJECT_OT_make_links_scene(wmOperatorType *ot)
/* better not run the poll check */
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
+ prop = RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
RNA_def_enum_funcs(prop, RNA_scene_local_itemf);
ot->prop = prop;
}
void OBJECT_OT_make_links_data(wmOperatorType *ot)
{
- static EnumPropertyItem make_links_items[]= {
- {MAKE_LINKS_OBDATA, "OBDATA", 0, "Object Data", ""},
- {MAKE_LINKS_MATERIALS, "MATERIAL", 0, "Materials", ""},
- {MAKE_LINKS_ANIMDATA, "ANIMATION", 0, "Animation Data", ""},
- {MAKE_LINKS_DUPLIGROUP, "DUPLIGROUP", 0, "DupliGroup", ""},
- {MAKE_LINKS_MODIFIERS, "MODIFIERS", 0, "Modifiers", ""},
+ static EnumPropertyItem make_links_items[] = {
+ {MAKE_LINKS_OBDATA, "OBDATA", 0, "Object Data", ""},
+ {MAKE_LINKS_MATERIALS, "MATERIAL", 0, "Materials", ""},
+ {MAKE_LINKS_ANIMDATA, "ANIMATION", 0, "Animation Data", ""},
+ {MAKE_LINKS_DUPLIGROUP, "DUPLIGROUP", 0, "DupliGroup", ""},
+ {MAKE_LINKS_MODIFIERS, "MODIFIERS", 0, "Modifiers", ""},
{0, NULL, 0, NULL, NULL}};
/* identifiers */
@@ -1361,7 +1358,7 @@ void OBJECT_OT_make_links_data(wmOperatorType *ot)
ot->poll = ED_operator_object_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", make_links_items, 0, "Type", "");
@@ -1375,22 +1372,22 @@ static void single_object_users(Scene *scene, View3D *v3d, int flag)
Base *base;
Object *ob, *obn;
- clear_sca_new_poins(); /* sensor/contr/act */
+ clear_sca_new_poins(); /* sensor/contr/act */
/* duplicate (must set newid) */
- for (base= FIRSTBASE; base; base= base->next) {
- ob= base->object;
+ for (base = FIRSTBASE; base; base = base->next) {
+ ob = base->object;
/* newid may still have some trash from Outliner tree building,
* so clear that first to avoid errors [#26002]
*/
ob->id.newid = NULL;
- if ( (base->flag & flag)==flag ) {
- if (ob->id.lib==NULL && ob->id.us>1) {
+ if ( (base->flag & flag) == flag) {
+ if (ob->id.lib == NULL && ob->id.us > 1) {
/* base gets copy of object */
- obn= copy_object(ob);
- base->object= obn;
+ obn = copy_object(ob);
+ base->object = obn;
ob->id.us--;
}
}
@@ -1400,7 +1397,7 @@ static void single_object_users(Scene *scene, View3D *v3d, int flag)
if (v3d) ID_NEW(v3d->camera);
/* object pointers */
- for (base= FIRSTBASE; base; base= base->next) {
+ for (base = FIRSTBASE; base; base = base->next) {
object_relink(base->object);
}
@@ -1413,9 +1410,9 @@ void ED_object_single_user(Scene *scene, Object *ob)
{
Base *base;
- for (base= FIRSTBASE; base; base= base->next) {
- if (base->object == ob) base->flag |= OB_DONE;
- else base->flag &= ~OB_DONE;
+ for (base = FIRSTBASE; base; base = base->next) {
+ if (base->object == ob) base->flag |= OB_DONE;
+ else base->flag &= ~OB_DONE;
}
single_object_users(scene, NULL, OB_DONE);
@@ -1426,18 +1423,18 @@ static void new_id_matar(Material **matar, int totcol)
ID *id;
int a;
- for (a=0; a<totcol; a++) {
- id= (ID *)matar[a];
+ for (a = 0; a < totcol; a++) {
+ id = (ID *)matar[a];
if (id && id->lib == NULL) {
if (id->newid) {
- matar[a]= (Material *)id->newid;
+ matar[a] = (Material *)id->newid;
id_us_plus(id->newid);
id->us--;
}
- else if (id->us>1) {
- matar[a]= copy_material(matar[a]);
+ else if (id->us > 1) {
+ matar[a] = copy_material(matar[a]);
id->us--;
- id->newid= (ID *)matar[a];
+ id->newid = (ID *)matar[a];
}
}
}
@@ -1454,73 +1451,73 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag)
ID *id;
int a;
- for (base= FIRSTBASE; base; base= base->next) {
- ob= base->object;
- if (ob->id.lib==NULL && (base->flag & flag)==flag ) {
- id= ob->data;
+ for (base = FIRSTBASE; base; base = base->next) {
+ ob = base->object;
+ if (ob->id.lib == NULL && (base->flag & flag) == flag) {
+ id = ob->data;
- if (id && id->us>1 && id->lib==NULL) {
- ob->recalc= OB_RECALC_DATA;
+ if (id && id->us > 1 && id->lib == NULL) {
+ ob->recalc = OB_RECALC_DATA;
BKE_copy_animdata_id_action(id);
- switch(ob->type) {
- case OB_LAMP:
- ob->data= la= copy_lamp(ob->data);
- for (a=0; a<MAX_MTEX; a++) {
- if (la->mtex[a]) {
- ID_NEW(la->mtex[a]->object);
+ switch (ob->type) {
+ case OB_LAMP:
+ ob->data = la = copy_lamp(ob->data);
+ for (a = 0; a < MAX_MTEX; a++) {
+ if (la->mtex[a]) {
+ ID_NEW(la->mtex[a]->object);
+ }
}
- }
- break;
- case OB_CAMERA:
- ob->data= copy_camera(ob->data);
- break;
- case OB_MESH:
- ob->data= copy_mesh(ob->data);
- //me= ob->data;
- //if (me && me->key)
- // ipo_idnew(me->key->ipo); /* drivers */
- break;
- case OB_MBALL:
- ob->data= copy_mball(ob->data);
- break;
- case OB_CURVE:
- case OB_SURF:
- case OB_FONT:
- ob->data= cu= copy_curve(ob->data);
- ID_NEW(cu->bevobj);
- ID_NEW(cu->taperobj);
- break;
- case OB_LATTICE:
- ob->data= copy_lattice(ob->data);
- break;
- case OB_ARMATURE:
- ob->recalc |= OB_RECALC_DATA;
- ob->data= copy_armature(ob->data);
- armature_rebuild_pose(ob, ob->data);
- break;
- case OB_SPEAKER:
- ob->data= copy_speaker(ob->data);
- break;
- default:
- if (G.debug & G_DEBUG)
- printf("ERROR %s: can't copy %s\n", __func__, id->name);
- return;
+ break;
+ case OB_CAMERA:
+ ob->data = copy_camera(ob->data);
+ break;
+ case OB_MESH:
+ ob->data = copy_mesh(ob->data);
+ //me= ob->data;
+ //if (me && me->key)
+ // ipo_idnew(me->key->ipo); /* drivers */
+ break;
+ case OB_MBALL:
+ ob->data = BKE_metaball_copy(ob->data);
+ break;
+ case OB_CURVE:
+ case OB_SURF:
+ case OB_FONT:
+ ob->data = cu = BKE_curve_copy(ob->data);
+ ID_NEW(cu->bevobj);
+ ID_NEW(cu->taperobj);
+ break;
+ case OB_LATTICE:
+ ob->data = copy_lattice(ob->data);
+ break;
+ case OB_ARMATURE:
+ ob->recalc |= OB_RECALC_DATA;
+ ob->data = copy_armature(ob->data);
+ armature_rebuild_pose(ob, ob->data);
+ break;
+ case OB_SPEAKER:
+ ob->data = copy_speaker(ob->data);
+ break;
+ default:
+ if (G.debug & G_DEBUG)
+ printf("ERROR %s: can't copy %s\n", __func__, id->name);
+ return;
}
id->us--;
- id->newid= ob->data;
+ id->newid = ob->data;
}
}
}
- me= bmain->mesh.first;
+ me = bmain->mesh.first;
while (me) {
ID_NEW(me->texcomesh);
- me= me->id.next;
+ me = me->id.next;
}
}
@@ -1529,10 +1526,10 @@ static void single_object_action_users(Scene *scene, int flag)
Object *ob;
Base *base;
- for (base= FIRSTBASE; base; base= base->next) {
- ob= base->object;
- if (ob->id.lib==NULL && (flag==0 || (base->flag & SELECT)) ) {
- ob->recalc= OB_RECALC_DATA;
+ for (base = FIRSTBASE; base; base = base->next) {
+ ob = base->object;
+ if (ob->id.lib == NULL && (flag == 0 || (base->flag & SELECT)) ) {
+ ob->recalc = OB_RECALC_DATA;
BKE_copy_animdata_id_action(&ob->id);
}
}
@@ -1546,30 +1543,30 @@ static void single_mat_users(Scene *scene, int flag, int do_textures)
Tex *tex;
int a, b;
- for (base= FIRSTBASE; base; base= base->next) {
- ob= base->object;
- if (ob->id.lib==NULL && (flag==0 || (base->flag & SELECT)) ) {
+ for (base = FIRSTBASE; base; base = base->next) {
+ ob = base->object;
+ if (ob->id.lib == NULL && (flag == 0 || (base->flag & SELECT)) ) {
- for (a=1; a<=ob->totcol; a++) {
- ma= give_current_material(ob, a);
+ for (a = 1; a <= ob->totcol; a++) {
+ ma = give_current_material(ob, a);
if (ma) {
/* do not test for LIB_NEW: this functions guaranteed delivers single_users! */
- if (ma->id.us>1) {
- man= copy_material(ma);
+ if (ma->id.us > 1) {
+ man = copy_material(ma);
BKE_copy_animdata_id_action(&man->id);
- man->id.us= 0;
+ man->id.us = 0;
assign_material(ob, man, a);
if (do_textures) {
- for (b=0; b<MAX_MTEX; b++) {
- if (ma->mtex[b] && (tex= ma->mtex[b]->tex)) {
- if (tex->id.us>1) {
+ for (b = 0; b < MAX_MTEX; b++) {
+ if (ma->mtex[b] && (tex = ma->mtex[b]->tex)) {
+ if (tex->id.us > 1) {
tex->id.us--;
- tex= copy_texture(tex);
+ tex = copy_texture(tex);
BKE_copy_animdata_id_action(&tex->id);
- man->mtex[b]->tex= tex;
+ man->mtex[b]->tex = tex;
}
}
}
@@ -1585,20 +1582,20 @@ static void do_single_tex_user(Tex **from)
{
Tex *tex, *texn;
- tex= *from;
- if (tex==NULL) return;
+ tex = *from;
+ if (tex == NULL) return;
if (tex->id.newid) {
- *from= (Tex *)tex->id.newid;
+ *from = (Tex *)tex->id.newid;
id_us_plus(tex->id.newid);
tex->id.us--;
}
- else if (tex->id.us>1) {
- texn= copy_texture(tex);
+ else if (tex->id.us > 1) {
+ texn = copy_texture(tex);
BKE_copy_animdata_id_action(&texn->id);
- tex->id.newid= (ID *)texn;
+ tex->id.newid = (ID *)texn;
tex->id.us--;
- *from= texn;
+ *from = texn;
}
}
@@ -1610,31 +1607,31 @@ static void single_tex_users_expand(Main *bmain)
World *wo;
int b;
- for (ma= bmain->mat.first; ma; ma=ma->id.next) {
+ for (ma = bmain->mat.first; ma; ma = ma->id.next) {
if (ma->id.flag & LIB_NEW) {
- for (b=0; b<MAX_MTEX; b++) {
+ for (b = 0; b < MAX_MTEX; b++) {
if (ma->mtex[b] && ma->mtex[b]->tex) {
- do_single_tex_user( &(ma->mtex[b]->tex) );
+ do_single_tex_user(&(ma->mtex[b]->tex));
}
}
}
}
- for (la= bmain->lamp.first; la; la=la->id.next) {
+ for (la = bmain->lamp.first; la; la = la->id.next) {
if (la->id.flag & LIB_NEW) {
- for (b=0; b<MAX_MTEX; b++) {
+ for (b = 0; b < MAX_MTEX; b++) {
if (la->mtex[b] && la->mtex[b]->tex) {
- do_single_tex_user( &(la->mtex[b]->tex) );
+ do_single_tex_user(&(la->mtex[b]->tex));
}
}
}
}
- for (wo= bmain->world.first; wo; wo=wo->id.next) {
+ for (wo = bmain->world.first; wo; wo = wo->id.next) {
if (wo->id.flag & LIB_NEW) {
- for (b=0; b<MAX_MTEX; b++) {
+ for (b = 0; b < MAX_MTEX; b++) {
if (wo->mtex[b] && wo->mtex[b]->tex) {
- do_single_tex_user( &(wo->mtex[b]->tex) );
+ do_single_tex_user(&(wo->mtex[b]->tex));
}
}
}
@@ -1651,26 +1648,26 @@ static void single_mat_users_expand(Main *bmain)
Material *ma;
int a;
- for (ob=bmain->object.first; ob; ob=ob->id.next)
+ for (ob = bmain->object.first; ob; ob = ob->id.next)
if (ob->id.flag & LIB_NEW)
new_id_matar(ob->mat, ob->totcol);
- for (me=bmain->mesh.first; me; me=me->id.next)
+ for (me = bmain->mesh.first; me; me = me->id.next)
if (me->id.flag & LIB_NEW)
new_id_matar(me->mat, me->totcol);
- for (cu=bmain->curve.first; cu; cu=cu->id.next)
+ for (cu = bmain->curve.first; cu; cu = cu->id.next)
if (cu->id.flag & LIB_NEW)
new_id_matar(cu->mat, cu->totcol);
- for (mb=bmain->mball.first; mb; mb=mb->id.next)
+ for (mb = bmain->mball.first; mb; mb = mb->id.next)
if (mb->id.flag & LIB_NEW)
new_id_matar(mb->mat, mb->totcol);
/* material imats */
- for (ma=bmain->mat.first; ma; ma=ma->id.next)
+ for (ma = bmain->mat.first; ma; ma = ma->id.next)
if (ma->id.flag & LIB_NEW)
- for (a=0; a<MAX_MTEX; a++)
+ for (a = 0; a < MAX_MTEX; a++)
if (ma->mtex[a])
ID_NEW(ma->mtex[a]->object);
}
@@ -1700,11 +1697,11 @@ static void make_local_makelocalmaterial(Material *ma)
id_make_local(&ma->id, 0);
- for (b=0; b<MAX_MTEX; b++)
+ for (b = 0; b < MAX_MTEX; b++)
if (ma->mtex[b] && ma->mtex[b]->tex)
id_make_local(&ma->mtex[b]->tex->id, 0);
- adt= BKE_animdata_from_id(&ma->id);
+ adt = BKE_animdata_from_id(&ma->id);
if (adt) BKE_animdata_make_local(adt);
/* nodetree? XXX */
@@ -1712,83 +1709,83 @@ static void make_local_makelocalmaterial(Material *ma)
static int make_local_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
AnimData *adt;
ParticleSystem *psys;
Material *ma, ***matarar;
Lamp *la;
ID *id;
- int a, b, mode= RNA_enum_get(op->ptr, "type");
+ int a, b, mode = RNA_enum_get(op->ptr, "type");
- if (mode==3) {
- BKE_library_make_local(bmain, NULL, 0); /* NULL is all libs */
+ if (mode == 3) {
+ BKE_library_make_local(bmain, NULL, 0); /* NULL is all libs */
WM_event_add_notifier(C, NC_WINDOW, NULL);
return OPERATOR_FINISHED;
}
clear_id_newpoins();
- CTX_DATA_BEGIN(C, Object*, ob, selected_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
if (ob->id.lib)
id_make_local(&ob->id, 0);
}
CTX_DATA_END;
/* maybe object pointers */
- CTX_DATA_BEGIN(C, Object*, ob, selected_objects) {
- if (ob->id.lib==NULL) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
+ if (ob->id.lib == NULL) {
ID_NEW(ob->parent);
}
}
CTX_DATA_END;
- CTX_DATA_BEGIN(C, Object*, ob, selected_objects) {
- id= ob->data;
+ CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
+ id = ob->data;
- if (id && mode>1) {
+ if (id && mode > 1) {
id_make_local(id, 0);
- adt= BKE_animdata_from_id(id);
+ adt = BKE_animdata_from_id(id);
if (adt) BKE_animdata_make_local(adt);
/* tag indirect data direct */
- matarar= (Material ***)give_matarar(ob);
+ matarar = (Material ***)give_matarar(ob);
if (matarar) {
- for (a=0; a<ob->totcol; a++) {
- ma= (*matarar)[a];
+ for (a = 0; a < ob->totcol; a++) {
+ ma = (*matarar)[a];
if (ma)
id_lib_extern(&ma->id);
}
}
}
- for (psys=ob->particlesystem.first; psys; psys=psys->next)
+ for (psys = ob->particlesystem.first; psys; psys = psys->next)
id_make_local(&psys->part->id, 0);
- adt= BKE_animdata_from_id(&ob->id);
+ adt = BKE_animdata_from_id(&ob->id);
if (adt) BKE_animdata_make_local(adt);
}
CTX_DATA_END;
- if (mode>1) {
- CTX_DATA_BEGIN(C, Object*, ob, selected_objects) {
- if (ob->type==OB_LAMP) {
- la= ob->data;
+ if (mode > 1) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
+ if (ob->type == OB_LAMP) {
+ la = ob->data;
- for (b=0; b<MAX_MTEX; b++)
+ for (b = 0; b < MAX_MTEX; b++)
if (la->mtex[b] && la->mtex[b]->tex)
id_make_local(&la->mtex[b]->tex->id, 0);
}
else {
- for (a=0; a<ob->totcol; a++) {
- ma= ob->mat[a];
+ for (a = 0; a < ob->totcol; a++) {
+ ma = ob->mat[a];
if (ma)
make_local_makelocalmaterial(ma);
}
- matarar= (Material ***)give_matarar(ob);
+ matarar = (Material ***)give_matarar(ob);
if (matarar) {
- for (a=0; a<ob->totcol; a++) {
- ma= (*matarar)[a];
+ for (a = 0; a < ob->totcol; a++) {
+ ma = (*matarar)[a];
if (ma)
make_local_makelocalmaterial(ma);
}
@@ -1805,7 +1802,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
void OBJECT_OT_make_local(wmOperatorType *ot)
{
- static EnumPropertyItem type_items[]= {
+ static EnumPropertyItem type_items[] = {
{1, "SELECTED_OBJECTS", 0, "Selected Objects", ""},
{2, "SELECTED_OBJECTS_DATA", 0, "Selected Objects and Data", ""},
{3, "ALL", 0, "All", ""},
@@ -1822,7 +1819,7 @@ void OBJECT_OT_make_local(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
@@ -1830,10 +1827,10 @@ void OBJECT_OT_make_local(wmOperatorType *ot)
static int make_single_user_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- View3D *v3d= CTX_wm_view3d(C); /* ok if this is NULL */
- int flag= RNA_enum_get(op->ptr, "type"); /* 0==ALL, SELECTED==selected objecs */
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ View3D *v3d = CTX_wm_view3d(C); /* ok if this is NULL */
+ int flag = RNA_enum_get(op->ptr, "type"); /* 0==ALL, SELECTED==selected objecs */
if (RNA_boolean_get(op->ptr, "object"))
single_object_users(scene, v3d, flag);
@@ -1859,7 +1856,7 @@ static int make_single_user_exec(bContext *C, wmOperator *op)
void OBJECT_OT_make_single_user(wmOperatorType *ot)
{
- static EnumPropertyItem type_items[]= {
+ static EnumPropertyItem type_items[] = {
{SELECT, "SELECTED_OBJECTS", 0, "Selected Objects", ""},
{0, "ALL", 0, "All", ""},
{0, NULL, 0, NULL, NULL}};
@@ -1875,7 +1872,7 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", type_items, SELECT, "Type", "");
@@ -1889,20 +1886,20 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot)
static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- Main *bmain= CTX_data_main(C);
- Base *base= ED_view3d_give_base_under_cursor(C, event->mval);
+ Main *bmain = CTX_data_main(C);
+ Base *base = ED_view3d_give_base_under_cursor(C, event->mval);
Material *ma;
- char name[MAX_ID_NAME-2];
+ char name[MAX_ID_NAME - 2];
RNA_string_get(op->ptr, "name", name);
- ma= (Material *)find_id("MA", name);
- if (base==NULL || ma==NULL)
+ ma = (Material *)find_id("MA", name);
+ if (base == NULL || ma == NULL)
return OPERATOR_CANCELLED;
assign_material(base->object, ma, 1);
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C));
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
return OPERATOR_FINISHED;
}
@@ -1925,5 +1922,5 @@ void OBJECT_OT_drop_named_material(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- RNA_def_string(ot->srna, "name", "Material", MAX_ID_NAME-2, "Name", "Material name to assign");
+ RNA_def_string(ot->srna, "name", "Material", MAX_ID_NAME - 2, "Name", "Material name to assign");
}
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 388766f5fa3..7a4db175ee4 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -79,8 +79,8 @@
/************************ Exported **************************/
/* simple API for object selection, rather than just using the flag
- * this takes into account the 'restrict selection in 3d view' flag.
- * deselect works always, the restriction just prevents selection */
+* this takes into account the 'restrict selection in 3d view' flag.
+* deselect works always, the restriction just prevents selection */
/* Note: send a NC_SCENE|ND_OB_SELECT notifier yourself! (or
* or a NC_SCENE|ND_OB_VISIBLE in case of visibility toggling */
@@ -88,34 +88,34 @@
void ED_base_object_select(Base *base, short mode)
{
if (base) {
- if (mode==BA_SELECT) {
+ if (mode == BA_SELECT) {
if (!(base->object->restrictflag & OB_RESTRICT_SELECT))
base->flag |= SELECT;
}
- else if (mode==BA_DESELECT) {
+ else if (mode == BA_DESELECT) {
base->flag &= ~SELECT;
}
- base->object->flag= base->flag;
+ base->object->flag = base->flag;
}
}
/* also to set active NULL */
void ED_base_object_activate(bContext *C, Base *base)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
/* sets scene->basact */
- BASACT= base;
+ BASACT = base;
if (base) {
/* XXX old signals, remember to handle notifiers now! */
// select_actionchannel_by_name(base->object->action, "Object", 1);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
}
else
- WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, NULL);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, NULL);
}
/********************** Selection Operators **********************/
@@ -124,7 +124,7 @@ static int objects_selectable_poll(bContext *C)
{
/* we don't check for linked scenes here, selection is
* still allowed then for inspection of scene */
- Object *obact= CTX_data_active_object(C);
+ Object *obact = CTX_data_active_object(C);
if (CTX_data_edit_object(C))
return 0;
@@ -141,23 +141,23 @@ static int object_select_by_type_exec(bContext *C, wmOperator *op)
short obtype, extend;
obtype = RNA_enum_get(op->ptr, "type");
- extend= RNA_boolean_get(op->ptr, "extend");
+ extend = RNA_boolean_get(op->ptr, "extend");
if (extend == 0) {
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
ED_base_object_select(base, BA_DESELECT);
}
CTX_DATA_END;
}
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
- if (base->object->type==obtype) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
+ if (base->object->type == obtype) {
ED_base_object_select(base, BA_SELECT);
}
}
CTX_DATA_END;
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -175,7 +175,7 @@ void OBJECT_OT_select_by_type(wmOperatorType *ot)
ot->poll = objects_selectable_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
@@ -198,11 +198,11 @@ static EnumPropertyItem prop_select_linked_types[] = {
static int object_select_linked_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob;
void *obdata = NULL;
Material *mat = NULL, *mat1;
- Tex *tex= NULL;
+ Tex *tex = NULL;
int a, b;
int nr = RNA_enum_get(op->ptr, "type");
short changed = 0, extend;
@@ -215,77 +215,77 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
* PSys: 6
*/
- extend= RNA_boolean_get(op->ptr, "extend");
+ extend = RNA_boolean_get(op->ptr, "extend");
if (extend == 0) {
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
ED_base_object_select(base, BA_DESELECT);
}
CTX_DATA_END;
}
- ob= OBACT;
- if (ob==NULL) {
+ ob = OBACT;
+ if (ob == NULL) {
BKE_report(op->reports, RPT_ERROR, "No Active Object");
return OPERATOR_CANCELLED;
}
- if (nr==1) {
- // XXX old animation system
+ if (nr == 1) {
+ // XXX old animation system
//ipo= ob->ipo;
//if (ipo==0) return OPERATOR_CANCELLED;
return OPERATOR_CANCELLED;
}
- else if (nr==2) {
- if (ob->data==NULL) return OPERATOR_CANCELLED;
- obdata= ob->data;
+ else if (nr == 2) {
+ if (ob->data == NULL) return OPERATOR_CANCELLED;
+ obdata = ob->data;
}
- else if (nr==3 || nr==4) {
- mat= give_current_material(ob, ob->actcol);
- if (mat==NULL) return OPERATOR_CANCELLED;
- if (nr==4) {
- if (mat->mtex[ (int)mat->texact ]) tex= mat->mtex[ (int)mat->texact ]->tex;
- if (tex==NULL) return OPERATOR_CANCELLED;
+ else if (nr == 3 || nr == 4) {
+ mat = give_current_material(ob, ob->actcol);
+ if (mat == NULL) return OPERATOR_CANCELLED;
+ if (nr == 4) {
+ if (mat->mtex[(int)mat->texact]) tex = mat->mtex[(int)mat->texact]->tex;
+ if (tex == NULL) return OPERATOR_CANCELLED;
}
}
- else if (nr==5) {
- if (ob->dup_group==NULL) return OPERATOR_CANCELLED;
+ else if (nr == 5) {
+ if (ob->dup_group == NULL) return OPERATOR_CANCELLED;
}
- else if (nr==6) {
- if (ob->particlesystem.first==NULL) return OPERATOR_CANCELLED;
+ else if (nr == 6) {
+ if (ob->particlesystem.first == NULL) return OPERATOR_CANCELLED;
}
- else if (nr==7) {
+ else if (nr == 7) {
/* do nothing */
}
- else if (nr==8) {
- if (ob->data==NULL) return OPERATOR_CANCELLED;
+ else if (nr == 8) {
+ if (ob->data == NULL) return OPERATOR_CANCELLED;
}
else
return OPERATOR_CANCELLED;
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
- if (nr==1) {
- // XXX old animation system
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
+ if (nr == 1) {
+ // XXX old animation system
//if (base->object->ipo==ipo) base->flag |= SELECT;
//changed = 1;
}
- else if (nr==2) {
- if (base->object->data==obdata) base->flag |= SELECT;
+ else if (nr == 2) {
+ if (base->object->data == obdata) base->flag |= SELECT;
changed = 1;
}
- else if (nr==3 || nr==4) {
- ob= base->object;
+ else if (nr == 3 || nr == 4) {
+ ob = base->object;
- for (a=1; a<=ob->totcol; a++) {
- mat1= give_current_material(ob, a);
- if (nr==3) {
- if (mat1==mat) base->flag |= SELECT;
+ for (a = 1; a <= ob->totcol; a++) {
+ mat1 = give_current_material(ob, a);
+ if (nr == 3) {
+ if (mat1 == mat) base->flag |= SELECT;
changed = 1;
}
- else if (mat1 && nr==4) {
- for (b=0; b<MAX_MTEX; b++) {
+ else if (mat1 && nr == 4) {
+ for (b = 0; b < MAX_MTEX; b++) {
if (mat1->mtex[b]) {
- if (tex==mat1->mtex[b]->tex) {
+ if (tex == mat1->mtex[b]->tex) {
base->flag |= SELECT;
changed = 1;
break;
@@ -295,19 +295,19 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
}
}
}
- else if (nr==5) {
- if (base->object->dup_group==ob->dup_group) {
+ else if (nr == 5) {
+ if (base->object->dup_group == ob->dup_group) {
base->flag |= SELECT;
changed = 1;
}
}
- else if (nr==6) {
+ else if (nr == 6) {
/* loop through other, then actives particles*/
ParticleSystem *psys;
ParticleSystem *psys_act;
- for (psys=base->object->particlesystem.first; psys; psys=psys->next) {
- for (psys_act=ob->particlesystem.first; psys_act; psys_act=psys_act->next) {
+ for (psys = base->object->particlesystem.first; psys; psys = psys->next) {
+ for (psys_act = ob->particlesystem.first; psys_act; psys_act = psys_act->next) {
if (psys->part == psys_act->part) {
base->flag |= SELECT;
changed = 1;
@@ -320,24 +320,24 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
}
}
}
- else if (nr==7) {
+ else if (nr == 7) {
if (ob->id.lib == base->object->id.lib) {
base->flag |= SELECT;
- changed= 1;
+ changed = 1;
}
}
- else if (nr==8) {
+ else if (nr == 8) {
if (base->object->data && ((ID *)ob->data)->lib == ((ID *)base->object->data)->lib) {
base->flag |= SELECT;
- changed= 1;
+ changed = 1;
}
}
- base->object->flag= base->flag;
+ base->object->flag = base->flag;
}
CTX_DATA_END;
if (changed) {
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -357,7 +357,7 @@ void OBJECT_OT_select_linked(wmOperatorType *ot)
ot->poll = objects_selectable_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
@@ -386,7 +386,7 @@ static short select_grouped_children(bContext *C, Object *ob, int recursive)
{
short changed = 0;
- CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
if (ob == base->object->parent) {
if (!(base->flag & SELECT)) {
ED_base_object_select(base, BA_SELECT);
@@ -401,17 +401,17 @@ static short select_grouped_children(bContext *C, Object *ob, int recursive)
return changed;
}
-static short select_grouped_parent(bContext *C) /* Makes parent active and de-selected OBACT */
+static short select_grouped_parent(bContext *C) /* Makes parent active and de-selected OBACT */
{
- Scene *scene= CTX_data_scene(C);
- View3D *v3d= CTX_wm_view3d(C);
+ Scene *scene = CTX_data_scene(C);
+ View3D *v3d = CTX_wm_view3d(C);
short changed = 0;
- Base *baspar, *basact= CTX_data_active_base(C);
+ Base *baspar, *basact = CTX_data_active_base(C);
- if (!basact || !(basact->object->parent)) return 0; /* we know OBACT is valid */
+ if (!basact || !(basact->object->parent)) return 0; /* we know OBACT is valid */
- baspar= object_in_scene(basact->object->parent, scene);
+ baspar = object_in_scene(basact->object->parent, scene);
/* can be NULL if parent in other scene */
if (baspar && BASE_SELECTABLE(v3d, baspar)) {
@@ -424,17 +424,17 @@ static short select_grouped_parent(bContext *C) /* Makes parent active and de-se
}
-#define GROUP_MENU_MAX 24
-static short select_grouped_group(bContext *C, Object *ob) /* Select objects in the same group as the active */
+#define GROUP_MENU_MAX 24
+static short select_grouped_group(bContext *C, Object *ob) /* Select objects in the same group as the active */
{
short changed = 0;
Group *group, *ob_groups[GROUP_MENU_MAX];
- int group_count=0, i;
+ int group_count = 0, i;
uiPopupMenu *pup;
uiLayout *layout;
- for (group=CTX_data_main(C)->group.first; group && group_count < GROUP_MENU_MAX; group=group->id.next) {
- if (object_in_group (ob, group)) {
+ for (group = CTX_data_main(C)->group.first; group && group_count < GROUP_MENU_MAX; group = group->id.next) {
+ if (object_in_group(ob, group)) {
ob_groups[group_count] = group;
group_count++;
}
@@ -444,7 +444,7 @@ static short select_grouped_group(bContext *C, Object *ob) /* Select objects in
return 0;
else if (group_count == 1) {
group = ob_groups[0];
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
if (!(base->flag & SELECT) && object_in_group(base->object, group)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
@@ -455,12 +455,12 @@ static short select_grouped_group(bContext *C, Object *ob) /* Select objects in
}
/* build the menu. */
- pup= uiPupMenuBegin(C, "Select Group", ICON_NONE);
- layout= uiPupMenuLayout(pup);
+ pup = uiPupMenuBegin(C, "Select Group", ICON_NONE);
+ layout = uiPupMenuLayout(pup);
- for (i=0; i<group_count; i++) {
+ for (i = 0; i < group_count; i++) {
group = ob_groups[i];
- uiItemStringO(layout, group->id.name+2, 0, "OBJECT_OT_select_same_group", "group", group->id.name);
+ uiItemStringO(layout, group->id.name + 2, 0, "OBJECT_OT_select_same_group", "group", group->id.name);
}
uiPupMenuEnd(C, pup);
@@ -469,19 +469,19 @@ static short select_grouped_group(bContext *C, Object *ob) /* Select objects in
static short select_grouped_object_hooks(bContext *C, Object *ob)
{
- Scene *scene= CTX_data_scene(C);
- View3D *v3d= CTX_wm_view3d(C);
+ Scene *scene = CTX_data_scene(C);
+ View3D *v3d = CTX_wm_view3d(C);
short changed = 0;
Base *base;
ModifierData *md;
HookModifierData *hmd;
- for (md = ob->modifiers.first; md; md=md->next) {
- if (md->type==eModifierType_Hook) {
- hmd= (HookModifierData*) md;
+ for (md = ob->modifiers.first; md; md = md->next) {
+ if (md->type == eModifierType_Hook) {
+ hmd = (HookModifierData *) md;
if (hmd->object && !(hmd->object->flag & SELECT)) {
- base= object_in_scene(hmd->object, scene);
+ base = object_in_scene(hmd->object, scene);
if (base && (BASE_SELECTABLE(v3d, base))) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
@@ -498,8 +498,8 @@ static short select_grouped_siblings(bContext *C, Object *ob)
{
short changed = 0;
- CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
- if ((base->object->parent==ob->parent) && !(base->flag & SELECT)) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
+ if ((base->object->parent == ob->parent) && !(base->flag & SELECT)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
}
@@ -512,7 +512,7 @@ static short select_grouped_type(bContext *C, Object *ob)
{
short changed = 0;
- CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
if ((base->object->type == ob->type) && !(base->flag & SELECT)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
@@ -526,7 +526,7 @@ static short select_grouped_layer(bContext *C, Object *ob)
{
char changed = 0;
- CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
if ((base->lay & ob->lay) && !(base->flag & SELECT)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
@@ -540,7 +540,7 @@ static short select_grouped_index_object(bContext *C, Object *ob)
{
char changed = 0;
- CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
if ((base->object->index == ob->index) && !(base->flag & SELECT)) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
@@ -554,7 +554,7 @@ static short select_grouped_color(bContext *C, Object *ob)
{
char changed = 0;
- CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
if (!(base->flag & SELECT) && (compare_v3v3(base->object->col, ob->col, 0.005f))) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
@@ -569,8 +569,8 @@ static short objects_share_gameprop(Object *a, Object *b)
bProperty *prop;
/*make a copy of all its properties*/
- for ( prop= a->prop.first; prop; prop = prop->next ) {
- if ( get_ob_property(b, prop->name) )
+ for (prop = a->prop.first; prop; prop = prop->next) {
+ if (get_ob_property(b, prop->name) )
return 1;
}
return 0;
@@ -580,7 +580,7 @@ static short select_grouped_gameprops(bContext *C, Object *ob)
{
char changed = 0;
- CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
if (!(base->flag & SELECT) && (objects_share_gameprop(base->object, ob))) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
@@ -602,8 +602,7 @@ static short select_grouped_keyingset(bContext *C, Object *UNUSED(ob))
/* select each object that Keying Set refers to */
// TODO: perhaps to be more in line with the rest of these, we should only take objects
// if the passed in object is included in this too
- CTX_DATA_BEGIN(C, Base*, base, selectable_bases)
- {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
/* only check for this object if it isn't selected already, to limit time wasted */
if ((base->flag & SELECT) == 0) {
KS_Path *ksp;
@@ -628,42 +627,42 @@ static short select_grouped_keyingset(bContext *C, Object *UNUSED(ob))
static int object_select_grouped_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
Object *ob;
int nr = RNA_enum_get(op->ptr, "type");
short changed = 0, extend;
- extend= RNA_boolean_get(op->ptr, "extend");
+ extend = RNA_boolean_get(op->ptr, "extend");
if (extend == 0) {
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
ED_base_object_select(base, BA_DESELECT);
changed = 1;
}
CTX_DATA_END;
}
- ob= OBACT;
- if (ob==NULL) {
+ ob = OBACT;
+ if (ob == NULL) {
BKE_report(op->reports, RPT_ERROR, "No Active Object");
return OPERATOR_CANCELLED;
}
- if (nr==1) changed |= select_grouped_children(C, ob, 1);
- else if (nr==2) changed |= select_grouped_children(C, ob, 0);
- else if (nr==3) changed |= select_grouped_parent(C);
- else if (nr==4) changed |= select_grouped_siblings(C, ob);
- else if (nr==5) changed |= select_grouped_type(C, ob);
- else if (nr==6) changed |= select_grouped_layer(C, ob);
- else if (nr==7) changed |= select_grouped_group(C, ob);
- else if (nr==8) changed |= select_grouped_object_hooks(C, ob);
- else if (nr==9) changed |= select_grouped_index_object(C, ob);
- else if (nr==10) changed |= select_grouped_color(C, ob);
- else if (nr==11) changed |= select_grouped_gameprops(C, ob);
- else if (nr==12) changed |= select_grouped_keyingset(C, ob);
+ if (nr == 1) changed |= select_grouped_children(C, ob, 1);
+ else if (nr == 2) changed |= select_grouped_children(C, ob, 0);
+ else if (nr == 3) changed |= select_grouped_parent(C);
+ else if (nr == 4) changed |= select_grouped_siblings(C, ob);
+ else if (nr == 5) changed |= select_grouped_type(C, ob);
+ else if (nr == 6) changed |= select_grouped_layer(C, ob);
+ else if (nr == 7) changed |= select_grouped_group(C, ob);
+ else if (nr == 8) changed |= select_grouped_object_hooks(C, ob);
+ else if (nr == 9) changed |= select_grouped_index_object(C, ob);
+ else if (nr == 10) changed |= select_grouped_color(C, ob);
+ else if (nr == 11) changed |= select_grouped_gameprops(C, ob);
+ else if (nr == 12) changed |= select_grouped_keyingset(C, ob);
if (changed) {
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -683,7 +682,7 @@ void OBJECT_OT_select_grouped(wmOperatorType *ot)
ot->poll = objects_selectable_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
@@ -697,24 +696,24 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op)
unsigned int layernum;
short extend;
- extend= RNA_boolean_get(op->ptr, "extend");
+ extend = RNA_boolean_get(op->ptr, "extend");
layernum = RNA_int_get(op->ptr, "layers");
if (extend == 0) {
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
ED_base_object_select(base, BA_DESELECT);
}
CTX_DATA_END;
}
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
- if (base->lay == (1<< (layernum -1)))
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
+ if (base->lay == (1 << (layernum - 1)))
ED_base_object_select(base, BA_SELECT);
}
CTX_DATA_END;
/* undo? */
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -732,7 +731,7 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot)
ot->poll = objects_selectable_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
@@ -750,7 +749,7 @@ static int object_select_all_exec(bContext *C, wmOperator *op)
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
if (base->flag & SELECT) {
action = SEL_DESELECT;
break;
@@ -759,27 +758,27 @@ static int object_select_all_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
}
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
switch (action) {
- case SEL_SELECT:
- ED_base_object_select(base, BA_SELECT);
- break;
- case SEL_DESELECT:
- ED_base_object_select(base, BA_DESELECT);
- break;
- case SEL_INVERT:
- if (base->flag & SELECT) {
- ED_base_object_select(base, BA_DESELECT);
- }
- else {
+ case SEL_SELECT:
ED_base_object_select(base, BA_SELECT);
- }
- break;
+ break;
+ case SEL_DESELECT:
+ ED_base_object_select(base, BA_DESELECT);
+ break;
+ case SEL_INVERT:
+ if (base->flag & SELECT) {
+ ED_base_object_select(base, BA_DESELECT);
+ }
+ else {
+ ED_base_object_select(base, BA_SELECT);
+ }
+ break;
}
}
CTX_DATA_END;
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -797,7 +796,7 @@ void OBJECT_OT_select_all(wmOperatorType *ot)
ot->poll = objects_selectable_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
@@ -814,7 +813,7 @@ static int object_select_same_group_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "group", group_name);
- for (group=CTX_data_main(C)->group.first; group; group=group->id.next) {
+ for (group = CTX_data_main(C)->group.first; group; group = group->id.next) {
if (!strcmp(group->id.name, group_name))
break;
}
@@ -822,13 +821,13 @@ static int object_select_same_group_exec(bContext *C, wmOperator *op)
if (!group)
return OPERATOR_PASS_THROUGH;
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
if (!(base->flag & SELECT) && object_in_group(base->object, group))
ED_base_object_select(base, BA_SELECT);
}
CTX_DATA_END;
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -846,7 +845,7 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot)
ot->poll = objects_selectable_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_string(ot->srna, "group", "", MAX_ID_NAME, "Group", "Name of the group to select");
}
@@ -854,20 +853,20 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot)
/**************************** Select Mirror ****************************/
static int object_select_mirror_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
short extend;
- extend= RNA_boolean_get(op->ptr, "extend");
+ extend = RNA_boolean_get(op->ptr, "extend");
- CTX_DATA_BEGIN(C, Base*, primbase, selected_bases) {
+ CTX_DATA_BEGIN (C, Base *, primbase, selected_bases) {
char tmpname[MAXBONENAME];
- flip_side_name(tmpname, primbase->object->id.name+2, TRUE);
+ flip_side_name(tmpname, primbase->object->id.name + 2, TRUE);
- if (strcmp(tmpname, primbase->object->id.name+2)!=0) { /* names differ */
- Object *ob= (Object *)find_id("OB", tmpname);
+ if (strcmp(tmpname, primbase->object->id.name + 2) != 0) { /* names differ */
+ Object *ob = (Object *)find_id("OB", tmpname);
if (ob) {
- Base *secbase= object_in_scene(ob, scene);
+ Base *secbase = object_in_scene(ob, scene);
if (secbase) {
ED_base_object_select(secbase, BA_SELECT);
@@ -881,7 +880,7 @@ static int object_select_mirror_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
/* undo? */
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -899,7 +898,7 @@ void OBJECT_OT_select_mirror(wmOperatorType *ot)
ot->poll = objects_selectable_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first");
}
@@ -912,24 +911,24 @@ static int object_select_random_exec(bContext *C, wmOperator *op)
float percent;
short extend;
- extend= RNA_boolean_get(op->ptr, "extend");
+ extend = RNA_boolean_get(op->ptr, "extend");
if (extend == 0) {
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
ED_base_object_select(base, BA_DESELECT);
}
CTX_DATA_END;
}
- percent = RNA_float_get(op->ptr, "percent")/100.0f;
+ percent = RNA_float_get(op->ptr, "percent") / 100.0f;
- CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, visible_bases) {
if (BLI_frand() < percent) {
ED_base_object_select(base, BA_SELECT);
}
}
CTX_DATA_END;
- WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
return OPERATOR_FINISHED;
}
@@ -947,7 +946,7 @@ void OBJECT_OT_select_random(wmOperatorType *ot)
ot->poll = objects_selectable_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_float_percentage(ot->srna, "percent", 50.f, 0.0f, 100.0f, "Percent", "Percentage of objects to select randomly", 0.f, 100.0f);
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index 79b1ca13c9e..5d31bfff99a 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -78,11 +78,11 @@ static void ED_object_shape_key_add(bContext *C, Scene *scene, Object *ob, int f
{
KeyBlock *kb;
if ((kb = object_insert_shape_key(scene, ob, NULL, from_mix))) {
- Key *key= ob_get_key(ob);
+ Key *key = ob_get_key(ob);
/* for absolute shape keys, new keys may not be added last */
ob->shapenr = BLI_findindex(&key->block, kb) + 1;
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
}
}
@@ -90,36 +90,36 @@ static void ED_object_shape_key_add(bContext *C, Scene *scene, Object *ob, int f
static int ED_object_shape_key_remove(bContext *C, Object *ob)
{
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
KeyBlock *kb, *rkb;
Key *key;
//IpoCurve *icu;
- key= ob_get_key(ob);
- if (key==NULL)
+ key = ob_get_key(ob);
+ if (key == NULL)
return 0;
- kb= BLI_findlink(&key->block, ob->shapenr-1);
+ kb = BLI_findlink(&key->block, ob->shapenr - 1);
if (kb) {
- for (rkb= key->block.first; rkb; rkb= rkb->next)
- if (rkb->relative == ob->shapenr-1)
- rkb->relative= 0;
+ for (rkb = key->block.first; rkb; rkb = rkb->next)
+ if (rkb->relative == ob->shapenr - 1)
+ rkb->relative = 0;
BLI_remlink(&key->block, kb);
key->totkey--;
- if (key->refkey== kb) {
- key->refkey= key->block.first;
+ if (key->refkey == kb) {
+ key->refkey = key->block.first;
if (key->refkey) {
/* apply new basis key on original data */
- switch(ob->type) {
+ switch (ob->type) {
case OB_MESH:
key_to_mesh(key->refkey, ob->data);
break;
case OB_CURVE:
case OB_SURF:
- key_to_curve(key->refkey, ob->data, BKE_curve_nurbs(ob->data));
+ key_to_curve(key->refkey, ob->data, BKE_curve_nurbs_get(ob->data));
break;
case OB_LATTICE:
key_to_latt(key->refkey, ob->data);
@@ -136,16 +136,16 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob)
}
}
- if (key->totkey==0) {
- if (GS(key->from->name)==ID_ME) ((Mesh *)key->from)->key= NULL;
- else if (GS(key->from->name)==ID_CU) ((Curve *)key->from)->key= NULL;
- else if (GS(key->from->name)==ID_LT) ((Lattice *)key->from)->key= NULL;
+ if (key->totkey == 0) {
+ if (GS(key->from->name) == ID_ME) ((Mesh *)key->from)->key = NULL;
+ else if (GS(key->from->name) == ID_CU) ((Curve *)key->from)->key = NULL;
+ else if (GS(key->from->name) == ID_LT) ((Lattice *)key->from)->key = NULL;
free_libblock_us(&(bmain->key), key);
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return 1;
}
@@ -155,53 +155,53 @@ static int object_shape_key_mirror(bContext *C, Object *ob)
KeyBlock *kb;
Key *key;
- key= ob_get_key(ob);
- if (key==NULL)
+ key = ob_get_key(ob);
+ if (key == NULL)
return 0;
- kb= BLI_findlink(&key->block, ob->shapenr-1);
+ kb = BLI_findlink(&key->block, ob->shapenr - 1);
if (kb) {
int i1, i2;
float *fp1, *fp2;
float tvec[3];
- char *tag_elem= MEM_callocN(sizeof(char) * kb->totelem, "shape_key_mirror");
+ char *tag_elem = MEM_callocN(sizeof(char) * kb->totelem, "shape_key_mirror");
- if (ob->type==OB_MESH) {
- Mesh *me= ob->data;
+ if (ob->type == OB_MESH) {
+ Mesh *me = ob->data;
MVert *mv;
mesh_octree_table(ob, NULL, NULL, 's');
- for (i1=0, mv=me->mvert; i1<me->totvert; i1++, mv++) {
- i2= mesh_get_x_mirror_vert(ob, i1);
- if (i2==i1) {
- fp1= ((float *)kb->data) + i1*3;
+ for (i1 = 0, mv = me->mvert; i1 < me->totvert; i1++, mv++) {
+ i2 = mesh_get_x_mirror_vert(ob, i1);
+ if (i2 == i1) {
+ fp1 = ((float *)kb->data) + i1 * 3;
fp1[0] = -fp1[0];
- tag_elem[i1]= 1;
+ tag_elem[i1] = 1;
}
else if (i2 != -1) {
- if (tag_elem[i1]==0 && tag_elem[i2]==0) {
- fp1= ((float *)kb->data) + i1*3;
- fp2= ((float *)kb->data) + i2*3;
+ if (tag_elem[i1] == 0 && tag_elem[i2] == 0) {
+ fp1 = ((float *)kb->data) + i1 * 3;
+ fp2 = ((float *)kb->data) + i2 * 3;
- copy_v3_v3(tvec, fp1);
- copy_v3_v3(fp1, fp2);
- copy_v3_v3(fp2, tvec);
+ copy_v3_v3(tvec, fp1);
+ copy_v3_v3(fp1, fp2);
+ copy_v3_v3(fp2, tvec);
/* flip x axis */
fp1[0] = -fp1[0];
fp2[0] = -fp2[0];
}
- tag_elem[i1]= tag_elem[i2]= 1;
+ tag_elem[i1] = tag_elem[i2] = 1;
}
}
mesh_octree_table(ob, NULL, NULL, 'e');
}
else if (ob->type == OB_LATTICE) {
- Lattice *lt= ob->data;
+ Lattice *lt = ob->data;
int i1, i2;
float *fp1, *fp2;
int u, v, w;
@@ -213,28 +213,28 @@ static int object_shape_key_mirror(bContext *C, Object *ob)
/* if (lt->editlatt) lt= lt->editlatt->latt; */
- for (w=0; w<lt->pntsw; w++) {
- for (v=0; v<lt->pntsv; v++) {
- for (u=0; u<pntsu_half; u++) {
- int u_inv= (lt->pntsu - 1) - u;
+ for (w = 0; w < lt->pntsw; w++) {
+ for (v = 0; v < lt->pntsv; v++) {
+ for (u = 0; u < pntsu_half; u++) {
+ int u_inv = (lt->pntsu - 1) - u;
float tvec[3];
if (u == u_inv) {
- i1= LT_INDEX(lt, u, v, w);
- fp1= ((float *)kb->data) + i1*3;
- fp1[0]= -fp1[0];
+ i1 = LT_INDEX(lt, u, v, w);
+ fp1 = ((float *)kb->data) + i1 * 3;
+ fp1[0] = -fp1[0];
}
else {
- i1= LT_INDEX(lt, u, v, w);
- i2= LT_INDEX(lt, u_inv, v, w);
+ i1 = LT_INDEX(lt, u, v, w);
+ i2 = LT_INDEX(lt, u_inv, v, w);
- fp1= ((float *)kb->data) + i1*3;
- fp2= ((float *)kb->data) + i2*3;
+ fp1 = ((float *)kb->data) + i1 * 3;
+ fp2 = ((float *)kb->data) + i2 * 3;
copy_v3_v3(tvec, fp1);
copy_v3_v3(fp1, fp2);
copy_v3_v3(fp2, tvec);
- fp1[0]= -fp1[0];
- fp2[0]= -fp2[0];
+ fp1[0] = -fp1[0];
+ fp2[0] = -fp2[0];
}
}
}
@@ -245,7 +245,7 @@ static int object_shape_key_mirror(bContext *C, Object *ob)
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return 1;
}
@@ -254,22 +254,22 @@ static int object_shape_key_mirror(bContext *C, Object *ob)
static int shape_key_mode_poll(bContext *C)
{
- Object *ob= ED_object_context(C);
- ID *data= (ob)? ob->data: NULL;
+ Object *ob = ED_object_context(C);
+ ID *data = (ob) ? ob->data : NULL;
return (ob && !ob->id.lib && data && !data->lib && ob->mode != OB_MODE_EDIT);
}
static int shape_key_poll(bContext *C)
{
- Object *ob= ED_object_context(C);
- ID *data= (ob)? ob->data: NULL;
+ Object *ob = ED_object_context(C);
+ ID *data = (ob) ? ob->data : NULL;
return (ob && !ob->id.lib && data && !data->lib);
}
static int shape_key_add_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_context(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = ED_object_context(C);
int from_mix = RNA_boolean_get(op->ptr, "from_mix");
ED_object_shape_key_add(C, scene, ob, from_mix);
@@ -289,7 +289,7 @@ void OBJECT_OT_shape_key_add(wmOperatorType *ot)
ot->exec = shape_key_add_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "from_mix", 1, "From Mix", "Create the new shape key from the existing mix of keys");
@@ -297,7 +297,7 @@ void OBJECT_OT_shape_key_add(wmOperatorType *ot)
static int shape_key_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
if (!ED_object_shape_key_remove(C, ob))
return OPERATOR_CANCELLED;
@@ -317,23 +317,23 @@ void OBJECT_OT_shape_key_remove(wmOperatorType *ot)
ot->exec = shape_key_remove_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_context(C);
- Key *key= ob_get_key(ob);
- KeyBlock *kb= ob_get_keyblock(ob);
+ Object *ob = ED_object_context(C);
+ Key *key = ob_get_key(ob);
+ KeyBlock *kb = ob_get_keyblock(ob);
if (!key || !kb)
return OPERATOR_CANCELLED;
- for (kb=key->block.first; kb; kb=kb->next)
- kb->curval= 0.0f;
+ for (kb = key->block.first; kb; kb = kb->next)
+ kb->curval = 0.0f;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
}
@@ -350,7 +350,7 @@ void OBJECT_OT_shape_key_clear(wmOperatorType *ot)
ot->exec = shape_key_clear_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* starting point and step size could be optional */
@@ -364,11 +364,11 @@ static int shape_key_retime_exec(bContext *C, wmOperator *UNUSED(op))
if (!key || !kb)
return OPERATOR_CANCELLED;
- for (kb=key->block.first; kb; kb=kb->next)
+ for (kb = key->block.first; kb; kb = kb->next)
kb->pos = (cfra += 0.1f);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
}
@@ -385,12 +385,12 @@ void OBJECT_OT_shape_key_retime(wmOperatorType *ot)
ot->exec = shape_key_retime_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int shape_key_mirror_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
if (!object_shape_key_mirror(C, ob))
return OPERATOR_CANCELLED;
@@ -409,28 +409,28 @@ void OBJECT_OT_shape_key_mirror(wmOperatorType *ot)
ot->exec = shape_key_mirror_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int shape_key_move_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
- int type= RNA_enum_get(op->ptr, "type");
- Key *key= ob_get_key(ob);
+ int type = RNA_enum_get(op->ptr, "type");
+ Key *key = ob_get_key(ob);
if (key) {
KeyBlock *kb, *kb_other;
- int shapenr_act= ob->shapenr-1;
- int shapenr_swap= shapenr_act + type;
- kb= BLI_findlink(&key->block, shapenr_act);
+ int shapenr_act = ob->shapenr - 1;
+ int shapenr_swap = shapenr_act + type;
+ kb = BLI_findlink(&key->block, shapenr_act);
- if ((type==-1 && kb->prev==NULL) || (type==1 && kb->next==NULL)) {
+ if ((type == -1 && kb->prev == NULL) || (type == 1 && kb->next == NULL)) {
return OPERATOR_CANCELLED;
}
- for (kb_other= key->block.first; kb_other; kb_other= kb_other->next) {
+ for (kb_other = key->block.first; kb_other; kb_other = kb_other->next) {
if (kb_other->relative == shapenr_act) {
kb_other->relative += type;
}
@@ -439,16 +439,16 @@ static int shape_key_move_exec(bContext *C, wmOperator *op)
}
}
- if (type==-1) {
+ if (type == -1) {
/* move back */
- kb_other= kb->prev;
+ kb_other = kb->prev;
BLI_remlink(&key->block, kb);
BLI_insertlinkbefore(&key->block, kb_other, kb);
ob->shapenr--;
}
else {
/* move next */
- kb_other= kb->next;
+ kb_other = kb->next;
BLI_remlink(&key->block, kb);
BLI_insertlinkafter(&key->block, kb_other, kb);
ob->shapenr++;
@@ -458,7 +458,7 @@ static int shape_key_move_exec(bContext *C, wmOperator *op)
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
}
@@ -480,7 +480,7 @@ void OBJECT_OT_shape_key_move(wmOperatorType *ot)
ot->exec = shape_key_move_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", slot_move, 0, "Type", "");
}
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 55954790687..e416bd5b762 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -78,57 +78,57 @@
static void object_clear_loc(Object *ob)
{
/* clear location if not locked */
- if ((ob->protectflag & OB_LOCK_LOCX)==0)
- ob->loc[0]= ob->dloc[0]= 0.0f;
- if ((ob->protectflag & OB_LOCK_LOCY)==0)
- ob->loc[1]= ob->dloc[1]= 0.0f;
- if ((ob->protectflag & OB_LOCK_LOCZ)==0)
- ob->loc[2]= ob->dloc[2]= 0.0f;
+ if ((ob->protectflag & OB_LOCK_LOCX) == 0)
+ ob->loc[0] = ob->dloc[0] = 0.0f;
+ if ((ob->protectflag & OB_LOCK_LOCY) == 0)
+ ob->loc[1] = ob->dloc[1] = 0.0f;
+ if ((ob->protectflag & OB_LOCK_LOCZ) == 0)
+ ob->loc[2] = ob->dloc[2] = 0.0f;
}
/* clear rotation of object */
static void object_clear_rot(Object *ob)
{
/* clear rotations that aren't locked */
- if (ob->protectflag & (OB_LOCK_ROTX|OB_LOCK_ROTY|OB_LOCK_ROTZ|OB_LOCK_ROTW)) {
+ if (ob->protectflag & (OB_LOCK_ROTX | OB_LOCK_ROTY | OB_LOCK_ROTZ | OB_LOCK_ROTW)) {
if (ob->protectflag & OB_LOCK_ROT4D) {
/* perform clamping on a component by component basis */
if (ob->rotmode == ROT_MODE_AXISANGLE) {
if ((ob->protectflag & OB_LOCK_ROTW) == 0)
- ob->rotAngle= ob->drotAngle= 0.0f;
+ ob->rotAngle = ob->drotAngle = 0.0f;
if ((ob->protectflag & OB_LOCK_ROTX) == 0)
- ob->rotAxis[0]= ob->drotAxis[0]= 0.0f;
+ ob->rotAxis[0] = ob->drotAxis[0] = 0.0f;
if ((ob->protectflag & OB_LOCK_ROTY) == 0)
- ob->rotAxis[1]= ob->drotAxis[1]= 0.0f;
+ ob->rotAxis[1] = ob->drotAxis[1] = 0.0f;
if ((ob->protectflag & OB_LOCK_ROTZ) == 0)
- ob->rotAxis[2]= ob->drotAxis[2]= 0.0f;
+ ob->rotAxis[2] = ob->drotAxis[2] = 0.0f;
/* check validity of axis - axis should never be 0,0,0 (if so, then we make it rotate about y) */
if (IS_EQF(ob->rotAxis[0], ob->rotAxis[1]) && IS_EQF(ob->rotAxis[1], ob->rotAxis[2]))
ob->rotAxis[1] = 1.0f;
if (IS_EQF(ob->drotAxis[0], ob->drotAxis[1]) && IS_EQF(ob->drotAxis[1], ob->drotAxis[2]))
- ob->drotAxis[1]= 1.0f;
+ ob->drotAxis[1] = 1.0f;
}
else if (ob->rotmode == ROT_MODE_QUAT) {
if ((ob->protectflag & OB_LOCK_ROTW) == 0)
- ob->quat[0]= ob->dquat[0]= 1.0f;
+ ob->quat[0] = ob->dquat[0] = 1.0f;
if ((ob->protectflag & OB_LOCK_ROTX) == 0)
- ob->quat[1]= ob->dquat[1]= 0.0f;
+ ob->quat[1] = ob->dquat[1] = 0.0f;
if ((ob->protectflag & OB_LOCK_ROTY) == 0)
- ob->quat[2]= ob->dquat[2]= 0.0f;
+ ob->quat[2] = ob->dquat[2] = 0.0f;
if ((ob->protectflag & OB_LOCK_ROTZ) == 0)
- ob->quat[3]= ob->dquat[3]= 0.0f;
+ ob->quat[3] = ob->dquat[3] = 0.0f;
// TODO: does this quat need normalizing now?
}
else {
/* the flag may have been set for the other modes, so just ignore the extra flag... */
if ((ob->protectflag & OB_LOCK_ROTX) == 0)
- ob->rot[0]= ob->drot[0]= 0.0f;
+ ob->rot[0] = ob->drot[0] = 0.0f;
if ((ob->protectflag & OB_LOCK_ROTY) == 0)
- ob->rot[1]= ob->drot[1]= 0.0f;
+ ob->rot[1] = ob->drot[1] = 0.0f;
if ((ob->protectflag & OB_LOCK_ROTZ) == 0)
- ob->rot[2]= ob->drot[2]= 0.0f;
+ ob->rot[2] = ob->drot[2] = 0.0f;
}
}
else {
@@ -147,30 +147,30 @@ static void object_clear_rot(Object *ob)
copy_v3_v3(oldeul, ob->rot);
}
- eul[0]= eul[1]= eul[2]= 0.0f;
+ eul[0] = eul[1] = eul[2] = 0.0f;
if (ob->protectflag & OB_LOCK_ROTX)
- eul[0]= oldeul[0];
+ eul[0] = oldeul[0];
if (ob->protectflag & OB_LOCK_ROTY)
- eul[1]= oldeul[1];
+ eul[1] = oldeul[1];
if (ob->protectflag & OB_LOCK_ROTZ)
- eul[2]= oldeul[2];
+ eul[2] = oldeul[2];
if (ob->rotmode == ROT_MODE_QUAT) {
eul_to_quat(ob->quat, eul);
/* quaternions flip w sign to accumulate rotations correctly */
- if ((quat1[0]<0.0f && ob->quat[0]>0.0f) || (quat1[0]>0.0f && ob->quat[0]<0.0f)) {
+ if ((quat1[0] < 0.0f && ob->quat[0] > 0.0f) || (quat1[0] > 0.0f && ob->quat[0] < 0.0f)) {
mul_qt_fl(ob->quat, -1.0f);
}
}
else if (ob->rotmode == ROT_MODE_AXISANGLE) {
- eulO_to_axis_angle(ob->rotAxis, &ob->rotAngle,eul, EULER_ORDER_DEFAULT);
+ eulO_to_axis_angle(ob->rotAxis, &ob->rotAngle, eul, EULER_ORDER_DEFAULT);
}
else {
copy_v3_v3(ob->rot, eul);
}
}
- } // Duplicated in source/blender/editors/armature/editarmature.c
+ } // Duplicated in source/blender/editors/armature/editarmature.c
else {
if (ob->rotmode == ROT_MODE_QUAT) {
unit_qt(ob->quat);
@@ -191,17 +191,17 @@ static void object_clear_rot(Object *ob)
static void object_clear_scale(Object *ob)
{
/* clear scale factors which are not locked */
- if ((ob->protectflag & OB_LOCK_SCALEX)==0) {
- ob->dscale[0]= 1.0f;
- ob->size[0]= 1.0f;
+ if ((ob->protectflag & OB_LOCK_SCALEX) == 0) {
+ ob->dscale[0] = 1.0f;
+ ob->size[0] = 1.0f;
}
- if ((ob->protectflag & OB_LOCK_SCALEY)==0) {
- ob->dscale[1]= 1.0f;
- ob->size[1]= 1.0f;
+ if ((ob->protectflag & OB_LOCK_SCALEY) == 0) {
+ ob->dscale[1] = 1.0f;
+ ob->size[1] = 1.0f;
}
- if ((ob->protectflag & OB_LOCK_SCALEZ)==0) {
- ob->dscale[2]= 1.0f;
- ob->size[2]= 1.0f;
+ if ((ob->protectflag & OB_LOCK_SCALEZ) == 0) {
+ ob->dscale[2] = 1.0f;
+ ob->size[2] = 1.0f;
}
}
@@ -209,10 +209,10 @@ static void object_clear_scale(Object *ob)
/* generic exec for clear-transform operators */
static int object_clear_transform_generic_exec(bContext *C, wmOperator *op,
- void (*clear_func)(Object*), const char default_ksName[])
+ void (*clear_func)(Object *), const char default_ksName[])
{
Main *bmain = CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
KeyingSet *ks;
/* sanity checks */
@@ -227,8 +227,7 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op,
/* operate on selected objects only if they aren't in weight-paint mode
* (so that object-transform clearing won't be applied at same time as bone-clearing)
*/
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (!(ob->mode & OB_MODE_WEIGHT_PAINT)) {
/* run provided clearing function */
clear_func(ob);
@@ -244,7 +243,7 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op,
/* this is needed so children are also updated */
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
}
@@ -269,7 +268,7 @@ void OBJECT_OT_location_clear(wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int object_rotation_clear_exec(bContext *C, wmOperator *op)
@@ -289,7 +288,7 @@ void OBJECT_OT_rotation_clear(wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int object_scale_clear_exec(bContext *C, wmOperator *op)
@@ -309,23 +308,22 @@ void OBJECT_OT_scale_clear(wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* --------------- */
static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
float *v1, *v3;
float mat[3][3];
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob->parent) {
/* vectors pointed to by v1 and v3 will get modified */
- v1= ob->loc;
- v3= ob->parentinv[3];
+ v1 = ob->loc;
+ v3 = ob->parentinv[3];
copy_m3_m4(mat, ob->parentinv);
negate_v3_v3(v3, v1);
@@ -338,7 +336,7 @@ static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op))
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
}
@@ -355,20 +353,20 @@ void OBJECT_OT_origin_clear(wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/*************************** Apply Transformation ****************************/
/* use this when the loc/size/rot of the parent has changed but the children
- * should stay in the same place, e.g. for apply-size-rot or object center */
-static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob )
+* should stay in the same place, e.g. for apply-size-rot or object center */
+static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob)
{
Object workob;
Object *ob_child;
/* a change was made, adjust the children to compensate */
- for (ob_child=bmain->object.first; ob_child; ob_child=ob_child->id.next) {
+ for (ob_child = bmain->object.first; ob_child; ob_child = ob_child->id.next) {
if (ob_child->parent == ob) {
object_apply_mat4(ob_child, ob_child->obmat, TRUE, FALSE);
what_does_parent(scene, ob_child, &workob);
@@ -379,21 +377,21 @@ static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob )
static int apply_objects_internal(bContext *C, ReportList *reports, int apply_loc, int apply_rot, int apply_scale)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
float rsmat[3][3], tmat[3][3], obmat[3][3], iobmat[3][3], mat[4][4], scale;
int a, change = 0;
/* first check if we can execute */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
- if (ob->type==OB_MESH) {
+ if (ob->type == OB_MESH) {
if (ID_REAL_USERS(ob->data) > 1) {
BKE_report(reports, RPT_ERROR, "Can't apply to a multi user mesh, doing nothing");
return OPERATOR_CANCELLED;
}
}
- else if (ob->type==OB_ARMATURE) {
+ else if (ob->type == OB_ARMATURE) {
if (ID_REAL_USERS(ob->data) > 1) {
BKE_report(reports, RPT_ERROR, "Can't apply to a multi user armature, doing nothing");
return OPERATOR_CANCELLED;
@@ -413,7 +411,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
return OPERATOR_CANCELLED;
}
- cu= ob->data;
+ cu = ob->data;
if (!(cu->flag & CU_3D) && (apply_rot || apply_loc)) {
BKE_report(reports, RPT_ERROR, "Neither rotation nor location could be applied to a 2d curve, doing nothing");
@@ -428,7 +426,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
CTX_DATA_END;
/* now execute */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
/* calculate rotation/scale matrix */
if (apply_scale && apply_rot)
@@ -466,24 +464,24 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
}
/* apply to object data */
- if (ob->type==OB_MESH) {
- Mesh *me= ob->data;
+ if (ob->type == OB_MESH) {
+ Mesh *me = ob->data;
MVert *mvert;
multiresModifier_scale_disp(scene, ob);
/* adjust data */
- mvert= me->mvert;
- for (a=0; a<me->totvert; a++, mvert++)
+ mvert = me->mvert;
+ for (a = 0; a < me->totvert; a++, mvert++)
mul_m4_v3(mat, mvert->co);
if (me->key) {
KeyBlock *kb;
- for (kb=me->key->block.first; kb; kb=kb->next) {
- float *fp= kb->data;
+ for (kb = me->key->block.first; kb; kb = kb->next) {
+ float *fp = kb->data;
- for (a=0; a<kb->totelem; a++, fp+=3)
+ for (a = 0; a < kb->totelem; a++, fp += 3)
mul_m4_v3(mat, fp);
}
}
@@ -491,7 +489,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
/* update normals */
mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL);
}
- else if (ob->type==OB_ARMATURE) {
+ else if (ob->type == OB_ARMATURE) {
ED_armature_apply_transform(ob, mat);
}
else if (ob->type == OB_LATTICE) {
@@ -505,7 +503,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
}
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
- Curve *cu= ob->data;
+ Curve *cu = ob->data;
Nurb *nu;
BPoint *bp;
@@ -513,20 +511,20 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
scale = mat3_to_scale(rsmat);
- for (nu=cu->nurb.first; nu; nu=nu->next) {
+ for (nu = cu->nurb.first; nu; nu = nu->next) {
if (nu->type == CU_BEZIER) {
- a= nu->pntsu;
- for (bezt= nu->bezt; a--; bezt++) {
+ a = nu->pntsu;
+ for (bezt = nu->bezt; a--; bezt++) {
mul_m4_v3(mat, bezt->vec[0]);
mul_m4_v3(mat, bezt->vec[1]);
mul_m4_v3(mat, bezt->vec[2]);
bezt->radius *= scale;
}
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
else {
- a= nu->pntsu*nu->pntsv;
- for (bp= nu->bp; a--; bp++)
+ a = nu->pntsu * nu->pntsv;
+ for (bp = nu->bp; a--; bp++)
mul_m4_v3(mat, bp->vec);
}
}
@@ -537,7 +535,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
if (apply_loc)
zero_v3(ob->loc);
if (apply_scale)
- ob->size[0]= ob->size[1]= ob->size[2]= 1.0f;
+ ob->size[0] = ob->size[1] = ob->size[2] = 1.0f;
if (apply_rot) {
zero_v3(ob->rot);
unit_qt(ob->quat);
@@ -545,13 +543,13 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
}
where_is_object(scene, ob);
- if (ob->type==OB_ARMATURE) {
+ if (ob->type == OB_ARMATURE) {
where_is_pose(scene, ob); /* needed for bone parents */
}
ignore_parent_tx(bmain, scene, ob);
- DAG_id_tag_update(&ob->id, OB_RECALC_OB|OB_RECALC_DATA);
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA);
change = 1;
}
@@ -560,16 +558,16 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
if (!change)
return OPERATOR_CANCELLED;
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
}
static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
int change = 0;
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
where_is_object(scene, ob);
object_apply_mat4(ob, ob->obmat, TRUE, TRUE);
where_is_object(scene, ob);
@@ -584,7 +582,7 @@ static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op))
if (!change)
return OPERATOR_CANCELLED;
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
return OPERATOR_FINISHED;
}
@@ -600,14 +598,14 @@ void OBJECT_OT_visual_transform_apply(wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int object_transform_apply_exec(bContext *C, wmOperator *op)
{
- const int loc= RNA_boolean_get(op->ptr, "location");
- const int rot= RNA_boolean_get(op->ptr, "rotation");
- const int sca= RNA_boolean_get(op->ptr, "scale");
+ const int loc = RNA_boolean_get(op->ptr, "location");
+ const int rot = RNA_boolean_get(op->ptr, "rotation");
+ const int sca = RNA_boolean_get(op->ptr, "scale");
if (loc || rot || sca) {
return apply_objects_internal(C, op->reports, loc, rot, sca);
@@ -629,7 +627,7 @@ void OBJECT_OT_transform_apply(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "location", 0, "Location", "");
RNA_def_boolean(ot->srna, "rotation", 0, "Rotation", "");
@@ -639,23 +637,23 @@ void OBJECT_OT_transform_apply(wmOperatorType *ot)
/********************* Set Object Center ************************/
enum {
- GEOMETRY_TO_ORIGIN=0,
+ GEOMETRY_TO_ORIGIN = 0,
ORIGIN_TO_GEOMETRY,
ORIGIN_TO_CURSOR
};
static int object_origin_set_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- Object *obedit= CTX_data_edit_object(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
Object *tob;
float cursor[3], cent[3], cent_neg[3], centn[3], min[3], max[3];
int centermode = RNA_enum_get(op->ptr, "type");
int around = RNA_enum_get(op->ptr, "center"); /* initialized from v3d->around */
/* keep track of what is changed */
- int tot_change=0, tot_lib_error=0, tot_multiuser_arm_error=0;
+ int tot_change = 0, tot_lib_error = 0, tot_multiuser_arm_error = 0;
if (obedit && centermode != GEOMETRY_TO_ORIGIN) {
BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in EditMode");
@@ -663,10 +661,10 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
else {
/* get the view settings if 'around' isn't set and the view is available */
- View3D *v3d= CTX_wm_view3d(C);
+ View3D *v3d = CTX_wm_view3d(C);
copy_v3_v3(cursor, give_cursor(scene, v3d));
if (v3d && !RNA_struct_property_is_set(op->ptr, "center"))
- around= v3d->around;
+ around = v3d->around;
}
zero_v3(cent);
@@ -674,8 +672,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
if (obedit) {
INIT_MINMAX(min, max);
- if (obedit->type==OB_MESH) {
- Mesh *me= obedit->data;
+ if (obedit->type == OB_MESH) {
+ Mesh *me = obedit->data;
BMEditMesh *em = me->edit_btmesh;
BMVert *eve;
BMIter iter;
@@ -688,10 +686,10 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
else {
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
- if (around==V3D_CENTROID) {
+ if (around == V3D_CENTROID) {
total++;
add_v3_v3(cent, eve->co);
- mul_v3_fl(cent, 1.0f/(float)total);
+ mul_v3_fl(cent, 1.0f / (float)total);
}
else {
DO_MINMAX(eve->co, min, max);
@@ -707,24 +705,24 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
EDBM_mesh_normals_update(em);
tot_change++;
DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
- }
+ }
}
/* reset flags */
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- ob->flag &= ~OB_DONE;
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
+ ob->flag &= ~OB_DONE;
}
CTX_DATA_END;
- for (tob= bmain->object.first; tob; tob= tob->id.next) {
+ for (tob = bmain->object.first; tob; tob = tob->id.next) {
if (tob->data)
((ID *)tob->data)->flag &= ~LIB_DOIT;
if (tob->dup_group)
((ID *)tob->dup_group)->flag &= ~LIB_DOIT;
}
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
- if ((ob->flag & OB_DONE)==0) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
+ if ((ob->flag & OB_DONE) == 0) {
int do_inverse_offset = FALSE;
ob->flag |= OB_DONE;
@@ -736,7 +734,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
if (ob->data == NULL) {
/* special support for dupligroups */
- if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group && (ob->dup_group->id.flag & LIB_DOIT)==0) {
+ if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group && (ob->dup_group->id.flag & LIB_DOIT) == 0) {
if (ob->dup_group->id.lib) {
tot_lib_error++;
}
@@ -755,7 +753,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
tot_change++;
ob->dup_group->id.flag |= LIB_DOIT;
- do_inverse_offset= TRUE;
+ do_inverse_offset = TRUE;
}
}
}
@@ -763,11 +761,11 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
tot_lib_error++;
}
- if (obedit==NULL && ob->type==OB_MESH) {
- Mesh *me= ob->data;
+ if (obedit == NULL && ob->type == OB_MESH) {
+ Mesh *me = ob->data;
if (centermode == ORIGIN_TO_CURSOR) { /* done */ }
- else if (around==V3D_CENTROID) { mesh_center_median(me, cent); }
+ else if (around == V3D_CENTROID) { mesh_center_median(me, cent); }
else { mesh_center_bounds(me, cent); }
negate_v3_v3(cent_neg, cent);
@@ -775,25 +773,25 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
tot_change++;
me->id.flag |= LIB_DOIT;
- do_inverse_offset= TRUE;
+ do_inverse_offset = TRUE;
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
- Curve *cu= ob->data;
+ Curve *cu = ob->data;
if (centermode == ORIGIN_TO_CURSOR) { /* done */ }
- else if (around==V3D_CENTROID) { curve_center_median(cu, cent); }
- else { curve_center_bounds(cu, cent); }
+ else if (around == V3D_CENTROID) { BKE_curve_center_median(cu, cent); }
+ else { BKE_curve_center_bounds(cu, cent); }
/* don't allow Z change if curve is 2D */
if ((ob->type == OB_CURVE) && !(cu->flag & CU_3D))
cent[2] = 0.0;
negate_v3_v3(cent_neg, cent);
- curve_translate(cu, cent_neg, 1);
+ BKE_curve_translate(cu, cent_neg, 1);
tot_change++;
cu->id.flag |= LIB_DOIT;
- do_inverse_offset= TRUE;
+ do_inverse_offset = TRUE;
if (obedit) {
if (centermode == GEOMETRY_TO_ORIGIN) {
@@ -802,12 +800,12 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
break;
}
}
- else if (ob->type==OB_FONT) {
+ else if (ob->type == OB_FONT) {
/* get from bb */
- Curve *cu= ob->data;
+ Curve *cu = ob->data;
- if (cu->bb==NULL && (centermode != ORIGIN_TO_CURSOR)) {
+ if (cu->bb == NULL && (centermode != ORIGIN_TO_CURSOR)) {
/* do nothing*/
}
else {
@@ -815,21 +813,21 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
/* done */
}
else {
- cent[0]= 0.5f * ( cu->bb->vec[4][0] + cu->bb->vec[0][0]);
- cent[1]= 0.5f * ( cu->bb->vec[0][1] + cu->bb->vec[2][1]) - 0.5f; /* extra 0.5 is the height o above line */
+ cent[0] = 0.5f * (cu->bb->vec[4][0] + cu->bb->vec[0][0]);
+ cent[1] = 0.5f * (cu->bb->vec[0][1] + cu->bb->vec[2][1]) - 0.5f; /* extra 0.5 is the height o above line */
}
- cent[2]= 0.0f;
+ cent[2] = 0.0f;
- cu->xof= cu->xof - (cent[0] / cu->fsize);
- cu->yof= cu->yof - (cent[1] / cu->fsize);
+ cu->xof = cu->xof - (cent[0] / cu->fsize);
+ cu->yof = cu->yof - (cent[1] / cu->fsize);
tot_change++;
cu->id.flag |= LIB_DOIT;
- do_inverse_offset= TRUE;
+ do_inverse_offset = TRUE;
}
}
- else if (ob->type==OB_ARMATURE) {
+ else if (ob->type == OB_ARMATURE) {
bArmature *arm = ob->data;
if (ID_REAL_USERS(arm) > 1) {
@@ -862,15 +860,15 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
MetaBall *mb = ob->data;
if (centermode == ORIGIN_TO_CURSOR) { /* done */ }
- else if (around==V3D_CENTROID) { BKE_metaball_center_median(mb, cent); }
- else { BKE_metaball_center_bounds(mb, cent); }
+ else if (around == V3D_CENTROID) { BKE_metaball_center_median(mb, cent); }
+ else { BKE_metaball_center_bounds(mb, cent); }
negate_v3_v3(cent_neg, cent);
BKE_metaball_translate(mb, cent_neg);
tot_change++;
mb->id.flag |= LIB_DOIT;
- do_inverse_offset= TRUE;
+ do_inverse_offset = TRUE;
if (obedit) {
if (centermode == GEOMETRY_TO_ORIGIN) {
@@ -889,27 +887,28 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
add_v3_v3(ob->loc, centn);
where_is_object(scene, ob);
- if (ob->type==OB_ARMATURE) {
+ if (ob->type == OB_ARMATURE) {
where_is_pose(scene, ob); /* needed for bone parents */
}
ignore_parent_tx(bmain, scene, ob);
/* other users? */
- CTX_DATA_BEGIN(C, Object*, ob_other, selected_editable_objects) {
- if ( (ob_other->flag & OB_DONE)==0 &&
- ( (ob->data && (ob->data == ob_other->data)) ||
- (ob->dup_group==ob_other->dup_group && (ob->transflag|ob_other->transflag) & OB_DUPLIGROUP) )
- ) {
+ CTX_DATA_BEGIN (C, Object *, ob_other, selected_editable_objects) {
+ if ((ob_other->flag & OB_DONE) == 0 &&
+ ((ob->data && (ob->data == ob_other->data)) ||
+ (ob->dup_group == ob_other->dup_group &&
+ (ob->transflag | ob_other->transflag) & OB_DUPLIGROUP)))
+ {
ob_other->flag |= OB_DONE;
- DAG_id_tag_update(&ob_other->id, OB_RECALC_OB|OB_RECALC_DATA);
+ DAG_id_tag_update(&ob_other->id, OB_RECALC_OB | OB_RECALC_DATA);
copy_v3_v3(centn, cent);
mul_mat3_m4_v3(ob_other->obmat, centn); /* ommit translation part */
add_v3_v3(ob_other->loc, centn);
where_is_object(scene, ob_other);
- if (ob_other->type==OB_ARMATURE) {
+ if (ob_other->type == OB_ARMATURE) {
where_is_pose(scene, ob_other); /* needed for bone parents */
}
ignore_parent_tx(bmain, scene, ob_other);
@@ -921,22 +920,22 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- for (tob= bmain->object.first; tob; tob= tob->id.next)
+ for (tob = bmain->object.first; tob; tob = tob->id.next)
if (tob->data && (((ID *)tob->data)->flag & LIB_DOIT))
- DAG_id_tag_update(&tob->id, OB_RECALC_OB|OB_RECALC_DATA);
+ DAG_id_tag_update(&tob->id, OB_RECALC_OB | OB_RECALC_DATA);
if (tot_change) {
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
}
/* Warn if any errors occurred */
- if (tot_lib_error+tot_multiuser_arm_error) {
- BKE_reportf(op->reports, RPT_WARNING, "%i Object(s) Not Centered, %i Changed:",tot_lib_error+tot_multiuser_arm_error, tot_change);
+ if (tot_lib_error + tot_multiuser_arm_error) {
+ BKE_reportf(op->reports, RPT_WARNING, "%i Object(s) Not Centered, %i Changed:", tot_lib_error + tot_multiuser_arm_error, tot_change);
if (tot_lib_error)
- BKE_reportf(op->reports, RPT_WARNING, "|%i linked library objects",tot_lib_error);
+ BKE_reportf(op->reports, RPT_WARNING, "|%i linked library objects", tot_lib_error);
if (tot_multiuser_arm_error)
- BKE_reportf(op->reports, RPT_WARNING, "|%i multiuser armature object(s)",tot_multiuser_arm_error);
+ BKE_reportf(op->reports, RPT_WARNING, "|%i multiuser armature object(s)", tot_multiuser_arm_error);
}
return OPERATOR_FINISHED;
@@ -969,7 +968,7 @@ void OBJECT_OT_origin_set(wmOperatorType *ot)
ot->poll = ED_operator_scene_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ot->prop = RNA_def_enum(ot->srna, "type", prop_set_center_types, 0, "Type", "");
RNA_def_enum(ot->srna, "center", prop_set_bounds_types, V3D_CENTROID, "Center", "");
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index ea0b7542886..744f8adb59f 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -85,9 +85,9 @@ static void vgroup_delete_all(Object *ob);
static Lattice *vgroup_edit_lattice(Object *ob)
{
- Lattice *lt= ob->data;
- BLI_assert(ob->type==OB_LATTICE);
- return (lt->editlatt)? lt->editlatt->latt: lt;
+ Lattice *lt = ob->data;
+ BLI_assert(ob->type == OB_LATTICE);
+ return (lt->editlatt) ? lt->editlatt->latt : lt;
}
int ED_vgroup_object_is_edit_mode(Object *ob)
@@ -95,7 +95,7 @@ int ED_vgroup_object_is_edit_mode(Object *ob)
if (ob->type == OB_MESH)
return (BMEdit_FromObject(ob) != NULL);
else if (ob->type == OB_LATTICE)
- return (((Lattice*)ob->data)->editlatt != NULL);
+ return (((Lattice *)ob->data)->editlatt != NULL);
return 0;
}
@@ -145,18 +145,18 @@ void ED_vgroup_delete(Object *ob, bDeformGroup *defgroup)
void ED_vgroup_clear(Object *ob)
{
- bDeformGroup *dg= (bDeformGroup *)ob->defbase.first;
- int edit_mode= ED_vgroup_object_is_edit_mode(ob);
+ bDeformGroup *dg = (bDeformGroup *)ob->defbase.first;
+ int edit_mode = ED_vgroup_object_is_edit_mode(ob);
while (dg) {
- bDeformGroup *next_dg= dg->next;
+ bDeformGroup *next_dg = dg->next;
if (edit_mode)
vgroup_delete_edit_mode(ob, dg);
else
vgroup_delete_object_mode(ob, dg);
- dg= next_dg;
+ dg = next_dg;
}
}
@@ -164,14 +164,14 @@ int ED_vgroup_data_create(ID *id)
{
/* create deform verts */
- if (GS(id->name)==ID_ME) {
- Mesh *me= (Mesh *)id;
- me->dvert= CustomData_add_layer(&me->vdata, CD_MDEFORMVERT, CD_CALLOC, NULL, me->totvert);
+ if (GS(id->name) == ID_ME) {
+ Mesh *me = (Mesh *)id;
+ me->dvert = CustomData_add_layer(&me->vdata, CD_MDEFORMVERT, CD_CALLOC, NULL, me->totvert);
return TRUE;
}
- else if (GS(id->name)==ID_LT) {
- Lattice *lt= (Lattice *)id;
- lt->dvert= MEM_callocN(sizeof(MDeformVert)*lt->pntsu*lt->pntsv*lt->pntsw, "lattice deformVert");
+ else if (GS(id->name) == ID_LT) {
+ Lattice *lt = (Lattice *)id;
+ lt->dvert = MEM_callocN(sizeof(MDeformVert) * lt->pntsu * lt->pntsv * lt->pntsw, "lattice deformVert");
return TRUE;
}
else {
@@ -185,7 +185,7 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to
*dvert_arr = NULL;
if (id) {
- switch(GS(id->name)) {
+ switch (GS(id->name)) {
case ID_ME:
{
Mesh *me = (Mesh *)id;
@@ -202,7 +202,7 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to
i = em->bm->totvert;
- *dvert_arr= MEM_mallocN(sizeof(void*)*i, "vgroup parray from me");
+ *dvert_arr = MEM_mallocN(sizeof(void *) * i, "vgroup parray from me");
*dvert_tot = i;
i = 0;
@@ -223,21 +223,21 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to
return 1;
}
else if (me->dvert) {
- MVert *mvert= me->mvert;
- MDeformVert *dvert= me->dvert;
+ MVert *mvert = me->mvert;
+ MDeformVert *dvert = me->dvert;
int i;
- *dvert_tot= me->totvert;
- *dvert_arr= MEM_mallocN(sizeof(void*)*me->totvert, "vgroup parray from me");
+ *dvert_tot = me->totvert;
+ *dvert_arr = MEM_mallocN(sizeof(void *) * me->totvert, "vgroup parray from me");
if (use_vert_sel) {
- for (i=0; i<me->totvert; i++) {
+ for (i = 0; i < me->totvert; i++) {
(*dvert_arr)[i] = (mvert[i].flag & SELECT) ?
- &dvert[i] : NULL;
+ &dvert[i] : NULL;
}
}
else {
- for (i=0; i<me->totvert; i++) {
+ for (i = 0; i < me->totvert; i++) {
(*dvert_arr)[i] = me->dvert + i;
}
}
@@ -250,24 +250,24 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to
}
case ID_LT:
{
- int i=0;
+ int i = 0;
- Lattice *lt= (Lattice *)id;
- lt= (lt->editlatt)? lt->editlatt->latt: lt;
+ Lattice *lt = (Lattice *)id;
+ lt = (lt->editlatt) ? lt->editlatt->latt : lt;
if (lt->dvert) {
- BPoint *def= lt->def;
- *dvert_tot= lt->pntsu*lt->pntsv*lt->pntsw;
- *dvert_arr= MEM_mallocN(sizeof(void*)*(*dvert_tot), "vgroup parray from me");
+ BPoint *def = lt->def;
+ *dvert_tot = lt->pntsu * lt->pntsv * lt->pntsw;
+ *dvert_arr = MEM_mallocN(sizeof(void *) * (*dvert_tot), "vgroup parray from me");
if (use_vert_sel) {
- for (i=0; i<*dvert_tot; i++) {
+ for (i = 0; i < *dvert_tot; i++) {
(*dvert_arr)[i] = (def->f1 & SELECT) ?
&lt->dvert[i] : NULL;
}
}
else {
- for (i=0; i<*dvert_tot; i++) {
+ for (i = 0; i < *dvert_tot; i++) {
(*dvert_arr)[i] = lt->dvert + i;
}
}
@@ -288,27 +288,27 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to
int ED_vgroup_give_array(ID *id, MDeformVert **dvert_arr, int *dvert_tot)
{
if (id) {
- switch(GS(id->name)) {
+ switch (GS(id->name)) {
case ID_ME:
{
Mesh *me = (Mesh *)id;
- *dvert_arr= me->dvert;
- *dvert_tot= me->totvert;
+ *dvert_arr = me->dvert;
+ *dvert_tot = me->totvert;
return TRUE;
}
case ID_LT:
{
- Lattice *lt= (Lattice *)id;
- lt= (lt->editlatt)? lt->editlatt->latt: lt;
- *dvert_arr= lt->dvert;
- *dvert_tot= lt->pntsu*lt->pntsv*lt->pntsw;
+ Lattice *lt = (Lattice *)id;
+ lt = (lt->editlatt) ? lt->editlatt->latt : lt;
+ *dvert_arr = lt->dvert;
+ *dvert_tot = lt->pntsu * lt->pntsv * lt->pntsw;
return TRUE;
}
}
}
- *dvert_arr= NULL;
- *dvert_tot= 0;
+ *dvert_arr = NULL;
+ *dvert_tot = 0;
return FALSE;
}
@@ -318,9 +318,9 @@ int ED_vgroup_copy_array(Object *ob, Object *ob_from)
MDeformVert **dvert_array_from, **dvf;
MDeformVert **dvert_array, **dv;
int dvert_tot_from, dvert_tot, i;
- int defbase_tot_from= BLI_countlist(&ob_from->defbase);
- int defbase_tot= BLI_countlist(&ob->defbase);
- short new_vgroup= FALSE;
+ int defbase_tot_from = BLI_countlist(&ob_from->defbase);
+ int defbase_tot = BLI_countlist(&ob->defbase);
+ short new_vgroup = FALSE;
/*get vertex groups arrays*/
ED_vgroup_give_parray(ob_from->data, &dvert_array_from, &dvert_tot_from, FALSE);
@@ -328,10 +328,10 @@ int ED_vgroup_copy_array(Object *ob, Object *ob_from)
if ((dvert_array == NULL) && (dvert_array_from != NULL) && ED_vgroup_data_create(ob->data)) {
ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, FALSE);
- new_vgroup= TRUE;
+ new_vgroup = TRUE;
}
- if (ob==ob_from || dvert_tot==0 || (dvert_tot != dvert_tot_from) || dvert_array_from==NULL || dvert_array==NULL) {
+ if (ob == ob_from || dvert_tot == 0 || (dvert_tot != dvert_tot_from) || dvert_array_from == NULL || dvert_array == NULL) {
if (dvert_array) MEM_freeN(dvert_array);
if (dvert_array_from) MEM_freeN(dvert_array_from);
@@ -345,29 +345,29 @@ int ED_vgroup_copy_array(Object *ob, Object *ob_from)
/* do the copy */
BLI_freelistN(&ob->defbase);
BLI_duplicatelist(&ob->defbase, &ob_from->defbase);
- ob->actdef= ob_from->actdef;
+ ob->actdef = ob_from->actdef;
if (defbase_tot_from < defbase_tot) {
/* correct vgroup indices because the number of vgroups is being reduced. */
- int *remap= MEM_mallocN(sizeof(int) * (defbase_tot + 1), __func__);
- for (i=0; i <= defbase_tot_from; i++) remap[i]= i;
- for (; i <= defbase_tot; i++) remap[i]= 0; /* can't use these, so disable */
+ int *remap = MEM_mallocN(sizeof(int) * (defbase_tot + 1), __func__);
+ for (i = 0; i <= defbase_tot_from; i++) remap[i] = i;
+ for (; i <= defbase_tot; i++) remap[i] = 0; /* can't use these, so disable */
vgroup_remap_update_users(ob, remap);
MEM_freeN(remap);
}
- dvf= dvert_array_from;
- dv= dvert_array;
+ dvf = dvert_array_from;
+ dv = dvert_array;
- for (i=0; i<dvert_tot; i++, dvf++, dv++) {
+ for (i = 0; i < dvert_tot; i++, dvf++, dv++) {
if ((*dv)->dw)
MEM_freeN((*dv)->dw);
- *(*dv)= *(*dvf);
+ *(*dv) = *(*dvf);
if ((*dv)->dw)
- (*dv)->dw= MEM_dupallocN((*dv)->dw);
+ (*dv)->dw = MEM_dupallocN((*dv)->dw);
}
MEM_freeN(dvert_array);
@@ -589,13 +589,13 @@ static void ED_vgroup_nr_vert_add(Object *ob,
/* add the vert to the deform group with the
* specified number
*/
- MDeformVert *dvert= NULL;
- int tot;
+ MDeformVert *dvert = NULL;
+ int tot;
/* get the vert */
ED_vgroup_give_array(ob->data, &dvert, &tot);
- if (dvert==NULL)
+ if (dvert == NULL)
return;
/* check that vertnum is valid before trying to get the relevant dvert */
@@ -604,7 +604,7 @@ static void ED_vgroup_nr_vert_add(Object *ob,
if (dvert) {
- MDeformVert *dv= &dvert[vertnum];
+ MDeformVert *dv = &dvert[vertnum];
MDeformWeight *dw;
/* Lets first check to see if this vert is
@@ -612,27 +612,27 @@ static void ED_vgroup_nr_vert_add(Object *ob,
* lets update it
*/
- dw= defvert_find_index(dv, def_nr);
+ dw = defvert_find_index(dv, def_nr);
if (dw) {
- switch(assignmode) {
- case WEIGHT_REPLACE:
- dw->weight = weight;
- break;
- case WEIGHT_ADD:
- dw->weight += weight;
- if (dw->weight >= 1.0f)
- dw->weight = 1.0f;
- break;
- case WEIGHT_SUBTRACT:
- dw->weight -= weight;
- /* if the weight is zero or less then
- * remove the vert from the deform group
- */
- if (dw->weight <= 0.0f) {
- defvert_remove_group(dv, dw);
- }
- break;
+ switch (assignmode) {
+ case WEIGHT_REPLACE:
+ dw->weight = weight;
+ break;
+ case WEIGHT_ADD:
+ dw->weight += weight;
+ if (dw->weight >= 1.0f)
+ dw->weight = 1.0f;
+ break;
+ case WEIGHT_SUBTRACT:
+ dw->weight -= weight;
+ /* if the weight is zero or less then
+ * remove the vert from the deform group
+ */
+ if (dw->weight <= 0.0f) {
+ defvert_remove_group(dv, dw);
+ }
+ break;
}
}
else {
@@ -640,21 +640,21 @@ static void ED_vgroup_nr_vert_add(Object *ob,
* we must take a different form of action ...
*/
- switch(assignmode) {
- case WEIGHT_SUBTRACT:
- /* if we are subtracting then we don't
- * need to do anything
- */
- return;
+ switch (assignmode) {
+ case WEIGHT_SUBTRACT:
+ /* if we are subtracting then we don't
+ * need to do anything
+ */
+ return;
- case WEIGHT_REPLACE:
- case WEIGHT_ADD:
- /* if we are doing an additive assignment, then
- * we need to create the deform weight
- */
+ case WEIGHT_REPLACE:
+ case WEIGHT_ADD:
+ /* if we are doing an additive assignment, then
+ * we need to create the deform weight
+ */
- /* we checked if the vertex was added before so no need to test again, simply add */
- defvert_add_index_notest(dv, def_nr, weight);
+ /* we checked if the vertex was added before so no need to test again, simply add */
+ defvert_add_index_notest(dv, def_nr, weight);
}
}
}
@@ -666,9 +666,9 @@ void ED_vgroup_vert_add(Object *ob, bDeformGroup *dg, int vertnum, float weight,
/* add the vert to the deform group with the
* specified assign mode
*/
- const int def_nr= BLI_findindex(&ob->defbase, dg);
+ const int def_nr = BLI_findindex(&ob->defbase, dg);
- MDeformVert *dv= NULL;
+ MDeformVert *dv = NULL;
int tot;
/* get the deform group number, exit if
@@ -678,7 +678,7 @@ void ED_vgroup_vert_add(Object *ob, bDeformGroup *dg, int vertnum, float weight,
/* if there's no deform verts then create some,
*/
- if (ED_vgroup_give_array(ob->data, &dv, &tot) && dv==NULL)
+ if (ED_vgroup_give_array(ob->data, &dv, &tot) && dv == NULL)
ED_vgroup_data_create(ob->data);
/* call another function to do the work
@@ -687,17 +687,17 @@ void ED_vgroup_vert_add(Object *ob, bDeformGroup *dg, int vertnum, float weight,
}
/* mesh object mode, lattice can be in editmode */
-void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum)
+void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum)
{
/* This routine removes the vertex from the specified
* deform group.
*/
/* TODO, this is slow in a loop, better pass def_nr directly, but leave for later... - campbell */
- const int def_nr= BLI_findindex(&ob->defbase, dg);
+ const int def_nr = BLI_findindex(&ob->defbase, dg);
if (def_nr != -1) {
- MDeformVert *dvert= NULL;
+ MDeformVert *dvert = NULL;
int tot;
/* get the deform vertices corresponding to the
@@ -706,10 +706,10 @@ void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum)
ED_vgroup_give_array(ob->data, &dvert, &tot);
if (dvert) {
- MDeformVert *dv= &dvert[vertnum];
+ MDeformVert *dv = &dvert[vertnum];
MDeformWeight *dw;
- dw= defvert_find_index(dv, def_nr);
+ dw = defvert_find_index(dv, def_nr);
defvert_remove_group(dv, dw); /* dw can be NULL */
}
}
@@ -717,20 +717,20 @@ void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum)
static float get_vert_def_nr(Object *ob, const int def_nr, const int vertnum)
{
- MDeformVert *dv= NULL;
+ MDeformVert *dv = NULL;
BMVert *eve;
Mesh *me;
/* get the deform vertices corresponding to the vertnum */
- if (ob->type==OB_MESH) {
- me= ob->data;
+ if (ob->type == OB_MESH) {
+ me = ob->data;
if (me->edit_btmesh) {
- eve= BM_vert_at_index(me->edit_btmesh->bm, vertnum);
+ eve = BM_vert_at_index(me->edit_btmesh->bm, vertnum);
if (!eve) {
return 0.0f;
}
- dv= CustomData_bmesh_get(&me->edit_btmesh->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+ dv = CustomData_bmesh_get(&me->edit_btmesh->bm->vdata, eve->head.data, CD_MDEFORMVERT);
}
else {
if (vertnum >= me->totvert) {
@@ -739,11 +739,11 @@ static float get_vert_def_nr(Object *ob, const int def_nr, const int vertnum)
dv = &me->dvert[vertnum];
}
}
- else if (ob->type==OB_LATTICE) {
- Lattice *lt= vgroup_edit_lattice(ob);
+ else if (ob->type == OB_LATTICE) {
+ Lattice *lt = vgroup_edit_lattice(ob);
if (lt->dvert) {
- if (vertnum >= lt->pntsu*lt->pntsv*lt->pntsw) {
+ if (vertnum >= lt->pntsu * lt->pntsv * lt->pntsw) {
return 0.0f;
}
dv = &lt->dvert[vertnum];
@@ -751,7 +751,7 @@ static float get_vert_def_nr(Object *ob, const int def_nr, const int vertnum)
}
if (dv) {
- MDeformWeight *dw= defvert_find_index(dv, def_nr);
+ MDeformWeight *dw = defvert_find_index(dv, def_nr);
if (dw) {
return dw->weight;
}
@@ -762,7 +762,7 @@ static float get_vert_def_nr(Object *ob, const int def_nr, const int vertnum)
float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum)
{
- const int def_nr= BLI_findindex(&ob->defbase, dg);
+ const int def_nr = BLI_findindex(&ob->defbase, dg);
if (def_nr == -1) {
return -1;
@@ -772,8 +772,8 @@ float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum)
}
void ED_vgroup_select_by_name(Object *ob, const char *name)
-{ /* note: ob->actdef==0 signals on painting to create a new one, if a bone in posemode is selected */
- ob->actdef= defgroup_name_index(ob, name) + 1;
+{ /* note: ob->actdef==0 signals on painting to create a new one, if a bone in posemode is selected */
+ ob->actdef = defgroup_name_index(ob, name) + 1;
}
/********************** Operator Implementations *********************/
@@ -781,7 +781,7 @@ void ED_vgroup_select_by_name(Object *ob, const char *name)
/* only in editmode */
static void vgroup_select_verts(Object *ob, int select)
{
- const int def_nr= ob->actdef-1;
+ const int def_nr = ob->actdef - 1;
MDeformVert *dv;
if (!BLI_findlink(&ob->defbase, def_nr)) {
@@ -789,7 +789,7 @@ static void vgroup_select_verts(Object *ob, int select)
}
if (ob->type == OB_MESH) {
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
if (me->edit_btmesh) {
BMEditMesh *em = me->edit_btmesh;
@@ -798,7 +798,7 @@ static void vgroup_select_verts(Object *ob, int select)
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
- dv= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+ dv = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
if (defvert_find_index(dv, def_nr)) {
BM_vert_select_set(em->bm, eve, select);
}
@@ -806,7 +806,7 @@ static void vgroup_select_verts(Object *ob, int select)
}
/* this has to be called, because this function operates on vertices only */
- if (select) EDBM_select_flush(em); // vertices to edges/faces
+ if (select) EDBM_select_flush(em); // vertices to edges/faces
else EDBM_deselect_flush(em);
}
else {
@@ -818,11 +818,11 @@ static void vgroup_select_verts(Object *ob, int select)
mv = me->mvert;
dv = me->dvert;
- for (i=0; i<me->totvert; i++, mv++, dv++) {
+ for (i = 0; i < me->totvert; i++, mv++, dv++) {
if (!(mv->flag & ME_HIDE)) {
if (defvert_find_index(dv, def_nr)) {
- if (select) mv->flag |= SELECT;
- else mv->flag &= ~SELECT;
+ if (select) mv->flag |= SELECT;
+ else mv->flag &= ~SELECT;
}
}
}
@@ -832,19 +832,19 @@ static void vgroup_select_verts(Object *ob, int select)
}
}
else if (ob->type == OB_LATTICE) {
- Lattice *lt= vgroup_edit_lattice(ob);
+ Lattice *lt = vgroup_edit_lattice(ob);
if (lt->dvert) {
BPoint *bp;
int a, tot;
- dv= lt->dvert;
+ dv = lt->dvert;
- tot= lt->pntsu*lt->pntsv*lt->pntsw;
- for (a=0, bp= lt->def; a<tot; a++, bp++, dv++) {
+ tot = lt->pntsu * lt->pntsv * lt->pntsw;
+ for (a = 0, bp = lt->def; a < tot; a++, bp++, dv++) {
if (defvert_find_index(dv, def_nr)) {
- if (select) bp->f1 |= SELECT;
- else bp->f1 &= ~SELECT;
+ if (select) bp->f1 |= SELECT;
+ else bp->f1 &= ~SELECT;
}
}
}
@@ -856,10 +856,10 @@ static void vgroup_duplicate(Object *ob)
bDeformGroup *dg, *cdg;
char name[sizeof(dg->name)];
MDeformWeight *dw_org, *dw_cpy;
- MDeformVert **dvert_array=NULL;
- int i, idg, icdg, dvert_tot=0;
+ MDeformVert **dvert_array = NULL;
+ int i, idg, icdg, dvert_tot = 0;
- dg = BLI_findlink(&ob->defbase, (ob->actdef-1));
+ dg = BLI_findlink(&ob->defbase, (ob->actdef - 1));
if (!dg)
return;
@@ -876,16 +876,16 @@ static void vgroup_duplicate(Object *ob)
BLI_addtail(&ob->defbase, cdg);
- idg = (ob->actdef-1);
+ idg = (ob->actdef - 1);
ob->actdef = BLI_countlist(&ob->defbase);
- icdg = (ob->actdef-1);
+ icdg = (ob->actdef - 1);
/* TODO, we might want to allow only copy selected verts here? - campbell */
ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, FALSE);
if (dvert_array) {
for (i = 0; i < dvert_tot; i++) {
- MDeformVert *dv= dvert_array[i];
+ MDeformVert *dv = dvert_array[i];
dw_org = defvert_find_index(dv, idg);
if (dw_org) {
/* defvert_verify_index re-allocs org so need to store the weight first */
@@ -901,9 +901,9 @@ static void vgroup_duplicate(Object *ob)
static void vgroup_normalize(Object *ob)
{
MDeformWeight *dw;
- MDeformVert *dv, **dvert_array=NULL;
- int i, dvert_tot=0;
- const int def_nr= ob->actdef-1;
+ MDeformVert *dv, **dvert_array = NULL;
+ int i, dvert_tot = 0;
+ const int def_nr = ob->actdef - 1;
const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
@@ -954,7 +954,7 @@ static void vgroup_normalize(Object *ob)
/* This finds all of the vertices face-connected to vert by an edge and returns a
* MEM_allocated array of indices of size count.
* count is an int passed by reference so it can be assigned the value of the length here. */
-static int* getSurroundingVerts(Mesh *me, int vert, int *count)
+static int *getSurroundingVerts(Mesh *me, int vert, int *count)
{
MPoly *mp = me->mpoly;
int i = me->totpoly;
@@ -981,12 +981,12 @@ static int* getSurroundingVerts(Mesh *me, int vert, int *count)
}
else if (!j) {
/* We are on the last corner. */
- a = (ml-1)->v;
+ a = (ml - 1)->v;
b = me->mloop[mp->loopstart].v;
}
else {
- a = (ml-1)->v;
- b = (ml+1)->v;
+ a = (ml - 1)->v;
+ b = (ml + 1)->v;
}
/* Append a and b verts to array, if not yet present. */
@@ -1026,7 +1026,7 @@ static void getSingleCoordinate(MVert *points, int count, float coord[3])
for (i = 0; i < count; i++) {
add_v3_v3(coord, points[i].co);
}
- mul_v3_fl(coord, 1.0f/count);
+ mul_v3_fl(coord, 1.0f / count);
}
/* given a plane and a start and end position,
@@ -1056,7 +1056,7 @@ static void getVerticalAndHorizontalChange(const float norm[3], float d, const f
// I need the derived mesh to be forgotten so the positions are recalculated with weight changes (see dm_deform_recalc)
static void dm_deform_clear(DerivedMesh *dm, Object *ob)
{
- if (ob->derivedDeform && (ob->derivedDeform)==dm) {
+ if (ob->derivedDeform && (ob->derivedDeform) == dm) {
ob->derivedDeform->needsFree = 1;
ob->derivedDeform->release(ob->derivedDeform);
ob->derivedDeform = NULL;
@@ -1068,7 +1068,7 @@ static void dm_deform_clear(DerivedMesh *dm, Object *ob)
}
/* recalculate the deformation */
-static DerivedMesh* dm_deform_recalc(Scene *scene, Object *ob)
+static DerivedMesh *dm_deform_recalc(Scene *scene, Object *ob)
{
return mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
}
@@ -1088,19 +1088,19 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
DerivedMesh *dm;
MDeformWeight *dw;
MVert m;
- MDeformVert *dvert = me->dvert+index;
+ MDeformVert *dvert = me->dvert + index;
int totweight = dvert->totweight;
float oldw = 0;
float oldPos[3] = {0};
float vc, hc, dist = 0.0f;
int i, k;
- float (*changes)[2] = MEM_mallocN(sizeof(float *)*totweight*2, "vertHorzChange");
- float *dists = MEM_mallocN(sizeof(float)*totweight, "distance");
+ float (*changes)[2] = MEM_mallocN(sizeof(float *) * totweight * 2, "vertHorzChange");
+ float *dists = MEM_mallocN(sizeof(float) * totweight, "distance");
/* track if up or down moved it closer for each bone */
- int *upDown = MEM_callocN(sizeof(int)*totweight, "upDownTracker");
+ int *upDown = MEM_callocN(sizeof(int) * totweight, "upDownTracker");
- int *dwIndices = MEM_callocN(sizeof(int)*totweight, "dwIndexTracker");
+ int *dwIndices = MEM_callocN(sizeof(int) * totweight, "dwIndexTracker");
float distToStart;
int bestIndex = 0;
char wasChange;
@@ -1115,11 +1115,11 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
distToStart = dot_v3v3(norm, oldPos) + d;
if (distToBe == originalDistToBe) {
- distToBe += distToStart - distToStart*strength;
+ distToBe += distToStart - distToStart * strength;
}
for (i = 0; i < totweight; i++) {
dwIndices[i] = i;
- dw = (dvert->dw+i);
+ dw = (dvert->dw + i);
vc = hc = 0;
if (!dw->weight) {
changes[i][0] = 0;
@@ -1133,10 +1133,10 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
}
oldw = dw->weight;
if (k) {
- dw->weight *= 1+cp;
+ dw->weight *= 1 + cp;
}
else {
- dw->weight /= 1+cp;
+ dw->weight /= 1 + cp;
}
if (dw->weight == oldw) {
changes[i][0] = 0;
@@ -1179,7 +1179,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
float tf;
int ti;
bestIndex = k;
- for (i = k+1; i < totweight; i++) {
+ for (i = k + 1; i < totweight; i++) {
dist = dists[i];
if (fabs(dist) > fabs(dists[i])) {
@@ -1212,7 +1212,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
bestIndex = -1;
// find the best change with an acceptable horizontal change
for (i = 0; i < totweight; i++) {
- if (fabs(changes[i][0]) > fabs(changes[i][1]*2.0f)) {
+ if (fabs(changes[i][0]) > fabs(changes[i][1] * 2.0f)) {
bestIndex = i;
break;
}
@@ -1228,13 +1228,13 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
}
lastIndex = bestIndex;
wasUp = upDown[bestIndex];
- dw = (dvert->dw+dwIndices[bestIndex]);
+ dw = (dvert->dw + dwIndices[bestIndex]);
oldw = dw->weight;
if (upDown[bestIndex]) {
- dw->weight *= 1+cp;
+ dw->weight *= 1 + cp;
}
else {
- dw->weight /= 1+cp;
+ dw->weight /= 1 + cp;
}
if (dw->weight > 1) {
dw->weight = 1;
@@ -1246,8 +1246,9 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
dm_deform_clear(dm, ob); dm = NULL;
}
}
- } while (wasChange && (distToStart-distToBe)/fabsf(distToStart-distToBe) ==
- (dists[bestIndex]-distToBe)/fabsf(dists[bestIndex]-distToBe));
+ } while (wasChange && ((distToStart - distToBe) / fabsf(distToStart - distToBe) ==
+ (dists[bestIndex] - distToBe) / fabsf(dists[bestIndex] - distToBe)));
+
MEM_freeN(upDown);
MEM_freeN(changes);
MEM_freeN(dists);
@@ -1267,10 +1268,10 @@ static void vgroup_fix(Scene *scene, Object *ob, float distToBe, float strength,
return;
for (i = 0; i < me->totvert && mvert; i++, mvert++) {
if (mvert->flag & SELECT) {
- int count=0;
+ int count = 0;
if ((verts = getSurroundingVerts(me, i, &count))) {
MVert m;
- MVert *p = MEM_callocN(sizeof(MVert)*(count), "deformedPoints");
+ MVert *p = MEM_callocN(sizeof(MVert) * (count), "deformedPoints");
int k;
DerivedMesh *dm = mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
@@ -1287,7 +1288,7 @@ static void vgroup_fix(Scene *scene, Object *ob, float distToBe, float strength,
getSingleCoordinate(p, count, coord);
dm->getVert(dm, i, &m);
sub_v3_v3v3(norm, m.co, coord);
- mag= normalize_v3(norm);
+ mag = normalize_v3(norm);
if (mag) { /* zeros fix */
d = -dot_v3v3(norm, coord);
/* dist = (dot_v3v3(norm, m.co) + d); */ /* UNUSED */
@@ -1305,9 +1306,9 @@ static void vgroup_fix(Scene *scene, Object *ob, float distToBe, float strength,
static void vgroup_levels(Object *ob, float offset, float gain)
{
MDeformWeight *dw;
- MDeformVert *dv, **dvert_array=NULL;
- int i, dvert_tot=0;
- const int def_nr= ob->actdef-1;
+ MDeformVert *dv, **dvert_array = NULL;
+ int i, dvert_tot = 0;
+ const int def_nr = ob->actdef - 1;
const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
@@ -1340,9 +1341,9 @@ static void vgroup_levels(Object *ob, float offset, float gain)
/* TODO - select between groups */
static void vgroup_normalize_all(Object *ob, int lock_active)
{
- MDeformVert *dv, **dvert_array=NULL;
- int i, dvert_tot=0;
- const int def_nr= ob->actdef-1;
+ MDeformVert *dv, **dvert_array = NULL;
+ int i, dvert_tot = 0;
+ const int def_nr = ob->actdef - 1;
const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
@@ -1385,17 +1386,17 @@ static void vgroup_lock_all(Object *ob, int action)
bDeformGroup *dg;
if (action == SEL_TOGGLE) {
- action= SEL_SELECT;
- for (dg= ob->defbase.first; dg; dg= dg->next) {
+ action = SEL_SELECT;
+ for (dg = ob->defbase.first; dg; dg = dg->next) {
if (dg->flag & DG_LOCK_WEIGHT) {
- action= SEL_DESELECT;
+ action = SEL_DESELECT;
break;
}
}
}
- for (dg= ob->defbase.first; dg; dg= dg->next) {
- switch(action) {
+ for (dg = ob->defbase.first; dg; dg = dg->next) {
+ switch (action) {
case SEL_SELECT:
dg->flag |= DG_LOCK_WEIGHT;
break;
@@ -1412,9 +1413,9 @@ static void vgroup_lock_all(Object *ob, int action)
static void vgroup_invert(Object *ob, const short auto_assign, const short auto_remove)
{
MDeformWeight *dw;
- MDeformVert *dv, **dvert_array=NULL;
- int i, dvert_tot=0;
- const int def_nr= ob->actdef-1;
+ MDeformVert *dv, **dvert_array = NULL;
+ int i, dvert_tot = 0;
+ const int def_nr = ob->actdef - 1;
const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
if (!BLI_findlink(&ob->defbase, def_nr)) {
@@ -1432,10 +1433,10 @@ static void vgroup_invert(Object *ob, const short auto_assign, const short auto_
}
if (auto_assign) {
- dw= defvert_verify_index(dv, def_nr);
+ dw = defvert_verify_index(dv, def_nr);
}
else {
- dw= defvert_find_index(dv, def_nr);
+ dw = defvert_find_index(dv, def_nr);
}
if (dw) {
@@ -1455,8 +1456,8 @@ static void vgroup_blend(Object *ob, const float fac)
{
MDeformVert *dv;
MDeformWeight *dw;
- int i, dvert_tot=0;
- const int def_nr= ob->actdef - 1;
+ int i, dvert_tot = 0;
+ const int def_nr = ob->actdef - 1;
BLI_assert(fac >= 0.0 && fac <= 1.0f);
@@ -1505,14 +1506,14 @@ static void vgroup_blend(Object *ob, const float fac)
int i1 /* , i2 */;
/* i1 is always the selected one */
if (sel1) {
- i1= BM_elem_index_get(eed->v1);
+ i1 = BM_elem_index_get(eed->v1);
/* i2= BM_elem_index_get(eed->v2); */ /* UNUSED */
- eve= eed->v2;
+ eve = eed->v2;
}
else {
/* i2= BM_elem_index_get(eed->v1); */ /* UNUSED */
- i1= BM_elem_index_get(eed->v2);
- eve= eed->v1;
+ i1 = BM_elem_index_get(eed->v2);
+ eve = eed->v1;
}
dv = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_MDEFORMVERT);
@@ -1586,9 +1587,9 @@ static void vgroup_blend(Object *ob, const float fac)
static void vgroup_clean(Object *ob, const float epsilon, int keep_single)
{
MDeformWeight *dw;
- MDeformVert *dv, **dvert_array=NULL;
- int i, dvert_tot=0;
- const int def_nr= ob->actdef-1;
+ MDeformVert *dv, **dvert_array = NULL;
+ int i, dvert_tot = 0;
+ const int def_nr = ob->actdef - 1;
const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
if (!BLI_findlink(&ob->defbase, def_nr)) {
@@ -1606,11 +1607,11 @@ static void vgroup_clean(Object *ob, const float epsilon, int keep_single)
continue;
}
- dw= defvert_find_index(dv, def_nr);
+ dw = defvert_find_index(dv, def_nr);
if (dw) {
if (dw->weight <= epsilon) {
- if (keep_single==FALSE || dv->totweight > 1) {
+ if (keep_single == FALSE || dv->totweight > 1) {
defvert_remove_group(dv, dw); /* dw can be NULL */
}
}
@@ -1623,7 +1624,7 @@ static void vgroup_clean(Object *ob, const float epsilon, int keep_single)
static void vgroup_clean_all(Object *ob, const float epsilon, const int keep_single)
{
- MDeformVert **dvert_array=NULL;
+ MDeformVert **dvert_array = NULL;
int i, dvert_tot = 0;
const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
@@ -1641,14 +1642,14 @@ static void vgroup_clean_all(Object *ob, const float epsilon, const int keep_sin
continue;
}
- j= dv->totweight;
+ j = dv->totweight;
while (j--) {
if (keep_single && dv->totweight == 1)
break;
- dw= dv->dw + j;
+ dw = dv->dw + j;
if (dw->weight <= epsilon) {
defvert_remove_group(dv, dw);
@@ -1676,14 +1677,14 @@ static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr,
SWAP(MDeformVert, *dvert, *dvert_mirr);
}
else {
- MDeformWeight *dw= defvert_find_index(dvert, act_vgroup);
- MDeformWeight *dw_mirr= defvert_find_index(dvert_mirr, act_vgroup);
+ MDeformWeight *dw = defvert_find_index(dvert, act_vgroup);
+ MDeformWeight *dw_mirr = defvert_find_index(dvert_mirr, act_vgroup);
if (dw || dw_mirr) {
if (dw_mirr == NULL)
- dw_mirr= defvert_verify_index(dvert_mirr, act_vgroup);
+ dw_mirr = defvert_verify_index(dvert_mirr, act_vgroup);
if (dw == NULL)
- dw= defvert_verify_index(dvert, act_vgroup);
+ dw = defvert_verify_index(dvert, act_vgroup);
SWAP(float, dw->weight, dw_mirr->weight);
}
@@ -1733,19 +1734,19 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
BMVert *eve, *eve_mirr;
MDeformVert *dvert, *dvert_mirr;
short sel, sel_mirr;
- int *flip_map, flip_map_len;
- const int def_nr= ob->actdef-1;
+ int *flip_map, flip_map_len;
+ const int def_nr = ob->actdef - 1;
- if ( (mirror_weights==0 && flip_vgroups==0) ||
+ if ( (mirror_weights == 0 && flip_vgroups == 0) ||
(BLI_findlink(&ob->defbase, def_nr) == NULL) )
{
return;
}
if (flip_vgroups) {
- flip_map= all_vgroups ?
- defgroup_flip_map(ob, &flip_map_len, FALSE) :
- defgroup_flip_map_single(ob, &flip_map_len, FALSE, def_nr);
+ flip_map = all_vgroups ?
+ defgroup_flip_map(ob, &flip_map_len, FALSE) :
+ defgroup_flip_map_single(ob, &flip_map_len, FALSE, def_nr);
BLI_assert(flip_map != NULL);
@@ -1755,13 +1756,13 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
}
}
else {
- flip_map= NULL;
- flip_map_len= 0;
+ flip_map = NULL;
+ flip_map_len = 0;
}
/* only the active group */
if (ob->type == OB_MESH) {
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
BMEditMesh *em = me->edit_btmesh;
if (em) {
@@ -1775,13 +1776,13 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
/* Go through the list of editverts and assign them */
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
- if ((eve_mirr= EDBM_verts_mirror_get(em, eve))) {
- sel= BM_elem_flag_test(eve, BM_ELEM_SELECT);
- sel_mirr= BM_elem_flag_test(eve_mirr, BM_ELEM_SELECT);
+ if ((eve_mirr = EDBM_verts_mirror_get(em, eve))) {
+ sel = BM_elem_flag_test(eve, BM_ELEM_SELECT);
+ sel_mirr = BM_elem_flag_test(eve_mirr, BM_ELEM_SELECT);
if ((sel || sel_mirr) && (eve != eve_mirr)) {
- dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
- dvert_mirr= CustomData_bmesh_get(&em->bm->vdata, eve_mirr->head.data, CD_MDEFORMVERT);
+ dvert = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+ dvert_mirr = CustomData_bmesh_get(&em->bm->vdata, eve_mirr->head.data, CD_MDEFORMVERT);
if (dvert && dvert_mirr) {
VGROUP_MIRR_OP;
}
@@ -1805,29 +1806,29 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
}
if (!use_vert_sel) {
- sel= sel_mirr= TRUE;
+ sel = sel_mirr = TRUE;
}
/* tag verts we have used */
- for (vidx= 0, mv= me->mvert; vidx < me->totvert; vidx++, mv++) {
+ for (vidx = 0, mv = me->mvert; vidx < me->totvert; vidx++, mv++) {
mv->flag &= ~ME_VERT_TMP_TAG;
}
- for (vidx= 0, mv= me->mvert; vidx < me->totvert; vidx++, mv++) {
+ for (vidx = 0, mv = me->mvert; vidx < me->totvert; vidx++, mv++) {
if ( ((mv->flag & ME_VERT_TMP_TAG) == 0) &&
- ((vidx_mirr= mesh_get_x_mirror_vert(ob, vidx)) != -1) &&
+ ((vidx_mirr = mesh_get_x_mirror_vert(ob, vidx)) != -1) &&
(vidx != vidx_mirr) &&
- ((((mv_mirr= me->mvert + vidx_mirr)->flag) & ME_VERT_TMP_TAG) == 0))
+ ((((mv_mirr = me->mvert + vidx_mirr)->flag) & ME_VERT_TMP_TAG) == 0))
{
if (use_vert_sel) {
- sel= mv->flag & SELECT;
- sel_mirr= mv_mirr->flag & SELECT;
+ sel = mv->flag & SELECT;
+ sel_mirr = mv_mirr->flag & SELECT;
}
if (sel || sel_mirr) {
- dvert= &me->dvert[vidx];
- dvert_mirr= &me->dvert[vidx_mirr];
+ dvert = &me->dvert[vidx];
+ dvert_mirr = &me->dvert[vidx_mirr];
VGROUP_MIRR_OP;
}
@@ -1839,7 +1840,7 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
}
}
else if (ob->type == OB_LATTICE) {
- Lattice *lt= vgroup_edit_lattice(ob);
+ Lattice *lt = vgroup_edit_lattice(ob);
int i1, i2;
int u, v, w;
int pntsu_half;
@@ -1852,27 +1853,27 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
/* unlike editmesh we know that by only looping over the first half of
* the 'u' indices it will cover all points except the middle which is
* ok in this case */
- pntsu_half= lt->pntsu / 2;
+ pntsu_half = lt->pntsu / 2;
- for (w=0; w<lt->pntsw; w++) {
- for (v=0; v<lt->pntsv; v++) {
- for (u=0; u<pntsu_half; u++) {
- int u_inv= (lt->pntsu - 1) - u;
+ for (w = 0; w < lt->pntsw; w++) {
+ for (v = 0; v < lt->pntsv; v++) {
+ for (u = 0; u < pntsu_half; u++) {
+ int u_inv = (lt->pntsu - 1) - u;
if (u != u_inv) {
BPoint *bp, *bp_mirr;
- i1= LT_INDEX(lt, u, v, w);
- i2= LT_INDEX(lt, u_inv, v, w);
+ i1 = LT_INDEX(lt, u, v, w);
+ i2 = LT_INDEX(lt, u_inv, v, w);
- bp= &lt->def[i1];
- bp_mirr= &lt->def[i2];
+ bp = &lt->def[i1];
+ bp_mirr = &lt->def[i2];
- sel= bp->f1 & SELECT;
- sel_mirr= bp_mirr->f1 & SELECT;
+ sel = bp->f1 & SELECT;
+ sel_mirr = bp_mirr->f1 & SELECT;
if (sel || sel_mirr) {
- dvert= &lt->dvert[i1];
- dvert_mirr= &lt->dvert[i2];
+ dvert = &lt->dvert[i1];
+ dvert_mirr = &lt->dvert[i2];
VGROUP_MIRR_OP;
}
@@ -1902,40 +1903,40 @@ static void vgroup_remap_update_users(Object *ob, int *map)
* they get deleted the numbers get out of sync, this corrects that */
if (ob->soft)
- ob->soft->vertgroup= map[ob->soft->vertgroup];
+ ob->soft->vertgroup = map[ob->soft->vertgroup];
- for (md=ob->modifiers.first; md; md=md->next) {
+ for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Explode) {
- emd= (ExplodeModifierData*)md;
- emd->vgroup= map[emd->vgroup];
+ emd = (ExplodeModifierData *)md;
+ emd->vgroup = map[emd->vgroup];
}
else if (md->type == eModifierType_Cloth) {
- clmd= (ClothModifierData*)md;
- clsim= clmd->sim_parms;
+ clmd = (ClothModifierData *)md;
+ clsim = clmd->sim_parms;
if (clsim) {
- clsim->vgroup_mass= map[clsim->vgroup_mass];
- clsim->vgroup_bend= map[clsim->vgroup_bend];
- clsim->vgroup_struct= map[clsim->vgroup_struct];
+ clsim->vgroup_mass = map[clsim->vgroup_mass];
+ clsim->vgroup_bend = map[clsim->vgroup_bend];
+ clsim->vgroup_struct = map[clsim->vgroup_struct];
}
}
}
- for (psys=ob->particlesystem.first; psys; psys=psys->next) {
- for (a=0; a<PSYS_TOT_VG; a++)
- psys->vgroup[a]= map[psys->vgroup[a]];
+ for (psys = ob->particlesystem.first; psys; psys = psys->next) {
+ for (a = 0; a < PSYS_TOT_VG; a++)
+ psys->vgroup[a] = map[psys->vgroup[a]];
}
}
static void vgroup_delete_update_users(Object *ob, int id)
{
- int i, defbase_tot= BLI_countlist(&ob->defbase) + 1;
- int *map= MEM_mallocN(sizeof(int) * defbase_tot, "vgroup del");
+ int i, defbase_tot = BLI_countlist(&ob->defbase) + 1;
+ int *map = MEM_mallocN(sizeof(int) * defbase_tot, "vgroup del");
- map[id]= map[0]= 0;
- for (i=1; i<id; i++) map[i]=i;
- for (i=id+1; i<defbase_tot; i++) map[i]=i-1;
+ map[id] = map[0] = 0;
+ for (i = 1; i < id; i++) map[i] = i;
+ for (i = id + 1; i < defbase_tot; i++) map[i] = i - 1;
vgroup_remap_update_users(ob, map);
MEM_freeN(map);
@@ -1944,9 +1945,9 @@ static void vgroup_delete_update_users(Object *ob, int id)
static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg)
{
- MDeformVert *dvert_array=NULL;
- int dvert_tot=0;
- const int def_nr= BLI_findindex(&ob->defbase, dg);
+ MDeformVert *dvert_array = NULL;
+ int dvert_tot = 0;
+ const int def_nr = BLI_findindex(&ob->defbase, dg);
assert(def_nr > -1);
@@ -1955,10 +1956,10 @@ static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg)
if (dvert_array) {
int i, j;
MDeformVert *dv;
- for (i= 0, dv= dvert_array; i < dvert_tot; i++, dv++) {
+ for (i = 0, dv = dvert_array; i < dvert_tot; i++, dv++) {
MDeformWeight *dw;
- dw= defvert_find_index(dv, def_nr);
+ dw = defvert_find_index(dv, def_nr);
defvert_remove_group(dv, dw); /* dw can be NULL */
/* inline, make into a function if anything else needs to do this */
@@ -1980,7 +1981,7 @@ static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg)
if (ob->actdef > def_nr)
ob->actdef--;
if (ob->actdef < 1 && ob->defbase.first)
- ob->actdef= 1;
+ ob->actdef = 1;
}
@@ -1989,10 +1990,10 @@ static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg)
static void vgroup_active_remove_verts(Object *ob, const int allverts, bDeformGroup *dg)
{
MDeformVert *dv;
- const int def_nr= BLI_findindex(&ob->defbase, dg);
+ const int def_nr = BLI_findindex(&ob->defbase, dg);
if (ob->type == OB_MESH) {
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
if (me->edit_btmesh) {
BMEditMesh *em = me->edit_btmesh;
@@ -2000,7 +2001,7 @@ static void vgroup_active_remove_verts(Object *ob, const int allverts, bDeformGr
BMIter iter;
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
- dv= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+ dv = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
if (dv && dv->dw && (allverts || BM_elem_flag_test(eve, BM_ELEM_SELECT))) {
MDeformWeight *dw = defvert_find_index(dv, def_nr);
@@ -2020,7 +2021,7 @@ static void vgroup_active_remove_verts(Object *ob, const int allverts, bDeformGr
mv = me->mvert;
dv = me->dvert;
- for (i=0; i<me->totvert; i++, mv++, dv++) {
+ for (i = 0; i < me->totvert; i++, mv++, dv++) {
if (mv->flag & SELECT) {
if (dv->dw && (allverts || (mv->flag & SELECT))) {
MDeformWeight *dw = defvert_find_index(dv, def_nr);
@@ -2031,17 +2032,17 @@ static void vgroup_active_remove_verts(Object *ob, const int allverts, bDeformGr
}
}
else if (ob->type == OB_LATTICE) {
- Lattice *lt= vgroup_edit_lattice(ob);
+ Lattice *lt = vgroup_edit_lattice(ob);
if (lt->dvert) {
BPoint *bp;
- int i, tot= lt->pntsu*lt->pntsv*lt->pntsw;
+ int i, tot = lt->pntsu * lt->pntsv * lt->pntsw;
- for (i=0, bp= lt->def; i<tot; i++, bp++) {
+ for (i = 0, bp = lt->def; i < tot; i++, bp++) {
if (allverts || (bp->f1 & SELECT)) {
MDeformWeight *dw;
- dv= &lt->dvert[i];
+ dv = &lt->dvert[i];
dw = defvert_find_index(dv, def_nr);
defvert_remove_group(dv, dw); /* dw can be NULL */
@@ -2054,7 +2055,7 @@ static void vgroup_active_remove_verts(Object *ob, const int allverts, bDeformGr
static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *dg)
{
int i;
- const int dg_index= BLI_findindex(&ob->defbase, dg);
+ const int dg_index = BLI_findindex(&ob->defbase, dg);
assert(dg_index > -1);
@@ -2062,32 +2063,32 @@ static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *dg)
vgroup_active_remove_verts(ob, TRUE, dg);
/* Make sure that any verts with higher indices are adjusted accordingly */
- if (ob->type==OB_MESH) {
- Mesh *me= ob->data;
+ if (ob->type == OB_MESH) {
+ Mesh *me = ob->data;
BMEditMesh *em = me->edit_btmesh;
BMIter iter;
BMVert *eve;
MDeformVert *dvert;
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
- dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+ dvert = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
if (dvert)
- for (i=0; i<dvert->totweight; i++)
+ for (i = 0; i < dvert->totweight; i++)
if (dvert->dw[i].def_nr > dg_index)
dvert->dw[i].def_nr--;
}
}
- else if (ob->type==OB_LATTICE) {
- Lattice *lt= vgroup_edit_lattice(ob);
+ else if (ob->type == OB_LATTICE) {
+ Lattice *lt = vgroup_edit_lattice(ob);
BPoint *bp;
- MDeformVert *dvert= lt->dvert;
+ MDeformVert *dvert = lt->dvert;
int a, tot;
if (dvert) {
- tot= lt->pntsu*lt->pntsv*lt->pntsw;
- for (a=0, bp= lt->def; a<tot; a++, bp++, dvert++) {
- for (i=0; i<dvert->totweight; i++) {
+ tot = lt->pntsu * lt->pntsv * lt->pntsw;
+ for (a = 0, bp = lt->def; a < tot; a++, bp++, dvert++) {
+ for (i = 0; i < dvert->totweight; i++) {
if (dvert->dw[i].def_nr > dg_index)
dvert->dw[i].def_nr--;
}
@@ -2098,26 +2099,26 @@ static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *dg)
vgroup_delete_update_users(ob, dg_index + 1);
/* Remove the group */
- BLI_freelinkN (&ob->defbase, dg);
+ BLI_freelinkN(&ob->defbase, dg);
/* Update the active deform index if necessary */
if (ob->actdef > dg_index)
ob->actdef--;
if (ob->actdef < 1 && ob->defbase.first)
- ob->actdef= 1;
+ ob->actdef = 1;
/* remove all dverts */
if (ob->defbase.first == NULL) {
- if (ob->type==OB_MESH) {
- Mesh *me= ob->data;
+ if (ob->type == OB_MESH) {
+ Mesh *me = ob->data;
CustomData_free_layer_active(&me->vdata, CD_MDEFORMVERT, me->totvert);
- me->dvert= NULL;
+ me->dvert = NULL;
}
- else if (ob->type==OB_LATTICE) {
- Lattice *lt= vgroup_edit_lattice(ob);
+ else if (ob->type == OB_LATTICE) {
+ Lattice *lt = vgroup_edit_lattice(ob);
if (lt->dvert) {
MEM_freeN(lt->dvert);
- lt->dvert= NULL;
+ lt->dvert = NULL;
}
}
}
@@ -2128,7 +2129,7 @@ static int vgroup_object_in_edit_mode(Object *ob)
if (ob->type == OB_MESH)
return (BMEdit_FromObject(ob) != NULL);
else if (ob->type == OB_LATTICE)
- return (((Lattice*)ob->data)->editlatt != NULL);
+ return (((Lattice *)ob->data)->editlatt != NULL);
return 0;
}
@@ -2147,7 +2148,7 @@ static int vgroup_object_in_wpaint_vert_select(Object *ob)
static void vgroup_delete(Object *ob)
{
- bDeformGroup *dg = BLI_findlink(&ob->defbase, ob->actdef-1);
+ bDeformGroup *dg = BLI_findlink(&ob->defbase, ob->actdef - 1);
if (!dg)
return;
@@ -2160,16 +2161,16 @@ static void vgroup_delete(Object *ob)
static void vgroup_delete_all(Object *ob)
{
/* Remove all DVerts */
- if (ob->type==OB_MESH) {
- Mesh *me= ob->data;
+ if (ob->type == OB_MESH) {
+ Mesh *me = ob->data;
CustomData_free_layer_active(&me->vdata, CD_MDEFORMVERT, me->totvert);
- me->dvert= NULL;
+ me->dvert = NULL;
}
- else if (ob->type==OB_LATTICE) {
- Lattice *lt= vgroup_edit_lattice(ob);
+ else if (ob->type == OB_LATTICE) {
+ Lattice *lt = vgroup_edit_lattice(ob);
if (lt->dvert) {
MEM_freeN(lt->dvert);
- lt->dvert= NULL;
+ lt->dvert = NULL;
}
}
@@ -2177,20 +2178,20 @@ static void vgroup_delete_all(Object *ob)
BLI_freelistN(&ob->defbase);
/* Fix counters/indices */
- ob->actdef= 0;
+ ob->actdef = 0;
}
/* only in editmode */
static void vgroup_assign_verts(Object *ob, const float weight)
{
MDeformVert *dv;
- const int def_nr= ob->actdef-1;
+ const int def_nr = ob->actdef - 1;
if (!BLI_findlink(&ob->defbase, def_nr))
return;
if (ob->type == OB_MESH) {
- Mesh *me= ob->data;
+ Mesh *me = ob->data;
if (me->edit_btmesh) {
BMEditMesh *em = me->edit_btmesh;
@@ -2204,10 +2205,10 @@ static void vgroup_assign_verts(Object *ob, const float weight)
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
MDeformWeight *dw;
- dv= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT); /* can be NULL */
- dw= defvert_verify_index(dv, def_nr);
+ dv = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT); /* can be NULL */
+ dw = defvert_verify_index(dv, def_nr);
if (dw) {
- dw->weight= weight;
+ dw->weight = weight;
}
}
}
@@ -2224,35 +2225,35 @@ static void vgroup_assign_verts(Object *ob, const float weight)
mv = me->mvert;
dv = me->dvert;
- for (i=0; i<me->totvert; i++, mv++, dv++) {
+ for (i = 0; i < me->totvert; i++, mv++, dv++) {
if (mv->flag & SELECT) {
MDeformWeight *dw;
- dw= defvert_verify_index(dv, def_nr);
+ dw = defvert_verify_index(dv, def_nr);
if (dw) {
- dw->weight= weight;
+ dw->weight = weight;
}
}
}
}
}
else if (ob->type == OB_LATTICE) {
- Lattice *lt= vgroup_edit_lattice(ob);
+ Lattice *lt = vgroup_edit_lattice(ob);
BPoint *bp;
int a, tot;
- if (lt->dvert==NULL)
+ if (lt->dvert == NULL)
ED_vgroup_data_create(&lt->id);
- dv= lt->dvert;
+ dv = lt->dvert;
- tot= lt->pntsu*lt->pntsv*lt->pntsw;
- for (a=0, bp= lt->def; a<tot; a++, bp++, dv++) {
+ tot = lt->pntsu * lt->pntsv * lt->pntsw;
+ for (a = 0, bp = lt->def; a < tot; a++, bp++, dv++) {
if (bp->f1 & SELECT) {
MDeformWeight *dw;
- dw= defvert_verify_index(dv, def_nr);
+ dw = defvert_verify_index(dv, def_nr);
if (dw) {
- dw->weight= weight;
+ dw->weight = weight;
}
}
}
@@ -2268,7 +2269,7 @@ static void vgroup_remove_verts(Object *ob, int allverts)
* active group index
*/
bDeformGroup *dg;
- for (dg= ob->defbase.first; dg; dg= dg->next) {
+ for (dg = ob->defbase.first; dg; dg = dg->next) {
vgroup_active_remove_verts(ob, allverts, dg);
}
}
@@ -2277,15 +2278,15 @@ static void vgroup_remove_verts(Object *ob, int allverts)
static int vertex_group_poll(bContext *C)
{
- Object *ob= ED_object_context(C);
- ID *data= (ob)? ob->data: NULL;
+ Object *ob = ED_object_context(C);
+ ID *data = (ob) ? ob->data : NULL;
return (ob && !ob->id.lib && OB_TYPE_SUPPORT_VGROUP(ob->type) && data && !data->lib);
}
-static int UNUSED_FUNCTION(vertex_group_poll_edit)(bContext *C)
+static int UNUSED_FUNCTION(vertex_group_poll_edit) (bContext * C)
{
- Object *ob= ED_object_context(C);
- ID *data= (ob)? ob->data: NULL;
+ Object *ob = ED_object_context(C);
+ ID *data = (ob) ? ob->data : NULL;
if (!(ob && !ob->id.lib && data && !data->lib))
return 0;
@@ -2296,24 +2297,24 @@ static int UNUSED_FUNCTION(vertex_group_poll_edit)(bContext *C)
/* editmode _or_ weight paint vertex sel */
static int vertex_group_poll_edit_or_wpaint_vert_select(bContext *C)
{
- Object *ob= ED_object_context(C);
- ID *data= (ob)? ob->data: NULL;
+ Object *ob = ED_object_context(C);
+ ID *data = (ob) ? ob->data : NULL;
if (!(ob && !ob->id.lib && data && !data->lib))
return 0;
- return ( vgroup_object_in_edit_mode(ob) ||
- vgroup_object_in_wpaint_vert_select(ob) );
+ return (vgroup_object_in_edit_mode(ob) ||
+ vgroup_object_in_wpaint_vert_select(ob));
}
static int vertex_group_add_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
ED_vgroup_add(ob);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
}
@@ -2329,12 +2330,12 @@ void OBJECT_OT_vertex_group_add(wmOperatorType *ot)
ot->exec = vertex_group_add_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int vertex_group_remove_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
if (RNA_boolean_get(op->ptr, "all"))
vgroup_delete_all(ob);
@@ -2342,8 +2343,8 @@ static int vertex_group_remove_exec(bContext *C, wmOperator *op)
vgroup_delete(ob);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
return OPERATOR_FINISHED;
}
@@ -2362,7 +2363,7 @@ void OBJECT_OT_vertex_group_remove(wmOperatorType *ot)
/* redo operator will fail in this case because vertex groups aren't stored
* in local edit mode stack and toggling "all" property will lead to
* all groups deleted without way to restore them (see [#29527], sergey) */
- ot->flag = /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
+ ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "all", 0, "All", "Remove from all vertex groups");
@@ -2370,15 +2371,15 @@ void OBJECT_OT_vertex_group_remove(wmOperatorType *ot)
static int vertex_group_assign_exec(bContext *C, wmOperator *op)
{
- ToolSettings *ts= CTX_data_tool_settings(C);
- Object *ob= ED_object_context(C);
+ ToolSettings *ts = CTX_data_tool_settings(C);
+ Object *ob = ED_object_context(C);
if (RNA_boolean_get(op->ptr, "new"))
ED_vgroup_add(ob);
vgroup_assign_verts(ob, ts->vgroup_weight);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2397,7 +2398,7 @@ void OBJECT_OT_vertex_group_assign(wmOperatorType *ot)
/* redo operator will fail in this case because vertex group assignment
* isn't stored in local edit mode stack and toggling "new" property will
* lead to creating plenty of new vertex groups (see [#29527], sergey) */
- ot->flag = /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
+ ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "new", 0, "New", "Assign vertex to new vertex group");
@@ -2405,12 +2406,12 @@ void OBJECT_OT_vertex_group_assign(wmOperatorType *ot)
static int vertex_group_remove_from_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
if (RNA_boolean_get(op->ptr, "all"))
vgroup_remove_verts(ob, 0);
else {
- bDeformGroup *dg= BLI_findlink(&ob->defbase, ob->actdef - 1);
+ bDeformGroup *dg = BLI_findlink(&ob->defbase, ob->actdef - 1);
if (dg == NULL) {
return OPERATOR_CANCELLED;
@@ -2420,7 +2421,7 @@ static int vertex_group_remove_from_exec(bContext *C, wmOperator *op)
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2439,7 +2440,7 @@ void OBJECT_OT_vertex_group_remove_from(wmOperatorType *ot)
/* redo operator will fail in this case because vertex groups assignment
* isn't stored in local edit mode stack and toggling "all" property will lead to
* removing vertices from all groups (see [#29527], sergey) */
- ot->flag = /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
+ ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "all", 0, "All", "Remove from all vertex groups");
@@ -2447,13 +2448,13 @@ void OBJECT_OT_vertex_group_remove_from(wmOperatorType *ot)
static int vertex_group_select_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
if (!ob || ob->id.lib)
return OPERATOR_CANCELLED;
vgroup_select_verts(ob, 1);
- WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
return OPERATOR_FINISHED;
}
@@ -2469,15 +2470,15 @@ void OBJECT_OT_vertex_group_select(wmOperatorType *ot)
ot->exec = vertex_group_select_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int vertex_group_deselect_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
vgroup_select_verts(ob, 0);
- WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
return OPERATOR_FINISHED;
}
@@ -2493,18 +2494,18 @@ void OBJECT_OT_vertex_group_deselect(wmOperatorType *ot)
ot->exec = vertex_group_deselect_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/*Adds a copy of selected vertex group from source object to source object*/
static int vertex_group_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
vgroup_duplicate(ob);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2520,21 +2521,21 @@ void OBJECT_OT_vertex_group_copy(wmOperatorType *ot)
ot->exec = vertex_group_copy_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int vertex_group_levels_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
- float offset= RNA_float_get(op->ptr,"offset");
- float gain= RNA_float_get(op->ptr,"gain");
+ float offset = RNA_float_get(op->ptr, "offset");
+ float gain = RNA_float_get(op->ptr, "gain");
vgroup_levels(ob, offset, gain);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2550,7 +2551,7 @@ void OBJECT_OT_vertex_group_levels(wmOperatorType *ot)
ot->exec = vertex_group_levels_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_float(ot->srna, "offset", 0.f, -1.0, 1.0, "Offset", "Value to add to weights", -1.0f, 1.f);
RNA_def_float(ot->srna, "gain", 1.f, 0.f, FLT_MAX, "Gain", "Value to multiply weights by", 0.0f, 10.f);
@@ -2558,13 +2559,13 @@ void OBJECT_OT_vertex_group_levels(wmOperatorType *ot)
static int vertex_group_normalize_exec(bContext *C, wmOperator *UNUSED(op))
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
vgroup_normalize(ob);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2580,19 +2581,19 @@ void OBJECT_OT_vertex_group_normalize(wmOperatorType *ot)
ot->exec = vertex_group_normalize_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int vertex_group_normalize_all_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
- int lock_active= RNA_boolean_get(op->ptr,"lock_active");
+ Object *ob = ED_object_context(C);
+ int lock_active = RNA_boolean_get(op->ptr, "lock_active");
vgroup_normalize_all(ob, lock_active);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2608,7 +2609,7 @@ void OBJECT_OT_vertex_group_normalize_all(wmOperatorType *ot)
ot->exec = vertex_group_normalize_all_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "lock_active", TRUE, "Lock Active",
"Keep the values of the active group while normalizing others");
@@ -2616,16 +2617,16 @@ void OBJECT_OT_vertex_group_normalize_all(wmOperatorType *ot)
static int vertex_group_fix_exec(bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
- Scene *scene= CTX_data_scene(C);
+ Object *ob = CTX_data_active_object(C);
+ Scene *scene = CTX_data_scene(C);
- float distToBe= RNA_float_get(op->ptr, "dist");
- float strength= RNA_float_get(op->ptr, "strength");
- float cp= RNA_float_get(op->ptr, "accuracy");
- ModifierData *md= ob->modifiers.first;
+ float distToBe = RNA_float_get(op->ptr, "dist");
+ float strength = RNA_float_get(op->ptr, "strength");
+ float cp = RNA_float_get(op->ptr, "accuracy");
+ ModifierData *md = ob->modifiers.first;
while (md) {
- if (md->type == eModifierType_Mirror && (md->mode&eModifierMode_Realtime)) {
+ if (md->type == eModifierType_Mirror && (md->mode & eModifierMode_Realtime)) {
break;
}
md = md->next;
@@ -2638,8 +2639,8 @@ static int vertex_group_fix_exec(bContext *C, wmOperator *op)
vgroup_fix(scene, ob, distToBe, strength, cp);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2650,14 +2651,14 @@ void OBJECT_OT_vertex_group_fix(wmOperatorType *ot)
ot->name = "Fix Vertex Group Deform";
ot->idname = "OBJECT_OT_vertex_group_fix";
ot->description = "Modify the position of selected vertices by changing only their respective "
- "groups' weights (this tool may be slow for many vertices)";
+ "groups' weights (this tool may be slow for many vertices)";
/* api callbacks */
ot->poll = vertex_group_poll;
ot->exec = vertex_group_fix_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_float(ot->srna, "dist", 0.0f, -FLT_MAX, FLT_MAX, "Distance", "The distance to move to", -10.0f, 10.0f);
RNA_def_float(ot->srna, "strength", 1.f, -2.0f, FLT_MAX, "Strength",
"The distance moved can be changed by this multiplier", -2.0f, 2.0f);
@@ -2668,7 +2669,7 @@ void OBJECT_OT_vertex_group_fix(wmOperatorType *ot)
static int vertex_group_lock_exec(bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_active_object(C);
+ Object *ob = CTX_data_active_object(C);
int action = RNA_enum_get(op->ptr, "action");
@@ -2688,21 +2689,21 @@ void OBJECT_OT_vertex_group_lock(wmOperatorType *ot)
ot->exec = vertex_group_lock_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
WM_operator_properties_select_all(ot);
}
static int vertex_group_invert_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
- int auto_assign= RNA_boolean_get(op->ptr,"auto_assign");
- int auto_remove= RNA_boolean_get(op->ptr,"auto_remove");
+ Object *ob = ED_object_context(C);
+ int auto_assign = RNA_boolean_get(op->ptr, "auto_assign");
+ int auto_remove = RNA_boolean_get(op->ptr, "auto_remove");
vgroup_invert(ob, auto_assign, auto_remove);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2718,7 +2719,7 @@ void OBJECT_OT_vertex_group_invert(wmOperatorType *ot)
ot->exec = vertex_group_invert_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "auto_assign", TRUE, "Add Weights",
"Add verts from groups that have zero weight before inverting");
@@ -2735,8 +2736,8 @@ static int vertex_group_blend_exec(bContext *C, wmOperator *op)
vgroup_blend(ob, fac);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2745,7 +2746,7 @@ static int vertex_group_blend_exec(bContext *C, wmOperator *op)
static int vertex_group_blend_poll(bContext *C)
{
Object *ob = ED_object_context(C);
- ID *data = (ob) ? ob->data: NULL;
+ ID *data = (ob) ? ob->data : NULL;
if (!(ob && !ob->id.lib && data && !data->lib))
return FALSE;
@@ -2782,7 +2783,7 @@ void OBJECT_OT_vertex_group_blend(wmOperatorType *ot)
ot->exec = vertex_group_blend_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
prop = RNA_def_property(ot->srna, "factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_ui_text(prop, "Factor", "");
@@ -2793,18 +2794,18 @@ void OBJECT_OT_vertex_group_blend(wmOperatorType *ot)
static int vertex_group_clean_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
- float limit= RNA_float_get(op->ptr,"limit");
- int all_groups= RNA_boolean_get(op->ptr,"all_groups");
- int keep_single= RNA_boolean_get(op->ptr,"keep_single");
+ float limit = RNA_float_get(op->ptr, "limit");
+ int all_groups = RNA_boolean_get(op->ptr, "all_groups");
+ int keep_single = RNA_boolean_get(op->ptr, "keep_single");
- if (all_groups) vgroup_clean_all(ob, limit, keep_single);
- else vgroup_clean(ob, limit, keep_single);
+ if (all_groups) vgroup_clean_all(ob, limit, keep_single);
+ else vgroup_clean(ob, limit, keep_single);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2821,7 +2822,7 @@ void OBJECT_OT_vertex_group_clean(wmOperatorType *ot)
ot->exec = vertex_group_clean_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_float(ot->srna, "limit", 0.01f, 0.0f, 1.0, "Limit", "Remove weights under this limit", 0.001f, 0.99f);
RNA_def_boolean(ot->srna, "all_groups", FALSE, "All Groups", "Clean all vertex groups");
@@ -2832,16 +2833,16 @@ void OBJECT_OT_vertex_group_clean(wmOperatorType *ot)
static int vertex_group_mirror_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
ED_vgroup_mirror(ob,
- RNA_boolean_get(op->ptr,"mirror_weights"),
- RNA_boolean_get(op->ptr,"flip_group_names"),
- RNA_boolean_get(op->ptr,"all_groups"));
+ RNA_boolean_get(op->ptr, "mirror_weights"),
+ RNA_boolean_get(op->ptr, "flip_group_names"),
+ RNA_boolean_get(op->ptr, "all_groups"));
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
return OPERATOR_FINISHED;
}
@@ -2852,14 +2853,14 @@ void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot)
ot->name = "Mirror Vertex Group";
ot->idname = "OBJECT_OT_vertex_group_mirror";
ot->description = "Mirror all vertex groups, flip weights and/or names, editing only selected vertices, "
- "flipping when both sides are selected otherwise copy from unselected";
+ "flipping when both sides are selected otherwise copy from unselected";
/* api callbacks */
ot->poll = vertex_group_poll;
ot->exec = vertex_group_mirror_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
RNA_def_boolean(ot->srna, "mirror_weights", TRUE, "Mirror Weights", "Mirror weights");
@@ -2870,21 +2871,21 @@ void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot)
static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene= CTX_data_scene(C);
- Object *ob= ED_object_context(C);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = ED_object_context(C);
Base *base;
- int retval= OPERATOR_CANCELLED;
+ int retval = OPERATOR_CANCELLED;
- for (base=scene->base.first; base; base= base->next) {
- if (base->object->type==ob->type) {
- if (base->object!=ob && base->object->data==ob->data) {
+ for (base = scene->base.first; base; base = base->next) {
+ if (base->object->type == ob->type) {
+ if (base->object != ob && base->object->data == ob->data) {
BLI_freelistN(&base->object->defbase);
BLI_duplicatelist(&base->object->defbase, &ob->defbase);
- base->object->actdef= ob->actdef;
+ base->object->actdef = ob->actdef;
DAG_id_tag_update(&base->object->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, base->object);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, base->object->data);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, base->object);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, base->object->data);
retval = OPERATOR_FINISHED;
}
@@ -2906,21 +2907,20 @@ void OBJECT_OT_vertex_group_copy_to_linked(wmOperatorType *ot)
ot->exec = vertex_group_copy_to_linked_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/*Copy vertex groups from source to target*/ /*warning! overwrites list*/
static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op)
{
- Object *obact= ED_object_context(C);
- int change= 0;
- int fail= 0;
+ Object *obact = ED_object_context(C);
+ int change = 0;
+ int fail = 0;
- CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
- {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (obact != ob) {
if (ED_vgroup_copy_array(ob, obact)) change++;
- else fail++;
+ else fail++;
}
}
CTX_DATA_END;
@@ -2947,7 +2947,7 @@ void OBJECT_OT_vertex_group_copy_to_selected(wmOperatorType *ot)
ot->exec= vertex_group_copy_to_selected_exec;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int vertex_group_copy_to_selected_single_exec(bContext *C, wmOperator *op)
@@ -3002,44 +3002,45 @@ void OBJECT_OT_vertex_group_copy_to_selected_single(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-static EnumPropertyItem vgroup_items[]= {
- {0, NULL, 0, NULL, NULL}};
+static EnumPropertyItem vgroup_items[] = {
+ {0, NULL, 0, NULL, NULL}
+};
static int set_active_group_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
- int nr= RNA_enum_get(op->ptr, "group");
+ Object *ob = ED_object_context(C);
+ int nr = RNA_enum_get(op->ptr, "group");
- BLI_assert(nr+1 >= 0);
- ob->actdef= nr+1;
+ BLI_assert(nr + 1 >= 0);
+ ob->actdef = nr + 1;
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob);
return OPERATOR_FINISHED;
}
static EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
EnumPropertyItem tmp = {0, "", 0, "", ""};
- EnumPropertyItem *item= NULL;
+ EnumPropertyItem *item = NULL;
bDeformGroup *def;
- int a, totitem= 0;
+ int a, totitem = 0;
if (!ob)
return vgroup_items;
- for (a=0, def=ob->defbase.first; def; def=def->next, a++) {
- tmp.value= a;
- tmp.icon= ICON_GROUP_VERTEX;
- tmp.identifier= def->name;
- tmp.name= def->name;
+ for (a = 0, def = ob->defbase.first; def; def = def->next, a++) {
+ tmp.value = a;
+ tmp.icon = ICON_GROUP_VERTEX;
+ tmp.identifier = def->name;
+ tmp.name = def->name;
RNA_enum_item_add(&item, &totitem, &tmp);
}
RNA_enum_item_end(&item, &totitem);
- *free= 1;
+ *free = 1;
return item;
}
@@ -3059,10 +3060,10 @@ void OBJECT_OT_vertex_group_set_active(wmOperatorType *ot)
ot->invoke = WM_menu_invoke;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "group", vgroup_items, 0, "Group", "Vertex group to set as active");
+ prop = RNA_def_enum(ot->srna, "group", vgroup_items, 0, "Group", "Vertex group to set as active");
RNA_def_enum_funcs(prop, vgroup_itemf);
ot->prop = prop;
}
@@ -3073,11 +3074,11 @@ static char *vgroup_init_remap(Object *ob)
{
bDeformGroup *def;
int defbase_tot = BLI_countlist(&ob->defbase);
- char *name_array= MEM_mallocN(MAX_VGROUP_NAME * sizeof(char) * defbase_tot, "sort vgroups");
+ char *name_array = MEM_mallocN(MAX_VGROUP_NAME * sizeof(char) * defbase_tot, "sort vgroups");
char *name;
- name= name_array;
- for (def = ob->defbase.first; def; def=def->next) {
+ name = name_array;
+ for (def = ob->defbase.first; def; def = def->next) {
BLI_strncpy(name, def->name, MAX_VGROUP_NAME);
name += MAX_VGROUP_NAME;
}
@@ -3087,33 +3088,33 @@ static char *vgroup_init_remap(Object *ob)
static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
{
- MDeformVert *dvert= NULL;
+ MDeformVert *dvert = NULL;
bDeformGroup *def;
int defbase_tot = BLI_countlist(&ob->defbase);
/* needs a dummy index at the start*/
- int *sort_map_update= MEM_mallocN(sizeof(int) * (defbase_tot + 1), "sort vgroups");
- int *sort_map= sort_map_update + 1;
+ int *sort_map_update = MEM_mallocN(sizeof(int) * (defbase_tot + 1), "sort vgroups");
+ int *sort_map = sort_map_update + 1;
char *name;
int i;
- name= name_array;
- for (def= ob->defbase.first, i=0; def; def=def->next, i++) {
- sort_map[i]= BLI_findstringindex(&ob->defbase, name, offsetof(bDeformGroup, name));
+ name = name_array;
+ for (def = ob->defbase.first, i = 0; def; def = def->next, i++) {
+ sort_map[i] = BLI_findstringindex(&ob->defbase, name, offsetof(bDeformGroup, name));
name += MAX_VGROUP_NAME;
BLI_assert(sort_map[i] != -1);
}
if (ob->mode == OB_MODE_EDIT) {
- if (ob->type==OB_MESH) {
+ if (ob->type == OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(ob);
BMIter iter;
BMVert *eve;
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
- dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+ dvert = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
if (dvert && dvert->totweight) {
defvert_remap(dvert, sort_map, defbase_tot);
}
@@ -3126,7 +3127,7 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
}
}
else {
- int dvert_tot=0;
+ int dvert_tot = 0;
ED_vgroup_give_array(ob->data, &dvert, &dvert_tot);
@@ -3139,14 +3140,14 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
}
/* update users */
- for (i=0; i<defbase_tot; i++)
+ for (i = 0; i < defbase_tot; i++)
sort_map[i]++;
- sort_map_update[0]= 0;
+ sort_map_update[0] = 0;
vgroup_remap_update_users(ob, sort_map_update);
BLI_assert(sort_map_update[ob->actdef] >= 0);
- ob->actdef= sort_map_update[ob->actdef];
+ ob->actdef = sort_map_update[ob->actdef];
MEM_freeN(sort_map_update);
@@ -3155,15 +3156,15 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
static int vgroup_sort(void *def_a_ptr, void *def_b_ptr)
{
- bDeformGroup *def_a= (bDeformGroup *)def_a_ptr;
- bDeformGroup *def_b= (bDeformGroup *)def_b_ptr;
+ bDeformGroup *def_a = (bDeformGroup *)def_a_ptr;
+ bDeformGroup *def_b = (bDeformGroup *)def_b_ptr;
return BLI_natstrcmp(def_a->name, def_b->name);
}
static int vertex_group_sort_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
char *name_array;
int ret;
@@ -3178,7 +3179,7 @@ static int vertex_group_sort_exec(bContext *C, wmOperator *op)
if (ret != OPERATOR_CANCELLED) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob);
}
if (name_array) MEM_freeN(name_array);
@@ -3197,15 +3198,15 @@ void OBJECT_OT_vertex_group_sort(wmOperatorType *ot)
ot->exec = vertex_group_sort_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int vgroup_move_exec(bContext *C, wmOperator *op)
{
- Object *ob= ED_object_context(C);
+ Object *ob = ED_object_context(C);
bDeformGroup *def;
char *name_array;
- int dir= RNA_enum_get(op->ptr, "direction"), ret;
+ int dir = RNA_enum_get(op->ptr, "direction"), ret;
def = BLI_findlink(&ob->defbase, ob->actdef - 1);
if (!def) {
@@ -3233,7 +3234,7 @@ static int vgroup_move_exec(bContext *C, wmOperator *op)
if (ret != OPERATOR_CANCELLED) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob);
}
return ret;
@@ -3256,7 +3257,7 @@ void OBJECT_OT_vertex_group_move(wmOperatorType *ot)
ot->exec = vgroup_move_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "direction", vgroup_slot_move, 0, "Direction", "Direction to move, UP or DOWN");
}
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c
index 417cddb74fe..c82e0459218 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -291,8 +291,7 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf
if (!dynamicPaint_createUVSurface(surface)) return 0;
/* Loop through selected frames */
- for (frame=surface->start_frame; frame<=surface->end_frame; frame++)
- {
+ for (frame=surface->start_frame; frame<=surface->end_frame; frame++) {
float progress = (frame - surface->start_frame) / (float)frames * 100;
surface->current_frame = frame;
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 5f22165176b..b541529e4c0 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -45,7 +45,9 @@
#include "DNA_space_types.h"
#include "BLI_math.h"
-#include "BLI_blenlib.h"
+#include "BLI_lasso.h"
+#include "BLI_listbase.h"
+#include "BLI_string.h"
#include "BLI_dynstr.h"
#include "BLI_kdtree.h"
#include "BLI_rand.h"
@@ -213,7 +215,7 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create)
/* in the case of only one editable thing, set pset->edittype accordingly */
if (pidlist.first && pidlist.first == pidlist.last) {
pid = pidlist.first;
- switch(pid->type) {
+ switch (pid->type) {
case PTCACHE_TYPE_PARTICLES:
pset->edittype = PE_TYPE_PARTICLES;
break;
@@ -401,7 +403,7 @@ static int key_test_depth(PEData *data, const float co[3])
View3D *v3d= data->vc.v3d;
double ux, uy, uz;
float depth;
- short wco[3], x,y;
+ short wco[3], x, y;
/* nothing to do */
if ((v3d->drawtype<=OB_WIRE) || (v3d->flag & V3D_ZBUF_SELECT)==0)
@@ -412,7 +414,7 @@ static int key_test_depth(PEData *data, const float co[3])
if (wco[0] == IS_CLIPPED)
return 0;
- gluProject(co[0],co[1],co[2], data->mats.modelview, data->mats.projection,
+ gluProject(co[0], co[1], co[2], data->mats.modelview, data->mats.projection,
(GLint *)data->mats.viewport, &ux, &uy, &uz);
x=wco[0];
@@ -471,14 +473,16 @@ static int key_inside_rect(PEData *data, const float co[3])
{
int sco[2];
- project_int(data->vc.ar, co,sco);
+ project_int(data->vc.ar, co, sco);
if (sco[0] == IS_CLIPPED)
return 0;
-
+
if (sco[0] > data->rect->xmin && sco[0] < data->rect->xmax &&
- sco[1] > data->rect->ymin && sco[1] < data->rect->ymax)
+ sco[1] > data->rect->ymin && sco[1] < data->rect->ymax)
+ {
return key_test_depth(data, co);
+ }
return 0;
}
@@ -618,7 +622,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
if (key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
if (edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(data->ob, psmd->dm, psys->part->from, psys->particles + p, mat);
- invert_m4_m4(imat,mat);
+ invert_m4_m4(imat, mat);
}
func(data, mat, imat, p, point->totkey-1, key);
@@ -632,7 +636,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
if (key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
if (edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(data->ob, psmd->dm, psys->part->from, psys->particles + p, mat);
- invert_m4_m4(imat,mat);
+ invert_m4_m4(imat, mat);
}
func(data, mat, imat, p, k, key);
@@ -898,7 +902,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
return;
psys = edit->psys;
- psmd = psys_get_modifier(ob,psys);
+ psmd = psys_get_modifier(ob, psys);
if (!psmd->dm)
return;
@@ -916,26 +920,26 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
dist_1st *= 0.75f * pset->emitterdist;
}
else {
- index= BLI_kdtree_find_nearest(edit->emitter_field,key->co,NULL,NULL);
+ index= BLI_kdtree_find_nearest(edit->emitter_field, key->co, NULL, NULL);
vec=edit->emitter_cosnos +index*6;
nor=vec+3;
sub_v3_v3v3(dvec, key->co, vec);
- dot=dot_v3v3(dvec,nor);
- copy_v3_v3(dvec,nor);
+ dot=dot_v3v3(dvec, nor);
+ copy_v3_v3(dvec, nor);
if (dot>0.0f) {
if (dot<dist_1st) {
normalize_v3(dvec);
- mul_v3_fl(dvec,dist_1st-dot);
+ mul_v3_fl(dvec, dist_1st-dot);
add_v3_v3(key->co, dvec);
}
}
else {
normalize_v3(dvec);
- mul_v3_fl(dvec,dist_1st-dot);
+ mul_v3_fl(dvec, dist_1st-dot);
add_v3_v3(key->co, dvec);
}
if (k==1)
@@ -943,7 +947,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
}
}
- invert_m4_m4(hairimat,hairmat);
+ invert_m4_m4(hairimat, hairmat);
LOOP_KEYS {
mul_m4_v3(hairimat, key->co);
@@ -1049,7 +1053,7 @@ static void recalc_lengths(PTCacheEdit *edit)
/* calculate a tree for finding nearest emitter's vertice */
static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
{
- DerivedMesh *dm=psys_get_modifier(ob,psys)->dm;
+ DerivedMesh *dm=psys_get_modifier(ob, psys)->dm;
PTCacheEdit *edit= psys->edit;
float *vec, *nor;
int i, totface /*, totvert*/;
@@ -1065,7 +1069,7 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
totface=dm->getNumTessFaces(dm);
/*totvert=dm->getNumVerts(dm);*/ /*UNSUED*/
- edit->emitter_cosnos=MEM_callocN(totface*6*sizeof(float),"emitter cosnos");
+ edit->emitter_cosnos=MEM_callocN(totface*6*sizeof(float), "emitter cosnos");
edit->emitter_field= BLI_kdtree_new(totface);
@@ -1073,30 +1077,30 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
nor=vec+3;
for (i=0; i<totface; i++, vec+=6, nor+=6) {
- MFace *mface=dm->getTessFaceData(dm,i,CD_MFACE);
+ MFace *mface=dm->getTessFaceData(dm, i, CD_MFACE);
MVert *mvert;
- mvert=dm->getVertData(dm,mface->v1,CD_MVERT);
- copy_v3_v3(vec,mvert->co);
- VECCOPY(nor,mvert->no);
+ mvert=dm->getVertData(dm, mface->v1, CD_MVERT);
+ copy_v3_v3(vec, mvert->co);
+ VECCOPY(nor, mvert->no);
- mvert=dm->getVertData(dm,mface->v2,CD_MVERT);
- add_v3_v3v3(vec,vec,mvert->co);
- VECADD(nor,nor,mvert->no);
+ mvert=dm->getVertData(dm, mface->v2, CD_MVERT);
+ add_v3_v3v3(vec, vec, mvert->co);
+ VECADD(nor, nor, mvert->no);
- mvert=dm->getVertData(dm,mface->v3,CD_MVERT);
- add_v3_v3v3(vec,vec,mvert->co);
- VECADD(nor,nor,mvert->no);
+ mvert=dm->getVertData(dm, mface->v3, CD_MVERT);
+ add_v3_v3v3(vec, vec, mvert->co);
+ VECADD(nor, nor, mvert->no);
if (mface->v4) {
- mvert=dm->getVertData(dm,mface->v4,CD_MVERT);
- add_v3_v3v3(vec,vec,mvert->co);
- VECADD(nor,nor,mvert->no);
+ mvert=dm->getVertData(dm, mface->v4, CD_MVERT);
+ add_v3_v3v3(vec, vec, mvert->co);
+ VECADD(nor, nor, mvert->no);
- mul_v3_fl(vec,0.25);
+ mul_v3_fl(vec, 0.25);
}
else
- mul_v3_fl(vec,0.3333f);
+ mul_v3_fl(vec, 0.3333f);
normalize_v3(nor);
@@ -1150,7 +1154,7 @@ static void update_world_cos(Object *ob, PTCacheEdit *edit)
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles+p, hairmat);
LOOP_KEYS {
- copy_v3_v3(key->world_co,key->co);
+ copy_v3_v3(key->world_co, key->co);
if (!(psys->flag & PSYS_GLOBAL_HAIR))
mul_m4_v3(hairmat, key->world_co);
}
@@ -1235,7 +1239,7 @@ void PE_update_object(Scene *scene, Object *ob, int useflag)
pe_deflect_emitter(scene, ob, edit);
PE_apply_lengths(scene, edit);
if (pe_x_mirror(ob))
- PE_apply_mirror(ob,edit->psys);
+ PE_apply_mirror(ob, edit->psys);
if (edit->psys)
update_world_cos(ob, edit);
if (pset->flag & PE_AUTO_VELOCITY)
@@ -1633,7 +1637,9 @@ int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, sho
copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
project_int(ar, co, vertco);
- if ((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
+ if (BLI_lasso_is_point_inside(mcords, moves, vertco[0], vertco[1], IS_CLIPPED) &&
+ key_test_depth(&data, co))
+ {
if (select && !(key->flag & PEK_SELECT)) {
key->flag |= PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
@@ -1650,8 +1656,10 @@ int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, sho
copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
- project_int(ar, co,vertco);
- if ((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
+ project_int(ar, co, vertco);
+ if (BLI_lasso_is_point_inside(mcords, moves, vertco[0], vertco[1], IS_CLIPPED) &&
+ key_test_depth(&data, co))
+ {
if (select && !(key->flag & PEK_SELECT)) {
key->flag |= PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
@@ -1900,7 +1908,7 @@ static void rekey_particle(PEData *data, int pa_index)
pa->flag |= PARS_REKEY;
- key= new_keys= MEM_callocN(data->totrekey * sizeof(HairKey),"Hair re-key keys");
+ key= new_keys= MEM_callocN(data->totrekey * sizeof(HairKey), "Hair re-key keys");
okey = pa->hair;
/* root and tip stay the same */
@@ -1912,7 +1920,7 @@ static void rekey_particle(PEData *data, int pa_index)
dval= (end - sta) / (float)(data->totrekey - 1);
/* interpolate new keys from old ones */
- for (k=1,key++; k<data->totrekey-1; k++,key++) {
+ for (k=1, key++; k<data->totrekey-1; k++, key++) {
state.time= (float)k / (float)(data->totrekey-1);
psys_get_particle_on_path(&sim, pa_index, &state, 0);
copy_v3_v3(key->co, state.co);
@@ -1929,7 +1937,7 @@ static void rekey_particle(PEData *data, int pa_index)
if (point->keys)
MEM_freeN(point->keys);
- ekey= point->keys= MEM_callocN(pa->totkey * sizeof(PTCacheEditKey),"Hair re-key edit keys");
+ ekey= point->keys= MEM_callocN(pa->totkey * sizeof(PTCacheEditKey), "Hair re-key edit keys");
for (k=0, key=pa->hair; k<pa->totkey; k++, key++, ekey++) {
ekey->co= key->co;
@@ -2215,7 +2223,7 @@ static void subdivide_particle(PEData *data, int pa_index)
sim.ob= data->ob;
sim.psys= edit->psys;
- for (k=0, ekey=point->keys; k<pa->totkey-1; k++,ekey++) {
+ for (k=0, ekey=point->keys; k<pa->totkey-1; k++, ekey++) {
if (ekey->flag&PEK_SELECT && (ekey+1)->flag&PEK_SELECT)
totnewkey++;
}
@@ -2224,16 +2232,16 @@ static void subdivide_particle(PEData *data, int pa_index)
pa->flag |= PARS_REKEY;
- nkey= new_keys= MEM_callocN((pa->totkey+totnewkey)*(sizeof(HairKey)),"Hair subdivide keys");
- nekey= new_ekeys= MEM_callocN((pa->totkey+totnewkey)*(sizeof(PTCacheEditKey)),"Hair subdivide edit keys");
+ nkey= new_keys= MEM_callocN((pa->totkey+totnewkey)*(sizeof(HairKey)), "Hair subdivide keys");
+ nekey= new_ekeys= MEM_callocN((pa->totkey+totnewkey)*(sizeof(PTCacheEditKey)), "Hair subdivide edit keys");
key = pa->hair;
endtime= key[pa->totkey-1].time;
for (k=0, ekey=point->keys; k<pa->totkey-1; k++, key++, ekey++) {
- memcpy(nkey,key,sizeof(HairKey));
- memcpy(nekey,ekey,sizeof(PTCacheEditKey));
+ memcpy(nkey, key, sizeof(HairKey));
+ memcpy(nekey, ekey, sizeof(PTCacheEditKey));
nekey->co= nkey->co;
nekey->time= &nkey->time;
@@ -2258,8 +2266,8 @@ static void subdivide_particle(PEData *data, int pa_index)
}
}
/*tip still not copied*/
- memcpy(nkey,key,sizeof(HairKey));
- memcpy(nekey,ekey,sizeof(PTCacheEditKey));
+ memcpy(nkey, key, sizeof(HairKey));
+ memcpy(nekey, ekey, sizeof(PTCacheEditKey));
nekey->co= nkey->co;
nekey->time= &nkey->time;
@@ -2348,7 +2356,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
copy_v3_v3(co, point->keys->co);
mul_m4_v3(mat, co);
- totn= BLI_kdtree_find_n_nearest(tree,10,co,NULL,nearest);
+ totn= BLI_kdtree_find_n_nearest(tree, 10, co, NULL, nearest);
for (n=0; n<totn; n++) {
/* this needs a custom threshold still */
@@ -2463,11 +2471,11 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
glTranslatef((float)x, (float)y, 0.0f);
glColor4ub(255, 255, 255, 128);
- glEnable(GL_LINE_SMOOTH );
+ glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
glutil_draw_lined_arc(0.0, M_PI*2.0, brush->size, 40);
glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH );
+ glDisable(GL_LINE_SMOOTH);
glPopMatrix();
}
@@ -2658,7 +2666,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
/* assign face inddex */
newpa->num= mirrorfaces[pa->num*2];
- newpa->num_dmcache= psys_particle_dm_face_lookup(ob,psmd->dm,newpa->num,newpa->fuv, NULL);
+ newpa->num_dmcache= psys_particle_dm_face_lookup(ob, psmd->dm, newpa->num, newpa->fuv, NULL);
/* update edit key pointers */
key= newpoint->keys;
@@ -2722,8 +2730,8 @@ static void brush_comb(PEData *data, float UNUSED(mat[][4]), float imat[][4], in
fac= (float)pow((double)(1.0f - data->dist / data->rad), (double)data->combfac);
- copy_v3_v3(cvec,data->dvec);
- mul_mat3_m4_v3(imat,cvec);
+ copy_v3_v3(cvec, data->dvec);
+ mul_mat3_m4_v3(imat, cvec);
mul_v3_fl(cvec, fac);
add_v3_v3(key->co, cvec);
@@ -2832,17 +2840,17 @@ static void brush_length(PEData *data, int point_index)
PTCacheEdit *edit= data->edit;
PTCacheEditPoint *point = edit->points + point_index;
KEY_K;
- float dvec[3],pvec[3] = {0.0f, 0.0f, 0.0f};
+ float dvec[3], pvec[3] = {0.0f, 0.0f, 0.0f};
LOOP_KEYS {
if (k==0) {
- copy_v3_v3(pvec,key->co);
+ copy_v3_v3(pvec, key->co);
}
else {
- sub_v3_v3v3(dvec,key->co,pvec);
- copy_v3_v3(pvec,key->co);
- mul_v3_fl(dvec,data->growfac);
- add_v3_v3v3(key->co,(key-1)->co,dvec);
+ sub_v3_v3v3(dvec, key->co, pvec);
+ copy_v3_v3(pvec, key->co);
+ mul_v3_fl(dvec, data->growfac);
+ add_v3_v3v3(key->co, (key-1)->co, dvec);
}
}
@@ -2869,7 +2877,7 @@ static void brush_puff(PEData *data, int point_index)
if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(data->ob, data->dm, psys->part->from, psys->particles + point_index, mat);
- invert_m4_m4(imat,mat);
+ invert_m4_m4(imat, mat);
}
else {
unit_m4(mat);
@@ -3001,8 +3009,8 @@ static void brush_smooth_get(PEData *data, float mat[][4], float UNUSED(imat[][4
if (key_index) {
float dvec[3];
- sub_v3_v3v3(dvec,key->co,(key-1)->co);
- mul_mat3_m4_v3(mat,dvec);
+ sub_v3_v3v3(dvec, key->co, (key-1)->co);
+ mul_mat3_m4_v3(mat, dvec);
add_v3_v3(data->vec, dvec);
data->tot++;
}
@@ -3014,12 +3022,12 @@ static void brush_smooth_do(PEData *data, float UNUSED(mat[][4]), float imat[][4
if (key_index) {
copy_v3_v3(vec, data->vec);
- mul_mat3_m4_v3(imat,vec);
+ mul_mat3_m4_v3(imat, vec);
- sub_v3_v3v3(dvec,key->co,(key-1)->co);
+ sub_v3_v3v3(dvec, key->co, (key-1)->co);
- sub_v3_v3v3(dvec,vec,dvec);
- mul_v3_fl(dvec,data->smoothfac);
+ sub_v3_v3v3(dvec, vec, dvec);
+ mul_v3_fl(dvec, data->smoothfac);
add_v3_v3(key->co, dvec);
}
@@ -3055,7 +3063,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
MFace *mface= NULL;
MVert *mvert= NULL;
int i, totface, intersect=0;
- float cur_d, cur_uv[2], v1[3], v2[3], v3[3], v4[3], min[3], max[3], p_min[3],p_max[3];
+ float cur_d, cur_uv[2], v1[3], v2[3], v3[3], v4[3], min[3], max[3], p_min[3], p_max[3];
float cur_ipoint[3];
if (dm == NULL) {
@@ -3076,50 +3084,50 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
if (pa_minmax==0) {
- INIT_MINMAX(p_min,p_max);
- DO_MINMAX(co1,p_min,p_max);
- DO_MINMAX(co2,p_min,p_max);
+ INIT_MINMAX(p_min, p_max);
+ DO_MINMAX(co1, p_min, p_max);
+ DO_MINMAX(co2, p_min, p_max);
}
else {
- copy_v3_v3(p_min,pa_minmax);
- copy_v3_v3(p_max,pa_minmax+3);
+ copy_v3_v3(p_min, pa_minmax);
+ copy_v3_v3(p_max, pa_minmax+3);
}
totface=dm->getNumTessFaces(dm);
- mface=dm->getTessFaceDataArray(dm,CD_MFACE);
- mvert=dm->getVertDataArray(dm,CD_MVERT);
+ mface=dm->getTessFaceDataArray(dm, CD_MFACE);
+ mvert=dm->getVertDataArray(dm, CD_MVERT);
/* lets intersect the faces */
- for (i=0; i<totface; i++,mface++) {
+ for (i=0; i<totface; i++, mface++) {
if (vert_cos) {
- copy_v3_v3(v1,vert_cos+3*mface->v1);
- copy_v3_v3(v2,vert_cos+3*mface->v2);
- copy_v3_v3(v3,vert_cos+3*mface->v3);
+ copy_v3_v3(v1, vert_cos+3*mface->v1);
+ copy_v3_v3(v2, vert_cos+3*mface->v2);
+ copy_v3_v3(v3, vert_cos+3*mface->v3);
if (mface->v4)
- copy_v3_v3(v4,vert_cos+3*mface->v4);
+ copy_v3_v3(v4, vert_cos+3*mface->v4);
}
else {
- copy_v3_v3(v1,mvert[mface->v1].co);
- copy_v3_v3(v2,mvert[mface->v2].co);
- copy_v3_v3(v3,mvert[mface->v3].co);
+ copy_v3_v3(v1, mvert[mface->v1].co);
+ copy_v3_v3(v2, mvert[mface->v2].co);
+ copy_v3_v3(v3, mvert[mface->v3].co);
if (mface->v4)
- copy_v3_v3(v4,mvert[mface->v4].co);
+ copy_v3_v3(v4, mvert[mface->v4].co);
}
if (face_minmax==0) {
- INIT_MINMAX(min,max);
- DO_MINMAX(v1,min,max);
- DO_MINMAX(v2,min,max);
- DO_MINMAX(v3,min,max);
+ INIT_MINMAX(min, max);
+ DO_MINMAX(v1, min, max);
+ DO_MINMAX(v2, min, max);
+ DO_MINMAX(v3, min, max);
if (mface->v4)
DO_MINMAX(v4, min, max);
- if (isect_aabb_aabb_v3(min,max,p_min,p_max)==0)
+ if (isect_aabb_aabb_v3(min, max, p_min, p_max)==0)
continue;
}
else {
copy_v3_v3(min, face_minmax+6*i);
copy_v3_v3(max, face_minmax+6*i+3);
- if (isect_aabb_aabb_v3(min,max,p_min,p_max)==0)
+ if (isect_aabb_aabb_v3(min, max, p_min, p_max)==0)
continue;
}
@@ -3127,7 +3135,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
if (isect_sweeping_sphere_tri_v3(co1, co2, radius, v2, v3, v1, &cur_d, cur_ipoint)) {
if (cur_d<*min_d) {
*min_d=cur_d;
- copy_v3_v3(ipoint,cur_ipoint);
+ copy_v3_v3(ipoint, cur_ipoint);
*min_face=i;
intersect=1;
}
@@ -3136,7 +3144,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
if (isect_sweeping_sphere_tri_v3(co1, co2, radius, v4, v1, v3, &cur_d, cur_ipoint)) {
if (cur_d<*min_d) {
*min_d=cur_d;
- copy_v3_v3(ipoint,cur_ipoint);
+ copy_v3_v3(ipoint, cur_ipoint);
*min_face=i;
intersect=1;
}
@@ -3182,8 +3190,8 @@ static int brush_add(PEData *data, short number)
Object *ob= data->ob;
PTCacheEdit *edit = data->edit;
ParticleSystem *psys= edit->psys;
- ParticleData *add_pars= MEM_callocN(number*sizeof(ParticleData),"ParticleData add");
- ParticleSystemModifierData *psmd= psys_get_modifier(ob,psys);
+ ParticleData *add_pars= MEM_callocN(number*sizeof(ParticleData), "ParticleData add");
+ ParticleSystemModifierData *psmd= psys_get_modifier(ob, psys);
ParticleSimulationData sim= {0};
ParticleEditSettings *pset= PE_settings(scene);
int i, k, n= 0, totpart= psys->totpart;
@@ -3194,7 +3202,7 @@ static int brush_add(PEData *data, short number)
short size= pset->brush[PE_BRUSH_ADD].size;
short size2= size*size;
DerivedMesh *dm=0;
- invert_m4_m4(imat,ob->obmat);
+ invert_m4_m4(imat, ob->obmat);
if (psys->flag & PSYS_GLOBAL_HAIR)
return 0;
@@ -3227,13 +3235,13 @@ static int brush_add(PEData *data, short number)
mco[1]= data->mval[1] + dmy;
ED_view3d_win_to_segment_clip(data->vc.ar, data->vc.v3d, mco, co1, co2);
- mul_m4_v3(imat,co1);
- mul_m4_v3(imat,co2);
+ mul_m4_v3(imat, co1);
+ mul_m4_v3(imat, co2);
min_d=2.0;
/* warning, returns the derived mesh face */
- if (particle_intersect_dm(scene, ob,dm,0,co1,co2,&min_d,&add_pars[n].num,add_pars[n].fuv,0,0,0,0)) {
- add_pars[n].num_dmcache= psys_particle_dm_face_lookup(ob,psmd->dm,add_pars[n].num,add_pars[n].fuv,NULL);
+ if (particle_intersect_dm(scene, ob, dm, 0, co1, co2, &min_d, &add_pars[n].num, add_pars[n].fuv, 0, 0, 0, 0)) {
+ add_pars[n].num_dmcache= psys_particle_dm_face_lookup(ob, psmd->dm, add_pars[n].num, add_pars[n].fuv, NULL);
n++;
}
}
@@ -3241,8 +3249,8 @@ static int brush_add(PEData *data, short number)
int newtotpart=totpart+n;
float hairmat[4][4], cur_co[3];
KDTree *tree=0;
- ParticleData *pa, *new_pars= MEM_callocN(newtotpart*sizeof(ParticleData),"ParticleData new");
- PTCacheEditPoint *point, *new_points= MEM_callocN(newtotpart*sizeof(PTCacheEditPoint),"PTCacheEditPoint array new");
+ ParticleData *pa, *new_pars= MEM_callocN(newtotpart*sizeof(ParticleData), "ParticleData new");
+ PTCacheEditPoint *point, *new_points= MEM_callocN(newtotpart*sizeof(PTCacheEditPoint), "PTCacheEditPoint array new");
PTCacheEditKey *key;
HairKey *hkey;
@@ -3267,7 +3275,7 @@ static int brush_add(PEData *data, short number)
tree=BLI_kdtree_new(psys->totpart);
for (i=0, pa=psys->particles; i<totpart; i++, pa++) {
- psys_particle_on_dm(psmd->dm,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,cur_co,0,0,0,0,0);
+ psys_particle_on_dm(psmd->dm, psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, cur_co, 0, 0, 0, 0, 0);
BLI_kdtree_insert(tree, i, cur_co, NULL);
}
@@ -3295,7 +3303,7 @@ static int brush_add(PEData *data, short number)
}
pa->size= 1.0f;
- initialize_particle(&sim, pa,i);
+ initialize_particle(&sim, pa, i);
reset_particle(&sim, pa, 0.0, 1.0);
point->flag |= PEP_EDIT_RECALC;
if (pe_x_mirror(ob))
@@ -3311,8 +3319,8 @@ static int brush_add(PEData *data, short number)
int w, maxw;
float maxd, totw=0.0, weight[3];
- psys_particle_on_dm(psmd->dm,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co1,0,0,0,0,0);
- maxw= BLI_kdtree_find_n_nearest(tree,3,co1,NULL,ptn);
+ psys_particle_on_dm(psmd->dm, psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co1, 0, 0, 0, 0, 0);
+ maxw= BLI_kdtree_find_n_nearest(tree, 3, co1, NULL, ptn);
maxd= ptn[maxw-1].dist;
@@ -3371,7 +3379,7 @@ static int brush_add(PEData *data, short number)
}
for (k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) {
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
- invert_m4_m4(imat,hairmat);
+ invert_m4_m4(imat, hairmat);
mul_m4_v3(imat, hkey->co);
}
}
@@ -3487,7 +3495,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
mval[0] = bedit->lastmouse[0] + step*dx;
mval[1] = bedit->lastmouse[1] + step*dy;
- switch(pset->brushtype) {
+ switch (pset->brushtype) {
case PE_BRUSH_COMB:
{
float mval_f[2];
@@ -3627,7 +3635,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
if (pset->brushtype == PE_BRUSH_ADD && pe_x_mirror(ob))
PE_mirror_x(scene, ob, 1);
- update_world_cos(ob,edit);
+ update_world_cos(ob, edit);
psys_free_path_cache(NULL, edit);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
@@ -3663,7 +3671,7 @@ static int brush_edit_exec(bContext *C, wmOperator *op)
if (!brush_edit_init(C, op))
return OPERATOR_CANCELLED;
- RNA_BEGIN(op->ptr, itemptr, "stroke") {
+ RNA_BEGIN (op->ptr, itemptr, "stroke") {
brush_edit_apply(C, op, &itemptr);
}
RNA_END;
@@ -3704,7 +3712,7 @@ static int brush_edit_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int brush_edit_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- switch(event->type) {
+ switch (event->type) {
case LEFTMOUSE:
case MIDDLEMOUSE:
case RIGHTMOUSE: // XXX hardcoded
@@ -3923,7 +3931,7 @@ void PE_undo_push(Scene *scene, const char *str)
}
/* copy */
- make_PTCacheUndo(edit,edit->curundo);
+ make_PTCacheUndo(edit, edit->curundo);
}
void PE_undo_step(Scene *scene, int step)
@@ -3933,7 +3941,7 @@ void PE_undo_step(Scene *scene, int step)
if (!edit) return;
if (step==0) {
- get_PTCacheUndo(edit,edit->curundo);
+ get_PTCacheUndo(edit, edit->curundo);
}
else if (step==1) {
@@ -4092,7 +4100,7 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
totpoint = psys ? psys->totpart : (int)((PTCacheMem*)cache->mem_cache.first)->totpoint;
edit= MEM_callocN(sizeof(PTCacheEdit), "PE_create_particle_edit");
- edit->points=MEM_callocN(totpoint*sizeof(PTCacheEditPoint),"PTCacheEditPoints");
+ edit->points=MEM_callocN(totpoint*sizeof(PTCacheEditPoint), "PTCacheEditPoints");
edit->totpoint = totpoint;
if (psys && !cache) {
@@ -4107,7 +4115,7 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
pa = psys->particles;
LOOP_POINTS {
point->totkey = pa->totkey;
- point->keys= MEM_callocN(point->totkey*sizeof(PTCacheEditKey),"ParticleEditKeys");
+ point->keys= MEM_callocN(point->totkey*sizeof(PTCacheEditKey), "ParticleEditKeys");
point->flag |= PEP_EDIT_RECALC;
hkey = pa->hair;
@@ -4143,7 +4151,7 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
continue;
if (!point->totkey) {
- key = point->keys = MEM_callocN(totframe*sizeof(PTCacheEditKey),"ParticleEditKeys");
+ key = point->keys = MEM_callocN(totframe*sizeof(PTCacheEditKey), "ParticleEditKeys");
point->flag |= PEP_EDIT_RECALC;
}
else
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 3d50ec26a40..13e407040c3 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -532,7 +532,7 @@ void PARTICLE_OT_dupliob_move_down(wmOperatorType *ot)
static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
{
- ParticleSystemModifierData *psmd = psys_get_modifier(ob,psys);
+ ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
ParticleEditSettings *pset= PE_settings(scene);
ParticleData *pa;
PTCacheEdit *edit;
@@ -551,7 +551,7 @@ static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
edit = psys->edit;
point= edit ? edit->points : NULL;
- for (i=0, pa=psys->particles; i<psys->totpart; i++,pa++) {
+ for (i=0, pa=psys->particles; i<psys->totpart; i++, pa++) {
if (point) {
ekey = point->keys;
point++;
@@ -559,8 +559,8 @@ static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
- for (k=0,key=pa->hair; k<pa->totkey; k++,key++) {
- mul_m4_v3(hairmat,key->co);
+ for (k=0, key=pa->hair; k<pa->totkey; k++, key++) {
+ mul_m4_v3(hairmat, key->co);
if (ekey) {
ekey->flag &= ~PEK_USE_WCO;
@@ -622,7 +622,7 @@ void PARTICLE_OT_disconnect_hair(wmOperatorType *ot)
static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
{
- ParticleSystemModifierData *psmd = psys_get_modifier(ob,psys);
+ ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
ParticleData *pa;
PTCacheEdit *edit;
PTCacheEditPoint *point;
@@ -661,7 +661,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
bvhtree_from_mesh_faces(&bvhtree, dm, 0.0, 2, 6);
- for (i=0, pa= psys->particles; i<psys->totpart; i++,pa++) {
+ for (i=0, pa= psys->particles; i<psys->totpart; i++, pa++) {
key = pa->hair;
nearest.index = -1;
@@ -675,23 +675,23 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
continue;
}
- mface = CDDM_get_tessface(dm,nearest.index);
+ mface = CDDM_get_tessface(dm, nearest.index);
- copy_v3_v3(v[0], CDDM_get_vert(dm,mface->v1)->co);
- copy_v3_v3(v[1], CDDM_get_vert(dm,mface->v2)->co);
- copy_v3_v3(v[2], CDDM_get_vert(dm,mface->v3)->co);
+ copy_v3_v3(v[0], CDDM_get_vert(dm, mface->v1)->co);
+ copy_v3_v3(v[1], CDDM_get_vert(dm, mface->v2)->co);
+ copy_v3_v3(v[2], CDDM_get_vert(dm, mface->v3)->co);
if (mface->v4) {
- copy_v3_v3(v[3], CDDM_get_vert(dm,mface->v4)->co);
- interp_weights_poly_v3( pa->fuv,v, 4, nearest.co);
+ copy_v3_v3(v[3], CDDM_get_vert(dm, mface->v4)->co);
+ interp_weights_poly_v3(pa->fuv, v, 4, nearest.co);
}
else
- interp_weights_poly_v3( pa->fuv,v, 3, nearest.co);
+ interp_weights_poly_v3(pa->fuv, v, 3, nearest.co);
pa->num = nearest.index;
- pa->num_dmcache = psys_particle_dm_face_lookup(ob,psmd->dm,pa->num,pa->fuv,NULL);
+ pa->num_dmcache = psys_particle_dm_face_lookup(ob, psmd->dm, pa->num, pa->fuv, NULL);
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
- invert_m4_m4(imat,hairmat);
+ invert_m4_m4(imat, hairmat);
sub_v3_v3v3(vec, nearest.co, key->co);
@@ -700,9 +700,9 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
point++;
}
- for (k=0,key=pa->hair; k<pa->totkey; k++,key++) {
+ for (k=0, key=pa->hair; k<pa->totkey; k++, key++) {
add_v3_v3(key->co, vec);
- mul_m4_v3(imat,key->co);
+ mul_m4_v3(imat, key->co);
if (ekey) {
ekey->flag |= PEK_USE_WCO;
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 20fa4c5753f..fa72085be7d 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -150,8 +150,8 @@ static int fluid_is_animated_mesh(FluidsimSettings *fss)
/* helper function */
void fluidsimGetGeometryObjFilename(Object *ob, char *dst) { //, char *srcname)
{
- //BLI_snprintf(dst,FILE_MAXFILE, "%s_cfgdata_%s.bobj.gz", srcname, ob->id.name);
- BLI_snprintf(dst,FILE_MAXFILE, "fluidcfgdata_%s.bobj.gz", ob->id.name);
+ //BLI_snprintf(dst, FILE_MAXFILE, "%s_cfgdata_%s.bobj.gz", srcname, ob->id.name);
+ BLI_snprintf(dst, FILE_MAXFILE, "fluidcfgdata_%s.bobj.gz", ob->id.name);
}
#endif
@@ -199,30 +199,30 @@ typedef struct FluidObject {
#if 0
static void fluidsimPrintChannel(FILE *file, float *channel, int paramsize, char *str, int entries)
{
- int i,j;
+ int i, j;
int channelSize = paramsize;
if (entries==3) {
- elbeemSimplifyChannelVec3( channel, &channelSize);
+ elbeemSimplifyChannelVec3(channel, &channelSize);
}
else if (entries==1) {
- elbeemSimplifyChannelFloat( channel, &channelSize);
+ elbeemSimplifyChannelFloat(channel, &channelSize);
}
else {
// invalid, cant happen?
}
fprintf(file, " CHANNEL %s =\n", str);
- for (i=0; i<channelSize;i++) {
- fprintf(file," ");
- for (j=0;j<=entries;j++) { // also print time value
- fprintf(file," %f ", channel[i*(entries+1)+j] );
- if (j==entries-1) { fprintf(file," "); }
+ for (i=0; i < channelSize; i++) {
+ fprintf(file, " ");
+ for (j=0;j <= entries;j++) { // also print time value
+ fprintf(file, " %f ", channel[i*(entries + 1) + j]);
+ if (j==entries-1) { fprintf(file, " "); }
}
- fprintf(file,"\n");
+ fprintf(file, "\n");
}
- fprintf(file, " ;\n" );
+ fprintf(file, " ;\n");
}
#endif
@@ -243,7 +243,7 @@ static void init_time(FluidsimSettings *domainSettings, FluidAnimChannels *chann
{
int i;
- channels->timeAtFrame = MEM_callocN( (channels->length+1)*sizeof(float), "timeAtFrame channel");
+ channels->timeAtFrame = MEM_callocN((channels->length+1)*sizeof(float), "timeAtFrame channel");
channels->timeAtFrame[0] = channels->timeAtFrame[1] = domainSettings->animStart; // start at index 1
@@ -361,9 +361,9 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
init_time(domainSettings, channels);
/* allocate domain animation channels */
- channels->DomainGravity = MEM_callocN( length * (CHANNEL_VEC+1) * sizeof(float), "channel DomainGravity");
- channels->DomainViscosity = MEM_callocN( length * (CHANNEL_FLOAT+1) * sizeof(float), "channel DomainViscosity");
- channels->DomainTime = MEM_callocN( length * (CHANNEL_FLOAT+1) * sizeof(float), "channel DomainTime");
+ channels->DomainGravity = MEM_callocN(length * (CHANNEL_VEC+1) * sizeof(float), "channel DomainGravity");
+ channels->DomainViscosity = MEM_callocN(length * (CHANNEL_FLOAT+1) * sizeof(float), "channel DomainViscosity");
+ channels->DomainTime = MEM_callocN(length * (CHANNEL_FLOAT+1) * sizeof(float), "channel DomainTime");
/* allocate fluid objects */
for (base=scene->base.first; base; base= base->next) {
@@ -379,17 +379,17 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
continue;
}
- fobj->Translation = MEM_callocN( length * (CHANNEL_VEC+1) * sizeof(float), "fluidobject Translation");
- fobj->Rotation = MEM_callocN( length * (CHANNEL_VEC+1) * sizeof(float), "fluidobject Rotation");
- fobj->Scale = MEM_callocN( length * (CHANNEL_VEC+1) * sizeof(float), "fluidobject Scale");
- fobj->Active = MEM_callocN( length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject Active");
- fobj->InitialVelocity = MEM_callocN( length * (CHANNEL_VEC+1) * sizeof(float), "fluidobject InitialVelocity");
+ fobj->Translation = MEM_callocN(length * (CHANNEL_VEC+1) * sizeof(float), "fluidobject Translation");
+ fobj->Rotation = MEM_callocN(length * (CHANNEL_VEC+1) * sizeof(float), "fluidobject Rotation");
+ fobj->Scale = MEM_callocN(length * (CHANNEL_VEC+1) * sizeof(float), "fluidobject Scale");
+ fobj->Active = MEM_callocN(length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject Active");
+ fobj->InitialVelocity = MEM_callocN(length * (CHANNEL_VEC+1) * sizeof(float), "fluidobject InitialVelocity");
if (fluidmd->fss->type == OB_FLUIDSIM_CONTROL) {
- fobj->AttractforceStrength = MEM_callocN( length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject AttractforceStrength");
- fobj->AttractforceRadius = MEM_callocN( length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject AttractforceRadius");
- fobj->VelocityforceStrength = MEM_callocN( length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject VelocityforceStrength");
- fobj->VelocityforceRadius = MEM_callocN( length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject VelocityforceRadius");
+ fobj->AttractforceStrength = MEM_callocN(length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject AttractforceStrength");
+ fobj->AttractforceRadius = MEM_callocN(length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject AttractforceRadius");
+ fobj->VelocityforceStrength = MEM_callocN(length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject VelocityforceStrength");
+ fobj->VelocityforceRadius = MEM_callocN(length * (CHANNEL_FLOAT+1) * sizeof(float), "fluidobject VelocityforceRadius");
}
if (fluid_is_animated_mesh(fluidmd->fss)) {
@@ -397,7 +397,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
int *tris=NULL, modifierIndex = modifiers_indexInObject(ob, (ModifierData *)fluidmd);
initElbeemMesh(scene, ob, &fobj->numVerts, &verts, &fobj->numTris, &tris, 0, modifierIndex);
- fobj->VertexCache = MEM_callocN( length *((fobj->numVerts*CHANNEL_VEC)+1) * sizeof(float), "fluidobject VertexCache");
+ fobj->VertexCache = MEM_callocN(length *((fobj->numVerts*CHANNEL_VEC)+1) * sizeof(float), "fluidobject VertexCache");
MEM_freeN(verts);
MEM_freeN(tris);
@@ -507,7 +507,7 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length)
if (ELEM(fluidmd->fss->type, OB_FLUIDSIM_DOMAIN, OB_FLUIDSIM_PARTICLE))
continue;
- elbeemResetMesh( &fsmesh );
+ elbeemResetMesh(&fsmesh);
fsmesh.type = fluidmd->fss->type;
fsmesh.name = ob->id.name;
@@ -594,8 +594,7 @@ static int fluid_validate_scene(ReportList *reports, Scene *scene, Object *fsDom
int channelObjCount = 0;
int fluidInputCount = 0;
- for (base=scene->base.first; base; base= base->next)
- {
+ for (base=scene->base.first; base; base= base->next) {
Object *ob = base->object;
FluidsimModifierData *fluidmdtmp = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
@@ -680,7 +679,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
if (fileCfg) {
dirExist = 1; fclose(fileCfg);
// remove cfg dummy from directory test
- BLI_delete(targetFile, 0,0);
+ BLI_delete(targetFile, 0, 0);
}
if (targetDir[0] == '\0' || (!dirExist)) {
@@ -692,7 +691,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
BLI_splitdirstring(blendDir, blendFile);
BLI_replace_extension(blendFile, FILE_MAX, ""); /* strip .blend */
- BLI_snprintf(newSurfdataPath, FILE_MAX ,"//fluidsimdata/%s_%s_", blendFile, fsDomain->id.name);
+ BLI_snprintf(newSurfdataPath, FILE_MAX, "//fluidsimdata/%s_%s_", blendFile, fsDomain->id.name);
BLI_snprintf(debugStrBuffer, 256, "fluidsimBake::error - warning resetting output dir to '%s'\n", newSurfdataPath);
elbeemDebugOut(debugStrBuffer);
@@ -704,7 +703,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
if (outStringsChanged) {
char dispmsg[FILE_MAX+256];
int selection=0;
- BLI_strncpy(dispmsg,"Output settings set to: '", sizeof(dispmsg));
+ BLI_strncpy(dispmsg, "Output settings set to: '", sizeof(dispmsg));
strcat(dispmsg, newSurfdataPath);
strcat(dispmsg, "'%t|Continue with changed settings%x1|Discard and abort%x0");
@@ -793,7 +792,7 @@ int runSimulationCallback(void *data, int status, int frame)
if (status == FLUIDSIM_CBSTATUS_NEWFRAME) {
fluidbake_updatejob(fb, frame / (float)settings->noOfFrames);
- //printf("elbeem blender cb s%d, f%d, domainid:%d noOfFrames: %d\n", status,frame, settings->domainId, settings->noOfFrames ); // DEBUG
+ //printf("elbeem blender cb s%d, f%d, domainid:%d noOfFrames: %d\n", status, frame, settings->domainId, settings->noOfFrames ); // DEBUG
}
if (fluidbake_breakjob(fb)) {
@@ -899,7 +898,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
if (getenv(strEnvName)) {
int dlevel = atoi(getenv(strEnvName));
elbeemSetDebugLevel(dlevel);
- BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer),"fluidsimBake::msg: Debug messages activated due to envvar '%s'\n",strEnvName);
+ BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer), "fluidsimBake::msg: Debug messages activated due to envvar '%s'\n", strEnvName);
elbeemDebugOut(debugStrBuffer);
}
@@ -936,7 +935,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
/* rough check of settings... */
if (domainSettings->previewresxyz > domainSettings->resolutionxyz) {
- BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::warning - Preview (%d) >= Resolution (%d)... setting equal.\n", domainSettings->previewresxyz , domainSettings->resolutionxyz);
+ BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer), "fluidsimBake::warning - Preview (%d) >= Resolution (%d)... setting equal.\n", domainSettings->previewresxyz, domainSettings->resolutionxyz);
elbeemDebugOut(debugStrBuffer);
domainSettings->previewresxyz = domainSettings->resolutionxyz;
}
@@ -959,7 +958,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
else {
gridlevels = domainSettings->maxRefine;
}
- BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name , gridlevels );
+ BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer), "fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name, gridlevels);
elbeemDebugOut(debugStrBuffer);
@@ -979,7 +978,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
/* ******** init domain object's matrix ******** */
copy_m4_m4(domainMat, fsDomain->obmat);
if (!invert_m4_m4(invDomMat, domainMat)) {
- BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::error - Invalid obj matrix?\n");
+ BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer), "fluidsimBake::error - Invalid obj matrix?\n");
elbeemDebugOut(debugStrBuffer);
BKE_report(reports, RPT_ERROR, "Invalid object matrix");
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index f9737b02a01..a46e3c69456 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -348,7 +348,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
oglrender->is_sequencer = is_sequencer;
if (is_sequencer) {
- oglrender->sseq = CTX_wm_space_seq(C);;
+ oglrender->sseq = CTX_wm_space_seq(C);
}
@@ -364,7 +364,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
/* MUST be cleared on exit */
oglrender->scene->customdata_mask_modal = (ED_view3d_datamask(oglrender->scene, oglrender->v3d) |
- ED_view3d_object_datamask(oglrender->scene) );
+ ED_view3d_object_datamask(oglrender->scene));
/* apply immediately in case we're rendering from a script,
* running notifiers again will overwrite */
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 6722ac5e686..b648dac6343 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -178,7 +178,7 @@ static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op))
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Nurb *nu;
- ListBase *nurbs = curve_editnurbs((Curve *)ob->data);
+ ListBase *nurbs = BKE_curve_editNurbs_get((Curve *)ob->data);
if (nurbs) {
for (nu = nurbs->first; nu; nu = nu->next)
@@ -233,7 +233,7 @@ static int material_slot_de_select(bContext *C, int select)
}
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
- ListBase *nurbs = curve_editnurbs((Curve *)ob->data);
+ ListBase *nurbs = BKE_curve_editNurbs_get((Curve *)ob->data);
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
@@ -329,7 +329,7 @@ static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op))
if (!ob || !(matar = give_matarar(ob)))
return OPERATOR_CANCELLED;
- CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob_iter, selected_editable_objects) {
if (ob != ob_iter && give_matarar(ob_iter)) {
if (ob->data != ob_iter->data)
assign_matarar(ob_iter, matar, ob->totcol);
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index bed17048ea1..772c114e6d6 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -80,26 +80,26 @@ static void region_draw_emboss(ARegion *ar, rcti *scirct)
rect.ymax = scirct->ymax - ar->winrct.ymin;
/* set transp line */
- glEnable( GL_BLEND );
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* right */
- glColor4ub(0,0,0, 30);
+ glColor4ub(0, 0, 0, 30);
sdrawline(rect.xmax, rect.ymin, rect.xmax, rect.ymax);
/* bottom */
- glColor4ub(0,0,0, 30);
+ glColor4ub(0, 0, 0, 30);
sdrawline(rect.xmin, rect.ymin, rect.xmax, rect.ymin);
/* top */
- glColor4ub(255,255,255, 30);
+ glColor4ub(255, 255, 255, 30);
sdrawline(rect.xmin, rect.ymax, rect.xmax, rect.ymax);
/* left */
- glColor4ub(255,255,255, 30);
+ glColor4ub(255, 255, 255, 30);
sdrawline(rect.xmin, rect.ymin, rect.xmin, rect.ymax);
- glDisable( GL_BLEND );
+ glDisable(GL_BLEND);
}
void ED_region_pixelspace(ARegion *ar)
@@ -115,7 +115,7 @@ void ED_region_pixelspace(ARegion *ar)
void ED_region_do_listen(ARegion *ar, wmNotifier *note)
{
/* generic notes first */
- switch(note->category) {
+ switch (note->category) {
case NC_WM:
if (note->data==ND_FILEREAD)
ED_region_tag_redraw(ar);
@@ -213,12 +213,12 @@ static void region_draw_azone_icon(AZone *az)
glColor4f(1.f, 1.f, 1.f, 0.8f);
gluQuadricDrawStyle(qobj, GLU_FILL);
- gluDisk( qobj, 0.0, 4.25f, 16, 1);
+ gluDisk(qobj, 0.0, 4.25f, 16, 1);
glColor4f(0.2f, 0.2f, 0.2f, 0.9f);
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
- gluDisk( qobj, 0.0, 4.25f, 16, 1);
+ gluDisk(qobj, 0.0, 4.25f, 16, 1);
glDisable(GL_LINE_SMOOTH);
@@ -247,7 +247,7 @@ static void region_draw_azone_tab_plus(AZone *az)
glEnable(GL_BLEND);
/* add code to draw region hidden as 'too small' */
- switch(az->edge) {
+ switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
break;
@@ -282,7 +282,7 @@ static void region_draw_azone_tab(AZone *az)
glColor4f(col[0], col[1], col[2], 0.5f);
/* add code to draw region hidden as 'too small' */
- switch(az->edge) {
+ switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_RB_ALPHA);
@@ -325,7 +325,7 @@ static void region_draw_azone_tria(AZone *az)
glColor4f(0.0f, 0.0f, 0.0f, 0.35f);
/* add code to draw region hidden as 'too small' */
- switch(az->edge) {
+ switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
ui_draw_anti_tria((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y1, (float)(az->x1+az->x2)/2, (float)az->y2);
break;
@@ -357,8 +357,8 @@ void ED_area_overdraw(bContext *C)
/* Draw AZones, in screenspace */
wmSubWindowSet(win, screen->mainwin);
- glEnable( GL_BLEND );
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
for (sa= screen->areabase.first; sa; sa= sa->next) {
AZone *az;
@@ -388,7 +388,7 @@ void ED_area_overdraw(bContext *C)
}
}
}
- glDisable( GL_BLEND );
+ glDisable(GL_BLEND);
}
@@ -623,7 +623,7 @@ static void area_azone_initialize(ScrArea *sa)
#define AZONEPAD_ICON 9
static void region_azone_edge(AZone *az, ARegion *ar)
{
- switch(az->edge) {
+ switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
az->x1= ar->winrct.xmin;
az->y1= ar->winrct.ymax - AZONEPAD_EDGE;
@@ -665,7 +665,7 @@ static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
if (azt->edge == az->edge) tot++;
}
- switch(az->edge) {
+ switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
az->x1= ar->winrct.xmax - tot*2*AZONEPAD_ICON;
az->y1= ar->winrct.ymax + AZONEPAD_ICON;
@@ -725,7 +725,7 @@ static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
if (azt->edge == az->edge) tot++;
}
- switch(az->edge) {
+ switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
az->x1= ar->winrct.xmax - 2.5*AZONEPAD_TAB_PLUSW;
@@ -770,7 +770,7 @@ static void region_azone_tab(ScrArea *sa, AZone *az, ARegion *ar)
if (azt->edge == az->edge) tot++;
}
- switch(az->edge) {
+ switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
az->x1= ar->winrct.xmax - 2*AZONEPAD_TABW;
@@ -815,7 +815,7 @@ static void region_azone_tria(ScrArea *sa, AZone *az, ARegion *ar)
if (azt->edge == az->edge) tot++;
}
- switch(az->edge) {
+ switch (az->edge) {
case AE_TOP_TO_BOTTOMRIGHT:
if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
az->x1= ar->winrct.xmax - 2*AZONEPAD_TRIAW;
@@ -1530,17 +1530,17 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
if (sa->flag & HEADER_NO_PULLDOWN) {
but = uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_RIGHT,
- xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
- &(sa->flag), 0, 0, 0, 0,
- "Show pulldown menus");
+ ICON_DISCLOSURE_TRI_RIGHT,
+ xco, yco, UI_UNIT_X, UI_UNIT_Y - 2,
+ &(sa->flag), 0, 0, 0, 0,
+ "Show pulldown menus");
}
else {
but = uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
- ICON_DISCLOSURE_TRI_DOWN,
- xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
- &(sa->flag), 0, 0, 0, 0,
- "Hide pulldown menus");
+ ICON_DISCLOSURE_TRI_DOWN,
+ xco, yco, UI_UNIT_X, UI_UNIT_Y - 2,
+ &(sa->flag), 0, 0, 0, 0,
+ "Hide pulldown menus");
}
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
@@ -1803,7 +1803,7 @@ void ED_region_info_draw(ARegion *ar, const char *text, int block, float alpha)
rect.ymax = ar->winrct.ymax - ar->winrct.ymin;
glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(0.0f, 0.0f, 0.0f, alpha);
glRecti(rect.xmin, rect.ymin, rect.xmax+1, rect.ymax+1);
glDisable(GL_BLEND);
@@ -1813,3 +1813,63 @@ void ED_region_info_draw(ARegion *ar, const char *text, int block, float alpha)
BLF_position(fontid, 12, rect.ymin + 5, 0.0f);
BLF_draw(fontid, text, BLF_DRAW_STR_DUMMY_MAX);
}
+
+void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy)
+{
+ float gridsize, gridstep = 1.0f / 32.0f;
+ float fac, blendfac;
+ int x1, y1, x2, y2;
+
+ /* the image is located inside (0, 0), (1, 1) as set by view2d */
+ UI_ThemeColorShade(TH_BACK, 20);
+
+ UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x1, &y1);
+ UI_view2d_to_region_no_clip(&ar->v2d, 1.0f, 1.0f, &x2, &y2);
+ glRectf(x1, y1, x2, y2);
+
+ /* gridsize adapted to zoom level */
+ gridsize = 0.5f * (zoomx + zoomy);
+ if (gridsize <= 0.0f)
+ return;
+
+ if (gridsize < 1.0f) {
+ while (gridsize < 1.0f) {
+ gridsize *= 4.0f;
+ gridstep *= 4.0f;
+ }
+ }
+ else {
+ while (gridsize >= 4.0f) {
+ gridsize /= 4.0f;
+ gridstep /= 4.0f;
+ }
+ }
+
+ /* the fine resolution level */
+ blendfac = 0.25f * gridsize - floorf(0.25f * gridsize);
+ CLAMP(blendfac, 0.0f, 1.0f);
+ UI_ThemeColorShade(TH_BACK, (int)(20.0f * (1.0f - blendfac)));
+
+ fac = 0.0f;
+ glBegin(GL_LINES);
+ while (fac < 1.0f) {
+ glVertex2f(x1, y1 * (1.0f - fac) + y2 * fac);
+ glVertex2f(x2, y1 * (1.0f - fac) + y2 * fac);
+ glVertex2f(x1 * (1.0f - fac) + x2 * fac, y1);
+ glVertex2f(x1 * (1.0f - fac) + x2 * fac, y2);
+ fac += gridstep;
+ }
+
+ /* the large resolution level */
+ UI_ThemeColor(TH_BACK);
+
+ fac = 0.0f;
+ while (fac < 1.0f) {
+ glVertex2f(x1, y1 * (1.0f - fac) + y2 * fac);
+ glVertex2f(x2, y1 * (1.0f - fac) + y2 * fac);
+ glVertex2f(x1 * (1.0f - fac) + x2 * fac, y1);
+ glVertex2f(x1 * (1.0f - fac) + x2 * fac, y2);
+ fac += 4.0f * gridstep;
+ }
+ glEnd();
+}
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 5ba0e86e0c1..50430399f09 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -81,14 +81,14 @@ GLubyte stipple_halftone[128] = {
GLubyte stipple_quarttone[128] = {
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0,
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0,
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0,
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0,
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0,
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0,
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0,
- 136,136,136,136,0,0,0,0,34,34,34,34,0,0,0,0};
+ 136, 136, 136, 136, 0, 0, 0, 0, 34, 34, 34, 34, 0, 0, 0, 0,
+ 136, 136, 136, 136, 0, 0, 0, 0, 34, 34, 34, 34, 0, 0, 0, 0,
+ 136, 136, 136, 136, 0, 0, 0, 0, 34, 34, 34, 34, 0, 0, 0, 0,
+ 136, 136, 136, 136, 0, 0, 0, 0, 34, 34, 34, 34, 0, 0, 0, 0,
+ 136, 136, 136, 136, 0, 0, 0, 0, 34, 34, 34, 34, 0, 0, 0, 0,
+ 136, 136, 136, 136, 0, 0, 0, 0, 34, 34, 34, 34, 0, 0, 0, 0,
+ 136, 136, 136, 136, 0, 0, 0, 0, 34, 34, 34, 34, 0, 0, 0, 0,
+ 136, 136, 136, 136, 0, 0, 0, 0, 34, 34, 34, 34, 0, 0, 0, 0};
GLubyte stipple_diag_stripes_pos[128] = {
@@ -195,16 +195,15 @@ void fdrawcheckerboard(float x1, float y1, float x2, float y2)
{
unsigned char col1[4]= {40, 40, 40}, col2[4]= {50, 50, 50};
- GLubyte checker_stipple[32*32/8] = {
- 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
- 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
- 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
- 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
- 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
- 255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
- 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
- 0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
- };
+ GLubyte checker_stipple[32 * 32 / 8] = {
+ 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
+ 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
+ 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255,
+ 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255,
+ 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
+ 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
+ 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255,
+ 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255};
glColor3ubv(col1);
glRectf(x1, y1, x2, y2);
@@ -370,8 +369,8 @@ void fdrawXORellipse(float xofs, float yofs, float hw, float hh)
set_inverted_drawing(1);
glPushMatrix();
- glTranslatef(xofs, yofs, 0.0);
- glScalef(1,hh/hw,1);
+ glTranslatef(xofs, yofs, 0.0f);
+ glScalef(1.0f, hh / hw, 1.0f);
glutil_draw_lined_arc(0.0, M_PI*2.0, hw, 20);
glPopMatrix();
@@ -786,10 +785,10 @@ void glaEnd2DDraw(gla2DDrawInfo *di)
static int curmode=0;
static int pointhack=0;
-static GLubyte Squaredot[16] = { 0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff};
+static GLubyte Squaredot[16] = {0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff};
void bglBegin(int mode)
{
@@ -825,7 +824,7 @@ int bglPointHack(void)
void bglVertex3fv(const float vec[3])
{
- switch(curmode) {
+ switch (curmode) {
case GL_POINTS:
if (pointhack) {
glRasterPos3fv(vec);
@@ -838,7 +837,7 @@ void bglVertex3fv(const float vec[3])
void bglVertex3f(float x, float y, float z)
{
- switch(curmode) {
+ switch (curmode) {
case GL_POINTS:
if (pointhack) {
glRasterPos3f(x, y, z);
@@ -851,7 +850,7 @@ void bglVertex3f(float x, float y, float z)
void bglVertex2fv(const float vec[2])
{
- switch(curmode) {
+ switch (curmode) {
case GL_POINTS:
if (pointhack) {
glRasterPos2fv(vec);
@@ -882,11 +881,15 @@ void bgl_get_mats(bglMats *mats)
/* Very strange code here - it seems that certain bad values in the
* modelview matrix can cause gluUnProject to give bad results. */
if (mats->modelview[0] < badvalue &&
- mats->modelview[0] > -badvalue)
- mats->modelview[0]= 0;
+ mats->modelview[0] > -badvalue)
+ {
+ mats->modelview[0] = 0;
+ }
if (mats->modelview[5] < badvalue &&
- mats->modelview[5] > -badvalue)
- mats->modelview[5]= 0;
+ mats->modelview[5] > -badvalue)
+ {
+ mats->modelview[5] = 0;
+ }
/* Set up viewport so that gluUnProject will give correct values */
mats->viewport[0] = 0;
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index cafa4527c20..512cd404273 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -963,7 +963,7 @@ void ED_screen_do_listen(bContext *C, wmNotifier *note)
wmWindow *win= CTX_wm_window(C);
/* generic notes */
- switch(note->category) {
+ switch (note->category) {
case NC_WM:
if (note->data==ND_FILEREAD)
win->screen->do_draw= 1;
@@ -1009,7 +1009,7 @@ void ED_screen_draw(wmWindow *win)
if (sa1 && sa2) {
dir = area_getorientation(sa1, sa2);
if (dir >= 0) {
- switch(dir) {
+ switch (dir) {
case 0: /* W */
dir = 'r';
dira = 'l';
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index e427e1e21cf..49672b77d43 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -597,7 +597,7 @@ static int actionzone_modal(bContext *C, wmOperator *op, wmEvent *event)
int deltax, deltay;
int mindelta= sad->az->type==AZONE_REGION?1:12;
- switch(event->type) {
+ switch (event->type) {
case MOUSEMOVE:
/* calculate gesture direction */
deltax= (event->x - sad->x);
@@ -735,7 +735,7 @@ static int area_swap_modal(bContext *C, wmOperator *op, wmEvent *event)
{
sActionzoneData *sad= op->customdata;
- switch(event->type) {
+ switch (event->type) {
case MOUSEMOVE:
/* second area, for join */
sad->sa2= screen_areahascursor(CTX_wm_screen(C), event->x, event->y);
@@ -1045,7 +1045,7 @@ static int area_move_modal(bContext *C, wmOperator *op, wmEvent *event)
int delta, x, y;
/* execute the events */
- switch(event->type) {
+ switch (event->type) {
case MOUSEMOVE:
x= RNA_int_get(op->ptr, "x");
@@ -1438,7 +1438,7 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
int dir;
/* execute the events */
- switch(event->type) {
+ switch (event->type) {
case MOUSEMOVE:
dir= RNA_enum_get(op->ptr, "direction");
@@ -1505,13 +1505,13 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
RNA_enum_set(op->ptr, "direction", 'h');
sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
- WM_cursor_set(CTX_wm_window(C),CURSOR_X_MOVE);
+ WM_cursor_set(CTX_wm_window(C), CURSOR_X_MOVE);
}
else {
RNA_enum_set(op->ptr, "direction", 'v');
sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V;
- WM_cursor_set(CTX_wm_window(C),CURSOR_Y_MOVE);
+ WM_cursor_set(CTX_wm_window(C), CURSOR_Y_MOVE);
}
}
}
@@ -1711,7 +1711,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
int delta;
/* execute the events */
- switch(event->type) {
+ switch (event->type) {
case MOUSEMOVE:
if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
@@ -2262,7 +2262,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
/* execute the events */
- switch(event->type) {
+ switch (event->type) {
case MOUSEMOVE:
{
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 5d4710accad..553a9a335d7 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -377,7 +377,9 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush,
/* check for overlay mode */
if (!(brush->flag & BRUSH_TEXTURE_OVERLAY) ||
!(ELEM(brush->mtex.brush_map_mode, MTEX_MAP_MODE_FIXED, MTEX_MAP_MODE_TILED)))
+ {
return;
+ }
/* save lots of GL state
* TODO: check on whether all of these are needed? */
@@ -566,7 +568,9 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
ELEM5(brush->sculpt_tool, SCULPT_TOOL_DRAW,
SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY,
SCULPT_TOOL_PINCH, SCULPT_TOOL_CREASE))
+ {
outline_col = brush->sub_col;
+ }
/* only do if brush is over the mesh */
if (hit)
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 55cf827fea6..ac327b56fb9 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -5038,7 +5038,7 @@ static int paint_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- RNA_BEGIN(op->ptr, itemptr, "stroke") {
+ RNA_BEGIN (op->ptr, itemptr, "stroke") {
paint_apply(C, op, &itemptr);
}
RNA_END;
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index b5d6f20aa79..6860b551556 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -530,6 +530,9 @@ static void ed_keymap_paint_brush_radial_control(wmKeyMap *keymap, const char *p
kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0);
set_brush_rc_props(kmi->ptr, paint, "strength", "use_unified_strength", flags);
+ kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", WKEY, KM_PRESS, 0, 0);
+ set_brush_rc_props(kmi->ptr, paint, "weight", "use_unified_weight", flags);
+
if (flags & RC_ROTATION) {
kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_CTRL, 0);
set_brush_rc_props(kmi->ptr, paint, "texture_slot.angle", NULL, flags);
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index fb640346a99..9fe941253f6 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -377,7 +377,7 @@ int paint_stroke_exec(bContext *C, wmOperator *op)
stroke->stroke_started = 1;
}
- RNA_BEGIN(op->ptr, itemptr, "stroke") {
+ RNA_BEGIN (op->ptr, itemptr, "stroke") {
stroke->update_step(C, stroke, &itemptr);
}
RNA_END;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index bd448cc8288..7d847df4175 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -2348,7 +2348,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
if (brush->vertexpaint_tool == PAINT_BLEND_BLUR)
paintweight = 0.0f;
else
- paintweight = ts->vgroup_weight;
+ paintweight = brush_weight(scene, brush);
for (index = 0; index < totindex; index++) {
if (indexar[index] && indexar[index] <= me->totpoly) {
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 157be337823..8d2dfc8dbfa 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -766,7 +766,7 @@ static int sculpt_search_sphere_cb(PBVHNode *node, void *data_v)
}
/* Handles clipping against a mirror modifier and SCULPT_LOCK axis flags */
-static void sculpt_clip(Sculpt *sd, SculptSession *ss, float *co, const float val[3])
+static void sculpt_clip(Sculpt *sd, SculptSession *ss, float co[3], const float val[3])
{
int i;
@@ -2817,8 +2817,10 @@ static void sculpt_init_mirror_clipping(Object *ob, SculptSession *ss)
/* update the clip tolerance */
if (mmd->tolerance >
ss->cache->clip_tolerance[i])
+ {
ss->cache->clip_tolerance[i] =
- mmd->tolerance;
+ mmd->tolerance;
+ }
}
}
}
@@ -2928,8 +2930,11 @@ static void sculpt_update_cache_invariants(bContext *C, Sculpt *sd, SculptSessio
SCULPT_TOOL_DRAW, SCULPT_TOOL_CREASE, SCULPT_TOOL_BLOB,
SCULPT_TOOL_LAYER, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY,
SCULPT_TOOL_CLAY_STRIPS, SCULPT_TOOL_ROTATE))
- if (!(brush->flag & BRUSH_ACCUMULATE))
+ {
+ if (!(brush->flag & BRUSH_ACCUMULATE)) {
cache->original = 1;
+ }
+ }
cache->special_rotation = (brush->flag & BRUSH_RAKE) ? sd->last_angle : 0;
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 89a786d02a9..c08ed2e85b9 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -237,7 +237,9 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
else if (unode->maxgrid && dm->getGridData) {
if ((dm->getNumGrids(dm) != unode->maxgrid) ||
(dm->getGridSize(dm) != unode->gridsize))
+ {
continue;
+ }
}
else {
continue;
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index b50c3f11534..73dfde8fd6f 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -221,7 +221,7 @@ static int sound_update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op)
struct FCurve* fcu;
char driven;
- SEQ_BEGIN(scene->ed, seq) {
+ SEQ_BEGIN (scene->ed, seq) {
fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "volume", 0, &driven);
if (fcu || driven)
seq->flag |= SEQ_AUDIO_VOLUME_ANIMATED;
@@ -318,6 +318,7 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op)
char filename[FILE_MAX];
Scene *scene;
Main *bmain;
+ int split;
int bitrate, accuracy;
AUD_DeviceSpecs specs;
@@ -333,6 +334,7 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op)
specs.format = RNA_enum_get(op->ptr, "format");
container = RNA_enum_get(op->ptr, "container");
codec = RNA_enum_get(op->ptr, "codec");
+ split = RNA_boolean_get(op->ptr, "split_channels");
scene = CTX_data_scene(C);
bmain = CTX_data_main(C);
specs.channels = scene->r.ffcodecdata.audio_channels;
@@ -341,8 +343,12 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op)
BLI_strncpy(filename, path, sizeof(filename));
BLI_path_abs(filename, bmain->name);
- result = AUD_mixdown(scene->sound_scene, SFRA * specs.rate / FPS, (EFRA - SFRA) * specs.rate / FPS,
- accuracy, filename, specs, container, codec, bitrate);
+ if(split)
+ result = AUD_mixdown_per_channel(scene->sound_scene, SFRA * specs.rate / FPS, (EFRA - SFRA) * specs.rate / FPS,
+ accuracy, filename, specs, container, codec, bitrate);
+ else
+ result = AUD_mixdown(scene->sound_scene, SFRA * specs.rate / FPS, (EFRA - SFRA) * specs.rate / FPS,
+ accuracy, filename, specs, container, codec, bitrate);
if (result) {
BKE_report(op->reports, RPT_ERROR, result);
@@ -437,8 +443,7 @@ static void sound_mixdown_draw(bContext *C, wmOperator *op)
RNA_def_property_flag(prop_codec, PROP_HIDDEN);
RNA_def_property_flag(prop_format, PROP_HIDDEN);
- switch(container)
- {
+ switch (container) {
case AUD_CONTAINER_AC3:
RNA_def_property_clear_flag(prop_format, PROP_HIDDEN);
RNA_def_property_enum_items(prop_format, ac3_format_items);
@@ -460,8 +465,7 @@ static void sound_mixdown_draw(bContext *C, wmOperator *op)
RNA_def_property_clear_flag(prop_codec, PROP_HIDDEN);
RNA_def_property_enum_items(prop_codec, all_codec_items);
- switch(codec)
- {
+ switch (codec) {
case AUD_CODEC_AAC:
RNA_enum_set(op->ptr, "format", AUD_FORMAT_S16);
break;
@@ -592,6 +596,7 @@ static void SOUND_OT_mixdown(wmOperatorType *ot)
RNA_def_enum(ot->srna, "codec", codec_items, AUD_CODEC_FLAC, "Codec", "Audio Codec");
RNA_def_enum(ot->srna, "format", format_items, AUD_FORMAT_S16, "Format", "Sample format");
RNA_def_int(ot->srna, "bitrate", 192, 32, 512, "Bitrate", "Bitrate in kbit/s", 32, 512);
+ RNA_def_boolean(ot->srna, "split_channels", 0, "Split channels", "Each channel will be rendered into a mono file");
#endif // WITH_AUDASPACE
}
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index b8c310f8477..a44eca17dfd 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -121,7 +121,7 @@ static int act_new_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_new (wmOperatorType *ot)
+void ACTION_OT_new(wmOperatorType *ot)
{
/* identifiers */
ot->name = "New Action";
@@ -204,7 +204,7 @@ static int act_markers_make_local_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_markers_make_local (wmOperatorType *ot)
+void ACTION_OT_markers_make_local(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Make Markers Local";
@@ -319,7 +319,7 @@ static int actkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_previewrange_set (wmOperatorType *ot)
+void ACTION_OT_previewrange_set(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Auto-Set Preview Range";
@@ -381,7 +381,7 @@ static int actkeys_viewsel_exec(bContext *C, wmOperator *UNUSED(op))
return actkeys_viewall(C, TRUE);
}
-void ACTION_OT_view_all (wmOperatorType *ot)
+void ACTION_OT_view_all(wmOperatorType *ot)
{
/* identifiers */
ot->name = "View All";
@@ -396,7 +396,7 @@ void ACTION_OT_view_all (wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-void ACTION_OT_view_selected (wmOperatorType *ot)
+void ACTION_OT_view_selected(wmOperatorType *ot)
{
/* identifiers */
ot->name = "View Selected";
@@ -484,7 +484,7 @@ static int actkeys_copy_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_copy (wmOperatorType *ot)
+void ACTION_OT_copy(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Copy Keyframes";
@@ -535,7 +535,7 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_paste (wmOperatorType *ot)
+void ACTION_OT_paste(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Paste Keyframes";
@@ -636,7 +636,7 @@ static int actkeys_insertkey_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_keyframe_insert (wmOperatorType *ot)
+void ACTION_OT_keyframe_insert(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Insert Keyframes";
@@ -712,7 +712,7 @@ static int actkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED
return OPERATOR_FINISHED;
}
-void ACTION_OT_duplicate (wmOperatorType *ot)
+void ACTION_OT_duplicate(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Duplicate Keyframes";
@@ -787,7 +787,7 @@ static int actkeys_delete_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_delete (wmOperatorType *ot)
+void ACTION_OT_delete(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Keyframes";
@@ -851,7 +851,7 @@ static int actkeys_clean_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_clean (wmOperatorType *ot)
+void ACTION_OT_clean(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clean Keyframes";
@@ -915,7 +915,7 @@ static int actkeys_sample_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_sample (wmOperatorType *ot)
+void ACTION_OT_sample(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Sample Keyframes";
@@ -1025,7 +1025,7 @@ static int actkeys_expo_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_extrapolation_type (wmOperatorType *ot)
+void ACTION_OT_extrapolation_type(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Keyframe Extrapolation";
@@ -1096,7 +1096,7 @@ static int actkeys_ipo_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_interpolation_type (wmOperatorType *ot)
+void ACTION_OT_interpolation_type(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Keyframe Interpolation";
@@ -1176,7 +1176,7 @@ static int actkeys_handletype_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_handle_type (wmOperatorType *ot)
+void ACTION_OT_handle_type(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Keyframe Handle Type";
@@ -1247,7 +1247,7 @@ static int actkeys_keytype_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_keyframe_type (wmOperatorType *ot)
+void ACTION_OT_keyframe_type(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Keyframe Type";
@@ -1315,7 +1315,7 @@ static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_frame_jump (wmOperatorType *ot)
+void ACTION_OT_frame_jump(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Jump to Frame";
@@ -1415,7 +1415,7 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_snap (wmOperatorType *ot)
+void ACTION_OT_snap(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Snap Keys";
@@ -1529,7 +1529,7 @@ static int actkeys_mirror_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_mirror (wmOperatorType *ot)
+void ACTION_OT_mirror(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Mirror Keys";
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index f76f5f6523e..a28f8ee1b99 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -158,7 +158,7 @@ static int actkeys_deselectall_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_select_all_toggle (wmOperatorType *ot)
+void ACTION_OT_select_all_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select All";
@@ -524,7 +524,7 @@ static int actkeys_columnselect_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ACTION_OT_select_column (wmOperatorType *ot)
+void ACTION_OT_select_column(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select All";
@@ -582,7 +582,7 @@ static int actkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_select_linked (wmOperatorType *ot)
+void ACTION_OT_select_linked(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Linked";
@@ -659,7 +659,7 @@ static int actkeys_select_more_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_select_more (wmOperatorType *ot)
+void ACTION_OT_select_more(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select More";
@@ -693,7 +693,7 @@ static int actkeys_select_less_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ACTION_OT_select_less (wmOperatorType *ot)
+void ACTION_OT_select_less(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Less";
@@ -860,7 +860,7 @@ static int actkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent
return actkeys_select_leftright_exec(C, op);
}
-void ACTION_OT_select_leftright (wmOperatorType *ot)
+void ACTION_OT_select_leftright(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Left/Right";
@@ -1174,7 +1174,7 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
}
-void ACTION_OT_clickselect (wmOperatorType *ot)
+void ACTION_OT_clickselect(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Mouse Select Keys";
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 9d0dab7d34e..c1875eb3a9a 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -269,12 +269,12 @@ static void action_header_area_draw(const bContext *C, ARegion *ar)
static void action_channel_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_ANIMATION:
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_OB_ACTIVE:
case ND_FRAME:
ED_region_tag_redraw(ar);
@@ -282,7 +282,7 @@ static void action_channel_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_OBJECT:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_KEYS:
@@ -307,12 +307,12 @@ static void action_channel_area_listener(ARegion *ar, wmNotifier *wmn)
static void action_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_ANIMATION:
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_RENDER_OPTIONS:
case ND_OB_ACTIVE:
case ND_FRAME:
@@ -322,7 +322,7 @@ static void action_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_OBJECT:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_TRANSFORM:
/* moving object shouldn't need to redraw action */
break;
@@ -334,7 +334,7 @@ static void action_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_NODE:
- switch(wmn->action) {
+ switch (wmn->action) {
case NA_EDITED:
ED_region_tag_redraw(ar);
break;
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index b698ec03668..20d5257a62f 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -535,7 +535,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
/* now for each buttons context type, we try to construct a path,
* tracing back recursively */
- switch(mainb) {
+ switch (mainb) {
case BCONTEXT_SCENE:
case BCONTEXT_RENDER:
found= buttons_context_path_scene(path);
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index fcc5b488ca9..2385bfd75b7 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -56,7 +56,7 @@
static void set_texture_context(bContext *C, SpaceButs *sbuts)
{
- switch(sbuts->mainb) {
+ switch (sbuts->mainb) {
case BCONTEXT_MATERIAL:
sbuts->texture_context = SB_TEXC_MAT_OR_LAMP;
break;
@@ -83,7 +83,7 @@ static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event)
if (!sbuts) /* editor type switch */
return;
- switch(event) {
+ switch (event) {
case B_CONTEXT_SWITCH:
case B_BUTSPREVIEW:
ED_area_tag_redraw(CTX_wm_area(C));
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index f1f4fb37b6e..b2a58041832 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -234,9 +234,9 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
SpaceButs *sbuts= sa->spacedata.first;
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_RENDER_OPTIONS:
buttons_area_redraw(sa, BCONTEXT_RENDER);
break;
@@ -262,7 +262,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_OBJECT:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_TRANSFORM:
buttons_area_redraw(sa, BCONTEXT_OBJECT);
buttons_area_redraw(sa, BCONTEXT_DATA); /* autotexpace flag */
@@ -307,7 +307,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_GEOM:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_SELECT:
case ND_DATA:
ED_area_tag_redraw(sa);
@@ -316,7 +316,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
break;
case NC_MATERIAL:
ED_area_tag_redraw(sa);
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_SHADING:
case ND_SHADING_DRAW:
case ND_NODES:
@@ -350,7 +350,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
ED_area_tag_redraw(sa);
break;
case NC_ANIMATION:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_KEYFRAME:
if (wmn->action == NA_EDITED)
ED_area_tag_redraw(sa);
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index eabd64bdc4f..82178e47ae5 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -63,6 +63,11 @@
/* Panels */
+static int clip_grease_pencil_panel_poll(const bContext *UNUSED(C), PanelType *UNUSED(pt))
+{
+ return TRUE;
+}
+
void ED_clip_buttons_register(ARegionType *art)
{
PanelType *pt;
@@ -72,6 +77,7 @@ void ED_clip_buttons_register(ARegionType *art)
strcpy(pt->label, "Grease Pencil");
pt->draw = gpencil_panel_standard;
pt->flag |= PNL_DEFAULT_CLOSED;
+ pt->poll = clip_grease_pencil_panel_poll;
BLI_addtail(&art->paneltypes, pt);
}
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index bf8976035a8..2f9956fc143 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -1380,7 +1380,12 @@ void clip_draw_main(SpaceClip *sc, ARegion *ar, Scene *scene)
if (ibuf) {
draw_movieclip_buffer(sc, ar, ibuf, width, height, zoomx, zoomy);
IMB_freeImBuf(ibuf);
+ }
+ else {
+ ED_region_grid_draw(ar, zoomx, zoomy);
+ }
+ if (width && height) {
draw_tracking_tracks(sc, ar, clip, width, height, zoomx, zoomy);
draw_distortion(sc, ar, clip, width, height, zoomx, zoomy);
}
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 3946d4cc36d..885357a100d 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -35,6 +35,7 @@
#include "BKE_movieclip.h"
#include "BKE_context.h"
#include "BKE_tracking.h"
+
#include "DNA_object_types.h" /* SELECT */
#include "BLI_utildefines.h"
@@ -55,6 +56,8 @@
#include "clip_intern.h" // own include
+/* ******** operactor poll functions ******** */
+
int ED_space_clip_poll(bContext *C)
{
SpaceClip *sc = CTX_wm_space_clip(C);
@@ -65,6 +68,51 @@ int ED_space_clip_poll(bContext *C)
return FALSE;
}
+int ED_space_clip_tracking_poll(bContext *C)
+{
+ SpaceClip *sc= CTX_wm_space_clip(C);
+
+ if (sc && sc->clip)
+ return ED_space_clip_show_trackedit(sc);
+
+ return FALSE;
+}
+
+int ED_space_clip_tracking_size_poll(bContext *C)
+{
+ if (ED_space_clip_tracking_poll(C)) {
+ MovieClip *clip = CTX_data_edit_movieclip(C);
+
+ if (clip) {
+ SpaceClip *sc = CTX_wm_space_clip(C);
+ int width, height;
+
+ BKE_movieclip_get_size(clip, &sc->user, &width, &height);
+
+ return width > 0 && height > 0;
+ }
+ }
+
+ return FALSE;
+}
+
+int ED_space_clip_tracking_frame_poll(bContext *C)
+{
+ if (ED_space_clip_tracking_poll(C)) {
+ MovieClip *clip = CTX_data_edit_movieclip(C);
+
+ if (clip) {
+ SpaceClip *sc = CTX_wm_space_clip(C);
+
+ return BKE_movieclip_has_frame(clip, &sc->user);
+ }
+ }
+
+ return FALSE;
+}
+
+/* ******** editing functions ******** */
+
void ED_space_clip_set(bContext *C, SpaceClip *sc, MovieClip *clip)
{
sc->clip = clip;
@@ -314,3 +362,12 @@ void ED_clip_mouse_pos(bContext *C, wmEvent *event, float co[2])
{
ED_clip_point_stable_pos(C, event->mval[0], event->mval[1], &co[0], &co[1]);
}
+
+int ED_space_clip_show_trackedit(SpaceClip *sc)
+{
+ if (sc) {
+ return ELEM3(sc->mode, SC_MODE_TRACKING, SC_MODE_RECONSTRUCTION, SC_MODE_DISTORTION);
+ }
+
+ return FALSE;
+}
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c
index df14491c9c9..4825403fb4a 100644
--- a/source/blender/editors/space_clip/clip_graph_draw.c
+++ b/source/blender/editors/space_clip/clip_graph_draw.c
@@ -87,60 +87,6 @@ static void draw_curve_knot(float x, float y, float xscale, float yscale, float
glPopMatrix();
}
-static void draw_graph_cfra(SpaceClip *sc, ARegion *ar, Scene *scene)
-{
- View2D *v2d = &ar->v2d;
- float xscale, yscale;
- float vec[2];
-
- /* Draw a light green line to indicate current frame */
- vec[0] = (float)(sc->user.framenr * scene->r.framelen);
-
- UI_ThemeColor(TH_CFRAME);
- glLineWidth(2.0);
-
- glBegin(GL_LINE_STRIP);
- vec[1] = v2d->cur.ymin;
- glVertex2fv(vec);
-
- vec[1] = v2d->cur.ymax;
- glVertex2fv(vec);
- glEnd();
-
- glLineWidth(1.0);
-
- UI_view2d_view_orthoSpecial(ar, v2d, 1);
-
- /* because the frame number text is subject to the same scaling as the contents of the view */
- UI_view2d_getscale(v2d, &xscale, &yscale);
- glScalef(1.0f/xscale, 1.0f, 1.0f);
-
- clip_draw_curfra_label(sc, (float)sc->user.framenr * xscale, 18);
-
- /* restore view transform */
- glScalef(xscale, 1.0, 1.0);
-}
-
-static void draw_graph_sfra_efra(Scene *scene, View2D *v2d)
-{
- UI_view2d_view_ortho(v2d);
-
- /* currently clip editor supposes that editing clip length is equal to scene frame range */
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
-
- glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax);
- glRectf((float)EFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
- glDisable(GL_BLEND);
-
- UI_ThemeColorShade(TH_BACK, -60);
-
- /* thin lines where the actual frames are */
- fdrawline((float)SFRA, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax);
- fdrawline((float)EFRA, v2d->cur.ymin, (float)EFRA, v2d->cur.ymax);
-}
-
static void tracking_segment_point_cb(void *UNUSED(userdata), MovieTrackingTrack *UNUSED(track),
MovieTrackingMarker *marker, int UNUSED(coord), float val)
{
@@ -280,8 +226,8 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene)
}
/* frame range */
- draw_graph_sfra_efra(scene, v2d);
+ clip_draw_sfra_efra(v2d, scene);
/* current frame */
- draw_graph_cfra(sc, ar, scene);
+ clip_draw_cfra(sc, ar, scene);
}
diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c
index f8c81c2944a..7916a96f98c 100644
--- a/source/blender/editors/space_clip/clip_graph_ops.c
+++ b/source/blender/editors/space_clip/clip_graph_ops.c
@@ -63,15 +63,13 @@
static int ED_space_clip_graph_poll(bContext *C)
{
- SpaceClip *sc = CTX_wm_space_clip(C);
-
- if (sc && sc->clip) {
+ if (ED_space_clip_tracking_poll(C)) {
ARegion *ar = CTX_wm_region(C);
return ar->regiontype == RGN_TYPE_PREVIEW;
}
- return 0;
+ return FALSE;
}
typedef struct {
@@ -82,7 +80,7 @@ static void toggle_selection_cb(void *userdata, MovieTrackingMarker *marker)
{
SelectUserData *data = (SelectUserData *)userdata;
- switch(data->action) {
+ switch (data->action) {
case SEL_SELECT:
marker->flag |= MARKER_GRAPH_SEL;
break;
@@ -486,7 +484,7 @@ void CLIP_OT_graph_delete_curve(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_operator_confirm;
ot->exec = delete_curve_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h
index 425a1da9ec5..0b63ae5b12f 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -38,6 +38,7 @@ struct MovieClip;
struct MovieTrackingMarker;
struct MovieTrackingTrack;
struct Scene;
+struct ScrArea;
struct SpaceClip;
struct wmOperatorType;
@@ -81,6 +82,7 @@ void CLIP_OT_rebuild_proxy(struct wmOperatorType *ot);
void CLIP_OT_mode_set(struct wmOperatorType *ot);
/* clip_toolbar.c */
+struct ARegion *ED_clip_has_properties_region(struct ScrArea *sa);
void CLIP_OT_tools(struct wmOperatorType *ot);
void CLIP_OT_properties(struct wmOperatorType *ot);
void ED_clip_tool_props_register(struct ARegionType *art);
@@ -104,6 +106,9 @@ void clip_delete_marker(struct bContext *C, struct MovieClip *clip, struct ListB
void clip_view_center_to_point(struct SpaceClip *sc, float x, float y);
+void clip_draw_cfra(struct SpaceClip *sc, struct ARegion *ar, struct Scene *scene);
+void clip_draw_sfra_efra(struct View2D *v2d, struct Scene *scene);
+
/* tracking_ops.c */
void CLIP_OT_select(struct wmOperatorType *ot);
void CLIP_OT_select_all(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 7e1bbc254e9..c7033b0db99 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -157,7 +157,7 @@ static int open_exec(bContext *C, wmOperator *op)
errno = 0;
- clip = BKE_add_movieclip_file(str);
+ clip = BKE_movieclip_file_add(str);
if (!clip) {
if (op->customdata)
@@ -361,7 +361,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
ViewPanData *vpd = op->customdata;
float offset[2];
- switch(event->type) {
+ switch (event->type) {
case MOUSEMOVE:
copy_v2_v2(vpd->vec, &vpd->xorig);
offset[0] = (vpd->x - event->x) / sc->zoom;
@@ -496,7 +496,7 @@ static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
ViewZoomData *vpd = op->customdata;
float factor;
- switch(event->type) {
+ switch (event->type) {
case MOUSEMOVE:
factor = 1.0f + (vpd->x-event->x + vpd->y - event->y) / 300.0f;
RNA_float_set(op->ptr, "factor", factor);
diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c
index b80deb8260a..da8bf8fedd9 100644
--- a/source/blender/editors/space_clip/clip_toolbar.c
+++ b/source/blender/editors/space_clip/clip_toolbar.c
@@ -56,7 +56,7 @@
/************************** properties ******************************/
-static ARegion *clip_has_properties_region(ScrArea *sa)
+ARegion *ED_clip_has_properties_region(ScrArea *sa)
{
ARegion *ar, *arnew;
@@ -90,9 +90,9 @@ static int properties_poll(bContext *C)
static int properties_exec(bContext *C, wmOperator *UNUSED(op))
{
ScrArea *sa = CTX_wm_area(C);
- ARegion *ar = clip_has_properties_region(sa);
+ ARegion *ar = ED_clip_has_properties_region(sa);
- if (ar)
+ if (ar && ar->alignment != RGN_ALIGN_NONE)
ED_region_toggle_hidden(C, ar);
return OPERATOR_FINISHED;
@@ -167,7 +167,7 @@ static int tools_exec(bContext *C, wmOperator *UNUSED(op))
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = clip_has_tools_region(sa);
- if (ar)
+ if (ar && ar->alignment != RGN_ALIGN_NONE)
ED_region_toggle_hidden(C, ar);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index 443a1d0cdd3..c8ba8be7eae 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -29,6 +29,7 @@
* \ingroup spclip
*/
+#include "DNA_scene_types.h"
#include "DNA_object_types.h" /* SELECT */
#include "MEM_guardedalloc.h"
@@ -42,6 +43,9 @@
#include "BKE_tracking.h"
#include "BKE_depsgraph.h"
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
#include "WM_api.h"
#include "WM_types.h"
@@ -53,6 +57,8 @@
#include "RNA_access.h"
#include "RNA_define.h"
+#include "UI_interface.h"
+#include "UI_resources.h"
#include "UI_view2d.h"
#include "clip_intern.h" // own include
@@ -220,3 +226,57 @@ void clip_view_center_to_point(SpaceClip *sc, float x, float y)
sc->xof = (x - 0.5f) * width * aspx;
sc->yof = (y - 0.5f) * height * aspy;
}
+
+void clip_draw_cfra(SpaceClip *sc, ARegion *ar, Scene *scene)
+{
+ View2D *v2d = &ar->v2d;
+ float xscale, yscale;
+ float vec[2];
+
+ /* Draw a light green line to indicate current frame */
+ vec[0] = (float)(sc->user.framenr * scene->r.framelen);
+
+ UI_ThemeColor(TH_CFRAME);
+ glLineWidth(2.0);
+
+ glBegin(GL_LINE_STRIP);
+ vec[1] = v2d->cur.ymin;
+ glVertex2fv(vec);
+
+ vec[1] = v2d->cur.ymax;
+ glVertex2fv(vec);
+ glEnd();
+
+ glLineWidth(1.0);
+
+ UI_view2d_view_orthoSpecial(ar, v2d, 1);
+
+ /* because the frame number text is subject to the same scaling as the contents of the view */
+ UI_view2d_getscale(v2d, &xscale, &yscale);
+ glScalef(1.0f/xscale, 1.0f, 1.0f);
+
+ clip_draw_curfra_label(sc, (float)sc->user.framenr * xscale, 18);
+
+ /* restore view transform */
+ glScalef(xscale, 1.0, 1.0);
+}
+
+void clip_draw_sfra_efra(View2D *v2d, Scene *scene)
+{
+ UI_view2d_view_ortho(v2d);
+
+ /* currently clip editor supposes that editing clip length is equal to scene frame range */
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
+
+ glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax);
+ glRectf((float)EFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
+ glDisable(GL_BLEND);
+
+ UI_ThemeColorShade(TH_BACK, -60);
+
+ /* thin lines where the actual frames are */
+ fdrawline((float)SFRA, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax);
+ fdrawline((float)EFRA, v2d->cur.ymin, (float)EFRA, v2d->cur.ymax);
+}
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 228c716e3b6..4044568b70d 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -96,7 +96,7 @@ static void init_preview_region(const bContext *C, ARegion *ar)
ar->v2d.keeptot = 0;
}
-static ARegion *clip_has_preview_region(const bContext *C, ScrArea *sa)
+static ARegion *ED_clip_has_preview_region(const bContext *C, ScrArea *sa)
{
ARegion *ar, *arnew;
@@ -236,9 +236,9 @@ static SpaceLink *clip_duplicate(SpaceLink *sl)
static void clip_listener(ScrArea *sa, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_FRAME:
clip_scopes_tag_refresh(sa);
/* no break! */
@@ -249,14 +249,14 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_MOVIECLIP:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_DISPLAY:
case ND_SELECT:
clip_scopes_tag_refresh(sa);
ED_area_tag_redraw(sa);
break;
}
- switch(wmn->action) {
+ switch (wmn->action) {
case NA_REMOVED:
case NA_EDITED:
case NA_EVALUATED:
@@ -270,7 +270,7 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_GEOM:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_SELECT:
clip_scopes_tag_refresh(sa);
ED_area_tag_redraw(sa);
@@ -619,10 +619,13 @@ static int clip_context(const bContext *C, const char *member, bContextDataResul
if (CTX_data_dir(member)) {
CTX_data_dir_set(result, clip_context_dir);
+
return TRUE;
}
else if (CTX_data_equals(member, "edit_movieclip")) {
- CTX_data_id_pointer_set(result, &sc->clip->id);
+ if (sc->clip)
+ CTX_data_id_pointer_set(result, &sc->clip->id);
+
return TRUE;
}
@@ -636,54 +639,163 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
Scene *scene = CTX_data_scene(C);
SpaceClip *sc = (SpaceClip *)sa->spacedata.first;
ARegion *ar_main = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- ARegion *ar_preview = clip_has_preview_region(C, sa);
+ ARegion *ar_tools = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS);
+ ARegion *ar_tool_props = BKE_area_find_region_type(sa, RGN_TYPE_TOOL_PROPS);
+ ARegion *ar_preview = ED_clip_has_preview_region(C, sa);
+ ARegion *ar_properties = ED_clip_has_properties_region(sa);
+ int main_visible = FALSE, preview_visible = FALSE, tools_visible = FALSE;
+ int tool_props_visible = FALSE, properties_visible = FALSE;
int view_changed = FALSE;
switch (sc->view) {
case SC_VIEW_CLIP:
- if (ar_preview && !(ar_preview->flag & RGN_FLAG_HIDDEN)) {
- ar_preview->flag |= RGN_FLAG_HIDDEN;
- ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
- WM_event_remove_handlers((bContext*)C, &ar_preview->handlers);
- view_changed = TRUE;
- }
- if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
- ar_main->alignment = RGN_ALIGN_NONE;
- view_changed = TRUE;
- }
- if (ar_preview && ar_preview->alignment != RGN_ALIGN_NONE) {
- /* store graph region align */
- if (ar_preview->alignment == RGN_ALIGN_TOP)
- sc->runtime_flag &= ~SC_GRAPH_BOTTOM;
- else
- sc->runtime_flag |= SC_GRAPH_BOTTOM;
-
- ar_preview->alignment = RGN_ALIGN_NONE;
- view_changed = TRUE;
- }
+ main_visible = TRUE;
+ preview_visible = FALSE;
+ tools_visible = TRUE;
+ tool_props_visible = TRUE;
+ properties_visible = TRUE;
break;
case SC_VIEW_GRAPH:
- if (ar_preview && (ar_preview->flag & RGN_FLAG_HIDDEN)) {
- ar_preview->flag &= ~RGN_FLAG_HIDDEN;
- ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
- ar_preview->v2d.cur = ar_preview->v2d.tot;
- view_changed = TRUE;
- }
- if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
- ar_main->alignment = RGN_ALIGN_NONE;
- view_changed = TRUE;
- }
- if (ar_preview && !ELEM(ar_preview->alignment, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) {
- if (sc->runtime_flag & SC_GRAPH_BOTTOM)
- ar_preview->alignment = RGN_ALIGN_BOTTOM;
- else
- ar_preview->alignment = RGN_ALIGN_TOP;
-
- view_changed = TRUE;
- }
+ main_visible = TRUE;
+ preview_visible = TRUE;
+ tools_visible = TRUE;
+ tool_props_visible = TRUE;
+ properties_visible = TRUE;
break;
}
+ if (main_visible) {
+ if (ar_main && (ar_main->flag & RGN_FLAG_HIDDEN)) {
+ ar_main->flag &= ~RGN_FLAG_HIDDEN;
+ ar_main->v2d.flag &= ~V2D_IS_INITIALISED;
+ view_changed = TRUE;
+ }
+
+ if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
+ ar_main->alignment = RGN_ALIGN_NONE;
+ view_changed = TRUE;
+ }
+ }
+ else {
+ if (ar_main && !(ar_main->flag & RGN_FLAG_HIDDEN)) {
+ ar_main->flag |= RGN_FLAG_HIDDEN;
+ ar_main->v2d.flag &= ~V2D_IS_INITIALISED;
+ WM_event_remove_handlers((bContext *)C, &ar_main->handlers);
+ view_changed = TRUE;
+ }
+ if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
+ ar_main->alignment = RGN_ALIGN_NONE;
+ view_changed = TRUE;
+ }
+ }
+
+ if (properties_visible) {
+ if (ar_properties && (ar_properties->flag & RGN_FLAG_HIDDEN)) {
+ ar_properties->flag &= ~RGN_FLAG_HIDDEN;
+ ar_properties->v2d.flag &= ~V2D_IS_INITIALISED;
+ view_changed = TRUE;
+ }
+ if (ar_properties && ar_properties->alignment != RGN_ALIGN_RIGHT) {
+ ar_properties->alignment = RGN_ALIGN_RIGHT;
+ view_changed = TRUE;
+ }
+ }
+ else {
+ if (ar_properties && !(ar_properties->flag & RGN_FLAG_HIDDEN)) {
+ ar_properties->flag |= RGN_FLAG_HIDDEN;
+ ar_properties->v2d.flag &= ~V2D_IS_INITIALISED;
+ WM_event_remove_handlers((bContext *)C, &ar_properties->handlers);
+ view_changed = TRUE;
+ }
+ if (ar_properties && ar_properties->alignment != RGN_ALIGN_NONE) {
+ ar_properties->alignment = RGN_ALIGN_NONE;
+ view_changed = TRUE;
+ }
+ }
+
+ if (tools_visible) {
+ if (ar_tools && (ar_tools->flag & RGN_FLAG_HIDDEN)) {
+ ar_tools->flag &= ~RGN_FLAG_HIDDEN;
+ ar_tools->v2d.flag &= ~V2D_IS_INITIALISED;
+ view_changed = TRUE;
+ }
+ if (ar_tools && ar_tools->alignment != RGN_ALIGN_LEFT) {
+ ar_tools->alignment = RGN_ALIGN_LEFT;
+ view_changed = TRUE;
+ }
+ }
+ else {
+ if (ar_tools && !(ar_tools->flag & RGN_FLAG_HIDDEN)) {
+ ar_tools->flag |= RGN_FLAG_HIDDEN;
+ ar_tools->v2d.flag &= ~V2D_IS_INITIALISED;
+ WM_event_remove_handlers((bContext *)C, &ar_tools->handlers);
+ view_changed = TRUE;
+ }
+ if (ar_tools && ar_tools->alignment != RGN_ALIGN_NONE) {
+ ar_tools->alignment = RGN_ALIGN_NONE;
+ view_changed = TRUE;
+ }
+ }
+
+ if (tool_props_visible) {
+ if (ar_tool_props && (ar_tool_props->flag & RGN_FLAG_HIDDEN)) {
+ ar_tool_props->flag &= ~RGN_FLAG_HIDDEN;
+ ar_tool_props->v2d.flag &= ~V2D_IS_INITIALISED;
+ view_changed = TRUE;
+ }
+ if (ar_tool_props && (ar_tool_props->alignment != (RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV))) {
+ ar_tool_props->alignment = RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV;
+ view_changed = TRUE;
+ }
+ }
+ else {
+ if (ar_tool_props && !(ar_tool_props->flag & RGN_FLAG_HIDDEN)) {
+ ar_tool_props->flag |= RGN_FLAG_HIDDEN;
+ ar_tool_props->v2d.flag &= ~V2D_IS_INITIALISED;
+ WM_event_remove_handlers((bContext *)C, &ar_tool_props->handlers);
+ view_changed = TRUE;
+ }
+ if (ar_tool_props && ar_tool_props->alignment != RGN_ALIGN_NONE) {
+ ar_tool_props->alignment = RGN_ALIGN_NONE;
+ view_changed = TRUE;
+ }
+ }
+
+ if (preview_visible) {
+ if (ar_preview && (ar_preview->flag & RGN_FLAG_HIDDEN)) {
+ ar_preview->flag &= ~RGN_FLAG_HIDDEN;
+ ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
+ ar_preview->v2d.cur = ar_preview->v2d.tot;
+ view_changed = TRUE;
+ }
+ if (ar_preview && !ELEM(ar_preview->alignment, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) {
+ if (sc->runtime_flag & SC_GRAPH_BOTTOM)
+ ar_preview->alignment = RGN_ALIGN_BOTTOM;
+ else
+ ar_preview->alignment = RGN_ALIGN_TOP;
+
+ view_changed = TRUE;
+ }
+ }
+ else {
+ /* store graph region align */
+ if (ar_preview->alignment == RGN_ALIGN_TOP)
+ sc->runtime_flag &= ~SC_GRAPH_BOTTOM;
+ else if (ar_preview->alignment == RGN_ALIGN_BOTTOM)
+ sc->runtime_flag |= SC_GRAPH_BOTTOM;
+
+ if (ar_preview && !(ar_preview->flag & RGN_FLAG_HIDDEN)) {
+ ar_preview->flag |= RGN_FLAG_HIDDEN;
+ ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
+ WM_event_remove_handlers((bContext *)C, &ar_preview->handlers);
+ view_changed = TRUE;
+ }
+ if (ar_preview && ar_preview->alignment != RGN_ALIGN_NONE) {
+ ar_preview->alignment = RGN_ALIGN_NONE;
+ view_changed = TRUE;
+ }
+ }
+
if (view_changed) {
ED_area_initialize(wm, window, sa);
ED_area_tag_redraw(sa);
@@ -808,7 +920,7 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar)
static void clip_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SCREEN:
if (wmn->data == ND_GPENCIL)
ED_region_tag_redraw(ar);
@@ -832,13 +944,13 @@ static void clip_preview_area_init(wmWindowManager *wm, ARegion *ar)
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
-static void clip_preview_area_draw(const bContext *C, ARegion *ar)
+static void graph_area_draw(const bContext *C, ARegion *ar)
{
View2D *v2d = &ar->v2d;
View2DScrollers *scrollers;
SpaceClip *sc = CTX_wm_space_clip(C);
Scene *scene = CTX_data_scene(C);
- short unitx = V2D_UNIT_FRAMESCALE, unity = V2D_UNIT_VALUES;
+ short unitx, unity;
if (sc->flag & SC_LOCK_TIMECURSOR)
ED_clip_graph_center_current_frame(scene, ar);
@@ -856,11 +968,18 @@ static void clip_preview_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_restore(C);
/* scrollers */
+ unitx = (sc->flag & SC_SHOW_SECONDS)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES;
+ unity = V2D_UNIT_VALUES;
scrollers = UI_view2d_scrollers_calc(C, v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP);
UI_view2d_scrollers_draw(C, v2d, scrollers);
UI_view2d_scrollers_free(scrollers);
}
+static void clip_preview_area_draw(const bContext *C, ARegion *ar)
+{
+ graph_area_draw(C, ar);
+}
+
static void clip_preview_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn))
{
}
@@ -896,7 +1015,7 @@ static void clip_tools_area_draw(const bContext *C, ARegion *ar)
static void clip_props_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_WM:
if (wmn->data == ND_HISTORY)
ED_region_tag_redraw(ar);
@@ -941,7 +1060,7 @@ static void clip_properties_area_draw(const bContext *C, ARegion *ar)
static void clip_properties_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SCREEN:
if (wmn->data ==ND_GPENCIL)
ED_region_tag_redraw(ar);
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 35986fa2700..b3bb7464761 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -78,20 +78,6 @@
#include "clip_intern.h" // own include
-static int space_clip_frame_poll(bContext *C)
-{
- SpaceClip *sc = CTX_wm_space_clip(C);
-
- if (sc) {
- MovieClip *clip = ED_space_clip(sc);
-
- if (clip)
- return BKE_movieclip_has_frame(clip, &sc->user);
- }
-
- return FALSE;
-}
-
/********************** add marker operator *********************/
static void add_marker(SpaceClip *sc, float x, float y)
@@ -156,7 +142,7 @@ void CLIP_OT_add_marker(wmOperatorType *ot)
/* api callbacks */
ot->invoke = add_marker_invoke;
ot->exec = add_marker_exec;
- ot->poll = space_clip_frame_poll;
+ ot->poll = ED_space_clip_tracking_size_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -201,7 +187,7 @@ void CLIP_OT_delete_track(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_operator_confirm;
ot->exec = delete_track_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -252,7 +238,7 @@ void CLIP_OT_delete_marker(wmOperatorType *ot)
/* api callbacks */
ot->invoke = WM_operator_confirm;
ot->exec = delete_marker_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -526,7 +512,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
SlideMarkerData *data = (SlideMarkerData *)op->customdata;
float dx, dy, mdelta[2];
- switch(event->type) {
+ switch (event->type) {
case LEFTCTRLKEY:
case RIGHTCTRLKEY:
case LEFTSHIFTKEY:
@@ -643,7 +629,7 @@ void CLIP_OT_slide_marker(wmOperatorType *ot)
ot->idname = "CLIP_OT_slide_marker";
/* api callbacks */
- ot->poll = space_clip_frame_poll;
+ ot->poll = ED_space_clip_tracking_size_poll;
ot->invoke = slide_marker_invoke;
ot->modal = slide_marker_modal;
@@ -857,7 +843,7 @@ void CLIP_OT_select(wmOperatorType *ot)
/* api callbacks */
ot->exec = select_exec;
ot->invoke = select_invoke;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_UNDO;
@@ -934,7 +920,7 @@ void CLIP_OT_select_border(wmOperatorType *ot)
ot->invoke = WM_border_select_invoke;
ot->exec = border_select_exec;
ot->modal = WM_border_select_modal;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_UNDO;
@@ -1018,7 +1004,7 @@ void CLIP_OT_select_circle(wmOperatorType *ot)
ot->invoke = WM_gesture_circle_invoke;
ot->modal = WM_gesture_circle_modal;
ot->exec = circle_select_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1109,7 +1095,7 @@ void CLIP_OT_select_all(wmOperatorType *ot)
/* api callbacks */
ot->exec = select_all_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1200,7 +1186,7 @@ void CLIP_OT_select_grouped(wmOperatorType *ot)
/* api callbacks */
ot->exec = select_groped_exec;
- ot->poll = space_clip_frame_poll;
+ ot->poll = ED_space_clip_tracking_size_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1577,7 +1563,7 @@ void CLIP_OT_track_markers(wmOperatorType *ot)
/* api callbacks */
ot->exec = track_markers_exec;
ot->invoke = track_markers_invoke;
- ot->poll = space_clip_frame_poll;
+ ot->poll = ED_space_clip_tracking_frame_poll;
ot->modal = track_markers_modal;
/* flags */
@@ -1800,7 +1786,7 @@ void CLIP_OT_solve_camera(wmOperatorType *ot)
ot->exec = solve_camera_exec;
ot->invoke = solve_camera_invoke;
ot->modal = solve_camera_modal;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1848,7 +1834,7 @@ void CLIP_OT_clear_solution(wmOperatorType *ot)
/* api callbacks */
ot->exec = clear_solution_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1900,7 +1886,7 @@ void CLIP_OT_clear_track_path(wmOperatorType *ot)
/* api callbacks */
ot->exec = clear_track_path_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1958,7 +1944,7 @@ void CLIP_OT_disable_markers(wmOperatorType *ot)
/* api callbacks */
ot->exec = disable_markers_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2016,7 +2002,7 @@ static Object *get_orientation_object(bContext *C)
static int set_orientation_poll(bContext *C)
{
- if (space_clip_frame_poll(C)) {
+ if (ED_space_clip_tracking_size_poll(C)) {
Scene *scene = CTX_data_scene(C);
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip(sc);
@@ -2626,7 +2612,7 @@ void CLIP_OT_set_scale(wmOperatorType *ot)
static int set_solution_scale_poll(bContext *C)
{
- if (space_clip_frame_poll(C)) {
+ if (ED_space_clip_tracking_size_poll(C)) {
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip(sc);
MovieTracking *tracking = &clip->tracking;
@@ -2704,7 +2690,7 @@ void CLIP_OT_set_center_principal(wmOperatorType *ot)
/* api callbacks */
ot->exec = set_center_principal_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2758,7 +2744,7 @@ void CLIP_OT_hide_tracks(wmOperatorType *ot)
/* api callbacks */
ot->exec = hide_tracks_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2797,7 +2783,7 @@ void CLIP_OT_hide_tracks_clear(wmOperatorType *ot)
/* api callbacks */
ot->exec = hide_tracks_clear_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2879,7 +2865,7 @@ void CLIP_OT_detect_features(wmOperatorType *ot)
/* api callbacks */
ot->exec = detect_features_exec;
- ot->poll = space_clip_frame_poll;
+ ot->poll = ED_space_clip_tracking_frame_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2974,7 +2960,7 @@ void CLIP_OT_frame_jump(wmOperatorType *ot)
/* api callbacks */
ot->exec = frame_jump_exec;
- ot->poll = space_clip_frame_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3031,7 +3017,7 @@ void CLIP_OT_join_tracks(wmOperatorType *ot)
/* api callbacks */
ot->exec = join_tracks_exec;
- ot->poll = space_clip_frame_poll;
+ ot->poll = ED_space_clip_tracking_size_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3081,7 +3067,7 @@ void CLIP_OT_lock_tracks(wmOperatorType *ot)
/* api callbacks */
ot->exec = lock_tracks_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3131,7 +3117,7 @@ void CLIP_OT_track_copy_color(wmOperatorType *ot)
/* api callbacks */
ot->exec = track_copy_color_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3180,7 +3166,7 @@ void CLIP_OT_stabilize_2d_add(wmOperatorType *ot)
/* api callbacks */
ot->exec = stabilize_2d_add_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3240,7 +3226,7 @@ void CLIP_OT_stabilize_2d_remove(wmOperatorType *ot)
/* api callbacks */
ot->exec = stabilize_2d_remove_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3283,7 +3269,7 @@ void CLIP_OT_stabilize_2d_select(wmOperatorType *ot)
/* api callbacks */
ot->exec = stabilize_2d_select_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3320,7 +3306,7 @@ void CLIP_OT_stabilize_2d_set_rotation(wmOperatorType *ot)
/* api callbacks */
ot->exec = stabilize_2d_set_rotation_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3511,7 +3497,7 @@ void CLIP_OT_clean_tracks(wmOperatorType *ot)
/* api callbacks */
ot->exec = clean_tracks_exec;
ot->invoke = clean_tracks_invoke;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3548,7 +3534,7 @@ void CLIP_OT_tracking_object_new(wmOperatorType *ot)
/* api callbacks */
ot->exec = tracking_object_new_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3586,7 +3572,7 @@ void CLIP_OT_tracking_object_remove(wmOperatorType *ot)
/* api callbacks */
ot->exec = tracking_object_remove_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3617,7 +3603,7 @@ void CLIP_OT_copy_tracks(wmOperatorType *ot)
/* api callbacks */
ot->exec = copy_tracks_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = ED_space_clip_tracking_poll;
/* flags */
ot->flag = OPTYPE_REGISTER;
@@ -3627,7 +3613,7 @@ void CLIP_OT_copy_tracks(wmOperatorType *ot)
static int paste_tracks_poll(bContext *C)
{
- if (ED_space_clip_poll(C)) {
+ if (ED_space_clip_tracking_poll(C)) {
return BKE_tracking_clipboard_has_tracks();
}
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 193fa2d2c65..10db1bb1f12 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -82,7 +82,7 @@ enum {
static void do_file_buttons(bContext *C, void *UNUSED(arg), int event)
{
- switch(event) {
+ switch (event) {
case B_FS_FILENAME:
file_filename_exec(C, NULL);
break;
@@ -279,7 +279,7 @@ static int get_file_icon(struct direntry *file)
static void file_draw_icon(uiBlock *block, char *path, int sx, int sy, int icon, int width, int height)
{
uiBut *but;
- int x,y;
+ int x, y;
/*float alpha=1.0f;*/
x = sx;
@@ -301,7 +301,7 @@ static void file_draw_string(int sx, int sy, const char* string, float width, in
fs.align = align;
- BLI_strncpy(fname,string, FILE_MAXFILE);
+ BLI_strncpy(fname, string, FILE_MAXFILE);
file_shorten_string(fname, width + 1.0f, 0);
/* no text clipping needed, uiStyleFontDraw does it but is a bit too strict (for buttons it works) */
@@ -417,8 +417,7 @@ static void draw_background(FileLayout *layout, View2D *v2d)
int sy;
/* alternating flat shade background */
- for (i=0; (i <= layout->rows); i+=2)
- {
+ for (i=0; (i <= layout->rows); i+=2) {
sy = (int)v2d->cur.ymax - i*(layout->tile_h+2*layout->tile_border_y) - layout->tile_border_y;
UI_ThemeColorShade(TH_BACK, -7);
@@ -490,8 +489,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
align = ( FILE_IMGDISPLAY == params->display) ? UI_STYLE_TEXT_CENTER : UI_STYLE_TEXT_LEFT;
- for (i=offset; (i < numfiles) && (i<offset+numfiles_layout); ++i)
- {
+ for (i = offset; (i < numfiles) && (i<offset+numfiles_layout); i++) {
ED_fileselect_layout_tilepos(layout, i, &sx, &sy);
sx += (int)(v2d->tot.xmin+2.0f);
sy = (int)(v2d->tot.ymax - sy);
@@ -514,7 +512,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
is_icon = 0;
imb = filelist_getimage(files, i);
if (!imb) {
- imb = filelist_geticon(files,i);
+ imb = filelist_geticon(files, i);
is_icon = 1;
}
@@ -528,8 +526,8 @@ void file_draw_list(const bContext *C, ARegion *ar)
UI_ThemeColor4(TH_TEXT);
if (file->selflag & EDITING_FILE) {
- uiBut *but = uiDefBut(block, TEX, 1, "", sx , sy-layout->tile_h-3,
- textwidth, textheight, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit),0,0,"");
+ uiBut *but = uiDefBut(block, TEX, 1, "", sx, sy-layout->tile_h-3,
+ textwidth, textheight, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit), 0, 0, "");
uiButSetRenameFunc(but, renamebutton_cb, file);
uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */
uiButClearFlag(but, UI_BUT_UNDO);
@@ -564,14 +562,14 @@ void file_draw_list(const bContext *C, ARegion *ar)
file_draw_string(sx, sy, file->mode3, layout->column_widths[COLUMN_MODE3], layout->tile_h, align);
sx += layout->column_widths[COLUMN_MODE3] + 12;
- file_draw_string(sx, sy, file->owner, layout->column_widths[COLUMN_OWNER] , layout->tile_h, align);
+ file_draw_string(sx, sy, file->owner, layout->column_widths[COLUMN_OWNER], layout->tile_h, align);
sx += layout->column_widths[COLUMN_OWNER] + 12;
#endif
file_draw_string(sx, sy, file->date, layout->column_widths[COLUMN_DATE], layout->tile_h, align);
sx += (int)layout->column_widths[COLUMN_DATE] + 12;
- file_draw_string(sx, sy, file->time, layout->column_widths[COLUMN_TIME] , layout->tile_h, align);
+ file_draw_string(sx, sy, file->time, layout->column_widths[COLUMN_TIME], layout->tile_h, align);
sx += (int)layout->column_widths[COLUMN_TIME] + 12;
if (!(file->type & S_IFDIR)) {
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h
index 9455f6390f7..d3598ffd4e7 100644
--- a/source/blender/editors/space_file/file_intern.h
+++ b/source/blender/editors/space_file/file_intern.h
@@ -88,7 +88,7 @@ int file_previous_exec(bContext *C, struct wmOperator *unused);
int file_next_exec(bContext *C, struct wmOperator *unused);
int file_filename_exec(bContext *C, struct wmOperator *unused);
int file_directory_exec(bContext *C, struct wmOperator *unused);
-int file_directory_new_exec(bContext *C,struct wmOperator *unused);
+int file_directory_new_exec(bContext *C, struct wmOperator *unused);
int file_delete_exec(bContext *C, struct wmOperator *unused);
int file_hilight_set(struct SpaceFile *sfile, struct ARegion *ar, int mx, int my);
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 7d1981a5a3b..f340c53f528 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -73,7 +73,7 @@
static FileSelection find_file_mouse_rect(SpaceFile *sfile, struct ARegion* ar, const rcti* rect)
{
FileSelection sel;
- float fxmin,fymin,fxmax, fymax;
+ float fxmin, fymin, fxmax, fymax;
View2D* v2d = &ar->v2d;
rcti rect_view;
@@ -911,8 +911,7 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
numfiles = filelist_numfiles(sfile->files);
/* check if we are editing a name */
- for (i=0; i < numfiles; ++i)
- {
+ for (i=0; i < numfiles; ++i) {
if (filelist_is_selected(sfile->files, i, CHECK_ALL) ) {
edit_idx=i;
break;
@@ -1036,7 +1035,7 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
SpaceFile *sfile= CTX_wm_space_file(C);
if (!sfile->params) {
- BKE_report(op->reports,RPT_WARNING, "No parent directory given");
+ BKE_report(op->reports, RPT_WARNING, "No parent directory given");
return OPERATOR_CANCELLED;
}
@@ -1050,7 +1049,7 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
if (generate_name) {
/* create a new, non-existing folder name */
if (!new_folder_path(sfile->params->dir, path, name)) {
- BKE_report(op->reports,RPT_ERROR, "Couldn't create new folder name");
+ BKE_report(op->reports, RPT_ERROR, "Couldn't create new folder name");
return OPERATOR_CANCELLED;
}
}
@@ -1059,7 +1058,7 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
BLI_dir_create_recursive(path);
if (!BLI_exists(path)) {
- BKE_report(op->reports,RPT_ERROR, "Couldn't create new folder");
+ BKE_report(op->reports, RPT_ERROR, "Couldn't create new folder");
return OPERATOR_CANCELLED;
}
@@ -1331,7 +1330,7 @@ void FILE_OT_filenum(struct wmOperatorType *ot)
ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
/* props */
- RNA_def_int(ot->srna, "increment", 1, -100, 100, "Increment", "", -100,100);
+ RNA_def_int(ot->srna, "increment", 1, -100, 100, "Increment", "", -100, 100);
}
static int file_rename_exec(bContext *C, wmOperator *UNUSED(op))
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index 596721bff07..9fe1940e87b 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -116,7 +116,7 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat
BLI_strncpy(dir, entry, FILE_MAX);
/* create list item */
- but = uiDefIconTextButS(block, LISTROW, 0, icon, dir, 0,0,UI_UNIT_X*10,UI_UNIT_Y, nr, 0, i, 0, 0, entry);
+ but = uiDefIconTextButS(block, LISTROW, 0, icon, dir, 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, nr, 0, i, 0, 0, entry);
uiButSetFunc(but, file_panel_cb, entry, NULL);
uiButSetFlag(but, UI_ICON_LEFT|UI_TEXT_LEFT);
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 45a271cc7e9..107acbf49b1 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -179,7 +179,7 @@ static int compare_name(const void *a1, const void *a2)
if ( strcmp(entry1->relname, "..")==0 ) return (-1);
if ( strcmp(entry2->relname, "..")==0 ) return (1);
- return (BLI_natstrcmp(entry1->relname,entry2->relname));
+ return (BLI_natstrcmp(entry1->relname, entry2->relname));
}
static int compare_date(const void *a1, const void *a2)
@@ -212,7 +212,7 @@ static int compare_date(const void *a1, const void *a2)
if ( entry1->s.st_mtime < entry2->s.st_mtime) return 1;
if ( entry1->s.st_mtime > entry2->s.st_mtime) return -1;
- else return BLI_natstrcmp(entry1->relname,entry2->relname);
+ else return BLI_natstrcmp(entry1->relname, entry2->relname);
}
static int compare_size(const void *a1, const void *a2)
@@ -244,7 +244,7 @@ static int compare_size(const void *a1, const void *a2)
if ( entry1->s.st_size < entry2->s.st_size) return 1;
if ( entry1->s.st_size > entry2->s.st_size) return -1;
- else return BLI_natstrcmp(entry1->relname,entry2->relname);
+ else return BLI_natstrcmp(entry1->relname, entry2->relname);
}
static int compare_extension(const void *a1, const void *a2)
@@ -419,7 +419,7 @@ void filelist_free_icons(void)
//-----------------FOLDERLIST (previous/next) --------------//
struct ListBase* folderlist_new(void)
{
- ListBase* p = MEM_callocN( sizeof(ListBase), "folderlist" );
+ ListBase* p = MEM_callocN(sizeof(ListBase), "folderlist" );
return p;
}
@@ -456,7 +456,7 @@ void folderlist_pushdir(ListBase* folderlist, const char *dir)
}
// create next folder element
- folder = (FolderList*)MEM_mallocN(sizeof(FolderList),"FolderList");
+ folder = (FolderList*)MEM_mallocN(sizeof(FolderList), "FolderList");
folder->foldername = (char*)MEM_mallocN(sizeof(char)*(strlen(dir)+1), "foldername");
folder->foldername[0] = '\0';
@@ -519,8 +519,8 @@ static void filelist_read_dir(struct FileList* filelist);
//------------------FILELIST------------------------//
struct FileList* filelist_new(short type)
{
- FileList* p = MEM_callocN( sizeof(FileList), "filelist" );
- switch(type) {
+ FileList* p = MEM_callocN(sizeof(FileList), "filelist" );
+ switch (type) {
case FILE_MAIN:
p->readf = filelist_read_main;
p->filterf = is_filtered_main;
@@ -982,7 +982,7 @@ int filelist_is_selected(struct FileList* filelist, int index, FileCheckType che
void filelist_sort(struct FileList* filelist, short sort)
{
- switch(sort) {
+ switch (sort) {
case FILE_SORT_ALPHA:
qsort(filelist->filelist, filelist->numfiles, sizeof(struct direntry), compare_name);
break;
@@ -1144,7 +1144,7 @@ void filelist_from_main(struct FileList *filelist)
filelist->filelist= (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry));
for (a=0; a<filelist->numfiles; a++) {
- memset( &(filelist->filelist[a]), 0 , sizeof(struct direntry));
+ memset(&(filelist->filelist[a]), 0, sizeof(struct direntry));
filelist->filelist[a].type |= S_IFDIR;
}
@@ -1198,7 +1198,7 @@ void filelist_from_main(struct FileList *filelist)
files = filelist->filelist;
if (!filelist->hide_parent) {
- memset( &(filelist->filelist[0]), 0 , sizeof(struct direntry));
+ memset(&(filelist->filelist[0]), 0, sizeof(struct direntry));
filelist->filelist[0].relname= BLI_strdup("..");
filelist->filelist[0].type |= S_IFDIR;
@@ -1212,7 +1212,7 @@ void filelist_from_main(struct FileList *filelist)
ok = 1;
if (ok) {
if (!filelist->hide_dot || id->name[2] != '.') {
- memset( files, 0 , sizeof(struct direntry));
+ memset(files, 0, sizeof(struct direntry));
if (id->lib==NULL)
files->relname= BLI_strdup(id->name+2);
else {
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 31695ddd776..b17ca5ee319 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -447,8 +447,7 @@ static void column_widths(struct FileList* files, struct FileLayout* layout)
layout->column_widths[i] = 0;
}
- for (i=0; (i < numfiles); ++i)
- {
+ for (i=0; (i < numfiles); ++i) {
struct direntry* file = filelist_file(files, i);
if (file) {
float len;
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index 48449ac8870..0c94bff8803 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -99,7 +99,7 @@ static FSMenuEntry *fsmenu_get_category(struct FSMenu* fsmenu, FSMenuCategory ca
{
FSMenuEntry *fsms = NULL;
- switch(category) {
+ switch (category) {
case FS_CATEGORY_SYSTEM:
fsms = fsmenu->fsmenu_system;
break;
@@ -115,7 +115,7 @@ static FSMenuEntry *fsmenu_get_category(struct FSMenu* fsmenu, FSMenuCategory ca
static void fsmenu_set_category(struct FSMenu* fsmenu, FSMenuCategory category, FSMenuEntry *fsms)
{
- switch(category) {
+ switch (category) {
case FS_CATEGORY_SYSTEM:
fsmenu->fsmenu_system = fsms;
break;
@@ -268,8 +268,7 @@ void fsmenu_read_bookmarks(struct FSMenu* fsmenu, const char *filename)
fp = BLI_fopen(filename, "r");
if (!fp) return;
- while ( fgets ( line, 256, fp ) != NULL ) /* read a line */
- {
+ while ( fgets ( line, 256, fp ) != NULL ) { /* read a line */
if (strncmp(line, "[Bookmarks]", 11)==0) {
category = FS_CATEGORY_BOOKMARKS;
}
@@ -316,7 +315,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
/* Adding Desktop and My Documents */
SHGetSpecialFolderPath(0, line, CSIDL_PERSONAL, 0);
- fsmenu_insert_entry(fsmenu,FS_CATEGORY_BOOKMARKS, line, 1, 0);
+ fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, 1, 0);
SHGetSpecialFolderPath(0, line, CSIDL_DESKTOPDIRECTORY, 0);
fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, 1, 0);
}
@@ -329,8 +328,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
const char *home;
/* loop through all the OS X Volumes, and add them to the SYSTEM section */
- for (i=1; err!=nsvErr; i++)
- {
+ for (i = 1; err != nsvErr; i++) {
FSRef dir;
unsigned char path[FILE_MAX];
@@ -389,8 +387,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
pathesArray = LSSharedFileListCopySnapshot(list, &seed);
pathesCount = CFArrayGetCount(pathesArray);
- for (i=0; i<pathesCount; i++)
- {
+ for (i=0; i<pathesCount; i++) {
itemRef = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(pathesArray, i);
err = LSSharedFileListItemResolve(itemRef,
@@ -402,7 +399,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
pathString = CFURLCopyFileSystemPath(cfURL, kCFURLPOSIXPathStyle);
- if (!CFStringGetCString(pathString,line,256,kCFStringEncodingASCII))
+ if (!CFStringGetCString(pathString, line, 256, kCFStringEncodingASCII))
continue;
fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, line, 1, 0);
@@ -415,8 +412,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
/* Then get network volumes */
err = noErr;
- for (i=1; err!=nsvErr; i++)
- {
+ for (i=1; err!=nsvErr; i++) {
FSRef dir;
FSVolumeRefNum volRefNum;
struct GetVolParmsInfoBuffer volParmsBuffer;
@@ -440,8 +436,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
pathesArray = LSSharedFileListCopySnapshot(list, &seed);
pathesCount = CFArrayGetCount(pathesArray);
- for (i=0; i<pathesCount; i++)
- {
+ for (i=0; i<pathesCount; i++) {
itemRef = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(pathesArray, i);
err = LSSharedFileListItemResolve(itemRef,
@@ -453,7 +448,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
pathString = CFURLCopyFileSystemPath(cfURL, kCFURLPOSIXPathStyle);
- if (!CFStringGetCString(pathString,line,256,kCFStringEncodingASCII))
+ if (!CFStringGetCString(pathString, line, 256, kCFStringEncodingASCII))
continue;
fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, 1, 0);
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 0cf15c22efa..dac5d1e1347 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -218,7 +218,7 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
}
else {
if (params->display == FILE_IMGDISPLAY) {
- if (!thumbnails_running(sfile->files,C)) {
+ if (!thumbnails_running(sfile->files, C)) {
thumbnails_start(sfile->files, C);
}
}
@@ -251,7 +251,7 @@ static void file_listener(ScrArea *sa, wmNotifier *wmn)
/* SpaceFile* sfile = (SpaceFile*)sa->spacedata.first; */
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SPACE:
switch (wmn->data) {
case ND_SPACE_FILE_LIST:
@@ -287,7 +287,7 @@ static void file_main_area_init(wmWindowManager *wm, ARegion *ar)
static void file_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SPACE:
switch (wmn->data) {
case ND_SPACE_FILE_LIST:
@@ -432,12 +432,12 @@ static void file_keymap(struct wmKeyConfig *keyconf)
RNA_int_set(kmi->ptr, "increment", 10);
kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
RNA_int_set(kmi->ptr, "increment", 100);
- kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, 0,0);
+ kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, 0, 0);
RNA_int_set(kmi->ptr, "increment", -1);
kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, KM_SHIFT, 0);
RNA_int_set(kmi->ptr, "increment", -10);
kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, KM_CTRL, 0);
- RNA_int_set(kmi->ptr, "increment",-100);
+ RNA_int_set(kmi->ptr, "increment", -100);
/* keys for button area (top) */
@@ -450,10 +450,10 @@ static void file_keymap(struct wmKeyConfig *keyconf)
RNA_int_set(kmi->ptr, "increment", 100);
kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, 0, 0);
RNA_int_set(kmi->ptr, "increment", -1);
- kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, KM_SHIFT,0);
+ kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, KM_SHIFT, 0);
RNA_int_set(kmi->ptr, "increment", -10);
- kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, KM_CTRL,0);
- RNA_int_set(kmi->ptr, "increment",-100);
+ kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADMINUS, KM_PRESS, KM_CTRL, 0);
+ RNA_int_set(kmi->ptr, "increment", -100);
}
@@ -476,7 +476,7 @@ static void file_channel_area_draw(const bContext *C, ARegion *ar)
static void file_channel_area_listener(ARegion *UNUSED(ar), wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
}
}
@@ -536,7 +536,7 @@ static void file_ui_area_draw(const bContext *C, ARegion *ar)
static void file_ui_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SPACE:
switch (wmn->data) {
case ND_SPACE_FILE_LIST:
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 4d2fe2cd568..8bc2eda7e33 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -85,7 +85,7 @@ static void do_graph_region_buttons(bContext *UNUSED(C), void *UNUSED(arg), int
{
//Scene *scene= CTX_data_scene(C);
- switch(event) {
+ switch (event) {
}
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index fc84cfc46a2..e772e2856c1 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -532,7 +532,7 @@ static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2
glBegin(GL_LINE_STRIP);
for (ctime= stime; ctime <= etime; ctime += samplefreq)
- glVertex2f( ctime, evaluate_fcurve(fcu, ctime)*unitFac );
+ glVertex2f(ctime, evaluate_fcurve(fcu, ctime) * unitFac);
glEnd();
@@ -720,8 +720,8 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View
correct_bezpart(v1, v2, v3, v4);
- forward_diff_bezier(v1[0], v2[0], v3[0], v4[0], data, resol, sizeof(float)*3);
- forward_diff_bezier(v1[1], v2[1], v3[1], v4[1], data+1, resol, sizeof(float)*3);
+ BKE_curve_forward_diff_bezier(v1[0], v2[0], v3[0], v4[0], data, resol, sizeof(float)*3);
+ BKE_curve_forward_diff_bezier(v1[1], v2[1], v3[1], v4[1], data+1, resol, sizeof(float)*3);
for (fp= data; resol; resol--, fp+= 3)
glVertex2fv(fp);
@@ -777,7 +777,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View
/* Draw the 'ghost' F-Curves (i.e. snapshots of the curve)
* NOTE: unit mapping has already been applied to the values, so do not try and apply again
*/
-void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
+void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
{
FCurve *fcu;
@@ -812,7 +812,7 @@ void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
/* This is called twice from space_graph.c -> graph_main_area_draw()
* Unselected then selected F-Curves are drawn so that they do not occlude each other.
*/
-void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid *grid, short sel)
+void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid *grid, short sel)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 76a2c926522..5f8281fda5b 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -83,7 +83,7 @@
/* Get the min/max keyframes*/
/* note: it should return total boundbox, filter for selection only can be argument... */
-void get_graph_keyframe_extents (bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax, const short selOnly)
+void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax, const short selOnly)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -181,7 +181,7 @@ static int graphkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_previewrange_set (wmOperatorType *ot)
+void GRAPH_OT_previewrange_set(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Auto-Set Preview Range";
@@ -243,7 +243,7 @@ static int graphkeys_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
return graphkeys_viewall(C, TRUE);
}
-void GRAPH_OT_view_all (wmOperatorType *ot)
+void GRAPH_OT_view_all(wmOperatorType *ot)
{
/* identifiers */
ot->name = "View All";
@@ -258,7 +258,7 @@ void GRAPH_OT_view_all (wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-void GRAPH_OT_view_selected (wmOperatorType *ot)
+void GRAPH_OT_view_selected(wmOperatorType *ot)
{
/* identifiers */
ot->name = "View Selected";
@@ -373,7 +373,7 @@ static int graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_ghost_curves_create (wmOperatorType *ot)
+void GRAPH_OT_ghost_curves_create(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Create Ghost Curves";
@@ -416,7 +416,7 @@ static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_ghost_curves_clear (wmOperatorType *ot)
+void GRAPH_OT_ghost_curves_clear(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear Ghost Curves";
@@ -511,7 +511,7 @@ static int graphkeys_insertkey_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_keyframe_insert (wmOperatorType *ot)
+void GRAPH_OT_keyframe_insert(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Insert Keyframes";
@@ -618,7 +618,7 @@ static int graphkeys_click_insert_invoke (bContext *C, wmOperator *op, wmEvent *
return graphkeys_click_insert_exec(C, op);
}
-void GRAPH_OT_click_insert (wmOperatorType *ot)
+void GRAPH_OT_click_insert(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Click-Insert Keyframes";
@@ -701,7 +701,7 @@ static int graphkeys_copy_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_copy (wmOperatorType *ot)
+void GRAPH_OT_copy(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Copy Keyframes";
@@ -746,7 +746,7 @@ static int graphkeys_paste_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_paste (wmOperatorType *ot)
+void GRAPH_OT_paste(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Paste Keyframes";
@@ -815,7 +815,7 @@ static int graphkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
return OPERATOR_FINISHED;
}
-void GRAPH_OT_duplicate (wmOperatorType *ot)
+void GRAPH_OT_duplicate(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Duplicate Keyframes";
@@ -885,7 +885,7 @@ static int graphkeys_delete_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_delete (wmOperatorType *ot)
+void GRAPH_OT_delete(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Keyframes";
@@ -947,7 +947,7 @@ static int graphkeys_clean_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_clean (wmOperatorType *ot)
+void GRAPH_OT_clean(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clean Keyframes";
@@ -1030,7 +1030,7 @@ static int graphkeys_bake_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_bake (wmOperatorType *ot)
+void GRAPH_OT_bake(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Bake Curve";
@@ -1174,7 +1174,7 @@ static int graphkeys_sound_bake_invoke (bContext *C, wmOperator *op, wmEvent *ev
return WM_operator_filesel(C, op, event);
}
-void GRAPH_OT_sound_bake (wmOperatorType *ot)
+void GRAPH_OT_sound_bake(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Bake Sound to F-Curves";
@@ -1248,7 +1248,7 @@ static int graphkeys_sample_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_sample (wmOperatorType *ot)
+void GRAPH_OT_sample(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Sample Keyframes";
@@ -1357,7 +1357,7 @@ static int graphkeys_expo_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_extrapolation_type (wmOperatorType *ot)
+void GRAPH_OT_extrapolation_type(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Keyframe Extrapolation";
@@ -1426,7 +1426,7 @@ static int graphkeys_ipo_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_interpolation_type (wmOperatorType *ot)
+void GRAPH_OT_interpolation_type(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Set Keyframe Interpolation";
@@ -1697,7 +1697,7 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
}
}
-void GRAPH_OT_euler_filter (wmOperatorType *ot)
+void GRAPH_OT_euler_filter(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Euler Discontinuity Filter";
@@ -1771,7 +1771,7 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_frame_jump (wmOperatorType *ot)
+void GRAPH_OT_frame_jump(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Jump to Frame";
@@ -1875,7 +1875,7 @@ static int graphkeys_snap_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_snap (wmOperatorType *ot)
+void GRAPH_OT_snap(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Snap Keys";
@@ -1993,7 +1993,7 @@ static int graphkeys_mirror_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_mirror (wmOperatorType *ot)
+void GRAPH_OT_mirror(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Mirror Keys";
@@ -2048,7 +2048,7 @@ static int graphkeys_smooth_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_smooth (wmOperatorType *ot)
+void GRAPH_OT_smooth(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Smooth Keys";
@@ -2152,7 +2152,7 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_fmodifier_add (wmOperatorType *ot)
+void GRAPH_OT_fmodifier_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add F-Curve Modifier";
@@ -2210,7 +2210,7 @@ static int graph_fmodifier_copy_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_fmodifier_copy (wmOperatorType *ot)
+void GRAPH_OT_fmodifier_copy(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Copy F-Modifiers";
@@ -2272,7 +2272,7 @@ static int graph_fmodifier_paste_exec(bContext *C, wmOperator *op)
}
}
-void GRAPH_OT_fmodifier_paste (wmOperatorType *ot)
+void GRAPH_OT_fmodifier_paste(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Paste F-Modifiers";
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 864708a873a..7c72fa0834d 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -166,7 +166,7 @@ static int graphkeys_deselectall_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_select_all_toggle (wmOperatorType *ot)
+void GRAPH_OT_select_all_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select All";
@@ -535,7 +535,7 @@ static int graphkeys_columnselect_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void GRAPH_OT_select_column (wmOperatorType *ot)
+void GRAPH_OT_select_column(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select All";
@@ -593,7 +593,7 @@ static int graphkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_select_linked (wmOperatorType *ot)
+void GRAPH_OT_select_linked(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Linked";
@@ -671,7 +671,7 @@ static int graphkeys_select_more_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_select_more (wmOperatorType *ot)
+void GRAPH_OT_select_more(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select More";
@@ -705,7 +705,7 @@ static int graphkeys_select_less_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GRAPH_OT_select_less (wmOperatorType *ot)
+void GRAPH_OT_select_less(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Less";
@@ -846,7 +846,7 @@ static int graphkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEve
return graphkeys_select_leftright_exec(C, op);
}
-void GRAPH_OT_select_leftright (wmOperatorType *ot)
+void GRAPH_OT_select_leftright(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Left/Right";
@@ -1331,7 +1331,7 @@ static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *ev
return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
}
-void GRAPH_OT_clickselect (wmOperatorType *ot)
+void GRAPH_OT_clickselect(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Mouse Select Keys";
diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c
index 8c2afe8a242..46c886b7d3c 100644
--- a/source/blender/editors/space_graph/graph_utils.c
+++ b/source/blender/editors/space_graph/graph_utils.c
@@ -92,7 +92,7 @@ bAnimListElem *get_active_fcurve_channel (bAnimContext *ac)
/* Operator Polling Callbacks */
/* Check if there are any visible keyframes (for selection tools) */
-int graphop_visible_keyframes_poll (bContext *C)
+int graphop_visible_keyframes_poll(bContext *C)
{
bAnimContext ac;
bAnimListElem *ale;
@@ -141,7 +141,7 @@ int graphop_visible_keyframes_poll (bContext *C)
}
/* Check if there are any visible + editable keyframes (for editing tools) */
-int graphop_editable_keyframes_poll (bContext *C)
+int graphop_editable_keyframes_poll(bContext *C)
{
bAnimContext ac;
bAnimListElem *ale;
@@ -191,7 +191,7 @@ int graphop_editable_keyframes_poll (bContext *C)
}
/* has active F-Curve that's editable */
-int graphop_active_fcurve_poll (bContext *C)
+int graphop_active_fcurve_poll(bContext *C)
{
bAnimContext ac;
bAnimListElem *ale;
@@ -226,7 +226,7 @@ int graphop_active_fcurve_poll (bContext *C)
}
/* has selected F-Curve that's editable */
-int graphop_selected_fcurve_poll (bContext *C)
+int graphop_selected_fcurve_poll(bContext *C)
{
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 37cdbd4963a..1b60a0a39ac 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -374,12 +374,12 @@ static void graph_buttons_area_draw(const bContext *C, ARegion *ar)
static void graph_region_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_ANIMATION:
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_RENDER_OPTIONS:
case ND_OB_ACTIVE:
case ND_FRAME:
@@ -393,7 +393,7 @@ static void graph_region_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_OBJECT:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_KEYS:
@@ -406,7 +406,7 @@ static void graph_region_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_NODE:
- switch(wmn->action) {
+ switch (wmn->action) {
case NA_EDITED:
case NA_SELECTED:
ED_region_tag_redraw(ar);
@@ -516,6 +516,7 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
if (sipo->flag & SIPO_TEMP_NEEDCHANSYNC) {
ANIM_sync_animchannels_to_data(C);
sipo->flag &= ~SIPO_TEMP_NEEDCHANSYNC;
+ ED_area_tag_redraw(sa);
}
/* init/adjust F-Curve colors */
@@ -551,21 +552,21 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
* TODO: find a way to module the hue so that not all curves have same color...
*/
float *col= fcu->color;
-
- switch(fcu->array_index) {
- case 0:
- col[0]= 1.0f; col[1]= 0.0f; col[2]= 0.0f;
- break;
- case 1:
- col[0]= 0.0f; col[1]= 1.0f; col[2]= 0.0f;
- break;
- case 2:
- col[0]= 0.0f; col[1]= 0.0f; col[2]= 1.0f;
- break;
- default:
- /* 'unknown' color - bluish so as to not conflict with handles */
- col[0]= 0.3f; col[1]= 0.8f; col[2]= 1.0f;
- break;
+
+ switch (fcu->array_index) {
+ case 0:
+ col[0] = 1.0f; col[1] = 0.0f; col[2] = 0.0f;
+ break;
+ case 1:
+ col[0] = 0.0f; col[1] = 1.0f; col[2] = 0.0f;
+ break;
+ case 2:
+ col[0] = 0.0f; col[1] = 0.0f; col[2] = 1.0f;
+ break;
+ default:
+ /* 'unknown' color - bluish so as to not conflict with handles */
+ col[0] = 0.3f; col[1] = 0.8f; col[2] = 1.0f;
+ break;
}
}
break;
@@ -596,55 +597,55 @@ void ED_spacetype_ipo(void)
st->spaceid= SPACE_IPO;
strncpy(st->name, "Graph", BKE_ST_MAXNAME);
- st->new= graph_new;
- st->free= graph_free;
- st->init= graph_init;
- st->duplicate= graph_duplicate;
- st->operatortypes= graphedit_operatortypes;
- st->keymap= graphedit_keymap;
- st->listener= graph_listener;
- st->refresh= graph_refresh;
+ st->new = graph_new;
+ st->free = graph_free;
+ st->init = graph_init;
+ st->duplicate = graph_duplicate;
+ st->operatortypes = graphedit_operatortypes;
+ st->keymap = graphedit_keymap;
+ st->listener = graph_listener;
+ st->refresh = graph_refresh;
/* regions: main window */
- art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_WINDOW;
- art->init= graph_main_area_init;
- art->draw= graph_main_area_draw;
- art->listener= graph_region_listener;
- art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_ANIMATION|ED_KEYMAP_FRAMES;
+ art->init = graph_main_area_init;
+ art->draw = graph_main_area_draw;
+ art->listener = graph_region_listener;
+ art->keymapflag = ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_ANIMATION|ED_KEYMAP_FRAMES;
BLI_addhead(&st->regiontypes, art);
/* regions: header */
- art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_HEADER;
- art->prefsizey= HEADERY;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
- art->listener= graph_region_listener;
- art->init= graph_header_area_init;
- art->draw= graph_header_area_draw;
+ art->prefsizey = HEADERY;
+ art->keymapflag = ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
+ art->listener = graph_region_listener;
+ art->init = graph_header_area_init;
+ art->draw = graph_header_area_draw;
BLI_addhead(&st->regiontypes, art);
/* regions: channels */
- art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_CHANNELS;
- art->prefsizex= 200+V2D_SCROLL_WIDTH; /* 200 is the 'standard', but due to scrollers, we want a bit more to fit the lock icons in */
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
- art->listener= graph_region_listener;
- art->init= graph_channel_area_init;
- art->draw= graph_channel_area_draw;
+ art->prefsizex = 200 + V2D_SCROLL_WIDTH; /* 200 is the 'standard', but due to scrollers, we want a bit more to fit the lock icons in */
+ art->keymapflag = ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
+ art->listener = graph_region_listener;
+ art->init = graph_channel_area_init;
+ art->draw = graph_channel_area_draw;
BLI_addhead(&st->regiontypes, art);
/* regions: UI buttons */
- art= MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
art->regionid = RGN_TYPE_UI;
- art->prefsizex= 200;
- art->keymapflag= ED_KEYMAP_UI;
- art->listener= graph_region_listener;
- art->init= graph_buttons_area_init;
- art->draw= graph_buttons_area_draw;
+ art->prefsizex = 200;
+ art->keymapflag = ED_KEYMAP_UI;
+ art->listener = graph_region_listener;
+ art->init = graph_buttons_area_init;
+ art->draw = graph_buttons_area_draw;
BLI_addhead(&st->regiontypes, art);
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 29bd5f5117d..793e5712c8c 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -334,65 +334,6 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
/* image drawing */
-static void draw_image_grid(ARegion *ar, float zoomx, float zoomy)
-{
- float gridsize, gridstep = 1.0f / 32.0f;
- float fac, blendfac;
- int x1, y1, x2, y2;
-
- /* the image is located inside (0,0),(1, 1) as set by view2d */
- UI_ThemeColorShade(TH_BACK, 20);
-
- UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x1, &y1);
- UI_view2d_to_region_no_clip(&ar->v2d, 1.0f, 1.0f, &x2, &y2);
- glRectf(x1, y1, x2, y2);
-
- /* gridsize adapted to zoom level */
- gridsize = 0.5f * (zoomx + zoomy);
- if (gridsize <= 0.0f) return;
-
- if (gridsize < 1.0f) {
- while (gridsize < 1.0f) {
- gridsize *= 4.0f;
- gridstep *= 4.0f;
- }
- }
- else {
- while (gridsize >= 4.0f) {
- gridsize /= 4.0f;
- gridstep /= 4.0f;
- }
- }
-
- /* the fine resolution level */
- blendfac = 0.25f * gridsize - floorf(0.25f * gridsize);
- CLAMP(blendfac, 0.0f, 1.0f);
- UI_ThemeColorShade(TH_BACK, (int)(20.0f * (1.0f - blendfac)));
-
- fac = 0.0f;
- glBegin(GL_LINES);
- while (fac < 1.0f) {
- glVertex2f(x1, y1 * (1.0f - fac) + y2 * fac);
- glVertex2f(x2, y1 * (1.0f - fac) + y2 * fac);
- glVertex2f(x1 * (1.0f - fac) + x2 * fac, y1);
- glVertex2f(x1 * (1.0f - fac) + x2 * fac, y2);
- fac += gridstep;
- }
-
- /* the large resolution level */
- UI_ThemeColor(TH_BACK);
-
- fac = 0.0f;
- while (fac < 1.0f) {
- glVertex2f(x1, y1 * (1.0f - fac) + y2 * fac);
- glVertex2f(x2, y1 * (1.0f - fac) + y2 * fac);
- glVertex2f(x1 * (1.0f - fac) + x2 * fac, y1);
- glVertex2f(x1 * (1.0f - fac) + x2 * fac, y2);
- fac += 4.0f * gridstep;
- }
- glEnd();
-}
-
static void sima_draw_alpha_pixels(float x1, float y1, int rectx, int recty, unsigned int *recti)
{
@@ -781,7 +722,7 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
/* draw the image or grid */
if (ibuf == NULL)
- draw_image_grid(ar, zoomx, zoomy);
+ ED_region_grid_draw(ar, zoomx, zoomy);
else if (sima->flag & SI_DRAW_TILE)
draw_image_buffer_repeated(sima, ar, scene, ima, ibuf, zoomx, zoomy);
else if (ima && (ima->tpageflag & IMA_TILES))
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 2c688990a8f..d9f3ffafb14 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -190,13 +190,14 @@ int space_image_main_area_poll(bContext *C)
return 0;
}
-/* For IMAGE_OT_curves_point_set to avoid sampling when in uv smooth mode */
+/* For IMAGE_OT_curves_point_set to avoid sampling when in uv smooth mode or editmode */
int space_image_main_area_not_uv_brush_poll(bContext *C)
{
SpaceImage *sima = CTX_wm_space_image(C);
+ Scene *scene = CTX_data_scene(C);
+ ToolSettings *toolsettings = scene->toolsettings;
- ToolSettings *toolsettings = CTX_data_scene(C)->toolsettings;
- if (sima && !toolsettings->uvsculpt)
+ if (sima && !toolsettings->uvsculpt && !scene->obedit)
return 1;
return 0;
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 08aa69fe499..447028b8bef 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -205,7 +205,9 @@ void ED_image_aspect(Image *ima, float *aspx, float *aspy)
if ((ima == NULL) || (ima->type == IMA_TYPE_R_RESULT) || (ima->type == IMA_TYPE_COMPOSITE) ||
(ima->aspx == 0.0f || ima->aspy == 0.0f))
+ {
return;
+ }
/* x is always 1 */
*aspy = ima->aspy / ima->aspx;
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index 1c2f43f67a4..2ef8f6c306c 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -183,7 +183,7 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
BezTriple *bezt;
BPoint *bp;
int a;
- ListBase *nurbs = curve_editnurbs(cu);
+ ListBase *nurbs = BKE_curve_editNurbs_get(cu);
for (nu = nurbs->first; nu; nu = nu->next) {
if (nu->type == CU_BEZIER) {
diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c
index dcead6c01db..22df7432ecb 100644
--- a/source/blender/editors/space_logic/logic_buttons.c
+++ b/source/blender/editors/space_logic/logic_buttons.c
@@ -104,7 +104,7 @@ static int cut_links_exec(bContext *C, wmOperator *op)
float mcoords[256][2];
int i= 0;
- RNA_BEGIN(op->ptr, itemptr, "path") {
+ RNA_BEGIN (op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
@@ -119,8 +119,7 @@ static int cut_links_exec(bContext *C, wmOperator *op)
uiBlock *block;
uiLinkLine *line, *nline;
uiBut *but;
- for (block= ar->uiblocks.first; block; block= block->next)
- {
+ for (block= ar->uiblocks.first; block; block= block->next) {
but= block->buttons.first;
while (but) {
if (but->type==LINK && but->link) {
diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c
index cac4fe04765..1e976cebafd 100644
--- a/source/blender/editors/space_logic/logic_ops.c
+++ b/source/blender/editors/space_logic/logic_ops.c
@@ -198,7 +198,7 @@ static int edit_actuator_invoke_properties(bContext *C, wmOperator *op)
bActuator *act = ptr.data;
Object *ob = ptr.id.data;
- RNA_string_set(op->ptr, "actuator",act->name);
+ RNA_string_set(op->ptr, "actuator", act->name);
RNA_string_set(op->ptr, "object", ob->id.name+2);
return 1;
}
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index f7c69c80067..184357344e1 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -371,7 +371,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
ob= CTX_data_active_object(C);
if (ob==NULL) return;
- switch(event) {
+ switch (event) {
case B_SETPROP:
/* check for inconsistent types */
@@ -551,13 +551,10 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
didit= 0;
for (ob=bmain->object.first; ob; ob=ob->id.next) {
act= ob->actuators.first;
- while (act)
- {
- if (act->type==ACT_SOUND)
- {
+ while (act) {
+ if (act->type==ACT_SOUND) {
bSoundActuator *sa= act->data;
- if (sa->sndnr)
- {
+ if (sa->sndnr) {
ID *sound= bmain->sound.first;
int nr= 1;
@@ -567,8 +564,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
break;
}
- while (sound)
- {
+ while (sound) {
if (nr==sa->sndnr)
break;
nr++;
@@ -727,8 +723,7 @@ static const char *actuator_name(int type)
static const char *actuator_pup(Object *owner)
{
- switch (owner->type)
- {
+ switch (owner->type) {
case OB_ARMATURE:
return "Actuators %t|Action %x15|Armature %x23|Motion %x0|Constraint %x9|Ipo %x1"
"|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
@@ -914,7 +909,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf
if (*count==0) return NULL;
if (*count>24) *count= 24; /* temporal */
- idar= MEM_callocN( (*count)*sizeof(void *), "idar");
+ idar= MEM_callocN((*count)*sizeof(void *), "idar");
ob= bmain->object.first;
nr= 0;
@@ -945,7 +940,7 @@ static int get_col_sensor(int type)
{
/* XXX themecolors not here */
- switch(type) {
+ switch (type) {
case SENS_ALWAYS: return TH_PANEL;
case SENS_DELAY: return TH_PANEL;
case SENS_TOUCH: return TH_PANEL;
@@ -1161,8 +1156,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
set_col_sensor(sens->type, 0);
- switch (sens->type)
- {
+ switch (sens->type) {
case SENS_ALWAYS:
{
ysize= 24;
@@ -1187,9 +1181,9 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
ts= sens->data;
- // uiDefBut(block, TEX, 1, "Property:", xco,yco-22,width, 19, &ts->name, 0, MAX_NAME, 0, 0, "Only look for Objects with this property");
- uiDefIDPoinBut(block, test_matpoin_but, ID_MA, 1, "MA:",(short)(xco + 10),(short)(yco-44), (short)(width - 20), 19, &ts->ma, "Only look for floors with this Material");
- // uiDefButF(block, NUM, 1, "Margin:", xco+width/2,yco-44,width/2, 19, &ts->dist, 0.0, 10.0, 100, 0, "Extra margin (distance) for larger sensitivity");
+ // uiDefBut(block, TEX, 1, "Property:", xco, yco-22, width, 19, &ts->name, 0, MAX_NAME, 0, 0, "Only look for Objects with this property");
+ uiDefIDPoinBut(block, test_matpoin_but, ID_MA, 1, "MA:", (short)(xco + 10), (short)(yco-44), (short)(width - 20), 19, &ts->ma, "Only look for floors with this Material");
+ // uiDefButF(block, NUM, 1, "Margin:", xco+width/2, yco-44, width/2, 19, &ts->dist, 0.0, 10.0, 100, 0, "Extra margin (distance) for larger sensitivity");
yco-= ysize;
break;
}
@@ -1206,11 +1200,11 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
/* The collision sensor will become a generic collision (i.e. it */
/* absorb the old touch sensor). */
- uiDefButBitS(block, TOG, SENS_COLLISION_PULSE, B_REDR, "Pulse",(short)(xco + 10),(short)(yco - 44),
+ uiDefButBitS(block, TOG, SENS_COLLISION_PULSE, B_REDR, "Pulse", (short)(xco + 10), (short)(yco - 44),
(short)(0.20 * (width-20)), 19, &cs->mode, 0.0, 0.0, 0, 0,
"Changes to the set of colliding objects generated pulses");
- uiDefButBitS(block, TOG, SENS_COLLISION_MATERIAL, B_REDR, "M/P",(short)(xco + 10 + (0.20 * (width-20))),(short)(yco - 44),
+ uiDefButBitS(block, TOG, SENS_COLLISION_MATERIAL, B_REDR, "M/P", (short)(xco + 10 + (0.20 * (width-20))), (short)(yco - 44),
(short)(0.20 * (width-20)), 19, &cs->mode, 0.0, 0.0, 0, 0,
"Toggle collision on material or property");
@@ -1225,7 +1219,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
"Only look for Objects with this property");
}
- /* uiDefButS(block, NUM, 1, "Damp:", xco+10+width-90,yco-24, 70, 19, &cs->damp, 0, 250, 0, 0, "For 'damp' time don't detect another collision"); */
+ /* uiDefButS(block, NUM, 1, "Damp:", xco+10+width-90, yco-24, 70, 19, &cs->damp, 0, 250, 0, 0, "For 'damp' time don't detect another collision"); */
yco-= ysize;
break;
@@ -1240,11 +1234,11 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
draw_default_sensor_header(sens, block, xco, yco, width);
ns= sens->data;
- uiDefBut(block, TEX, 1, "Property:",(short)(10+xco),(short)(yco-44), (short)(width-20), 19,
+ uiDefBut(block, TEX, 1, "Property:", (short)(10+xco), (short)(yco-44), (short)(width-20), 19,
&ns->name, 0, MAX_NAME, 0, 0, "Only look for Objects with this property");
- uiDefButF(block, NUM, 1, "Dist",(short)(10+xco),(short)(yco-68),(short)((width-22)/2), 19,
+ uiDefButF(block, NUM, 1, "Dist", (short)(10+xco), (short)(yco-68), (short)((width-22)/2), 19,
&ns->dist, 0.0, 1000.0, 1000, 0, "Trigger distance");
- uiDefButF(block, NUM, 1, "Reset",(short)(10+xco+(width-22)/2), (short)(yco-68), (short)((width-22)/2), 19,
+ uiDefButF(block, NUM, 1, "Reset", (short)(10+xco+(width-22)/2), (short)(yco-68), (short)((width-22)/2), 19,
&ns->resetdist, 0.0, 1000.0, 1000, 0, "Reset distance");
yco-= ysize;
break;
@@ -1261,7 +1255,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
rs= sens->data;
uiDefBut(block, TEX, 1, "Prop:",
- (short)(10+xco),(short)(yco-44), (short)(0.7 * (width-20)), 19,
+ (short)(10+xco), (short)(yco-44), (short)(0.7 * (width-20)), 19,
&rs->name, 0, MAX_NAME, 0, 0,
"Only look for Objects with this property");
@@ -1344,27 +1338,25 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
str= "Type %t|Equal %x0|Not Equal %x1|Interval %x2|Changed %x3";
/* str= "Type %t|Equal %x0|Not Equal %x1"; */
- uiDefButI(block, MENU, B_REDR, str, xco+30,yco-44,width-60, 19,
+ uiDefButI(block, MENU, B_REDR, str, xco+30, yco-44, width-60, 19,
&ps->type, 0, 31, 0, 0, "Type");
- if (ps->type != SENS_PROP_EXPRESSION)
- {
- uiDefBut(block, TEX, 1, "Prop: ", xco+30,yco-68,width-60, 19,
+ if (ps->type != SENS_PROP_EXPRESSION) {
+ uiDefBut(block, TEX, 1, "Prop: ", xco+30, yco-68, width-60, 19,
ps->name, 0, MAX_NAME, 0, 0, "Property name");
}
- if (ps->type == SENS_PROP_INTERVAL)
- {
- uiDefBut(block, TEX, 1, "Min: ", xco,yco-92,width/2, 19,
+ if (ps->type == SENS_PROP_INTERVAL) {
+ uiDefBut(block, TEX, 1, "Min: ", xco, yco-92, width/2, 19,
ps->value, 0, MAX_NAME, 0, 0, "check for min value");
- uiDefBut(block, TEX, 1, "Max: ", xco+width/2,yco-92,width/2, 19,
+ uiDefBut(block, TEX, 1, "Max: ", xco+width/2, yco-92, width/2, 19,
ps->maxvalue, 0, MAX_NAME, 0, 0, "check for max value");
}
else if (ps->type == SENS_PROP_CHANGED) {
/* pass */
}
else {
- uiDefBut(block, TEX, 1, "Value: ", xco+30,yco-92,width-60, 19,
+ uiDefBut(block, TEX, 1, "Value: ", xco+30, yco-92, width-60, 19,
ps->value, 0, MAX_NAME, 0, 0, "check for value");
}
@@ -1398,12 +1390,11 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
str= "Type %t|State changed %x0|Lin error below %x1|Lin error above %x2|Rot error below %x3|Rot error above %x4";
- uiDefButI(block, MENU, B_REDR, str, xco+10,yco-66,0.4*(width-20), 19,
+ uiDefButI(block, MENU, B_REDR, str, xco+10, yco-66, 0.4*(width-20), 19,
&arm->type, 0, 31, 0, 0, "Type");
- if (arm->type != SENS_ARM_STATE_CHANGED)
- {
- uiDefButF(block, NUM, 1, "Value: ", xco+10+0.4*(width-20),yco-66,0.6*(width-20), 19,
+ if (arm->type != SENS_ARM_STATE_CHANGED) {
+ uiDefButF(block, NUM, 1, "Value: ", xco+10+0.4*(width-20), yco-66, 0.6*(width-20), 19,
&arm->value, -10000.0, 10000.0, 100, 0, "Test the error against this value");
}
}
@@ -1421,7 +1412,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
draw_default_sensor_header(sens, block, xco, yco, width);
as= sens->data;
- uiDefBut(block, TEX, 1, "Act: ", xco+30,yco-44,width-60, 19,
+ uiDefBut(block, TEX, 1, "Act: ", xco+30, yco-44, width-60, 19,
as->name, 0, MAX_NAME, 0, 0, "Actuator name, actuator active state modifications will be detected");
yco-= ysize;
break;
@@ -1437,11 +1428,11 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
draw_default_sensor_header(sens, block, xco, yco, width);
ds = sens->data;
- uiDefButS(block, NUM, 0, "Delay",(short)(10+xco),(short)(yco-44),(short)((width-22)*0.4+10), 19,
+ uiDefButS(block, NUM, 0, "Delay", (short)(10+xco), (short)(yco-44), (short)((width-22)*0.4+10), 19,
&ds->delay, 0.0, 5000.0, 0, 0, "Delay in number of logic tics before the positive trigger (default 60 per second)");
- uiDefButS(block, NUM, 0, "Dur",(short)(10+xco+(width-22)*0.4+10),(short)(yco-44),(short)((width-22)*0.4-10), 19,
+ uiDefButS(block, NUM, 0, "Dur", (short)(10+xco+(width-22)*0.4+10), (short)(yco-44), (short)((width-22)*0.4-10), 19,
&ds->duration, 0.0, 5000.0, 0, 0, "If >0, delay in number of logic tics before the negative trigger following the positive trigger");
- uiDefButBitS(block, TOG, SENS_DELAY_REPEAT, 0, "REP",(short)(xco + 10 + (width-22)*0.8),(short)(yco - 44),
+ uiDefButBitS(block, TOG, SENS_DELAY_REPEAT, 0, "REP", (short)(xco + 10 + (width-22)*0.8), (short)(yco - 44),
(short)(0.20 * (width-22)), 19, &ds->flag, 0.0, 0.0, 0, 0,
"Toggle repeat option. If selected, the sensor restarts after Delay+Dur logic tics");
yco-= ysize;
@@ -1471,7 +1462,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
"Specify the type of event this mouse sensor should trigger on");
if (ms->type==32) {
- uiDefButBitS(block, TOG, SENS_MOUSE_FOCUS_PULSE, B_REDR, "Pulse",(short)(xco + 10) + (width*0.8f)-20,(short)(yco - 44),
+ uiDefButBitS(block, TOG, SENS_MOUSE_FOCUS_PULSE, B_REDR, "Pulse", (short)(xco + 10) + (width*0.8f)-20, (short)(yco - 44),
(short)(0.20 * (width-20)), 19, &ms->flag, 0.0, 0.0, 0, 0,
"Moving the mouse over a different object generates a pulse");
}
@@ -1489,9 +1480,8 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
draw_default_sensor_header(sens, block, xco, yco, width);
randomSensor = sens->data;
/* some files were wrongly written, avoid crash now */
- if (randomSensor)
- {
- uiDefButI(block, NUM, 1, "Seed: ", xco+10,yco-44,(width-20), 19,
+ if (randomSensor) {
+ uiDefButI(block, NUM, 1, "Seed: ", xco+10, yco-44, (width-20), 19,
&randomSensor->seed, 0, 1000, 0, 0,
"Initial seed of the generator. (Choose 0 for not random)");
}
@@ -1509,7 +1499,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
/* 1. property or material */
uiDefButBitS(block, TOG, SENS_COLLISION_MATERIAL, B_REDR, "M/P",
- xco + 10,yco - 44, 0.20 * (width-20), 19,
+ xco + 10, yco - 44, 0.20 * (width-20), 19,
&raySens->mode, 0.0, 0.0, 0, 0,
"Toggle collision on material or property");
@@ -1526,7 +1516,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
/* X-Ray option */
uiDefButBitS(block, TOG, SENS_RAY_XRAY, 1, "X",
- xco + 10,yco - 68, 0.10 * (width-20), 19,
+ xco + 10, yco - 68, 0.10 * (width-20), 19,
&raySens->mode, 0.0, 0.0, 0, 0,
"Toggle X-Ray option (see through objects that don't have the property)");
/* 2. sensing range */
@@ -1610,8 +1600,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
&joy->flag, 0, 0, 0, 0,
"Triggered by all events on this joysticks current type (axis/button/hat)");
}
- if (joy->type == SENS_JOY_BUTTON)
- {
+ if (joy->type == SENS_JOY_BUTTON) {
if ((joy->flag & SENS_JOY_ANY_EVENT)==0) {
uiDefButI(block, NUM, 1, "Number:", xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
&joy->button, 0, 18, 100, 0,
@@ -1623,7 +1612,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
&joy->axis, 1, 8.0, 100, 0,
"Specify which axis pair to use, 1 is useually the main direction input");
- uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20),yco-44, 0.4 * (width-20), 19,
+ uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20), yco-44, 0.4 * (width-20), 19,
&joy->precision, 0, 32768.0, 100, 0,
"Specify the precision of the axis");
@@ -1651,7 +1640,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
&joy->axis_single, 1, 16.0, 100, 0,
"Specify a single axis (verticle/horizontal/other) to detect");
- uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20),yco-44, 0.4 * (width-20), 19,
+ uiDefButI(block, NUM, 1, "Threshold:", xco+10 + 0.6 * (width-20), yco-44, 0.4 * (width-20), 19,
&joy->precision, 0, 32768.0, 100, 0,
"Specify the precision of the axis");
}
@@ -1679,10 +1668,10 @@ static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
- /* uiDefBut(block, LABEL, 1, "Not yet...", xco,yco-24,80, 19, NULL, 0, 0, 0, 0, ""); */
+ /* uiDefBut(block, LABEL, 1, "Not yet...", xco, yco-24, 80, 19, NULL, 0, 0, 0, 0, ""); */
ec= cont->data;
- /* uiDefBut(block, BUT, 1, "Variables", xco,yco-24,80, 19, NULL, 0, 0, 0, 0, "Available variables for expression"); */
- uiDefBut(block, TEX, 1, "Exp:", xco + 10 , yco-21, width-20, 19,
+ /* uiDefBut(block, BUT, 1, "Variables", xco, yco-24, 80, 19, NULL, 0, 0, 0, 0, "Available variables for expression"); */
+ uiDefBut(block, TEX, 1, "Exp:", xco + 10, yco-21, width-20, 19,
ec->str, 0, sizeof(ec->str), 0, 0,
"Expression");
@@ -1700,11 +1689,11 @@ static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco
uiBlockBeginAlign(block);
- uiDefButI(block, MENU, B_REDR, "Execution Method%t|Script%x0|Module%x1", xco+4,yco-23, 66, 19, &pc->mode, 0, 0, 0, 0, "Python script type (textblock or module - faster)");
+ uiDefButI(block, MENU, B_REDR, "Execution Method%t|Script%x0|Module%x1", xco+4, yco-23, 66, 19, &pc->mode, 0, 0, 0, 0, "Python script type (textblock or module - faster)");
if (pc->mode==0)
- uiDefIDPoinBut(block, test_scriptpoin_but, ID_TXT, 1, "", xco+70,yco-23,width-74, 19, &pc->text, "Blender textblock to run as a script");
+ uiDefIDPoinBut(block, test_scriptpoin_but, ID_TXT, 1, "", xco+70, yco-23, width-74, 19, &pc->text, "Blender textblock to run as a script");
else {
- uiDefBut(block, TEX, 1, "", xco+70,yco-23,(width-70)-25, 19, pc->module, 0, sizeof(pc->module), 0, 0, "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used");
+ uiDefBut(block, TEX, 1, "", xco+70, yco-23, (width-70)-25, 19, pc->module, 0, sizeof(pc->module), 0, 0, "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used");
uiDefButBitI(block, TOG, CONT_PY_DEBUG, B_REDR, "D", (xco+width)-25, yco-23, 19, 19, &pc->flag, 0, 0, 0, 0, "Continuously reload the module from disk for editing external modules without restarting");
}
uiBlockEndAlign(block);
@@ -1727,7 +1716,7 @@ static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco
static int get_col_actuator(int type)
{
- switch(type) {
+ switch (type) {
case ACT_ACTION: return TH_PANEL;
case ACT_SHAPEACTION: return TH_PANEL;
case ACT_OBJECT: return TH_PANEL;
@@ -1869,14 +1858,12 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
/* yco is at the top of the rect, draw downwards */
set_col_actuator(act->type, 0);
- switch (act->type)
- {
+ switch (act->type) {
case ACT_OBJECT:
{
oa = act->data;
wval = (width-100)/3;
- if (oa->type == ACT_OBJECT_NORMAL)
- {
+ if (oa->type == ACT_OBJECT_NORMAL) {
if (ob->gameflag & OB_DYNAMIC) {
ysize= 175;
}
@@ -1904,8 +1891,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefButBitS(block, TOG, ACT_DLOC_LOCAL, 0, "L", xco+45+3*wval, yco-45, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
uiDefButBitS(block, TOG, ACT_DROT_LOCAL, 0, "L", xco+45+3*wval, yco-64, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
- if ( ob->gameflag & OB_DYNAMIC )
- {
+ if (ob->gameflag & OB_DYNAMIC) {
uiDefBut(block, LABEL, 0, "Force", xco, yco-87, 55, 19, NULL, 0, 0, 0, 0, "Sets the force");
uiBlockBeginAlign(block);
uiDefButF(block, NUM, 0, "", xco+45, yco-87, wval, 19, oa->forceloc, -10000.0, 10000.0, 10, 0, "");
@@ -1921,8 +1907,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiBlockEndAlign(block);
}
- if ( ob->gameflag & OB_DYNAMIC )
- {
+ if (ob->gameflag & OB_DYNAMIC) {
uiDefBut(block, LABEL, 0, "LinV", xco, yco-129, 45, 19, NULL, 0, 0, 0, 0, "Sets the linear velocity");
uiBlockBeginAlign(block);
uiDefButF(block, NUM, 0, "", xco+45, yco-129, wval, 19, oa->linearvelocity, -10000.0, 10000.0, 10, 0, "");
@@ -1945,11 +1930,10 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefButBitS(block, TOG, ACT_LIN_VEL_LOCAL, 0, "L", xco+45+3*wval, yco-129, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
uiDefButBitS(block, TOG, ACT_ANG_VEL_LOCAL, 0, "L", xco+45+3*wval, yco-148, 15, 19, &oa->flag, 0.0, 0.0, 0, 0, "Local transformation");
- uiDefButBitS(block, TOG, ACT_ADD_LIN_VEL, 0, "use_additive",xco+45+3*wval+15, yco-129, 35, 19, &oa->flag, 0.0, 0.0, 0, 0, "Toggles between ADD and SET linV");
+ uiDefButBitS(block, TOG, ACT_ADD_LIN_VEL, 0, "use_additive", xco+45+3*wval+15, yco-129, 35, 19, &oa->flag, 0.0, 0.0, 0, 0, "Toggles between ADD and SET linV");
}
}
- else if (oa->type == ACT_OBJECT_SERVO)
- {
+ else if (oa->type == ACT_OBJECT_SERVO) {
ysize= 195;
glRects(xco, yco-ysize, xco+width, yco);
@@ -2030,22 +2014,22 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
if (aa->type == ACT_ACTION_FROM_PROP) {
- uiDefBut(block, TEX, 0, "Prop: ",xco+10, yco-44, width-20, 19, aa->name, 0.0, MAX_NAME, 0, 0, "Use this property to define the Action position");
+ uiDefBut(block, TEX, 0, "Prop: ", xco+10, yco-44, width-20, 19, aa->name, 0.0, MAX_NAME, 0, 0, "Use this property to define the Action position");
}
else {
- uiDefButF(block, NUM, 0, "Sta: ",xco+10, yco-44, (width-20)/2, 19, &aa->sta, 1.0, MAXFRAMEF, 0, 0, "Start frame");
- uiDefButF(block, NUM, 0, "End: ",xco+10+(width-20)/2, yco-44, (width-20)/2, 19, &aa->end, 1.0, MAXFRAMEF, 0, 0, "End frame");
+ uiDefButF(block, NUM, 0, "Sta: ", xco+10, yco-44, (width-20)/2, 19, &aa->sta, 1.0, MAXFRAMEF, 0, 0, "Start frame");
+ uiDefButF(block, NUM, 0, "End: ", xco+10+(width-20)/2, yco-44, (width-20)/2, 19, &aa->end, 1.0, MAXFRAMEF, 0, 0, "End frame");
}
uiDefButS(block, NUM, 0, "Blendin: ", xco+10, yco-64, (width-20)/2, 19, &aa->blendin, 0.0, 32767, 0.0, 0.0, "Number of frames of motion blending");
uiDefButS(block, NUM, 0, "Priority: ", xco+10+(width-20)/2, yco-64, (width-20)/2, 19, &aa->priority, 0.0, 100.0, 0.0, 0.0, "Execution priority - lower numbers will override actions with higher numbers, With 2 or more actions at once, the overriding channels must be lower in the stack");
- uiDefBut(block, TEX, 0, "FrameProp: ",xco+10, yco-84, width-20, 19, aa->frameProp, 0.0, MAX_NAME, 0, 0, "Assign the action's current frame number to this property");
+ uiDefBut(block, TEX, 0, "FrameProp: ", xco+10, yco-84, width-20, 19, aa->frameProp, 0.0, MAX_NAME, 0, 0, "Assign the action's current frame number to this property");
#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
if (aa->type == ACT_ACTION_MOTION) {
- uiDefButF(block, NUM, 0, "Cycle: ",xco+30, yco-84, (width-60)/2, 19, &aa->stridelength, 0.0, 2500.0, 0, 0, "Distance covered by a single cycle of the action");
+ uiDefButF(block, NUM, 0, "Cycle: ", xco+30, yco-84, (width-60)/2, 19, &aa->stridelength, 0.0, 2500.0, 0, 0, "Distance covered by a single cycle of the action");
}
#endif
@@ -2125,9 +2109,9 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
pa= act->data;
str= "Type%t|Assign%x0|Add %x1|Copy %x2|Toggle (bool/int/float/timer)%x3";
- uiDefButI(block, MENU, B_REDR, str, xco+30,yco-24,width-60, 19, &pa->type, 0, 31, 0, 0, "Type");
+ uiDefButI(block, MENU, B_REDR, str, xco+30, yco-24, width-60, 19, &pa->type, 0, 31, 0, 0, "Type");
- uiDefBut(block, TEX, 1, "Prop: ", xco+30,yco-44,width-60, 19, pa->name, 0, MAX_NAME, 0, 0, "Property name");
+ uiDefBut(block, TEX, 1, "Prop: ", xco+30, yco-44, width-60, 19, pa->name, 0, MAX_NAME, 0, 0, "Property name");
if (pa->type==ACT_PROP_TOGGLE) {
@@ -2139,7 +2123,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
uiDefBut(block, TEX, 1, "Prop: ", xco+10+(width-20)/2, yco-64, (width-20)/2, 19, pa->value, 0, MAX_NAME, 0, 0, "Copy this property");
}
else {
- uiDefBut(block, TEX, 1, "Value: ", xco+30,yco-64,width-60, 19, pa->value, 0, MAX_NAME, 0, 0, "change with this value, use \"\" around strings");
+ uiDefBut(block, TEX, 1, "Value: ", xco+30, yco-64, width-60, 19, pa->value, 0, MAX_NAME, 0, 0, "change with this value, use \"\" around strings");
}
yco-= ysize;
@@ -2163,20 +2147,20 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
IDnames_to_pupstring(&str, "Sound files", NULL, &(bmain->sound), (ID *)sa->sound, &(sa->sndnr));
/* reset this value, it is for handling the event */
sa->sndnr = 0;
- uiDefButS(block, MENU, B_SOUNDACT_BROWSE, str, xco+10,yco-22,20,19, &(sa->sndnr), 0, 0, 0, 0, "");
+ uiDefButS(block, MENU, B_SOUNDACT_BROWSE, str, xco+10, yco-22, 20, 19, &(sa->sndnr), 0, 0, 0, 0, "");
uiDefButO(block, BUT, "sound.open", 0, "Load Sound", xco+wval+10, yco-22, wval, 19,
"Load a sound file (remember to set caching on for small sounds that are played often)");
if (sa->sound) {
char dummy_str[] = "Sound mode %t|Play Stop %x0|Play End %x1|Loop Stop %x2|"
"Loop End %x3|Loop Ping Pong Stop %x5|Loop Ping Pong %x4";
- uiDefBut(block, TEX, B_IDNAME, "SO:",xco+30,yco-22,wval-20,19,
+ uiDefBut(block, TEX, B_IDNAME, "SO:", xco+30, yco-22, wval-20, 19,
((ID *)sa->sound)->name+2, 0.0, MAX_ID_NAME-2, 0, 0, "");
- uiDefButS(block, MENU, 1, dummy_str,xco+10,yco-44,width-20, 19,
+ uiDefButS(block, MENU, 1, dummy_str, xco+10, yco-44, width-20, 19,
&sa->type, 0.0, 0.0, 0, 0, "");
- uiDefButF(block, NUM, 0, "Volume:", xco+10,yco-66,wval, 19, &sa->volume,
+ uiDefButF(block, NUM, 0, "Volume:", xco+10, yco-66, wval, 19, &sa->volume,
0.0, 1.0, 0, 0, "Sets the volume of this sound");
- uiDefButF(block, NUM, 0, "Pitch:",xco+wval+10,yco-66,wval, 19, &sa->pitch,-12.0,
+ uiDefButF(block, NUM, 0, "Pitch:", xco+wval+10, yco-66, wval, 19, &sa->pitch, -12.0,
12.0, 0, 0, "Sets the pitch of this sound");
uiDefButS(block, TOG | BIT, 0, "3D Sound", xco+10, yco-88, width-20, 19,
&sa->flag, 0.0, 1.0, 0.0, 0.0, "Plays the sound positioned in 3D space");
@@ -2547,8 +2531,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
ysize = 48;
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
- uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, sizeof(gma->filename), 0, 0, "Load this blend file, use the \"//\" prefix for a path relative to the current blend file");
-// uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, sizeof(gma->loadaniname), 0, 0, "Use this loadinganimation");
+ uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44, width-20, 19, &(gma->filename), 0, sizeof(gma->filename), 0, 0, "Load this blend file, use the \"//\" prefix for a path relative to the current blend file");
+// uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64, width-20, 19, &(gma->loadaniname), 0, sizeof(gma->loadaniname), 0, 0, "Use this loadinganimation");
}
#if 0
else if (gma->type == ACT_GAME_START) {
@@ -2556,8 +2540,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
- uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, sizeof(gma->filename), 0, 0, "Load this file");
- uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, sizeof(gma->loadaniname), 0, 0, "Use this loadinganimation");
+ uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44, width-20, 19, &(gma->filename), 0, sizeof(gma->filename), 0, 0, "Load this file");
+ uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64, width-20, 19, &(gma->loadaniname), 0, sizeof(gma->loadaniname), 0, 0, "Use this loadinganimation");
}
#endif
else if (ELEM4(gma->type, ACT_GAME_RESTART, ACT_GAME_QUIT, ACT_GAME_SAVECFG, ACT_GAME_LOADCFG)) {
@@ -2673,7 +2657,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
randAct = act->data;
/* 1. seed */
- uiDefButI(block, NUM, 1, "Seed: ", (xco+10),yco-24, 0.4 *(width-20), 19,
+ uiDefButI(block, NUM, 1, "Seed: ", (xco+10), yco-24, 0.4 *(width-20), 19,
&randAct->seed, 0, 1000, 0, 0,
"Initial seed of the random generator. Use Python for more freedom. "
" (Choose 0 for not random)");
@@ -2793,21 +2777,21 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
/* line 3: Text/Property */
uiDefButBitS(block, TOG, 1, B_REDR, "T/P",
- (xco+10),(yco-(myline*24)), (0.20 * (width-20)), 19,
+ (xco+10), (yco-(myline*24)), (0.20 * (width-20)), 19,
&ma->bodyType, 0.0, 0.0, 0, 0,
"Toggle message type: either Text or a PropertyName");
if (ma->bodyType == ACT_MESG_MESG) {
/* line 3: Message Body */
uiDefBut(block, TEX, 1, "Body: ",
- (xco+10+(0.20*(width-20))),(yco-(myline++*24)),(0.8*(width-20)),19,
+ (xco+10+(0.20*(width-20))), (yco-(myline++*24)), (0.8*(width-20)), 19,
&ma->body, 0, MAX_NAME, 0, 0,
"Optional message body Text");
}
else {
/* line 3: Property body (set by property) */
uiDefBut(block, TEX, 1, "Propname: ",
- (xco+10+(0.20*(width-20))),(yco-(myline++*24)),(0.8*(width-20)),19,
+ (xco+10+(0.20*(width-20))), (yco-(myline++*24)), (0.8*(width-20)), 19,
&ma->body, 0, MAX_NAME, 0, 0,
"The message body will be set by the Property Value");
}
@@ -2821,18 +2805,17 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
if (tdfa->type == ACT_2DFILTER_CUSTOMFILTER) {
ysize +=20;
}
- glRects( xco, yco-ysize, xco+width, yco );
- uiEmboss( (float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1 );
+ glRects(xco, yco-ysize, xco+width, yco);
+ uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
- switch(tdfa->type)
- {
+ switch (tdfa->type) {
case ACT_2DFILTER_MOTIONBLUR:
if (!tdfa->flag) {
- uiDefButS(block, TOG, B_REDR, "D", xco+30,yco-44,19, 19, &tdfa->flag, 0.0, 0.0, 0.0, 0.0, "Disable Motion Blur");
- uiDefButF(block, NUM, B_REDR, "Value:", xco+52,yco-44,width-82,19,&tdfa->float_arg,0.0,1.0,0.0,0.0,"Set motion blur value");
+ uiDefButS(block, TOG, B_REDR, "D", xco+30, yco-44, 19, 19, &tdfa->flag, 0.0, 0.0, 0.0, 0.0, "Disable Motion Blur");
+ uiDefButF(block, NUM, B_REDR, "Value:", xco+52, yco-44, width-82, 19, &tdfa->float_arg, 0.0, 1.0, 0.0, 0.0, "Set motion blur value");
}
else {
- uiDefButS(block, TOG, B_REDR, "Disabled", xco+30,yco-44,width-60, 19, &tdfa->flag, 0.0, 0.0, 0.0, 0.0, "Enable Motion Blur");
+ uiDefButS(block, TOG, B_REDR, "Disabled", xco+30, yco-44, width-60, 19, &tdfa->flag, 0.0, 0.0, 0.0, 0.0, "Enable Motion Blur");
}
break;
case ACT_2DFILTER_BLUR:
@@ -2848,18 +2831,18 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
case ACT_2DFILTER_NOFILTER:
case ACT_2DFILTER_DISABLED:
case ACT_2DFILTER_ENABLED:
- uiDefButI(block, NUM, B_REDR, "Pass Number:", xco+30,yco-44,width-60,19,&tdfa->int_arg,0.0,MAX_RENDER_PASS-1,0.0,0.0,"Set filter order");
+ uiDefButI(block, NUM, B_REDR, "Pass Number:", xco+30, yco-44, width-60, 19, &tdfa->int_arg, 0.0, MAX_RENDER_PASS-1, 0.0, 0.0, "Set filter order");
break;
case ACT_2DFILTER_CUSTOMFILTER:
- uiDefButI(block, NUM, B_REDR, "Pass Number:", xco+30,yco-44,width-60,19,&tdfa->int_arg,0.0,MAX_RENDER_PASS-1,0.0,0.0,"Set filter order");
- uiDefIDPoinBut(block, test_scriptpoin_but, ID_SCRIPT, 1, "Script: ", xco+30,yco-64,width-60, 19, &tdfa->text, "");
+ uiDefButI(block, NUM, B_REDR, "Pass Number:", xco+30, yco-44, width-60, 19, &tdfa->int_arg, 0.0, MAX_RENDER_PASS-1, 0.0, 0.0, "Set filter order");
+ uiDefIDPoinBut(block, test_scriptpoin_but, ID_SCRIPT, 1, "Script: ", xco+30, yco-64, width-60, 19, &tdfa->text, "");
break;
}
str= "2D Filter %t|Motion Blur %x1|Blur %x2|Sharpen %x3|Dilation %x4|Erosion %x5|"
"Laplacian %x6|Sobel %x7|Prewitt %x8|Gray Scale %x9|Sepia %x10|Invert %x11|Custom Filter %x12|"
"Enable Filter %x-2|Disable Filter %x-1|Remove Filter %x0|";
- uiDefButS(block, MENU, B_REDR, str, xco+30,yco-24,width-60, 19, &tdfa->type, 0.0, 0.0, 0.0, 0.0, "2D filter type");
+ uiDefButS(block, MENU, B_REDR, str, xco+30, yco-24, width-60, 19, &tdfa->type, 0.0, 0.0, 0.0, 0.0, "2D filter type");
yco -= ysize;
break;
@@ -2929,7 +2912,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
ysize += 40;
break;
case ACT_ARM_SETWEIGHT:
- uiDefButF(block, NUM, B_REDR, "Weight:", xco+5+(width-10)*0.35,yco-24,(width-10)*0.65,19,&armAct->weight,0.0,1.0,0.0,0.0,"Set weight of this constraint");
+ uiDefButF(block, NUM, B_REDR, "Weight:", xco+5+(width-10)*0.35, yco-24, (width-10)*0.65, 19, &armAct->weight, 0.0, 1.0, 0.0, 0.0, "Set weight of this constraint");
break;
}
}
@@ -3041,7 +3024,7 @@ static uiBlock *controller_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
uiBlockSetButmFunc(block, do_controller_menu, NULL);
uiDefBut(block, BUTM, 1, "Show Objects", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, BUTM, 1, "Hide Objects", 0,(short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
+ uiDefBut(block, BUTM, 1, "Hide Objects", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 1, 1, "");
uiDefBut(block, SEPR, 0, "", 0, (short)(yco-=6), 160, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefBut(block, BUTM, 1, "Show Controllers", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 2, 2, "");
uiDefBut(block, BUTM, 1, "Hide Controllers", 0, (short)(yco-=20), 160, 19, NULL, 0.0, 0.0, 3, 3, "");
@@ -3759,8 +3742,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
- switch (RNA_enum_get(ptr, "mode"))
- {
+ switch (RNA_enum_get(ptr, "mode")) {
case ACT_ARM_RUN:
break;
case ACT_ARM_ENABLE:
@@ -3835,8 +3817,7 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext
RNA_main_pointer_create(CTX_data_main(C), &main_ptr);
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
- switch (RNA_enum_get(ptr, "mode"))
- {
+ switch (RNA_enum_get(ptr, "mode")) {
case ACT_CONST_TYPE_LOC:
uiItemR(layout, ptr, "limit", 0, NULL, ICON_NONE);
@@ -3865,7 +3846,7 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext
uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_force_distance")==1);
uiItemR(sub, ptr, "distance", 0, "", ICON_NONE);
- uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER , NULL, ICON_NONE);
+ uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
split = uiLayoutSplit(layout, 0.15, 0);
uiItemR(split, ptr, "use_material_detect", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
@@ -3886,7 +3867,7 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext
uiItemR(layout, ptr, "direction_axis_pos", 0, NULL, ICON_NONE);
row=uiLayoutRow(layout, 1);
- uiItemR(row, ptr, "damping", UI_ITEM_R_SLIDER , NULL, ICON_NONE);
+ uiItemR(row, ptr, "damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "time", 0, NULL, ICON_NONE);
row=uiLayoutRow(layout, 0);
@@ -3900,16 +3881,16 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext
case ACT_CONST_TYPE_FH:
split=uiLayoutSplit(layout, 0.75, 0);
row= uiLayoutRow(split, 0);
- uiItemR(row, ptr, "fh_damping", UI_ITEM_R_SLIDER , NULL, ICON_NONE);
+ uiItemR(row, ptr, "fh_damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "fh_height", 0, NULL, ICON_NONE);
- uiItemR(split, ptr, "use_fh_paralel_axis", UI_ITEM_R_TOGGLE , NULL, ICON_NONE);
+ uiItemR(split, ptr, "use_fh_paralel_axis", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
row = uiLayoutRow(layout, 0);
uiItemR(row, ptr, "direction_axis", 0, NULL, ICON_NONE);
split = uiLayoutSplit(row, 0.9, 0);
uiItemR(split, ptr, "fh_force", 0, NULL, ICON_NONE);
- uiItemR(split, ptr, "use_fh_normal", UI_ITEM_R_TOGGLE , NULL, ICON_NONE);
+ uiItemR(split, ptr, "use_fh_normal", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
split = uiLayoutSplit(layout, 0.15, 0);
uiItemR(split, ptr, "use_material_detect", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
@@ -3934,8 +3915,7 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
uiLayout *row, *split, *sub;
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
- switch (RNA_enum_get(ptr, "mode"))
- {
+ switch (RNA_enum_get(ptr, "mode")) {
case ACT_EDOB_ADD_OBJECT:
row = uiLayoutRow(layout, 0);
uiItemR(row, ptr, "object", 0, NULL, ICON_NONE);
@@ -3988,8 +3968,7 @@ static void draw_actuator_filter_2d(uiLayout *layout, PointerRNA *ptr)
uiLayout *row, *split;
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
- switch (RNA_enum_get(ptr, "mode"))
- {
+ switch (RNA_enum_get(ptr, "mode")) {
case ACT_2DFILTER_CUSTOMFILTER:
uiItemR(layout, ptr, "filter_pass", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "glsl_shader", 0, NULL, ICON_NONE);
@@ -4163,8 +4142,7 @@ static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr)
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
uiItemPointerR(layout, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
- switch(RNA_enum_get(ptr, "mode"))
- {
+ switch (RNA_enum_get(ptr, "mode")) {
case ACT_PROP_TOGGLE:
break;
case ACT_PROP_ADD:
@@ -4571,7 +4549,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
uiItemR(split, &settings_ptr, "show_state_panel", UI_ITEM_R_NO_BG, "", ICON_DISCLOSURE_TRI_RIGHT);
row = uiLayoutRow(split, 1);
- uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide controllers");
+ uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide controllers");
if (ob == act_ob)
uiItemMenuEnumO(row, "LOGIC_OT_controller_add", "type", "Add Controller", ICON_NONE);
@@ -4666,7 +4644,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
if ((ob->scavisflag & OB_VIS_SENS) == 0) continue;
row = uiLayoutRow(layout, 1);
- uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
+ uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
if (ob == act_ob)
uiItemMenuEnumO(row, "LOGIC_OT_sensor_add", "type", "Add Sensor", ICON_NONE);
@@ -4732,7 +4710,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
if ( (ob->scavisflag & OB_VIS_ACT) == 0) continue;
row = uiLayoutRow(layout, 1);
- uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators");
+ uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators");
if (ob == act_ob)
uiItemMenuEnumO(row, "LOGIC_OT_actuator_add", "type", "Add Actuator", ICON_NONE);
@@ -4861,9 +4839,9 @@ void logic_buttons(bContext *C, ARegion *ar)
/* presume it is only objects for now */
uiBlockBeginAlign(block);
// if (ob->controllers.first) uiSetCurFont(block, UI_HELVB);
- uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Active Object name");
+ uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Active Object name");
// if (ob->controllers.first) uiSetCurFont(block, UI_HELV);
- uiDefButBitS(block, TOG, OB_ADDCONT, B_ADD_CONT, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Controller");
+ uiDefButBitS(block, TOG, OB_ADDCONT, B_ADD_CONT, "Add", (short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Controller");
uiBlockEndAlign(block);
yco-=20;
@@ -4900,9 +4878,9 @@ void logic_buttons(bContext *C, ARegion *ar)
}
}
uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, OB_ALLSTATE, B_SET_STATE_BIT, "All",(short)(xco+226), yco-10, 22, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Set all state bits");
- uiDefButBitS(block, TOG, OB_INITSTBIT, B_INIT_STATE_BIT, "Ini",(short)(xco+248), yco-10, 22, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Set the initial state");
- uiDefButBitS(block, TOG, OB_DEBUGSTATE, 0, "D",(short)(xco+270), yco-10, 15, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Print state debug info");
+ uiDefButBitS(block, TOG, OB_ALLSTATE, B_SET_STATE_BIT, "All", (short)(xco+226), yco-10, 22, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Set all state bits");
+ uiDefButBitS(block, TOG, OB_INITSTBIT, B_INIT_STATE_BIT, "Ini", (short)(xco+248), yco-10, 22, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Set the initial state");
+ uiDefButBitS(block, TOG, OB_DEBUGSTATE, 0, "D", (short)(xco+270), yco-10, 15, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Print state debug info");
uiBlockEndAlign(block);
yco-=35;
@@ -4935,7 +4913,7 @@ void logic_buttons(bContext *C, ARegion *ar)
if (cont->flag & CONT_SHOW) {
cont->otype= cont->type;
- uiDefButS(block, MENU, B_CHANGE_CONT, controller_pup(),(short)(xco+22), yco, 70, UI_UNIT_Y, &cont->type, 0, 0, 0, 0, "Controller type");
+ uiDefButS(block, MENU, B_CHANGE_CONT, controller_pup(), (short)(xco+22), yco, 70, UI_UNIT_Y, &cont->type, 0, 0, 0, 0, "Controller type");
but = uiDefBut(block, TEX, 1, "", (short)(xco+92), yco, (short)(width-158), UI_UNIT_Y, cont->name, 0, MAX_NAME, 0, 0, "Controller name");
uiButSetFunc(but, make_unique_prop_names_cb, cont->name, (void*) 0);
@@ -4945,10 +4923,10 @@ void logic_buttons(bContext *C, ARegion *ar)
}
else {
cpack(0x999999);
- glRecti(xco+22, yco, xco+width-22,yco+19);
+ glRecti(xco+22, yco, xco+width-22, yco+19);
but = uiDefBut(block, LABEL, 0, controller_name(cont->type), (short)(xco+22), yco, 70, UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller type");
//uiButSetFunc(but, old_sca_move_controller, cont, NULL);
- but = uiDefBut(block, LABEL, 0, cont->name,(short)(xco+92), yco,(short)(width-158), UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller name");
+ but = uiDefBut(block, LABEL, 0, cont->name, (short)(xco+92), yco, (short)(width-158), UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller name");
//uiButSetFunc(but, old_sca_move_controller, cont, NULL);
uiBlockBeginAlign(block);
@@ -4964,7 +4942,7 @@ void logic_buttons(bContext *C, ARegion *ar)
but = uiDefIconBut(block, LINK, 0, ICON_LINK, (short)(xco+width), ycoo, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
uiSetButLink(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR);
- uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, UI_UNIT_X, UI_UNIT_Y, cont, LINK_CONTROLLER, 0, 0, 0, "");
+ uiDefIconBut(block, INLINK, 0, ICON_INLINK, (short)(xco-19), ycoo, UI_UNIT_X, UI_UNIT_Y, cont, LINK_CONTROLLER, 0, 0, 0, "");
/* offset is >0 if at least one controller was displayed */
offset++;
yco-=20;
@@ -4999,9 +4977,9 @@ void logic_buttons(bContext *C, ARegion *ar)
/* presume it is only objects for now */
uiBlockBeginAlign(block);
// if (ob->sensors.first) uiSetCurFont(block, UI_HELVB);
- uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
+ uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
// if (ob->sensors.first) uiSetCurFont(block, UI_HELV);
- uiDefButBitS(block, TOG, OB_ADDSENS, B_ADD_SENS, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Sensor");
+ uiDefButBitS(block, TOG, OB_ADDSENS, B_ADD_SENS, "Add", (short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Sensor");
uiBlockEndAlign(block);
yco-=20;
@@ -5036,7 +5014,7 @@ void logic_buttons(bContext *C, ARegion *ar)
}
else {
set_col_sensor(sens->type, 1);
- glRecti(xco+22, yco, xco+width-22,yco+19);
+ glRecti(xco + 22, yco, xco + width - 22, yco + 19);
but = uiDefBut(block, LABEL, 0, sensor_name(sens->type), (short)(xco+22), yco, 80, UI_UNIT_Y, sens, 0, 0, 0, 0, "");
//uiButSetFunc(but, old_sca_move_sensor, sens, NULL);
but = uiDefBut(block, LABEL, 0, sens->name, (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens, 0, MAX_NAME, 0, 0, "");
@@ -5079,9 +5057,9 @@ void logic_buttons(bContext *C, ARegion *ar)
/* presume it is only objects for now */
uiBlockBeginAlign(block);
// if (ob->actuators.first) uiSetCurFont(block, UI_HELVB);
- uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2,(short)(xco-10), yco,(short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators");
+ uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators");
// if (ob->actuators.first) uiSetCurFont(block, UI_HELV);
- uiDefButBitS(block, TOG, OB_ADDACT, B_ADD_ACT, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Actuator");
+ uiDefButBitS(block, TOG, OB_ADDACT, B_ADD_ACT, "Add", (short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Actuator");
uiBlockEndAlign(block);
yco-=20;
@@ -5114,7 +5092,7 @@ void logic_buttons(bContext *C, ARegion *ar)
}
else {
set_col_actuator(act->type, 1);
- glRecti((short)(xco+22), yco, (short)(xco+width-22),(short)(yco+19));
+ glRecti((short)(xco+22), yco, (short)(xco+width-22), (short)(yco+19));
/* but= */ uiDefBut(block, LABEL, 0, actuator_name(act->type), (short)(xco+22), yco, 90, UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator type");
// uiButSetFunc(but, old_sca_move_actuator, act, NULL);
/* but= */ uiDefBut(block, LABEL, 0, act->name, (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator name");
@@ -5130,7 +5108,7 @@ void logic_buttons(bContext *C, ARegion *ar)
ycoo= yco;
}
- uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, UI_UNIT_X, UI_UNIT_Y, act, LINK_ACTUATOR, 0, 0, 0, "");
+ uiDefIconBut(block, INLINK, 0, ICON_INLINK, (short)(xco - 19), ycoo, UI_UNIT_X, UI_UNIT_Y, act, LINK_ACTUATOR, 0, 0, 0, "");
yco-=20;
}
diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c
index 82175f83d39..93105c39f39 100644
--- a/source/blender/editors/space_logic/space_logic.c
+++ b/source/blender/editors/space_logic/space_logic.c
@@ -195,12 +195,12 @@ static void logic_refresh(const bContext *UNUSED(C), ScrArea *UNUSED(sa))
static void logic_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_LOGIC:
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_FRAME:
ED_region_tag_redraw(ar);
break;
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index de42e4a783d..a133d370d99 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -76,7 +76,7 @@ static void do_nla_region_buttons(bContext *C, void *UNUSED(arg), int event)
{
//Scene *scene= CTX_data_scene(C);
- switch(event) {
+ switch (event) {
}
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index 1d323cb6a4f..c8f9c66d24b 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -211,7 +211,7 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
/* offset for start of channel (on LHS of channel-list) */
if (ale->id) {
/* special exception for materials and particles */
- if (ELEM(GS(ale->id->name),ID_MA,ID_PA))
+ if (ELEM(GS(ale->id->name), ID_MA, ID_PA))
offset= 21 + NLACHANNEL_BUTTON_WIDTH;
else
offset= 14;
@@ -341,7 +341,7 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *e
return OPERATOR_FINISHED;
}
-void NLA_OT_channels_click (wmOperatorType *ot)
+void NLA_OT_channels_click(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Mouse Click on NLA Channels";
@@ -415,7 +415,7 @@ static int nlaedit_add_tracks_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_tracks_add (wmOperatorType *ot)
+void NLA_OT_tracks_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Track(s)";
@@ -479,7 +479,7 @@ static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_delete_tracks (wmOperatorType *ot)
+void NLA_OT_delete_tracks(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Tracks";
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 7ed49025814..d331415bc46 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -534,7 +534,7 @@ static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, V
/* ---------------------- */
-void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
+void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -920,7 +920,7 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
}
}
-void draw_nla_channel_list (bContext *C, bAnimContext *ac, ARegion *ar)
+void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index 1a94b1160be..994021db9ff 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -76,7 +76,7 @@
/* Utilities exported to other places... */
/* Perform validation for blending/extend settings */
-void ED_nla_postop_refresh (bAnimContext *ac)
+void ED_nla_postop_refresh(bAnimContext *ac)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@@ -155,7 +155,7 @@ static int nlaedit_enable_tweakmode_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_tweakmode_enter (wmOperatorType *ot)
+void NLA_OT_tweakmode_enter(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Enter Tweak Mode";
@@ -220,7 +220,7 @@ static int nlaedit_disable_tweakmode_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_tweakmode_exit (wmOperatorType *ot)
+void NLA_OT_tweakmode_exit(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Exit Tweak Mode";
@@ -335,7 +335,7 @@ static int nlaedit_viewsel_exec(bContext *C, wmOperator *UNUSED(op))
return nlaedit_viewall(C, TRUE);
}
-void NLA_OT_view_all (wmOperatorType *ot)
+void NLA_OT_view_all(wmOperatorType *ot)
{
/* identifiers */
ot->name = "View All";
@@ -350,7 +350,7 @@ void NLA_OT_view_all (wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-void NLA_OT_view_selected (wmOperatorType *ot)
+void NLA_OT_view_selected(wmOperatorType *ot)
{
/* identifiers */
ot->name = "View Selected";
@@ -468,7 +468,7 @@ static int nlaedit_add_actionclip_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_actionclip_add (wmOperatorType *ot)
+void NLA_OT_actionclip_add(wmOperatorType *ot)
{
PropertyRNA *prop;
@@ -595,7 +595,7 @@ static int nlaedit_add_transition_exec (bContext *C, wmOperator *op)
}
}
-void NLA_OT_transition_add (wmOperatorType *ot)
+void NLA_OT_transition_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Transition";
@@ -680,7 +680,7 @@ static int nlaedit_add_sound_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_soundclip_add (wmOperatorType *ot)
+void NLA_OT_soundclip_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Sound Clip";
@@ -742,7 +742,7 @@ static int nlaedit_add_meta_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_meta_add (wmOperatorType *ot)
+void NLA_OT_meta_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add Meta-Strips";
@@ -794,7 +794,7 @@ static int nlaedit_remove_meta_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_meta_remove (wmOperatorType *ot)
+void NLA_OT_meta_remove(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove Meta-Strips";
@@ -897,7 +897,7 @@ static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED
return OPERATOR_FINISHED;
}
-void NLA_OT_duplicate (wmOperatorType *ot)
+void NLA_OT_duplicate(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Duplicate Strips";
@@ -972,7 +972,7 @@ static int nlaedit_delete_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_delete (wmOperatorType *ot)
+void NLA_OT_delete(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Strips";
@@ -1117,7 +1117,7 @@ static int nlaedit_split_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_split (wmOperatorType *ot)
+void NLA_OT_split(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Split Strips";
@@ -1170,7 +1170,7 @@ static int nlaedit_bake_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_bake (wmOperatorType *ot)
+void NLA_OT_bake(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Bake Strips";
@@ -1232,7 +1232,7 @@ static int nlaedit_toggle_mute_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_mute_toggle (wmOperatorType *ot)
+void NLA_OT_mute_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Toggle Muting";
@@ -1389,7 +1389,7 @@ static int nlaedit_swap_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_swap (wmOperatorType *ot)
+void NLA_OT_swap(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Swap Strips";
@@ -1463,7 +1463,7 @@ static int nlaedit_move_up_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_move_up (wmOperatorType *ot)
+void NLA_OT_move_up(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Move Strips Up";
@@ -1537,7 +1537,7 @@ static int nlaedit_move_down_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_move_down (wmOperatorType *ot)
+void NLA_OT_move_down(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Move Strips Down";
@@ -1613,7 +1613,7 @@ static int nlaedit_sync_actlen_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_action_sync_length (wmOperatorType *ot)
+void NLA_OT_action_sync_length(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Sync Action Length";
@@ -1713,7 +1713,7 @@ static int nlaedit_apply_scale_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_apply_scale (wmOperatorType *ot)
+void NLA_OT_apply_scale(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Apply Scale";
@@ -1776,7 +1776,7 @@ static int nlaedit_clear_scale_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void NLA_OT_clear_scale (wmOperatorType *ot)
+void NLA_OT_clear_scale(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Clear Scale";
@@ -1917,7 +1917,7 @@ static int nlaedit_snap_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_snap (wmOperatorType *ot)
+void NLA_OT_snap(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Snap Strips";
@@ -2036,7 +2036,7 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_fmodifier_add (wmOperatorType *ot)
+void NLA_OT_fmodifier_add(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add F-Modifier";
@@ -2100,7 +2100,7 @@ static int nla_fmodifier_copy_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_fmodifier_copy (wmOperatorType *ot)
+void NLA_OT_fmodifier_copy(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Copy F-Modifiers";
@@ -2162,7 +2162,7 @@ static int nla_fmodifier_paste_exec(bContext *C, wmOperator *op)
}
}
-void NLA_OT_fmodifier_paste (wmOperatorType *ot)
+void NLA_OT_fmodifier_paste(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Paste F-Modifiers";
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
index 78fb92f2ee4..b320adc25fb 100644
--- a/source/blender/editors/space_nla/nla_ops.c
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -58,7 +58,7 @@
/* ************************** poll callbacks for operators **********************************/
/* tweakmode is NOT enabled */
-int nlaop_poll_tweakmode_off (bContext *C)
+int nlaop_poll_tweakmode_off(bContext *C)
{
Scene *scene;
@@ -80,7 +80,7 @@ int nlaop_poll_tweakmode_off (bContext *C)
}
/* tweakmode IS enabled */
-int nlaop_poll_tweakmode_on (bContext *C)
+int nlaop_poll_tweakmode_on(bContext *C)
{
Scene *scene;
@@ -102,7 +102,7 @@ int nlaop_poll_tweakmode_on (bContext *C)
}
/* is tweakmode enabled - for use in NLA operator code */
-short nlaedit_is_tweakmode_on (bAnimContext *ac)
+short nlaedit_is_tweakmode_on(bAnimContext *ac)
{
if (ac && ac->scene)
return (ac->scene->flag & SCE_NLA_EDIT_ON);
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index b0cd59ea7ad..cfd4a3202d2 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -183,7 +183,7 @@ static int nlaedit_deselectall_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void NLA_OT_select_all_toggle (wmOperatorType *ot)
+void NLA_OT_select_all_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name = "(De)select All";
@@ -254,8 +254,8 @@ static void borderselect_nla_strips (bAnimContext *ac, rcti rect, short mode, sh
/* only select strips if they fall within the required ranges (if applicable) */
for (strip= nlt->strips.first; strip; strip= strip->next) {
- if ( (mode == NLA_BORDERSEL_CHANNELS) ||
- BKE_nlastrip_within_bounds(strip, rectf.xmin, rectf.xmax) )
+ if ( (mode == NLA_BORDERSEL_CHANNELS) ||
+ BKE_nlastrip_within_bounds(strip, rectf.xmin, rectf.xmax))
{
/* set selection */
ACHANNEL_SET_FLAG(strip, selectmode, NLASTRIP_FLAG_SELECT);
@@ -481,7 +481,7 @@ static int nlaedit_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent
return nlaedit_select_leftright_exec(C, op);
}
-void NLA_OT_select_leftright (wmOperatorType *ot)
+void NLA_OT_select_leftright(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select Left/Right";
@@ -643,7 +643,7 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
}
-void NLA_OT_click_select (wmOperatorType *ot)
+void NLA_OT_click_select(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Mouse Select";
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 4dc3aef7d2c..27c48d2232f 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -348,12 +348,12 @@ static void nla_buttons_area_draw(const bContext *C, ARegion *ar)
static void nla_region_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_ANIMATION:
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_OB_ACTIVE:
case ND_FRAME:
case ND_MARKERS:
@@ -362,7 +362,7 @@ static void nla_region_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_OBJECT:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_KEYS:
@@ -381,12 +381,12 @@ static void nla_region_listener(ARegion *ar, wmNotifier *wmn)
static void nla_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_ANIMATION:
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_RENDER_OPTIONS:
case ND_OB_ACTIVE:
case ND_FRAME:
@@ -396,7 +396,7 @@ static void nla_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_OBJECT:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_KEYS:
@@ -406,7 +406,7 @@ static void nla_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_NODE:
- switch(wmn->action) {
+ switch (wmn->action) {
case NA_EDITED:
ED_region_tag_redraw(ar);
break;
@@ -425,19 +425,19 @@ static void nla_main_area_listener(ARegion *ar, wmNotifier *wmn)
static void nla_channel_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_ANIMATION:
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_OB_ACTIVE:
ED_region_tag_redraw(ar);
break;
}
break;
case NC_OBJECT:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_KEYS:
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 42aea32b7f6..bd17c821567 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -266,7 +266,7 @@ static void node_draw_socket_new(bNodeSocket *sock, float size)
/* 16 values of sin function */
static float si[16] = {
- 0.00000000f, 0.39435585f,0.72479278f,0.93775213f,
+ 0.00000000f, 0.39435585f, 0.72479278f,0.93775213f,
0.99871650f,0.89780453f,0.65137248f,0.29936312f,
-0.10116832f,-0.48530196f,-0.79077573f,-0.96807711f,
-0.98846832f,-0.84864425f,-0.57126821f,-0.20129852f
@@ -289,12 +289,12 @@ static void node_draw_socket_new(bNodeSocket *sock, float size)
glColor4ub(0, 0, 0, 150);
glEnable(GL_BLEND);
- glEnable( GL_LINE_SMOOTH );
+ glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINE_LOOP);
for (a=0; a<16; a++)
glVertex2f(x+size*si[a], y+size*co[a]);
glEnd();
- glDisable( GL_LINE_SMOOTH );
+ glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
#endif
@@ -442,7 +442,7 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
nodeSetActive(ntree, node);
if ( ntree->type == NTREE_TEXTURE )
- ntreeTexCheckCyclics( ntree );
+ ntreeTexCheckCyclics(ntree);
// allqueue(REDRAWBUTSSHADING, 0);
// allqueue(REDRAWNODE, 0);
@@ -870,16 +870,16 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
/* group node outline */
uiSetRoundBox(UI_CNR_ALL);
glColor4ub(200, 200, 200, 140);
- glEnable( GL_LINE_SMOOTH );
+ glEnable(GL_LINE_SMOOTH);
uiDrawBox(GL_LINE_LOOP, rect.xmin-node_group_frame, rect.ymin, rect.xmax+node_group_frame, rect.ymax+group_header, BASIS_RAD);
- glDisable( GL_LINE_SMOOTH );
+ glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
/* backdrop title */
UI_ThemeColor(TH_TEXT_HI);
layout = uiBlockLayout(gnode->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, (short)(rect.xmin+15), (short)(rect.ymax+group_header),
- MIN2((int)(rect.xmax - rect.xmin-18.0f), node_group_frame+20), group_header, UI_GetStyle());
+ MIN2((int)(rect.xmax - rect.xmin-18.0f), node_group_frame+20), group_header, UI_GetStyle());
RNA_pointer_create(&ntree->id, &RNA_Node, gnode, &ptr);
uiTemplateIDBrowse(layout, (bContext*)C, &ptr, "node_tree", NULL, NULL, NULL);
uiBlockLayoutResolve(gnode->block, NULL, NULL);
@@ -963,7 +963,7 @@ static void node_update_frame(const bContext *UNUSED(C), bNodeTree *UNUSED(ntree
static void node_common_set_butfunc(bNodeType *ntype)
{
- switch(ntype->type) {
+ switch (ntype->type) {
case NODE_GROUP:
ntype->uifunc= node_uifunc_group;
ntype->drawfunc= node_draw_group;
@@ -1176,7 +1176,7 @@ static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA *
static void node_shader_set_butfunc(bNodeType *ntype)
{
ntype->uifuncbut = NULL;
- switch(ntype->type) {
+ switch (ntype->type) {
/* case NODE_GROUP: note, typeinfo for group is generated... see "XXX ugly hack" */
case SH_NODE_MATERIAL:
@@ -1635,9 +1635,14 @@ static void node_composit_buts_diff_matte(uiLayout *layout, bContext *UNUSED(C),
static void node_composit_buts_distance_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
- uiLayout *col;
+ uiLayout *col, *row;
col = uiLayoutColumn(layout, 1);
+
+ uiItemL(layout, "Color Space:", ICON_NONE);
+ row= uiLayoutRow(layout, 0);
+ uiItemR(row, ptr, "channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+
uiItemR(col, ptr, "tolerance", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(col, ptr, "falloff", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
}
@@ -1647,7 +1652,7 @@ static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C)
uiLayout *row, *col;
uiItemL(layout, "Despill Channel:", ICON_NONE);
- row = uiLayoutRow(layout,0);
+ row = uiLayoutRow(layout, 0);
uiItemR(row, ptr, "channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
col= uiLayoutColumn(layout, 0);
@@ -1655,7 +1660,7 @@ static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C)
if (RNA_enum_get(ptr, "limit_method")==0) {
uiItemL(col, "Limiting Channel:", ICON_NONE);
- row=uiLayoutRow(col,0);
+ row=uiLayoutRow(col, 0);
uiItemR(row, ptr, "limit_channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
@@ -1710,7 +1715,7 @@ static void node_composit_buts_channel_matte(uiLayout *layout, bContext *UNUSED(
uiItemR(col, ptr, "limit_method", 0, NULL, ICON_NONE);
if (RNA_enum_get(ptr, "limit_method")==0) {
uiItemL(col, "Limiting Channel:", ICON_NONE);
- row=uiLayoutRow(col,0);
+ row=uiLayoutRow(col, 0);
uiItemR(row, ptr, "limit_channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
@@ -1941,7 +1946,7 @@ static void node_composit_buts_moviedistortion(uiLayout *layout, bContext *C, Po
static void node_composit_set_butfunc(bNodeType *ntype)
{
ntype->uifuncbut = NULL;
- switch(ntype->type) {
+ switch (ntype->type) {
/* case NODE_GROUP: note, typeinfo for group is generated... see "XXX ugly hack" */
case CMP_NODE_IMAGE:
@@ -2137,7 +2142,7 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), Pointe
col= uiLayoutColumn(layout, 0);
- switch( tex->type ) {
+ switch ( tex->type ) {
case TEX_BLEND:
uiItemR(col, &tex_ptr, "progression", 0, "", ICON_NONE);
row= uiLayoutRow(col, 0);
@@ -2222,45 +2227,50 @@ static void node_texture_set_butfunc(bNodeType *ntype)
if ( ntype->type >= TEX_NODE_PROC && ntype->type < TEX_NODE_PROC_MAX ) {
ntype->uifunc = node_texture_buts_proc;
}
- else switch(ntype->type) {
-
+ else {
+ switch (ntype->type) {
+
case TEX_NODE_MATH:
ntype->uifunc = node_buts_math;
break;
-
+
case TEX_NODE_MIX_RGB:
ntype->uifunc = node_buts_mix_rgb;
break;
-
+
case TEX_NODE_VALTORGB:
ntype->uifunc = node_buts_colorramp;
break;
-
+
case TEX_NODE_CURVE_RGB:
ntype->uifunc= node_buts_curvecol;
break;
-
+
case TEX_NODE_CURVE_TIME:
ntype->uifunc = node_buts_time;
break;
-
+
case TEX_NODE_TEXTURE:
ntype->uifunc = node_buts_texture;
break;
-
+
case TEX_NODE_BRICKS:
ntype->uifunc = node_texture_buts_bricks;
break;
-
+
case TEX_NODE_IMAGE:
ntype->uifunc = node_texture_buts_image;
break;
-
+
case TEX_NODE_OUTPUT:
ntype->uifunc = node_texture_buts_output;
break;
+ }
+ }
+
+ if (ntype->uifuncbut == NULL) {
+ ntype->uifuncbut = ntype->uifunc;
}
- if (ntype->uifuncbut == NULL) ntype->uifuncbut = ntype->uifunc;
}
/* ******* init draw callbacks for all tree types, only called in usiblender.c, once ************* */
@@ -2305,7 +2315,7 @@ void ED_init_node_butfuncs(void)
for (i=0; i < NUM_SOCKET_TYPES; ++i) {
stype = ntreeGetSocketType(i);
if (stype) {
- switch(stype->type) {
+ switch (stype->type) {
case SOCK_FLOAT:
case SOCK_INT:
case SOCK_BOOLEAN:
@@ -2494,8 +2504,8 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa
else {
/* always do all three, to prevent data hanging around */
- forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0], resol, sizeof(float)*2);
- forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0]+1, resol, sizeof(float)*2);
+ BKE_curve_forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0], resol, sizeof(float)*2);
+ BKE_curve_forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0]+1, resol, sizeof(float)*2);
return 1;
}
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 040f921b6ac..7cddaa5e0e7 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -459,17 +459,17 @@ static void node_circle_draw(float x, float y, float size, char *col, int highli
{
/* 16 values of sin function */
static float si[16] = {
- 0.00000000f, 0.39435585f,0.72479278f,0.93775213f,
- 0.99871650f,0.89780453f,0.65137248f,0.29936312f,
- -0.10116832f,-0.48530196f,-0.79077573f,-0.96807711f,
- -0.98846832f,-0.84864425f,-0.57126821f,-0.20129852f
+ 0.00000000f, 0.39435585f, 0.72479278f, 0.93775213f,
+ 0.99871650f, 0.89780453f, 0.65137248f, 0.29936312f,
+ -0.10116832f, -0.48530196f, -0.79077573f, -0.96807711f,
+ -0.98846832f, -0.84864425f, -0.57126821f, -0.20129852f
};
/* 16 values of cos function */
static float co[16] ={
- 1.00000000f,0.91895781f,0.68896691f,0.34730525f,
- -0.05064916f,-0.44039415f,-0.75875812f,-0.95413925f,
- -0.99486932f,-0.87434661f,-0.61210598f,-0.25065253f,
- 0.15142777f,0.52896401f,0.82076344f,0.97952994f,
+ 1.00000000f, 0.91895781f, 0.68896691f, 0.34730525f,
+ -0.05064916f, -0.44039415f, -0.75875812f, -0.95413925f,
+ -0.99486932f, -0.87434661f, -0.61210598f, -0.25065253f,
+ 0.15142777f, 0.52896401f, 0.82076344f, 0.97952994f,
};
int a;
@@ -488,12 +488,12 @@ static void node_circle_draw(float x, float y, float size, char *col, int highli
glColor4ub(0, 0, 0, 150);
}
glEnable(GL_BLEND);
- glEnable( GL_LINE_SMOOTH );
+ glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINE_LOOP);
for (a=0; a<16; a++)
glVertex2f(x+size*si[a], y+size*co[a]);
glEnd();
- glDisable( GL_LINE_SMOOTH );
+ glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
glLineWidth(1.0f);
}
@@ -547,7 +547,7 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv)
glPixelZoom(xscale, yscale);
glEnable(GL_BLEND);
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); /* premul graphics */
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); /* premul graphics */
glColor4f(1.0, 1.0, 1.0, 1.0);
glaDrawPixelsTex(prv->xmin, prv->ymin, preview->xsize, preview->ysize, GL_UNSIGNED_BYTE, preview->rect);
@@ -691,7 +691,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
/* outline active and selected emphasis */
if ( node->flag & (NODE_ACTIVE|SELECT) ) {
glEnable(GL_BLEND);
- glEnable( GL_LINE_SMOOTH );
+ glEnable(GL_LINE_SMOOTH);
/* using different shades of TH_TEXT_HI for the empasis, like triangle */
if ( node->flag & NODE_ACTIVE )
UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, -40);
@@ -700,7 +700,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_LEFT); // round all corners except lower right
uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD);
- glDisable( GL_LINE_SMOOTH );
+ glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
@@ -786,14 +786,14 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
/* outline active and selected emphasis */
if ( node->flag & (NODE_ACTIVE|SELECT) ) {
glEnable(GL_BLEND);
- glEnable( GL_LINE_SMOOTH );
+ glEnable(GL_LINE_SMOOTH);
/* using different shades of TH_TEXT_HI for the empasis, like triangle */
if ( node->flag & NODE_ACTIVE )
UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, -40);
else
UI_ThemeColorShadeAlpha(TH_TEXT_HI, -20, -120);
uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad);
- glDisable( GL_LINE_SMOOTH );
+ glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
@@ -939,7 +939,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
//uiFreeBlocksWin(&sa->uiblocks, sa->win);
/* only set once */
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_MAP1_VERTEX_3);
/* aspect+font, set each time */
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index dda06267237..f38e3e0d272 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -284,7 +284,7 @@ void ED_node_shader_default(Scene *scene, ID *id)
ntree= ntreeAddTree("Shader Nodetree", NTREE_SHADER, 0);
- switch(GS(id->name)) {
+ switch (GS(id->name)) {
case ID_MA: {
Material *ma= (Material*)id;
ma->nodetree = ntree;
@@ -1458,7 +1458,7 @@ static int sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int sample_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- switch(event->type) {
+ switch (event->type) {
case LEFTMOUSE:
case RIGHTMOUSE: // XXX hardcoded
sample_exit(C, op);
@@ -2651,7 +2651,7 @@ static int cut_links_exec(bContext *C, wmOperator *op)
float mcoords[256][2];
int i= 0;
- RNA_BEGIN(op->ptr, itemptr, "path") {
+ RNA_BEGIN (op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index 4df60e6eede..a540f18b3a5 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -517,7 +517,7 @@ static int node_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_int_set(op->ptr, "mouse_x", event->mval[0]);
RNA_int_set(op->ptr, "mouse_y", event->mval[1]);
- return node_select_exec(C,op);
+ return node_select_exec(C, op);
}
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index 049886b1d66..13e85c7f74d 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -220,8 +220,10 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
/* also preserve mapping for texture nodes */
if (node_from->typeinfo->nclass == NODE_CLASS_TEXTURE &&
- node_prev->typeinfo->nclass == NODE_CLASS_TEXTURE)
+ node_prev->typeinfo->nclass == NODE_CLASS_TEXTURE)
+ {
memcpy(node_from->storage, node_prev->storage, sizeof(NodeTexBase));
+ }
/* remove node */
node_remove_linked(ntree, node_prev);
@@ -295,11 +297,14 @@ static void ui_node_sock_name(bNodeSocket *sock, char name[UI_MAX_NAME_STR])
BLI_strncpy(node_name, node->typeinfo->name, UI_MAX_NAME_STR);
if (node->inputs.first == NULL &&
- node->outputs.first != node->outputs.last &&
- !(node->typeinfo->flag & NODE_OPTIONS))
+ node->outputs.first != node->outputs.last &&
+ !(node->typeinfo->flag & NODE_OPTIONS))
+ {
BLI_snprintf(name, UI_MAX_NAME_STR, "%s | %s", node_name, sock->link->fromsock->name);
- else
+ }
+ else {
BLI_strncpy(name, node_name, UI_MAX_NAME_STR);
+ }
}
else if (sock->type == SOCK_SHADER)
BLI_strncpy(name, "None", UI_MAX_NAME_STR);
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index fca9927b0f5..3540c20e515 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -172,7 +172,7 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
short shader_type = snode->shaderfrom;
/* preview renders */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SCENE:
switch (wmn->data) {
case ND_NODES:
@@ -244,7 +244,7 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
ED_area_tag_redraw(sa);
break;
case NC_SCREEN:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_ANIMPLAY:
ED_area_tag_refresh(sa);
break;
@@ -429,7 +429,7 @@ static void node_header_area_draw(const bContext *C, ARegion *ar)
static void node_region_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SPACE:
if (wmn->data==ND_SPACE_NODE)
ED_region_tag_redraw(ar);
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 779475943dd..042b668c9cc 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -77,7 +77,7 @@ static void outliner_height(SpaceOops *soops, ListBase *lb, int *h)
TreeElement *te= lb->first;
while (te) {
TreeStoreElem *tselem= TREESTORE(te);
- if (TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem, soops))
outliner_height(soops, &te->subtree, h);
(*h) += UI_UNIT_Y;
te= te->next;
@@ -92,7 +92,7 @@ static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
// TreeStoreElem *tselem= TREESTORE(te);
// XXX fixme... te->xend is not set yet
- if (!TSELEM_OPEN(tselem,soops)) {
+ if (!TSELEM_OPEN(tselem, soops)) {
if (te->xend > *w)
*w = te->xend;
}
@@ -117,7 +117,7 @@ static void outliner_rna_width(SpaceOops *soops, ListBase *lb, int *w, int start
if (startx+100 > *w)
*w = startx+100;
- if (TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem, soops))
outliner_rna_width(soops, &te->subtree, w, startx+UI_UNIT_X);
te= te->next;
}
@@ -278,7 +278,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
if (tselem->type==0) {
test_idbutton(tselem->id->name+2); // library.c, unique name and alpha sort
- switch(GS(tselem->id->name)) {
+ switch (GS(tselem->id->name)) {
case ID_MA:
WM_event_add_notifier(C, NC_MATERIAL, NULL); break;
case ID_TE:
@@ -305,7 +305,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
}
}
else {
- switch(tselem->type) {
+ switch (tselem->type) {
case TSE_DEFGROUP:
defgroup_unique_name(te->directdata, (Object *)tselem->id); // id = object
break;
@@ -505,7 +505,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
}
}
- if (TSELEM_OPEN(tselem,soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree);
+ if (TSELEM_OPEN(tselem, soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree);
}
}
@@ -546,7 +546,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
ptr= &te->rnaptr;
prop= te->directdata;
- if (!(RNA_property_type(prop) == PROP_POINTER && (TSELEM_OPEN(tselem,soops))) )
+ if (!(RNA_property_type(prop) == PROP_POINTER && (TSELEM_OPEN(tselem, soops))) )
uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, (int)te->ys, OL_RNA_COL_SIZEX, UI_UNIT_Y-1);
}
else if (tselem->type == TSE_RNA_ARRAY_ELEM) {
@@ -557,7 +557,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
}
}
- if (TSELEM_OPEN(tselem,soops)) outliner_draw_rnabuts(block, scene, ar, soops, sizex, &te->subtree);
+ if (TSELEM_OPEN(tselem, soops)) outliner_draw_rnabuts(block, scene, ar, soops, sizex, &te->subtree);
}
}
@@ -719,7 +719,7 @@ static void keymap_type_cb(bContext *C, void *kmi_v, void *UNUSED(arg_v))
short maptype= keymap_menu_type(kmi->type);
if (maptype!=kmi->maptype) {
- switch(kmi->maptype) {
+ switch (kmi->maptype) {
case OL_KM_KEYBOARD:
kmi->type= AKEY;
kmi->val= KM_PRESS;
@@ -776,14 +776,14 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
xstart+= butw2+5;
/* edit actual event */
- switch(kmi->maptype) {
+ switch (kmi->maptype) {
case OL_KM_KEYBOARD:
uiDefKeyevtButS(block, 0, "", xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->type, "Key code");
xstart+= butw2+5;
break;
case OL_KM_MOUSE:
str= keymap_mouse_menu();
- uiDefButS(block, MENU, 0, str, xstart,(int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->type, 0, 0, 0, 0, "Mouse button");
+ uiDefButS(block, MENU, 0, str, xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->type, 0, 0, 0, 0, "Mouse button");
xstart+= butw2+5;
break;
case OL_KM_TWEAK:
@@ -814,7 +814,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
}
}
- if (TSELEM_OPEN(tselem,soops)) outliner_draw_keymapbuts(block, ar, soops, &te->subtree);
+ if (TSELEM_OPEN(tselem, soops)) outliner_draw_keymapbuts(block, ar, soops, &te->subtree);
}
}
@@ -857,7 +857,7 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa
}
}
- if (TSELEM_OPEN(tselem,soops)) outliner_buttons(C, block, ar, soops, &te->subtree);
+ if (TSELEM_OPEN(tselem, soops)) outliner_buttons(C, block, ar, soops, &te->subtree);
}
}
@@ -904,7 +904,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
arg.alpha= alpha;
if (tselem->type) {
- switch( tselem->type) {
+ switch ( tselem->type) {
case TSE_ANIM_DATA:
UI_icon_draw(x, y, ICON_ANIM_DATA); break; // xxx
case TSE_NLA:
@@ -932,7 +932,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
{
Object *ob= (Object *)tselem->id;
ModifierData *md= BLI_findlink(&ob->modifiers, tselem->nr);
- switch(md->type) {
+ switch (md->type) {
case eModifierType_Subsurf:
UI_icon_draw(x, y, ICON_MOD_SUBSURF); break;
case eModifierType_Armature:
@@ -1093,7 +1093,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
}
}
else {
- switch( GS(tselem->id->name)) {
+ switch ( GS(tselem->id->name)) {
case ID_SCE:
tselem_draw_icon_uibut(&arg, ICON_SCENE_DATA); break;
case ID_ME:
@@ -1108,7 +1108,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
{
Lamp *la= (Lamp *)tselem->id;
- switch(la->type) {
+ switch (la->type) {
case LA_LOCAL:
tselem_draw_icon_uibut(&arg, ICON_LAMP_POINT); break;
case LA_SUN:
@@ -1185,7 +1185,7 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa
uiSetRoundBox(UI_CNR_ALL);
glColor4ub(255, 255, 255, 100);
- uiRoundBox( (float)*offsx-0.5f*ufac, (float)ys-1.0f*ufac, (float)*offsx+UI_UNIT_Y-3.0f*ufac, (float)ys+UI_UNIT_Y-3.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac);
+ uiRoundBox((float) * offsx-0.5f*ufac, (float)ys-1.0f*ufac, (float)*offsx+UI_UNIT_Y-3.0f*ufac, (float)ys+UI_UNIT_Y-3.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac);
glEnable(GL_BLEND); /* roundbox disables */
}
@@ -1317,7 +1317,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
/* active circle */
if (active) {
uiSetRoundBox(UI_CNR_ALL);
- uiRoundBox( (float)startx+UI_UNIT_Y-1.5f*ufac, (float)*starty+2.0f*ufac, (float)startx+2.0f*UI_UNIT_Y-4.0f*ufac, (float)*starty+UI_UNIT_Y-1.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac);
+ uiRoundBox((float)startx+UI_UNIT_Y-1.5f*ufac, (float)*starty+2.0f*ufac, (float)startx+2.0f*UI_UNIT_Y-4.0f*ufac, (float)*starty+UI_UNIT_Y-1.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac);
glEnable(GL_BLEND); /* roundbox disables it */
te->flag |= TE_ACTIVE; // for lookup in display hierarchies
@@ -1332,7 +1332,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
icon_x = startx+5*ufac;
// icons a bit higher
- if (TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem, soops))
UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_DOWN);
else
UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_RIGHT);
@@ -1371,7 +1371,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
offsx+= (int)(UI_UNIT_X + UI_GetStringWidth(te->name));
/* closed item, we draw the icons, not when it's a scene, or master-server list though */
- if (!TSELEM_OPEN(tselem,soops)) {
+ if (!TSELEM_OPEN(tselem, soops)) {
if (te->subtree.first) {
if (tselem->type==0 && te->idcode==ID_SCE);
else if (tselem->type!=TSE_R_LAYER) { /* this tree element always has same amount of branches, so don't draw */
@@ -1397,7 +1397,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
te->ys= (float)*starty;
te->xend= startx+offsx;
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
*starty-= UI_UNIT_Y;
for (ten= te->subtree.first; ten; ten= ten->next)
@@ -1430,7 +1430,7 @@ static void outliner_draw_hierarchy(SpaceOops *soops, ListBase *lb, int startx,
*starty-= UI_UNIT_Y;
- if (TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem, soops))
outliner_draw_hierarchy(soops, &te->subtree, startx+UI_UNIT_X, starty);
}
@@ -1454,12 +1454,12 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase *
tselem= TREESTORE(te);
/* selection status */
- if (TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem, soops))
if (tselem->type == TSE_RNA_STRUCT)
glRecti(0, *starty+1, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, *starty+UI_UNIT_Y-1);
*starty-= UI_UNIT_Y;
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
outliner_draw_struct_marks(ar, soops, &te->subtree, starty);
if (tselem->type == TSE_RNA_STRUCT)
fdrawline(0, (float)*starty+UI_UNIT_Y, ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, (float)*starty+UI_UNIT_Y);
@@ -1480,7 +1480,7 @@ static void outliner_draw_selection(ARegion *ar, SpaceOops *soops, ListBase *lb,
glRecti(0, *starty+1, (int)ar->v2d.cur.xmax, *starty+UI_UNIT_Y-1);
}
*starty-= UI_UNIT_Y;
- if (TSELEM_OPEN(tselem,soops)) outliner_draw_selection(ar, soops, &te->subtree, starty);
+ if (TSELEM_OPEN(tselem, soops)) outliner_draw_selection(ar, soops, &te->subtree, starty);
}
}
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 62d93f62d0f..7b200e9593d 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -652,7 +652,7 @@ static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te,
te->ys= (float)(*starty);
*starty-= UI_UNIT_Y;
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
TreeElement *ten;
for (ten= te->subtree.first; ten; ten= ten->next) {
outliner_set_coordinates_element(soops, ten, startx+UI_UNIT_X, starty);
@@ -875,7 +875,7 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase
}
else tselem->flag |= TSE_CLOSED;
- if (TSELEM_OPEN(tselem,soops)) tree_element_show_hierarchy(scene, soops, &te->subtree);
+ if (TSELEM_OPEN(tselem, soops)) tree_element_show_hierarchy(scene, soops, &te->subtree);
}
}
@@ -1140,7 +1140,7 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportL
}
/* go over sub-tree */
- if (TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem, soops))
do_outliner_drivers_editop(soops, &te->subtree, reports, mode);
}
}
@@ -1308,7 +1308,7 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
}
/* go over sub-tree */
- if (TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem, soops))
do_outliner_keyingset_editop(soops, ks, &te->subtree, mode);
}
}
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index c06576e48a6..00b3979b074 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -99,7 +99,7 @@ static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *se
change |= 1;
}
}
- else if (TSELEM_OPEN(tselem,soops)) {
+ else if (TSELEM_OPEN(tselem, soops)) {
/* Only try selecting sub-elements if we haven't hit the right element yet
*
* Hack warning:
@@ -629,7 +629,7 @@ static int tree_element_active_keymap_item(bContext *UNUSED(C), TreeElement *te,
int tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
{
- switch(te->idcode) {
+ switch (te->idcode) {
/* Note: no ID_OB: objects are handled specially to allow multiple
* selection. See do_outliner_item_activate. */
case ID_MA:
@@ -652,7 +652,7 @@ int tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, TreeElement
/* Context can be NULL when set==0 */
int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set)
{
- switch(tselem->type) {
+ switch (tselem->type) {
case TSE_DEFGROUP:
return tree_element_active_defgroup(C, scene, te, tselem, set);
case TSE_BONE:
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 5c527face83..89eb51f73ba 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -96,7 +96,7 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb,
}
else {
int idcode= GS(tselem->id->name);
- switch(idcode) {
+ switch (idcode) {
case ID_SCE:
*scenelevel= 1;
break;
@@ -115,9 +115,9 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb,
}
}
}
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
set_operation_types(soops, &te->subtree,
- scenelevel, objectlevel, idlevel, datalevel);
+ scenelevel, objectlevel, idlevel, datalevel);
}
}
}
@@ -230,7 +230,7 @@ static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops *
operation_cb(C, scene, te, tsep, tselem);
}
}
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
outliner_do_libdata_operation(C, scene, soops, &te->subtree, operation_cb);
}
}
@@ -356,7 +356,7 @@ static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElemen
}
else {
/* link to scene */
- base= MEM_callocN( sizeof(Base), "add_base");
+ base= MEM_callocN(sizeof(Base), "add_base");
BLI_addhead(&scene->base, base);
base->lay= (1<<20)-1; /*v3d->lay;*/ /* would be nice to use the 3d layer but the include's not here */
gob->ob->flag |= SELECT;
@@ -388,7 +388,7 @@ void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOops *soop
operation_cb(C, scene_owner ? scene_owner : scene_act, te, NULL, tselem);
}
}
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
outliner_do_object_operation(C, scene_act, soops, &te->subtree, operation_cb);
}
}
@@ -495,7 +495,7 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li
operation_cb(event, te, tselem);
}
}
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
outliner_do_data_operation(soops, type, event, &te->subtree, operation_cb);
}
}
@@ -870,7 +870,7 @@ static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *l
operation_cb(te, tselem, tsep, newid);
}
}
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
outliner_do_id_set_operation(soops, type, &te->subtree, newid, operation_cb);
}
}
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index e2d43386c5e..026132e1f16 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -538,7 +538,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
int index;
temod->name = "Modifiers";
- for (index=0,md=ob->modifiers.first; md; index++,md=md->next) {
+ for (index=0, md=ob->modifiers.first; md; index++, md=md->next) {
TreeElement *te = outliner_add_element(soops, &temod->subtree, ob, temod, TSE_MODIFIER, index);
te->name= md->name;
te->directdata = md;
@@ -956,7 +956,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
te->name= RNA_struct_ui_name(ptr->type);
/* If searching don't expand RNA entries */
- if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
+ if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA", te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
iterprop= RNA_struct_iterator_property(ptr->type);
tot= RNA_property_collection_length(ptr, iterprop);
@@ -966,7 +966,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
if (!tselem->used)
tselem->flag &= ~TSE_CLOSED;
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
for (a=0; a<tot; a++)
outliner_add_element(soops, &te->subtree, (void*)ptr, te, TSE_RNA_PROPERTY, a);
}
@@ -988,13 +988,13 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
te->rnaptr= *ptr;
/* If searching don't expand RNA entries */
- if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
+ if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA", te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
if (proptype == PROP_POINTER) {
pptr= RNA_property_pointer_get(ptr, prop);
if (pptr.data) {
- if (TSELEM_OPEN(tselem,soops))
+ if (TSELEM_OPEN(tselem, soops))
outliner_add_element(soops, &te->subtree, (void*)&pptr, te, TSE_RNA_STRUCT, -1);
else
te->flag |= TE_LAZY_CLOSED;
@@ -1003,7 +1003,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
else if (proptype == PROP_COLLECTION) {
tot= RNA_property_collection_length(ptr, prop);
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
for (a=0; a<tot; a++) {
RNA_property_collection_lookup_int(ptr, prop, a, &pptr);
outliner_add_element(soops, &te->subtree, (void*)&pptr, te, TSE_RNA_STRUCT, a);
@@ -1015,7 +1015,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
else if (ELEM3(proptype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
tot= RNA_property_array_length(ptr, prop);
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
for (a=0; a<tot; a++)
outliner_add_element(soops, &te->subtree, (void*)ptr, te, TSE_RNA_ARRAY_ELEM, a);
}
@@ -1048,7 +1048,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
te->directdata= idv;
te->name= km->idname;
- if (TSELEM_OPEN(tselem,soops)) {
+ if (TSELEM_OPEN(tselem, soops)) {
a= 0;
for (kmi = km->items.first; kmi; kmi = kmi->next, a++) {
@@ -1351,7 +1351,7 @@ static int outliner_filter_tree(SpaceOops *soops, ListBase *lb)
/* flag as not a found item */
tselem->flag &= ~TSE_SEARCHMATCH;
- if ((!TSELEM_OPEN(tselem,soops)) || outliner_filter_tree(soops, &te->subtree)==0) {
+ if ((!TSELEM_OPEN(tselem, soops)) || outliner_filter_tree(soops, &te->subtree)==0) {
outliner_free_tree(&te->subtree);
BLI_remlink(lb, te);
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index ed050b7f93d..c2a3affa1b6 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -182,9 +182,9 @@ static void outliner_main_area_free(ARegion *UNUSED(ar))
static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SCENE:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_OB_ACTIVE:
case ND_OB_SELECT:
case ND_OB_VISIBLE:
@@ -200,7 +200,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_OBJECT:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_TRANSFORM:
/* transform doesn't change outliner data */
break;
@@ -212,7 +212,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case ND_CONSTRAINT:
- switch(wmn->action) {
+ switch (wmn->action) {
case NA_ADDED:
case NA_REMOVED:
case NA_RENAME:
@@ -244,7 +244,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case NC_MATERIAL:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_SHADING:
case ND_SHADING_DRAW:
ED_region_tag_redraw(ar);
@@ -255,7 +255,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case NC_GEOM:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_DATA:
/* needed for vertex groups only, no special notifier atm so use NC_GEOM|ND_DATA */
ED_region_tag_redraw(ar);
@@ -263,7 +263,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
}
break;
case NC_ANIMATION:
- switch(wmn->data) {
+ switch (wmn->data) {
case ND_NLA_ACTCHANGE:
case ND_KEYFRAME:
ED_region_tag_redraw(ar);
@@ -299,7 +299,7 @@ static void outliner_header_area_free(ARegion *UNUSED(ar))
static void outliner_header_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SCENE:
if (wmn->data == ND_KEYINGSET)
ED_region_tag_redraw(ar);
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index dfa733deac6..09d974fe4b8 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -188,7 +188,7 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
else if (RNA_struct_find_property(op->ptr, "files")) {
/* used for image strip */
/* best guess, first images name */
- RNA_BEGIN(op->ptr, itemptr, "files") {
+ RNA_BEGIN (op->ptr, itemptr, "files") {
char *name = RNA_string_get_alloc(&itemptr, "name", NULL, 0);
BLI_strncpy(seq_load->name, name, sizeof(seq_load->name));
MEM_freeN(name);
@@ -420,8 +420,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
BLI_split_dir_part(seq_load.path, dir_only, sizeof(dir_only));
- RNA_BEGIN(op->ptr, itemptr, "files")
- {
+ RNA_BEGIN (op->ptr, itemptr, "files") {
RNA_string_get(&itemptr, "name", file_only);
BLI_join_dirfile(seq_load.path, sizeof(seq_load.path), dir_only, file_only);
@@ -595,7 +594,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
strip = seq->strip;
se = strip->stripdata;
- RNA_BEGIN(op->ptr, itemptr, "files") {
+ RNA_BEGIN (op->ptr, itemptr, "files") {
char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0);
BLI_strncpy(se->name, filename, sizeof(se->name));
MEM_freeN(filename);
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index cd0c8779c39..38a5151590e 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -206,14 +206,12 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x
length = floor((waveform->length - startsample) / samplestep);
glBegin(GL_LINE_STRIP);
- for (i = 0; i < length; i++)
- {
+ for (i = 0; i < length; i++) {
pos = startsample + i * samplestep;
value = waveform->data[pos * 3];
- for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++)
- {
+ for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++) {
if (value > waveform->data[j * 3])
value = waveform->data[j * 3];
}
@@ -223,14 +221,12 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x
glEnd();
glBegin(GL_LINE_STRIP);
- for (i = 0; i < length; i++)
- {
+ for (i = 0; i < length; i++) {
pos = startsample + i * samplestep;
value = waveform->data[pos * 3 + 1];
- for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++)
- {
+ for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++) {
if (value < waveform->data[j * 3 + 1])
value = waveform->data[j * 3 + 1];
}
@@ -930,7 +926,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
glTexCoord2f(1.0f, 1.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymax);
glTexCoord2f(1.0f, 0.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymin);
}
- glEnd( );
+ glEnd();
glBindTexture(GL_TEXTURE_2D, last_texid);
glDisable(GL_TEXTURE_2D);
glDeleteTextures(1, &texid);
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index bd306f2d646..d2b1cccfefc 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -87,7 +87,6 @@ EnumPropertyItem sequencer_prop_effect_types[] = {
{SEQ_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", "Gamma Cross effect strip type"},
{SEQ_MUL, "MULTIPLY", 0, "Multiply", "Multiply effect strip type"},
{SEQ_OVERDROP, "OVER_DROP", 0, "Alpha Over Drop", "Alpha Over Drop effect strip type"},
- {SEQ_PLUGIN, "PLUGIN", 0, "Plugin", "Plugin effect strip type"},
{SEQ_WIPE, "WIPE", 0, "Wipe", "Wipe effect strip type"},
{SEQ_GLOW, "GLOW", 0, "Glow", "Glow effect strip type"},
{SEQ_TRANSFORM, "TRANSFORM", 0, "Transform", "Transform effect strip type"},
@@ -202,7 +201,7 @@ static void seq_proxy_build_job(const bContext *C)
WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, proxy_endjob);
}
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if ((seq->flag & SELECT)) {
context = seq_proxy_rebuild_context(pj->main, pj->scene, seq);
link = BLI_genericNodeN(context);
@@ -462,8 +461,7 @@ void deselect_all_seq(Scene *scene)
if (ed == NULL) return;
- SEQP_BEGIN(ed, seq)
- {
+ SEQP_BEGIN (ed, seq) {
seq->flag &= ~SEQ_ALLSEL;
}
SEQ_END
@@ -846,7 +844,7 @@ static int insert_gap(Scene *scene, int gap, int cfra)
if (ed == NULL) return 0;
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (seq->startdisp >= cfra) {
seq->start += gap;
calc_sequence(scene, seq);
@@ -872,8 +870,7 @@ static void UNUSED_FUNCTION(touch_seq_files) (Scene * scene)
WM_cursor_wait(1);
- SEQP_BEGIN(ed, seq)
- {
+ SEQP_BEGIN (ed, seq) {
if (seq->flag & SELECT) {
if (seq->type == SEQ_MOVIE) {
if (seq->strip && seq->strip->stripdata) {
@@ -900,8 +897,7 @@ static void set_filter_seq(Scene *scene)
if (okee("Set Deinterlace") == 0) return;
- SEQP_BEGIN(ed, seq)
- {
+ SEQP_BEGIN (ed, seq) {
if (seq->flag & SELECT) {
if (seq->type == SEQ_MOVIE) {
seq->flag |= SEQ_FILTERY;
@@ -936,8 +932,7 @@ static void UNUSED_FUNCTION(seq_remap_paths) (Scene * scene)
if (strcmp(to, from) == 0)
return;
- SEQP_BEGIN(ed, seq)
- {
+ SEQP_BEGIN (ed, seq) {
if (seq->flag & SELECT) {
if (strncmp(seq->strip->dir, from, strlen(from)) == 0) {
printf("found %s\n", seq->strip->dir);
@@ -1482,7 +1477,7 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
BLI_movelisttolist(ed->seqbasep, &newlist);
if (cut_side != SEQ_SIDE_BOTH) {
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (cut_side == SEQ_SIDE_LEFT) {
if (seq->startdisp >= cut_frame) {
seq->flag &= ~SEQ_ALLSEL;
@@ -3015,7 +3010,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
}
seq->strip->stripdata = se = MEM_callocN(len * sizeof(StripElem), "stripelem");
- RNA_BEGIN(op->ptr, itemptr, "files") {
+ RNA_BEGIN (op->ptr, itemptr, "files") {
char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0);
BLI_strncpy(se->name, filename, sizeof(se->name));
MEM_freeN(filename);
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index c40a809e6af..e63a3052d26 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -51,7 +51,7 @@ struct ARegion *sequencer_has_buttons_region(struct ScrArea *sa);
/* sequencer_draw.c */
void draw_timeline_seq(const struct bContext *C, struct ARegion *ar);
-void draw_image_seq(const struct bContext* C, struct Scene *scene,struct ARegion *ar, struct SpaceSeq *sseq, int cfra, int offset);
+void draw_image_seq(const struct bContext* C, struct Scene *scene, struct ARegion *ar, struct SpaceSeq *sseq, int cfra, int offset);
void seq_reset_imageofs(struct SpaceSeq *sseq);
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index 2447ca6cfbe..f326052ea60 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -362,7 +362,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
deselect_all_seq(scene);
UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL);
- SEQP_BEGIN(ed, seq)
+ SEQP_BEGIN (ed, seq)
{
if (x < CFRA) {
if (seq->enddisp < CFRA) {
@@ -940,7 +940,7 @@ static short select_grouped_type(Editing *ed, Sequence *actseq)
Sequence *seq;
short changed = FALSE;
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (seq->type == actseq->type) {
seq->flag |= SELECT;
changed = TRUE;
@@ -957,7 +957,7 @@ static short select_grouped_type_basic(Editing *ed, Sequence *actseq)
short changed = FALSE;
short is_sound = SEQ_IS_SOUND(actseq);
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (is_sound ? SEQ_IS_SOUND(seq) : !SEQ_IS_SOUND(seq)) {
seq->flag |= SELECT;
changed = TRUE;
@@ -974,7 +974,7 @@ static short select_grouped_type_effect(Editing *ed, Sequence *actseq)
short changed = FALSE;
short is_effect = SEQ_IS_EFFECT(actseq);
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (is_effect ? SEQ_IS_EFFECT(seq) : !SEQ_IS_EFFECT(seq)) {
seq->flag |= SELECT;
changed = TRUE;
@@ -995,7 +995,7 @@ static short select_grouped_data(Editing *ed, Sequence *actseq)
return changed;
if (SEQ_HAS_PATH(actseq) && dir) {
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (SEQ_HAS_PATH(seq) && seq->strip && strcmp(seq->strip->dir, dir) == 0) {
seq->flag |= SELECT;
changed = TRUE;
@@ -1005,7 +1005,7 @@ static short select_grouped_data(Editing *ed, Sequence *actseq)
}
else if (actseq->type == SEQ_SCENE) {
Scene *sce = actseq->scene;
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (seq->type == SEQ_SCENE && seq->scene == sce) {
seq->flag |= SELECT;
changed = TRUE;
@@ -1015,7 +1015,7 @@ static short select_grouped_data(Editing *ed, Sequence *actseq)
}
else if (actseq->type == SEQ_MOVIECLIP) {
MovieClip *clip = actseq->clip;
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (seq->type == SEQ_MOVIECLIP && seq->clip == clip) {
seq->flag |= SELECT;
changed = TRUE;
@@ -1037,14 +1037,14 @@ static short select_grouped_effect(Editing *ed, Sequence *actseq)
for (i = 0; i <= SEQ_EFFECT_MAX; i++)
effects[i] = FALSE;
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (ELEM3(actseq, seq->seq1, seq->seq2, seq->seq3)) {
effects[seq->type] = TRUE;
}
}
SEQ_END;
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (effects[seq->type]) {
if (seq->seq1) seq->seq1->flag |= SELECT;
if (seq->seq2) seq->seq2->flag |= SELECT;
@@ -1062,7 +1062,7 @@ static short select_grouped_time_overlap(Editing *ed, Sequence *actseq)
Sequence *seq;
short changed = FALSE;
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
if (!((seq->startdisp >= actseq->enddisp) || (seq->enddisp < actseq->startdisp))) {
seq->flag |= SELECT;
changed = TRUE;
@@ -1083,7 +1083,7 @@ static short select_grouped_effect_link(Editing *ed, Sequence *actseq)
int machine = actseq->machine;
SeqIterator iter;
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
seq->tmp= NULL;
}
SEQ_END;
@@ -1153,7 +1153,7 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op)
}
if (extend == 0) {
- SEQP_BEGIN(ed, seq) {
+ SEQP_BEGIN (ed, seq) {
seq->flag &= ~SELECT;
changed = TRUE;
}
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index ec340dd323e..e421ace75a0 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -466,6 +466,7 @@ static void sequencer_preview_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_FRAME:
case ND_MARKERS:
case ND_SEQUENCER:
+ case ND_RENDER_OPTIONS:
ED_region_tag_redraw(ar);
break;
}
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index beccca51265..032cc4ecbf2 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -187,6 +187,7 @@ static void text_operatortypes(void)
WM_operatortype_append(TEXT_OT_paste);
WM_operatortype_append(TEXT_OT_copy);
WM_operatortype_append(TEXT_OT_cut);
+ WM_operatortype_append(TEXT_OT_duplicate_line);
WM_operatortype_append(TEXT_OT_convert_whitespace);
WM_operatortype_append(TEXT_OT_uncomment);
@@ -297,6 +298,8 @@ static void text_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "TEXT_OT_cut", DELKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "TEXT_OT_copy", INSERTKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "TEXT_OT_paste", INSERTKEY, KM_PRESS, KM_SHIFT, 0);
+
+ WM_keymap_add_item(keymap, "TEXT_OT_duplicate_line", DKEY, KM_PRESS, KM_CTRL, 0);
if (U.uiflag & USER_MMB_PASTE) { // XXX not dynamic
kmi = WM_keymap_add_item(keymap, "TEXT_OT_paste", MIDDLEMOUSE, KM_PRESS, 0, 0);
@@ -353,7 +356,6 @@ static void text_keymap(struct wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", ENDKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0)->ptr, "type", FILE_BOTTOM);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", DELKEY, KM_PRESS, 0, 0)->ptr, "type", DEL_NEXT_CHAR);
- RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", DKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_NEXT_CHAR);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", BACKSPACEKEY, KM_PRESS, 0, 0)->ptr, "type", DEL_PREV_CHAR);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", BACKSPACEKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", DEL_PREV_CHAR); /* same as above [#26623] */
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", DELKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_NEXT_WORD);
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 84f960ecf2a..ffb686b6810 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -130,8 +130,7 @@ static void flatten_string_append(FlattenString *fs, const char *c, int accum, i
fs->accum = naccum;
}
- for (i = 0; i < len; i++)
- {
+ for (i = 0; i < len; i++) {
fs->buf[fs->pos + i] = c[i];
fs->accum[fs->pos + i] = accum;
}
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index 2d297dd20d7..07d2dffb95b 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -118,6 +118,7 @@ void TEXT_OT_refresh_pyconstraints(struct wmOperatorType *ot);
void TEXT_OT_paste(struct wmOperatorType *ot);
void TEXT_OT_copy(struct wmOperatorType *ot);
void TEXT_OT_cut(struct wmOperatorType *ot);
+void TEXT_OT_duplicate_line(struct wmOperatorType *ot);
void TEXT_OT_convert_whitespace(struct wmOperatorType *ot);
void TEXT_OT_uncomment(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 730dfb7d979..f60217ba8ac 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -826,6 +826,36 @@ void TEXT_OT_paste(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "selection", 0, "Selection", "Paste text selected elsewhere rather than copied (X11 only)");
}
+/**************** duplicate operator *******************/
+
+static int text_duplicate_line_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Text *text= CTX_data_edit_text(C);
+
+ txt_duplicate_line(text);
+
+ WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
+
+ /* run the script while editing, evil but useful */
+ if (CTX_wm_space_text(C)->live_edit) {
+ text_run_script(C, NULL);
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void TEXT_OT_duplicate_line(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Duplicate Line";
+ ot->idname = "TEXT_OT_duplicate_line";
+ ot->description = "Duplicate the current line";
+
+ /* api callbacks */
+ ot->exec = text_duplicate_line_exec;
+ ot->poll = text_edit_poll;
+}
+
/******************* copy operator *********************/
static void txt_copy_clipboard(Text *text)
diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c
index 23fff8fb274..f980e19e9c8 100644
--- a/source/blender/editors/space_text/text_python.c
+++ b/source/blender/editors/space_text/text_python.c
@@ -364,20 +364,6 @@ static short UNUSED_FUNCTION(do_texttools) (SpaceText * st, char ascii, unsigned
return swallow;
}
-#if 0
-#ifdef WITH_PYTHON
-/* Run text plugin scripts if enabled */
-if (st->doplugins && event && val)
-{
- if (BPY_menu_do_shortcut(PYMENU_TEXTPLUGIN, event, qual)) {
- do_draw = 1;
- }
-}
-#endif
-if (do_draw)
- ; // XXX redraw_alltext();
-#endif
-
static short UNUSED_FUNCTION(do_textmarkers) (SpaceText * st, char ascii, unsigned short evnt, short val)
{
Text *text;
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index 5e56dfa728e..674dd670cf7 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -111,7 +111,7 @@ static void time_draw_cache(SpaceTime *stime, Object *ob)
int i, sta = pid->cache->startframe, end = pid->cache->endframe;
int len = (end - sta + 1)*4;
- switch(pid->type) {
+ switch (pid->type) {
case PTCACHE_TYPE_SOFTBODY:
if (!(stime->cache_display & TIME_CACHE_SOFTBODY)) continue;
break;
@@ -171,7 +171,7 @@ static void time_draw_cache(SpaceTime *stime, Object *ob)
glTranslatef(0.0, (float)V2D_SCROLL_HEIGHT+yoffs, 0.0);
glScalef(1.0, CACHE_DRAW_HEIGHT, 0.0);
- switch(pid->type) {
+ switch (pid->type) {
case PTCACHE_TYPE_SOFTBODY:
col[0] = 1.0; col[1] = 0.4; col[2] = 0.02;
col[3] = 0.1;
@@ -357,8 +357,7 @@ static void time_draw_keyframes(const bContext *C, SpaceTime *stime, ARegion *ar
short active_done = 0;
/* draw keyframes from all selected objects */
- CTX_DATA_BEGIN(C, Object*, obsel, selected_objects)
- {
+ CTX_DATA_BEGIN (C, Object*, obsel, selected_objects) {
/* last arg is 0, since onlysel doesn't apply here... */
time_draw_idblock_keyframes(v2d, (ID *)obsel, 0);
@@ -509,7 +508,7 @@ static void time_main_area_draw(const bContext *C, ARegion *ar)
static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SPACE:
if (wmn->data == ND_SPACE_TIME)
ED_region_tag_redraw(ar);
@@ -549,7 +548,7 @@ static void time_header_area_draw(const bContext *C, ARegion *ar)
static void time_header_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
- switch(wmn->category) {
+ switch (wmn->category) {
case NC_SCREEN:
if (wmn->data==ND_ANIMPLAY)
ED_region_tag_redraw(ar);
diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c
index e9bf9345b5c..6c683eba085 100644
--- a/source/blender/editors/space_userpref/space_userpref.c
+++ b/source/blender/editors/space_userpref/space_userpref.c
@@ -145,7 +145,7 @@ static void userpref_header_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn
{
/* context changes */
#if 0
- switch(wmn->category) {
+ switch (wmn->category) {
default:
break;
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 4508dae36e7..1f431122929 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -47,6 +47,7 @@
#include "DNA_speaker_types.h"
#include "DNA_world_types.h"
#include "DNA_armature_types.h"
+#include "DNA_object_types.h"
#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
@@ -2213,7 +2214,7 @@ void nurbs_foreachScreenVert(
short s[2] = {IS_CLIPPED, 0};
Nurb *nu;
int i;
- ListBase *nurbs = curve_editnurbs(cu);
+ ListBase *nurbs = BKE_curve_editNurbs_get(cu);
ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
@@ -3963,7 +3964,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
break;
case OB_MBALL:
- if (is_basis_mball(ob)) {
+ if (BKE_metaball_is_basis(ob)) {
lb = &ob->disp;
if (lb->first == NULL) makeDispListMBall(scene, ob);
if (lb->first == NULL) return 1;
@@ -5648,7 +5649,7 @@ static void curve_draw_speed(Scene *scene, Object *ob)
if (icu == NULL || icu->totvert < 2)
return;
- glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) );
+ glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
bglBegin(GL_POINTS);
for (a = 0, bezt = icu->bezt; a < icu->totvert; a++, bezt++) {
@@ -6140,7 +6141,7 @@ static void draw_bounding_volume(Scene *scene, Object *ob, char type)
bb = ob->bb ? ob->bb : ( (Curve *)ob->data)->bb;
}
else if (ob->type == OB_MBALL) {
- if (is_basis_mball(ob)) {
+ if (BKE_metaball_is_basis(ob)) {
bb = ob->bb;
if (bb == NULL) {
makeDispListMBall(scene, ob);
@@ -6231,7 +6232,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
}
}
else if (ob->type == OB_MBALL) {
- if (is_basis_mball(ob)) {
+ if (BKE_metaball_is_basis(ob)) {
if ((base->flag & OB_FROMDUPLI) == 0)
drawDispListwire(&ob->disp);
}
@@ -6291,7 +6292,7 @@ static void drawWireExtra(Scene *scene, RegionView3D *rv3d, Object *ob)
}
}
else if (ob->type == OB_MBALL) {
- if (is_basis_mball(ob)) {
+ if (BKE_metaball_is_basis(ob)) {
drawDispListwire(&ob->disp);
}
}
@@ -6670,7 +6671,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
cu = ob->data;
if (cu->editnurb) {
- ListBase *nurbs = curve_editnurbs(cu);
+ ListBase *nurbs = BKE_curve_editNurbs_get(cu);
drawnurb(scene, v3d, rv3d, base, nurbs->first, dt);
}
else if (dt == OB_BOUNDBOX) {
@@ -7168,7 +7169,7 @@ static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset)
MVert *mvert = me->mvert;
data.mvert = mvert;
data.offset = (void *)(intptr_t) offset;
- glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) );
+ glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
bglBegin(GL_POINTS);
dm->foreachMappedVert(dm, bbs_obmode_mesh_verts__mapFunc, &data);
bglEnd();
@@ -7191,7 +7192,7 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset)
{
void *ptrs[2] = {(void *)(intptr_t) offset, em};
- glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) );
+ glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
bglBegin(GL_POINTS);
dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, ptrs);
bglEnd();
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 0e520a511fe..2bb08a4b9b4 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -47,7 +47,6 @@
#include "BKE_curve.h"
#include "BKE_constraint.h" // for the get_constraint_target function
#include "BKE_DerivedMesh.h"
-#include "BKE_deform.h"
#include "BKE_displist.h"
#include "BKE_effect.h"
#include "BKE_font.h"
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index c3ff00e3c82..13129616843 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -211,7 +211,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BPoint *bp;
BezTriple *bezt;
int a;
- ListBase *nurbs = curve_editnurbs(cu);
+ ListBase *nurbs = BKE_curve_editNurbs_get(cu);
StructRNA *seltype = NULL;
void *selp = NULL;
@@ -333,7 +333,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Y:", 0, yi -= buth, 200, buth,
&(tfp->ve_median[1]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
uiButSetUnitType(but, PROP_UNIT_LENGTH);
- but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:",0, yi -= buth, 200, buth,
+ but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:", 0, yi -= buth, 200, buth,
&(tfp->ve_median[2]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
uiButSetUnitType(but, PROP_UNIT_LENGTH);
@@ -509,7 +509,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BPoint *bp;
BezTriple *bezt;
int a;
- ListBase *nurbs = curve_editnurbs(cu);
+ ListBase *nurbs = BKE_curve_editNurbs_get(cu);
const float scale_w = compute_scale_factor(ve_median[4], median[4]);
nu = nurbs->first;
@@ -571,8 +571,8 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
bp++;
}
}
- test2DNurb(nu);
- testhandlesNurb(nu); /* test for bezier too */
+ BKE_nurb_test2D(nu);
+ BKE_nurb_handles_test(nu); /* test for bezier too */
nu = nu->next;
}
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 6f637afd293..2f66fdf8cd4 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -700,11 +700,12 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
fac = fac * fac;
interp_v3_v3v3(xaxis, xaxis, m_inv[0], fac);
}
- else
-#endif
- {
+ else {
copy_v3_v3(xaxis, m_inv[0]);
}
+#else
+ copy_v3_v3(xaxis, m_inv[0]);
+#endif
/* Determine the direction of the x vector (for rotating up and down) */
/* This can likely be computed directly from the quaternion. */
@@ -1554,7 +1555,9 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom,
if (!use_cam_zoom) {
if (zfac != 1.0f && zfac * vod->rv3d->dist > 0.001f * vod->grid &&
zfac * vod->rv3d->dist < 10.0f * vod->far)
+ {
view_zoom_mouseloc(vod->ar, zfac, vod->oldx, vod->oldy);
+ }
}
/* these limits were in old code too */
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index ab4eca2e303..c4309980b18 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -294,15 +294,15 @@ static char *view3d_modeselect_pup(Scene *scene)
if (!((ID *)ob->data)->lib) {
/* if active object is editable */
- if (ELEM6(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_LATTICE)) {
- str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
- }
- else if (ob->type == OB_ARMATURE) {
+ if (ob->type == OB_ARMATURE) {
if (ob->mode & OB_MODE_POSE)
str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT | OB_MODE_POSE, ICON_EDITMODE_HLT);
else
str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
}
+ else if (OB_TYPE_SUPPORT_EDITMODE(ob->type)) {
+ str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
+ }
if (ob->type == OB_MESH) {
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index ac9c32816dd..e1bbc0e1545 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -48,9 +48,12 @@
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
-#include "BLI_blenlib.h"
+#include "BLI_lasso.h"
+#include "BLI_rect.h"
#include "BLI_rand.h"
#include "BLI_linklist.h"
+#include "BLI_listbase.h"
+#include "BLI_string.h"
#include "BLI_utildefines.h"
/* vertex box select */
@@ -319,79 +322,6 @@ static int edge_inside_rect(rcti *rect, short x1, short y1, short x2, short y2)
#define MOVES_GESTURE 50
#define MOVES_LASSO 500
-int lasso_inside(int mcords[][2], short moves, int sx, int sy)
-{
- /* we do the angle rule, define that all added angles should be about zero or 2*PI */
- float angletot = 0.0, len, dot, ang, cross, fp1[2], fp2[2];
- int a;
- int *p1, *p2;
-
- if (sx == IS_CLIPPED)
- return 0;
-
- p1 = mcords[moves - 1];
- p2 = mcords[0];
-
- /* first vector */
- fp1[0] = (float)(p1[0] - sx);
- fp1[1] = (float)(p1[1] - sy);
- len = sqrt(fp1[0] * fp1[0] + fp1[1] * fp1[1]);
- fp1[0] /= len;
- fp1[1] /= len;
-
- for (a = 0; a < moves; a++) {
- /* second vector */
- fp2[0] = (float)(p2[0] - sx);
- fp2[1] = (float)(p2[1] - sy);
- len = sqrt(fp2[0] * fp2[0] + fp2[1] * fp2[1]);
- fp2[0] /= len;
- fp2[1] /= len;
-
- /* dot and angle and cross */
- dot = fp1[0] * fp2[0] + fp1[1] * fp2[1];
- ang = fabs(saacos(dot));
-
- cross = (float)((p1[1] - p2[1]) * (p1[0] - sx) + (p2[0] - p1[0]) * (p1[1] - sy));
-
- if (cross < 0.0f) angletot -= ang;
- else angletot += ang;
-
- /* circulate */
- fp1[0] = fp2[0]; fp1[1] = fp2[1];
- p1 = p2;
- p2 = mcords[a + 1];
- }
-
- if (fabs(angletot) > 4.0) return 1;
- return 0;
-}
-
-/* edge version for lasso select. we assume boundbox check was done */
-int lasso_inside_edge(int mcords[][2], short moves, int x0, int y0, int x1, int y1)
-{
- int v1[2], v2[2];
- int a;
-
- if (x0 == IS_CLIPPED || x1 == IS_CLIPPED)
- return 0;
-
- v1[0] = x0, v1[1] = y0;
- v2[0] = x1, v2[1] = y1;
-
- /* check points in lasso */
- if (lasso_inside(mcords, moves, v1[0], v1[1])) return 1;
- if (lasso_inside(mcords, moves, v2[0], v2[1])) return 1;
-
- /* no points in lasso, so we have to intersect with lasso edge */
-
- if (isect_line_line_v2_int(mcords[0], mcords[moves - 1], v1, v2) > 0) return 1;
- for (a = 0; a < moves - 1; a++) {
- if (isect_line_line_v2_int(mcords[a], mcords[a + 1], v1, v2) > 0) return 1;
- }
-
- return 0;
-}
-
/* warning; lasso select with backbuffer-check draws in backbuf with persp(PERSP_WIN)
* and returns with persp(PERSP_VIEW). After lasso select backbuf is not OK
@@ -412,7 +342,7 @@ static void do_lasso_select_pose(ViewContext *vc, Object *ob, int mcords[][2], s
mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail);
project_int(vc->ar, vec, sco2);
- if (lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) {
+ if (BLI_lasso_is_edge_inside(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1], IS_CLIPPED)) {
if (select) pchan->bone->flag |= BONE_SELECTED;
else pchan->bone->flag &= ~BONE_SELECTED;
}
@@ -441,7 +371,7 @@ static void do_lasso_select_objects(ViewContext *vc, int mcords[][2], short move
for (base = vc->scene->base.first; base; base = base->next) {
if (BASE_SELECTABLE(vc->v3d, base)) { /* use this to avoid un-needed lasso lookups */
project_short(vc->ar, base->object->obmat[3], &base->sx);
- if (lasso_inside(mcords, moves, base->sx, base->sy)) {
+ if (BLI_lasso_is_point_inside(mcords, moves, base->sx, base->sy, IS_CLIPPED)) {
if (select) ED_base_object_select(base, BA_SELECT);
else ED_base_object_select(base, BA_DESELECT);
@@ -454,26 +384,13 @@ static void do_lasso_select_objects(ViewContext *vc, int mcords[][2], short move
}
}
-static void lasso_select_boundbox(rcti *rect, int mcords[][2], short moves)
-{
- short a;
-
- rect->xmin = rect->xmax = mcords[0][0];
- rect->ymin = rect->ymax = mcords[0][1];
-
- for (a = 1; a < moves; a++) {
- if (mcords[a][0] < rect->xmin) rect->xmin = mcords[a][0];
- else if (mcords[a][0] > rect->xmax) rect->xmax = mcords[a][0];
- if (mcords[a][1] < rect->ymin) rect->ymin = mcords[a][1];
- else if (mcords[a][1] > rect->ymax) rect->ymax = mcords[a][1];
- }
-}
-
static void do_lasso_select_mesh__doSelectVert(void *userData, BMVert *eve, int x, int y, int UNUSED(index))
{
LassoSelectUserData *data = userData;
- if (BLI_in_rcti(data->rect, x, y) && lasso_inside(data->mcords, data->moves, x, y)) {
+ if (BLI_in_rcti(data->rect, x, y) &&
+ BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED))
+ {
BM_vert_select_set(data->vc->em->bm, eve, data->select);
}
}
@@ -484,14 +401,15 @@ static void do_lasso_select_mesh__doSelectEdge(void *userData, BMEdge *eed, int
if (EDBM_backbuf_check(bm_solidoffs + index)) {
if (data->pass == 0) {
if (edge_fully_inside_rect(data->rect, x0, y0, x1, y1) &&
- lasso_inside(data->mcords, data->moves, x0, y0) &&
- lasso_inside(data->mcords, data->moves, x1, y1)) {
+ BLI_lasso_is_point_inside(data->mcords, data->moves, x0, y0, IS_CLIPPED) &&
+ BLI_lasso_is_point_inside(data->mcords, data->moves, x1, y1, IS_CLIPPED))
+ {
BM_edge_select_set(data->vc->em->bm, eed, data->select);
data->done = 1;
}
}
else {
- if (lasso_inside_edge(data->mcords, data->moves, x0, y0, x1, y1)) {
+ if (BLI_lasso_is_edge_inside(data->mcords, data->moves, x0, y0, x1, y1, IS_CLIPPED)) {
BM_edge_select_set(data->vc->em->bm, eed, data->select);
}
}
@@ -501,7 +419,9 @@ static void do_lasso_select_mesh__doSelectFace(void *userData, BMFace *efa, int
{
LassoSelectUserData *data = userData;
- if (BLI_in_rcti(data->rect, x, y) && lasso_inside(data->mcords, data->moves, x, y)) {
+ if (BLI_in_rcti(data->rect, x, y) &&
+ BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED))
+ {
BM_face_select_set(data->vc->em->bm, efa, data->select);
}
}
@@ -513,7 +433,7 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves,
rcti rect;
int bbsel;
- lasso_select_boundbox(&rect, mcords, moves);
+ BLI_lasso_boundbox(&rect, mcords, moves);
/* set editmesh */
vc->em = BMEdit_FromObject(vc->obedit);
@@ -567,73 +487,13 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves,
EDBM_selectmode_flush(vc->em);
}
-/* BMESH_TODO */
-#if 0
-/* this is an exception in that its the only lasso that dosnt use the 3d view (uses space image view) */
-static void do_lasso_select_mesh_uv(int mcords[][2], short moves, short select)
-{
- EditFace *efa;
- MTFace *tf;
- int screenUV[2], nverts, i, ok = 1;
- rcti rect;
-
- lasso_select_boundbox(&rect, mcords, moves);
-
- if (draw_uvs_face_check()) { /* Face Center Sel */
- float cent[2];
- ok = 0;
- for (efa = em->faces.first; efa; efa = efa->next) {
- /* assume not touched */
- efa->tmp.l = 0;
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if ((select) != (simaFaceSel_Check(efa, tf))) {
- uv_center(tf->uv, cent, (void *)efa->v4);
- uvco_to_areaco_noclip(cent, screenUV);
- if (BLI_in_rcti(&rect, screenUV[0], screenUV[1]) && lasso_inside(mcords, moves, screenUV[0], screenUV[1])) {
- efa->tmp.l = ok = 1;
- }
- }
- }
- /* (de)selects all tagged faces and deals with sticky modes */
- if (ok)
- uvface_setsel__internal(select);
-
- }
- else { /* Vert Sel*/
- for (efa = em->faces.first; efa; efa = efa->next) {
- tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
- if (uvedit_face_visible_test(scene, ima, efa, tf)) {
- nverts = efa->v4 ? 4 : 3;
- for (i = 0; i < nverts; i++) {
- if ((select) != (simaUVSel_Check(efa, tf, i))) {
- uvco_to_areaco_noclip(tf->uv[i], screenUV);
- if (BLI_in_rcti(&rect, screenUV[0], screenUV[1]) && lasso_inside(mcords, moves, screenUV[0], screenUV[1])) {
- if (select) {
- simaUVSel_Set(efa, tf, i);
- }
- else {
- simaUVSel_UnSet(efa, tf, i);
- }
- }
- }
- }
- }
- }
- }
- if (ok && G.sima->flag & SI_SYNC_UVSEL) {
- if (select) EM_select_flush(vc->em);
- else EM_deselect_flush(vc->em);
- }
-}
-#endif
-
static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
{
LassoSelectUserData *data = userData;
Object *obedit = data->vc->obedit;
Curve *cu = (Curve *)obedit->data;
- if (lasso_inside(data->mcords, data->moves, x, y)) {
+ if (BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED)) {
if (bp) {
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
if (bp == cu->lastsel && !(bp->f1 & 1)) cu->lastsel = NULL;
@@ -681,7 +541,7 @@ static void do_lasso_select_lattice__doSelect(void *userData, BPoint *bp, int x,
{
LassoSelectUserData *data = userData;
- if (lasso_inside(data->mcords, data->moves, x, y)) {
+ if (BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED)) {
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
}
}
@@ -722,20 +582,22 @@ static void do_lasso_select_armature(ViewContext *vc, int mcords[][2], short mov
project_short(vc->ar, vec, sco2);
didpoint = 0;
- if (lasso_inside(mcords, moves, sco1[0], sco1[1])) {
+ if (BLI_lasso_is_point_inside(mcords, moves, sco1[0], sco1[1], IS_CLIPPED)) {
if (select) ebone->flag |= BONE_ROOTSEL;
else ebone->flag &= ~BONE_ROOTSEL;
didpoint = 1;
change = TRUE;
}
- if (lasso_inside(mcords, moves, sco2[0], sco2[1])) {
+ if (BLI_lasso_is_point_inside(mcords, moves, sco2[0], sco2[1], IS_CLIPPED)) {
if (select) ebone->flag |= BONE_TIPSEL;
else ebone->flag &= ~BONE_TIPSEL;
didpoint = 1;
change = TRUE;
}
/* if one of points selected, we skip the bone itself */
- if (didpoint == 0 && lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) {
+ if (didpoint == 0 &&
+ BLI_lasso_is_edge_inside(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1], IS_CLIPPED))
+ {
if (select) ebone->flag |= BONE_TIPSEL | BONE_ROOTSEL | BONE_SELECTED;
else ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
change = TRUE;
@@ -771,7 +633,7 @@ static void do_lasso_select_meta(ViewContext *vc, int mcords[][2], short moves,
mul_v3_m4v3(vec, vc->obedit->obmat, &ml->x);
project_short(vc->ar, vec, sco);
- if (lasso_inside(mcords, moves, sco[0], sco[1])) {
+ if (BLI_lasso_is_point_inside(mcords, moves, sco[0], sco[1], IS_CLIPPED)) {
if (select) ml->flag |= SELECT;
else ml->flag &= ~SELECT;
}
@@ -850,7 +712,7 @@ static void do_lasso_select_paintvert(ViewContext *vc, int mcords[][2], short mo
paintvert_deselect_all_visible(ob, SEL_DESELECT, FALSE); /* flush selection at the end */
bm_vertoffs = me->totvert + 1; /* max index array */
- lasso_select_boundbox(&rect, mcords, moves);
+ BLI_lasso_boundbox(&rect, mcords, moves);
EDBM_backbuf_border_mask_init(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
edbm_backbuf_check_and_select_verts_obmode(me, select);
@@ -873,7 +735,7 @@ static void do_lasso_select_paintface(ViewContext *vc, int mcords[][2], short mo
bm_vertoffs = me->totpoly + 1; /* max index array */
- lasso_select_boundbox(&rect, mcords, moves);
+ BLI_lasso_boundbox(&rect, mcords, moves);
EDBM_backbuf_border_mask_init(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
edbm_backbuf_check_and_select_tfaces(me, select);
@@ -893,7 +755,7 @@ static void do_lasso_select_node(int mcords[][2], short moves, short select)
short node_cent[2];
float node_centf[2];
- lasso_select_boundbox(&rect, mcords, moves);
+ BLI_lasso_boundbox(&rect, mcords, moves);
/* store selection in temp test flag */
for (node = snode->edittree->nodes.first; node; node = node->next) {
@@ -902,7 +764,7 @@ static void do_lasso_select_node(int mcords[][2], short moves, short select)
node_centf[1] = (node->totr.ymin + node->totr.ymax) / 2;
ipoco_to_areaco_noclip(G.v2d, node_centf, node_cent);
- if (BLI_in_rcti(&rect, node_cent[0], node_cent[1]) && lasso_inside(mcords, moves, node_cent[0], node_cent[1])) {
+ if (BLI_in_rcti(&rect, node_cent[0], node_cent[1]) && BLI_lasso_is_point_inside(mcords, moves, node_cent[0], node_cent[1])) {
if (select) {
node->flag |= SELECT;
}
@@ -968,7 +830,7 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op)
int i = 0;
int mcords[1024][2];
- RNA_BEGIN(op->ptr, itemptr, "path") {
+ RNA_BEGIN (op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
@@ -1113,7 +975,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
const char *name = object_mouse_select_menu_data[name_index].idname;
if (!extend) {
- CTX_DATA_BEGIN(C, Base *, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
if (base->flag & SELECT) {
ED_base_object_select(base, BA_DESELECT);
changed = 1;
@@ -1122,7 +984,7 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
}
- CTX_DATA_BEGIN(C, Base *, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
/* this is a bit dodjy, there should only be ONE object with this name, but library objects can mess this up */
if (strcmp(name, base->object->id.name + 2) == 0) {
ED_base_object_activate(C, base);
@@ -1189,7 +1051,7 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int
short ok;
LinkNode *linklist = NULL;
- CTX_DATA_BEGIN(C, Base *, base, selectable_bases) {
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases) {
ok = FALSE;
/* two selection methods, the CTRL select uses max dist of 15 */
@@ -1967,7 +1829,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, i
if (extend == 0 && select) {
if (bone_only) {
- CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones) {
+ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) {
if ((pchan->bone->flag & BONE_UNSELECTABLE) == 0) {
pchan->bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
}
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 1c1fa4c7fac..988d0a00601 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -106,7 +106,7 @@ static void special_transvert_update(Object *obedit)
}
else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
Curve *cu = obedit->data;
- ListBase *nurbs = curve_editnurbs(cu);
+ ListBase *nurbs = BKE_curve_editNurbs_get(cu);
Nurb *nu = nurbs->first;
while (nu) {
@@ -141,8 +141,8 @@ static void special_transvert_update(Object *obedit)
}
}
- test2DNurb(nu);
- testhandlesNurb(nu); /* test for bezier too */
+ BKE_nurb_test2D(nu);
+ BKE_nurb_handles_test(nu); /* test for bezier too */
nu = nu->next;
}
}
@@ -375,7 +375,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
Curve *cu = obedit->data;
int totmalloc = 0;
- ListBase *nurbs = curve_editnurbs(cu);
+ ListBase *nurbs = BKE_curve_editNurbs_get(cu);
for (nu = nurbs->first; nu; nu = nu->next) {
if (nu->type == CU_BEZIER)
@@ -557,7 +557,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
else {
struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID);
- CTX_DATA_BEGIN(C, Object *, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob->mode & OB_MODE_POSE) {
bPoseChannel *pchan;
bArmature *arm = ob->data;
@@ -691,7 +691,7 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
else {
struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID);
- CTX_DATA_BEGIN(C, Object *, ob, selected_editable_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
if (ob->mode & OB_MODE_POSE) {
bPoseChannel *pchan;
bArmature *arm = ob->data;
@@ -928,7 +928,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
}
}
else {
- CTX_DATA_BEGIN(C, Object *, ob, selected_objects) {
+ CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
copy_v3_v3(vec, ob->obmat[3]);
/* special case for camera -- snap to bundles */
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index f3819a1b83c..6d72ca99678 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -225,7 +225,11 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2])
adr[1]= out[1];
}
else if (t->spacetype==SPACE_CLIP) {
- UI_view2d_to_region_no_clip(t->view, vec[0], vec[1], adr, adr+1);
+ float v[2];
+
+ copy_v2_v2(v, vec);
+
+ UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr+1);
}
}
@@ -274,6 +278,19 @@ void applyAspectRatio(TransInfo *t, float *vec)
vec[0] /= aspx;
vec[1] /= aspy;
}
+ else if ((t->spacetype==SPACE_CLIP) && (t->mode==TFM_TRANSLATION)) {
+ if (t->options & CTX_MOVIECLIP) {
+ SpaceClip *sc = t->sa->spacedata.first;
+ float aspx, aspy;
+ int width, height;
+
+ ED_space_clip_size(sc, &width, &height);
+ ED_space_clip_aspect(sc, &aspx, &aspy);
+
+ vec[0] *= width / aspx;
+ vec[1] *= height / aspy;
+ }
+ }
}
void removeAspectRatio(TransInfo *t, float *vec)
@@ -294,12 +311,24 @@ void removeAspectRatio(TransInfo *t, float *vec)
vec[0] *= aspx;
vec[1] *= aspy;
}
+ else if ((t->spacetype==SPACE_CLIP) && (t->mode==TFM_TRANSLATION)) {
+ if (t->options & CTX_MOVIECLIP) {
+ SpaceClip *sc = t->sa->spacedata.first;
+ float aspx, aspy;
+ int width, height;
+
+ ED_space_clip_size(sc, &width, &height);
+ ED_space_clip_aspect(sc, &aspx, &aspy);
+
+ vec[0] *= aspx / width;
+ vec[1] *= aspy / height;
+ }
+ }
}
static void viewRedrawForce(const bContext *C, TransInfo *t)
{
- if (t->spacetype == SPACE_VIEW3D)
- {
+ if (t->spacetype == SPACE_VIEW3D) {
/* Do we need more refined tags? */
if (t->flag & T_POSE)
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
@@ -415,7 +444,7 @@ static void view_editmove(unsigned short UNUSED(event))
if (Trans.flag & T_2D_EDIT)
return;
- switch(event) {
+ switch (event) {
case WHEELUPMOUSE:
if ( G.qual & LR_SHIFTKEY ) {
@@ -586,8 +615,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
t->redraw |= handleMouseInput(t, &t->mouse, event);
- if (event->type == MOUSEMOVE)
- {
+ if (event->type == MOUSEMOVE) {
if (t->modifiers & MOD_CONSTRAINT_SELECT)
t->con.mode |= CON_SELECT;
@@ -626,10 +654,10 @@ int transformEvent(TransInfo *t, wmEvent *event)
t->redraw |= TREDRAW_HARD;
}
else if (t->mode == TFM_TRANSLATION) {
- if (t->options&CTX_MOVIECLIP) {
+ if(t->options & CTX_MOVIECLIP) {
restoreTransObjects(t);
- t->flag^= T_ALT_TRANSFORM;
+ t->flag ^= T_ALT_TRANSFORM;
t->redraw |= TREDRAW_HARD;
}
}
@@ -802,7 +830,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
t->redraw |= handleNumInput(&(t->num), event);
}
/* else do non-mapped events */
- else if (event->val==KM_PRESS) {
+ else if (event->val == KM_PRESS) {
switch (event->type) {
case RIGHTMOUSE:
t->state = TRANS_CANCEL;
@@ -1088,11 +1116,9 @@ int transformEvent(TransInfo *t, wmEvent *event)
}
/* confirm transform if launch key is released after mouse move */
- if (t->flag & T_RELEASE_CONFIRM)
- {
+ if (t->flag & T_RELEASE_CONFIRM) {
/* XXX Keyrepeat bug in Xorg fucks this up, will test when fixed */
- if (event->type == t->launch_event && (t->launch_event == LEFTMOUSE || t->launch_event == RIGHTMOUSE))
- {
+ if (event->type == t->launch_event && (t->launch_event == LEFTMOUSE || t->launch_event == RIGHTMOUSE)) {
t->state = TRANS_CONFIRM;
}
}
@@ -1156,20 +1182,19 @@ typedef enum {
} ArrowDirection;
static void drawArrow(ArrowDirection d, short offset, short length, short size)
{
- switch(d)
- {
+ switch (d) {
case LEFT:
offset = -offset;
length = -length;
size = -size;
case RIGHT:
glBegin(GL_LINES);
- glVertex2s( offset, 0);
- glVertex2s( offset + length, 0);
- glVertex2s( offset + length, 0);
- glVertex2s( offset + length - size, -size);
- glVertex2s( offset + length, 0);
- glVertex2s( offset + length - size, size);
+ glVertex2s(offset, 0);
+ glVertex2s(offset + length, 0);
+ glVertex2s(offset + length, 0);
+ glVertex2s(offset + length - size, -size);
+ glVertex2s(offset + length, 0);
+ glVertex2s(offset + length - size, size);
glEnd();
break;
case DOWN:
@@ -1178,12 +1203,12 @@ static void drawArrow(ArrowDirection d, short offset, short length, short size)
size = -size;
case UP:
glBegin(GL_LINES);
- glVertex2s( 0, offset);
- glVertex2s( 0, offset + length);
- glVertex2s( 0, offset + length);
+ glVertex2s(0, offset);
+ glVertex2s(0, offset + length);
+ glVertex2s(0, offset + length);
glVertex2s(-size, offset + length - size);
- glVertex2s( 0, offset + length);
- glVertex2s( size, offset + length - size);
+ glVertex2s(0, offset + length);
+ glVertex2s(size, offset + length - size);
glEnd();
break;
}
@@ -1191,26 +1216,25 @@ static void drawArrow(ArrowDirection d, short offset, short length, short size)
static void drawArrowHead(ArrowDirection d, short size)
{
- switch(d)
- {
+ switch (d) {
case LEFT:
size = -size;
case RIGHT:
glBegin(GL_LINES);
- glVertex2s( 0, 0);
- glVertex2s( -size, -size);
- glVertex2s( 0, 0);
- glVertex2s( -size, size);
+ glVertex2s(0, 0);
+ glVertex2s(-size, -size);
+ glVertex2s(0, 0);
+ glVertex2s(-size, size);
glEnd();
break;
case DOWN:
size = -size;
case UP:
glBegin(GL_LINES);
- glVertex2s( 0, 0);
+ glVertex2s(0, 0);
glVertex2s(-size, -size);
- glVertex2s( 0, 0);
- glVertex2s( size, -size);
+ glVertex2s(0, 0);
+ glVertex2s(size, -size);
glEnd();
break;
}
@@ -1223,11 +1247,10 @@ static void drawArc(float size, float angle_start, float angle_end, int segments
glBegin(GL_LINE_STRIP);
- for ( angle = angle_start; angle < angle_end; angle += delta)
- {
- glVertex2f( cosf(angle) * size, sinf(angle) * size);
+ for ( angle = angle_start; angle < angle_end; angle += delta) {
+ glVertex2f(cosf(angle) * size, sinf(angle) * size);
}
- glVertex2f( cosf(angle_end) * size, sinf(angle_end) * size);
+ glVertex2f(cosf(angle_end) * size, sinf(angle_end) * size);
glEnd();
}
@@ -1245,8 +1268,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
{
TransInfo *t = (TransInfo*)customdata;
- if (t->helpline != HLP_NONE && !(t->flag & T_USES_MANIPULATOR))
- {
+ if (t->helpline != HLP_NONE && !(t->flag & T_USES_MANIPULATOR)) {
float vecrot[3], cent[2];
int mval[2];
@@ -1267,8 +1289,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
glPushMatrix();
- switch(t->helpline)
- {
+ switch (t->helpline) {
case HLP_SPRING:
UI_ThemeColor(TH_WIRE);
@@ -1417,23 +1438,23 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
}
/* convert flag to enum */
- switch(t->flag & (T_PROP_EDIT|T_PROP_CONNECTED))
- {
- case (T_PROP_EDIT|T_PROP_CONNECTED):
- proportional = PROP_EDIT_CONNECTED;
- break;
- case T_PROP_EDIT:
- proportional = PROP_EDIT_ON;
- break;
- default:
- proportional = PROP_EDIT_OFF;
+ switch (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) {
+ case (T_PROP_EDIT|T_PROP_CONNECTED):
+ proportional = PROP_EDIT_CONNECTED;
+ break;
+ case T_PROP_EDIT:
+ proportional = PROP_EDIT_ON;
+ break;
+ default:
+ proportional = PROP_EDIT_OFF;
}
// If modal, save settings back in scene if not set as operator argument
if (t->flag & T_MODAL) {
/* save settings if not set in operator */
- if ( (prop = RNA_struct_find_property(op->ptr, "proportional")) && !RNA_property_is_set(op->ptr, prop))
+ if ((prop = RNA_struct_find_property(op->ptr, "proportional")) &&
+ !RNA_property_is_set(op->ptr, prop))
{
if (t->obedit)
ts->proportional = proportional;
@@ -1441,12 +1462,14 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
ts->proportional_objects = (proportional != PROP_EDIT_OFF);
}
- if ( (prop = RNA_struct_find_property(op->ptr, "proportional_size")) && !RNA_property_is_set(op->ptr, prop))
+ if ((prop = RNA_struct_find_property(op->ptr, "proportional_size")) &&
+ !RNA_property_is_set(op->ptr, prop))
{
ts->proportional_size = t->prop_size;
}
- if ( (prop = RNA_struct_find_property(op->ptr, "proportional_edit_falloff")) && !RNA_property_is_set(op->ptr, prop))
+ if ((prop = RNA_struct_find_property(op->ptr, "proportional_edit_falloff")) &&
+ !RNA_property_is_set(op->ptr, prop))
{
ts->prop_mode = t->prop_mode;
}
@@ -1460,34 +1483,31 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
}
if (t->spacetype == SPACE_VIEW3D) {
- if ( (prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) && !RNA_property_is_set(op->ptr, prop))
+ if ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) &&
+ !RNA_property_is_set(op->ptr, prop))
{
View3D *v3d = t->view;
-
+
v3d->twmode = t->current_orientation;
}
}
}
- if (RNA_struct_find_property(op->ptr, "proportional"))
- {
+ if (RNA_struct_find_property(op->ptr, "proportional")) {
RNA_enum_set(op->ptr, "proportional", proportional);
RNA_enum_set(op->ptr, "proportional_edit_falloff", t->prop_mode);
RNA_float_set(op->ptr, "proportional_size", t->prop_size);
}
- if ((prop = RNA_struct_find_property(op->ptr, "axis")))
- {
+ if ((prop = RNA_struct_find_property(op->ptr, "axis"))) {
RNA_property_float_set_array(op->ptr, prop, t->axis);
}
- if ((prop = RNA_struct_find_property(op->ptr, "mirror")))
- {
+ if ((prop = RNA_struct_find_property(op->ptr, "mirror"))) {
RNA_property_boolean_set(op->ptr, prop, t->flag & T_MIRROR);
}
- if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")))
- {
+ if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) {
/* constraint orientation can be global, event if user selects something else
* so use the orientation in the constraint if set
* */
@@ -1498,8 +1518,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
RNA_enum_set(op->ptr, "constraint_orientation", t->current_orientation);
}
- if (t->con.mode & CON_APPLY)
- {
+ if (t->con.mode & CON_APPLY) {
if (t->con.mode & CON_AXIS0) {
constraint_axis[0] = 1;
}
@@ -1527,8 +1546,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
t->state = TRANS_STARTING;
- if ( (prop = RNA_struct_find_property(op->ptr, "texture_space")) && RNA_property_is_set(op->ptr, prop))
- {
+ if ( (prop = RNA_struct_find_property(op->ptr, "texture_space")) && RNA_property_is_set(op->ptr, prop)) {
if (RNA_property_boolean_get(op->ptr, prop)) {
options |= CTX_TEXTURE;
}
@@ -1540,8 +1558,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
t->launch_event = event ? event->type : -1;
- if (t->launch_event == EVT_TWEAK_R)
- {
+ if (t->launch_event == EVT_TWEAK_R) {
t->launch_event = RIGHTMOUSE;
}
else if (t->launch_event == EVT_TWEAK_L) {
@@ -1550,18 +1567,15 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
// XXX Remove this when wm_operator_call_internal doesn't use window->eventstate (which can have type = 0)
// For manipulator only, so assume LEFTMOUSE
- if (t->launch_event == 0)
- {
+ if (t->launch_event == 0) {
t->launch_event = LEFTMOUSE;
}
- if (!initTransInfo(C, t, op, event)) // internal data, mouse, vectors
- {
+ if (!initTransInfo(C, t, op, event)) { /* internal data, mouse, vectors */
return 0;
}
- if (t->spacetype == SPACE_VIEW3D)
- {
+ if (t->spacetype == SPACE_VIEW3D) {
//calc_manipulator_stats(curarea);
initTransformOrientation(C, t);
@@ -1592,15 +1606,12 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
}
/* Stupid code to have Ctrl-Click on manipulator work ok */
- if (event)
- {
+ if (event) {
wmKeyMap *keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
wmKeyMapItem *kmi;
- for (kmi = keymap->items.first; kmi; kmi = kmi->next)
- {
- if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS)
- {
+ for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
+ if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS) {
if ((ELEM(kmi->type, LEFTCTRLKEY, RIGHTCTRLKEY) && event->ctrl) ||
(ELEM(kmi->type, LEFTSHIFTKEY, RIGHTSHIFTKEY) && event->shift) ||
(ELEM(kmi->type, LEFTALTKEY, RIGHTALTKEY) && event->alt) ||
@@ -1731,16 +1742,14 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
break;
}
- if (t->state == TRANS_CANCEL)
- {
+ if (t->state == TRANS_CANCEL) {
postTrans(C, t);
return 0;
}
/* overwrite initial values if operator supplied a non-null vector */
- if ( (prop = RNA_struct_find_property(op->ptr, "value")) && RNA_property_is_set(op->ptr, prop))
- {
+ if ((prop = RNA_struct_find_property(op->ptr, "value")) && RNA_property_is_set(op->ptr, prop)) {
float values[4]= {0}; /* in case value isn't length 4, avoid uninitialized memory */
if (RNA_property_array_check(prop)) {
@@ -1756,22 +1765,19 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
}
/* Transformation axis from operator */
- if ((prop = RNA_struct_find_property(op->ptr, "axis")) && RNA_property_is_set(op->ptr, prop))
- {
+ if ((prop = RNA_struct_find_property(op->ptr, "axis")) && RNA_property_is_set(op->ptr, prop)) {
RNA_property_float_get_array(op->ptr, prop, t->axis);
normalize_v3(t->axis);
copy_v3_v3(t->axis_orig, t->axis);
}
/* Constraint init from operator */
- if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop))
- {
+ if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop)) {
int constraint_axis[3];
RNA_property_boolean_get_array(op->ptr, prop, constraint_axis);
- if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2])
- {
+ if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) {
t->con.mode |= CON_APPLY;
if (constraint_axis[0]) {
@@ -1797,8 +1803,7 @@ void transformApply(bContext *C, TransInfo *t)
{
t->context = C;
- if ((t->redraw & TREDRAW_HARD) || (t->draw_handle_apply == NULL && (t->redraw & TREDRAW_SOFT)))
- {
+ if ((t->redraw & TREDRAW_HARD) || (t->draw_handle_apply == NULL && (t->redraw & TREDRAW_SOFT))) {
selectConstraint(t);
if (t->transform) {
t->transform(t, t->mval); // calls recalcData()
@@ -1811,13 +1816,11 @@ void transformApply(bContext *C, TransInfo *t)
}
/* If auto confirm is on, break after one pass */
- if (t->options & CTX_AUTOCONFIRM)
- {
+ if (t->options & CTX_AUTOCONFIRM) {
t->state = TRANS_CONFIRM;
}
- if (BKE_ptcache_get_continue_physics())
- {
+ if (BKE_ptcache_get_continue_physics()) {
// TRANSFORM_FIX_ME
//do_screenhandlers(G.curscreen);
t->redraw |= TREDRAW_HARD;
@@ -1842,11 +1845,9 @@ int transformEnd(bContext *C, TransInfo *t)
t->context = C;
- if (t->state != TRANS_STARTING && t->state != TRANS_RUNNING)
- {
+ if (t->state != TRANS_STARTING && t->state != TRANS_RUNNING) {
/* handle restoring objects */
- if (t->state == TRANS_CANCEL)
- {
+ if (t->state == TRANS_CANCEL) {
/* exception, edge slide transformed UVs too */
if (t->mode==TFM_EDGE_SLIDE)
doEdgeSlide(t, 0.0f);
@@ -1942,8 +1943,8 @@ static void protectedAxisAngleBits(short protectflag, float axis[3], float *angl
/* axis-angle get limited with euler... */
float eul[3], oldeul[3];
- axis_angle_to_eulO( eul, EULER_ORDER_DEFAULT,axis, *angle);
- axis_angle_to_eulO( oldeul, EULER_ORDER_DEFAULT,oldAxis, oldAngle);
+ axis_angle_to_eulO(eul, EULER_ORDER_DEFAULT, axis, *angle);
+ axis_angle_to_eulO(oldeul, EULER_ORDER_DEFAULT, oldAxis, oldAngle);
if (protectflag & OB_LOCK_ROTX)
eul[0]= oldeul[0];
@@ -1952,7 +1953,7 @@ static void protectedAxisAngleBits(short protectflag, float axis[3], float *angl
if (protectflag & OB_LOCK_ROTZ)
eul[2]= oldeul[2];
- eulO_to_axis_angle( axis, angle,eul, EULER_ORDER_DEFAULT);
+ eulO_to_axis_angle(axis, angle, eul, EULER_ORDER_DEFAULT);
/* when converting to axis-angle, we need a special exception for the case when there is no axis */
if (IS_EQF(axis[0], axis[1]) && IS_EQF(axis[1], axis[2])) {
@@ -1998,7 +1999,7 @@ static void protectedQuaternionBits(short protectflag, float *quat, float *oldqu
if (protectflag & OB_LOCK_ROTZ)
eul[2]= oldeul[2];
- eul_to_quat( quat,eul);
+ eul_to_quat(quat, eul);
/* restore original quat size */
mul_qt_fl(quat, qlen);
@@ -2097,8 +2098,7 @@ static void constraintob_from_transdata(bConstraintOb *cob, TransData *td)
* - current space should be local
*/
memset(cob, 0, sizeof(bConstraintOb));
- if (td->ext)
- {
+ if (td->ext) {
if (td->ext->rotOrder == ROT_MODE_QUAT) {
/* quats */
/* objects and bones do normalization first too, otherwise
@@ -2175,15 +2175,15 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td)
/* copy results from cob->matrix */
if (td->ext->rotOrder == ROT_MODE_QUAT) {
/* quats */
- mat4_to_quat( td->ext->quat,cob.matrix);
+ mat4_to_quat(td->ext->quat, cob.matrix);
}
else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
/* axis angle */
- mat4_to_axis_angle( &td->ext->quat[1], &td->ext->quat[0],cob.matrix);
+ mat4_to_axis_angle(&td->ext->quat[1], &td->ext->quat[0], cob.matrix);
}
else {
/* eulers */
- mat4_to_eulO( td->ext->rot, td->ext->rotOrder,cob.matrix);
+ mat4_to_eulO(td->ext->rot, td->ext->rotOrder, cob.matrix);
}
}
}
@@ -2209,7 +2209,7 @@ static void constraintSizeLim(TransInfo *t, TransData *td)
if (td->flag & TD_SINGLESIZE)
return;
- size_to_mat4( cob.matrix,td->ext->size);
+ size_to_mat4(cob.matrix, td->ext->size);
}
/* Evaluate valid constraints */
@@ -2260,7 +2260,7 @@ static void constraintSizeLim(TransInfo *t, TransData *td)
if (td->flag & TD_SINGLESIZE)
return;
- mat4_to_size( td->ext->size,cob.matrix);
+ mat4_to_size(td->ext->size, cob.matrix);
}
}
}
@@ -2271,8 +2271,7 @@ static void postInputWarp(TransInfo *t, float values[3])
{
mul_v3_fl(values, (float)(M_PI * 2));
- if (t->customData) /* non-null value indicates reversed input */
- {
+ if (t->customData) { /* non-null value indicates reversed input */
negate_v3(values);
}
}
@@ -2324,8 +2323,7 @@ int handleEventWarp(TransInfo *t, wmEvent *event)
{
int status = 0;
- if (event->type == MIDDLEMOUSE && event->val==KM_PRESS)
- {
+ if (event->type == MIDDLEMOUSE && event->val == KM_PRESS) {
// Use customData pointer to signal warp direction
if (t->customData == NULL)
t->customData = (void*)1;
@@ -2465,11 +2463,9 @@ int handleEventShear(TransInfo *t, wmEvent *event)
{
int status = 0;
- if (event->type == MIDDLEMOUSE && event->val==KM_PRESS)
- {
+ if (event->type == MIDDLEMOUSE && event->val == KM_PRESS) {
// Use customData pointer to signal Shear direction
- if (t->customData == NULL)
- {
+ if (t->customData == NULL) {
initMouseInputMode(t, &t->mouse, INPUT_VERTICAL_ABSOLUTE);
t->customData = (void*)1;
}
@@ -2603,7 +2599,7 @@ static void headerResize(TransInfo *t, float vec[3], char *str)
}
if (t->con.mode & CON_APPLY) {
- switch(t->num.idx_max) {
+ switch (t->num.idx_max) {
case 0:
spos += sprintf(spos, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext);
break;
@@ -2632,7 +2628,7 @@ static void headerResize(TransInfo *t, float vec[3], char *str)
#define VECSIGNFLIP(a, b) ((SIGN(a[0]) & SIGN(b[0]))==0 || (SIGN(a[1]) & SIGN(b[1]))==0 || (SIGN(a[2]) & SIGN(b[2]))==0)
/* smat is reference matrix, only scaled */
-static void TransMat3ToSize( float mat[][3], float smat[][3], float *size)
+static void TransMat3ToSize(float mat[][3], float smat[][3], float *size)
{
float vec[3];
@@ -2692,7 +2688,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3])
//print_v3("fsize", fsize);
}
else {
- mat3_to_size( fsize,tmat);
+ mat3_to_size(fsize, tmat);
}
protectedSizeBits(td->protectflag, fsize);
@@ -2755,8 +2751,7 @@ int Resize(TransInfo *t, const int mval[2])
char str[200];
/* for manipulator, center handle, the scaling can't be done relative to center */
- if ( (t->flag & T_USES_MANIPULATOR) && t->con.mode==0)
- {
+ if ( (t->flag & T_USES_MANIPULATOR) && t->con.mode==0) {
ratio = 1.0f - ((t->imval[0] - mval[0]) + (t->imval[1] - mval[1]))/100.0f;
}
else {
@@ -2774,14 +2769,13 @@ int Resize(TransInfo *t, const int mval[2])
applySnapping(t, size);
- if (t->flag & T_AUTOVALUES)
- {
+ if (t->flag & T_AUTOVALUES) {
copy_v3_v3(size, t->auto_values);
}
copy_v3_v3(t->values, size);
- size_to_mat3( mat,size);
+ size_to_mat3(mat, size);
if (t->con.applySize) {
t->con.applySize(t, NULL, mat);
@@ -2803,7 +2797,7 @@ int Resize(TransInfo *t, const int mval[2])
/* evil hack - redo resize if cliping needed */
if (t->flag & T_CLIP_UV && clipUVTransform(t, size, 1)) {
- size_to_mat3( mat,size);
+ size_to_mat3(mat, size);
if (t->con.applySize)
t->con.applySize(t, NULL, mat);
@@ -2972,14 +2966,14 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
add_v3_v3v3(td->loc, vec, center);
- sub_v3_v3v3(vec,td->loc,td->iloc);
+ sub_v3_v3v3(vec, td->loc, td->iloc);
protectedTransBits(td->protectflag, vec);
add_v3_v3v3(td->loc, td->iloc, vec);
if (td->flag & TD_USEQUAT) {
mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
- mat3_to_quat( quat,fmat); // Actual transform
+ mat3_to_quat(quat, fmat); // Actual transform
if (td->ext->quat) {
mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
@@ -3008,8 +3002,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
copy_m3_m4(pmtx, t->poseobj->obmat);
invert_m3_m3(imtx, pmtx);
- if ((td->flag & TD_NO_LOC) == 0)
- {
+ if ((td->flag & TD_NO_LOC) == 0) {
sub_v3_v3v3(vec, td->center, center);
mul_m3_v3(pmtx, vec); // To Global space
@@ -3047,7 +3040,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
if (td->ext->rotOrder == ROT_MODE_QUAT) {
mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
- mat3_to_quat( quat,fmat); // Actual transform
+ mat3_to_quat(quat, fmat); // Actual transform
mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
/* this function works on end result */
@@ -3061,10 +3054,10 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle);
mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
- mat3_to_quat( quat,fmat); // Actual transform
+ mat3_to_quat(quat, fmat); // Actual transform
mul_qt_qtqt(tquat, quat, iquat);
- quat_to_axis_angle( td->ext->rotAxis, td->ext->rotAngle,tquat);
+ quat_to_axis_angle(td->ext->rotAxis, td->ext->rotAngle, tquat);
/* this function works on end result */
protectedAxisAngleBits(td->protectflag, td->ext->rotAxis, td->ext->rotAngle, td->ext->irotAxis, td->ext->irotAngle);
@@ -3077,12 +3070,12 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
/* calculate the total rotatation in eulers */
copy_v3_v3(eul, td->ext->irot);
- eulO_to_mat3( eulmat,eul, td->ext->rotOrder);
+ eulO_to_mat3(eulmat, eul, td->ext->rotOrder);
/* mat = transform, obmat = bone rotation */
mul_m3_m3m3(fmat, smat, eulmat);
- mat3_to_compatible_eulO( eul, td->ext->rot, td->ext->rotOrder,fmat);
+ mat3_to_compatible_eulO(eul, td->ext->rot, td->ext->rotOrder, fmat);
/* and apply (to end result only) */
protectedRotateBits(td->protectflag, eul, td->ext->irot);
@@ -3093,8 +3086,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
}
}
else {
- if ((td->flag & TD_NO_LOC) == 0)
- {
+ if ((td->flag & TD_NO_LOC) == 0) {
/* translation */
sub_v3_v3v3(vec, td->center, center);
mul_m3_v3(mat, vec);
@@ -3116,7 +3108,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
/* euler or quaternion? */
if ((td->ext->rotOrder == ROT_MODE_QUAT) || (td->flag & TD_USEQUAT)) {
mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
- mat3_to_quat( quat,fmat); // Actual transform
+ mat3_to_quat(quat, fmat); // Actual transform
mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
/* this function works on end result */
@@ -3129,10 +3121,10 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle);
mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
- mat3_to_quat( quat,fmat); // Actual transform
+ mat3_to_quat(quat, fmat); // Actual transform
mul_qt_qtqt(tquat, quat, iquat);
- quat_to_axis_angle( td->ext->rotAxis, td->ext->rotAngle,tquat);
+ quat_to_axis_angle(td->ext->rotAxis, td->ext->rotAngle, tquat);
/* this function works on end result */
protectedAxisAngleBits(td->protectflag, td->ext->rotAxis, td->ext->rotAngle, td->ext->irotAxis, td->ext->irotAngle);
@@ -3145,11 +3137,11 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
/* calculate the total rotatation in eulers */
add_v3_v3v3(eul, td->ext->irot, td->ext->drot); /* we have to correct for delta rot */
- eulO_to_mat3( obmat,eul, td->ext->rotOrder);
+ eulO_to_mat3(obmat, eul, td->ext->rotOrder);
/* mat = transform, obmat = object rotation */
mul_m3_m3m3(fmat, smat, obmat);
- mat3_to_compatible_eulO( eul, td->ext->rot, td->ext->rotOrder,fmat);
+ mat3_to_compatible_eulO(eul, td->ext->rot, td->ext->rotOrder, fmat);
/* correct back for delta rot */
sub_v3_v3v3(eul, eul, td->ext->drot);
@@ -3170,7 +3162,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3])
float mat[3][3];
int i;
- vec_rot_to_mat3( mat,axis, angle);
+ vec_rot_to_mat3(mat, axis, angle);
for (i = 0 ; i < t->total; i++, td++) {
@@ -3182,10 +3174,10 @@ static void applyRotation(TransInfo *t, float angle, float axis[3])
if (t->con.applyRot) {
t->con.applyRot(t, td, axis, NULL);
- vec_rot_to_mat3( mat,axis, angle * td->factor);
+ vec_rot_to_mat3(mat, axis, angle * td->factor);
}
else if (t->flag & T_PROP_EDIT) {
- vec_rot_to_mat3( mat,axis, angle * td->factor);
+ vec_rot_to_mat3(mat, axis, angle * td->factor);
}
ElementRotation(t, td, mat, t->around);
@@ -3271,8 +3263,8 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a
float mat[3][3], smat[3][3], totmat[3][3];
int i;
- vec_rot_to_mat3( smat,axis1, angles[0]);
- vec_rot_to_mat3( totmat,axis2, angles[1]);
+ vec_rot_to_mat3(smat, axis1, angles[0]);
+ vec_rot_to_mat3(totmat, axis2, angles[1]);
mul_m3_m3m3(mat, smat, totmat);
@@ -3284,8 +3276,8 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a
continue;
if (t->flag & T_PROP_EDIT) {
- vec_rot_to_mat3( smat,axis1, td->factor * angles[0]);
- vec_rot_to_mat3( totmat,axis2, td->factor * angles[1]);
+ vec_rot_to_mat3(smat, axis1, td->factor * angles[0]);
+ vec_rot_to_mat3(totmat, axis2, td->factor * angles[1]);
mul_m3_m3m3(mat, smat, totmat);
}
@@ -3332,8 +3324,8 @@ int Trackball(TransInfo *t, const int UNUSED(mval[2]))
}
(void)spos;
- vec_rot_to_mat3( smat,axis1, phi[0]);
- vec_rot_to_mat3( totmat,axis2, phi[1]);
+ vec_rot_to_mat3(smat, axis1, phi[0]);
+ vec_rot_to_mat3(totmat, axis2, phi[1]);
mul_m3_m3m3(mat, smat, totmat);
@@ -3440,7 +3432,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str)
autoik[0]= '\0';
if (t->con.mode & CON_APPLY) {
- switch(t->num.idx_max) {
+ switch (t->num.idx_max) {
case 0:
spos += sprintf(spos, "D: %s (%s)%s %s %s", &tvec[0], distvec, t->con.text, t->proptext, &autoik[0]);
break;
@@ -3491,7 +3483,7 @@ static void applyTranslation(TransInfo *t, float vec[3])
axis_angle_to_quat(quat, axis, angle);
- quat_to_mat3( mat,quat);
+ quat_to_mat3(mat, quat);
ElementRotation(t, td, mat, V3D_LOCAL);
}
@@ -3899,7 +3891,7 @@ void initBevel(TransInfo *t)
int handleEventBevel(TransInfo *t, wmEvent *event)
{
- if (event->val==KM_PRESS) {
+ if (event->val == KM_PRESS) {
if (!G.editBMesh) return 0;
switch (event->type) {
@@ -3932,7 +3924,7 @@ int handleEventBevel(TransInfo *t, wmEvent *event)
int Bevel(TransInfo *t, const int UNUSED(mval[2]))
{
- float distance,d;
+ float distance, d;
int i;
char str[128];
const char *mode;
@@ -4185,9 +4177,9 @@ static void ElementBoneSize(TransInfo *t, TransData *td, float mat[3][3])
/* we've tucked the scale in loc */
oldy= td->iloc[1];
- size_to_mat3( sizemat,td->iloc);
+ size_to_mat3(sizemat, td->iloc);
mul_m3_m3m3(tmat, tmat, sizemat);
- mat3_to_size( td->loc,tmat);
+ mat3_to_size(td->loc, tmat);
td->loc[1]= oldy;
}
@@ -4217,7 +4209,7 @@ int BoneSize(TransInfo *t, const int mval[2])
constraintNumInput(t, size);
}
- size_to_mat3( mat,size);
+ size_to_mat3(mat, size);
if (t->con.applySize) {
t->con.applySize(t, NULL, mat);
@@ -4869,7 +4861,7 @@ void freeSlideVerts(TransInfo *t)
LinkNode *look = sld->vertlist;
GHash *vertgh = sld->vhash;
while (look) {
- sv = BLI_ghash_lookup(vertgh,(EditVert*)look->link);
+ sv = BLI_ghash_lookup(vertgh, (EditVert*)look->link);
if (sv != NULL) {
sv->up->f &= !SELECT;
sv->down->f &= !SELECT;
@@ -5175,7 +5167,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2]))
if (t->con.mode & CON_APPLY) {
size[0] = size[1] = size[2] = -1;
- size_to_mat3( mat,size);
+ size_to_mat3(mat, size);
if (t->con.applySize) {
t->con.applySize(t, NULL, mat);
@@ -5200,7 +5192,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2]))
else {
size[0] = size[1] = size[2] = 1;
- size_to_mat3( mat,size);
+ size_to_mat3(mat, size);
for (i = 0, td=t->data; i < t->total; i++, td++) {
if (td->flag & TD_NOACTION)
@@ -5243,8 +5235,7 @@ int Align(TransInfo *t, const int UNUSED(mval[2]))
/* saving original center */
copy_v3_v3(center, t->center);
- for (i = 0 ; i < t->total; i++, td++)
- {
+ for (i = 0 ; i < t->total; i++, td++) {
float mat[3][3], invmat[3][3];
if (td->flag & TD_NOACTION)
@@ -5469,7 +5460,7 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d,
/* do the snapping to nearest frame/second */
if (doTime) {
- val= (float)( floor((val/secf) + 0.5f) * secf );
+ val= (float)(floor((val/secf) + 0.5f) * secf);
}
else
#endif
@@ -5608,9 +5599,9 @@ static void applyTimeTranslate(TransInfo *t, float UNUSED(sval))
if (autosnap == SACTSNAP_STEP) {
if (doTime)
- deltax= (float)( floor((deltax/secf) + 0.5f) * secf );
+ deltax= (float)(floor((deltax/secf) + 0.5f) * secf);
else
- deltax= (float)( floor(deltax + 0.5f) );
+ deltax= (float)(floor(deltax + 0.5f));
}
val = BKE_nla_tweakedit_remap(adt, td->ival, NLATIME_CONVERT_MAP);
@@ -5622,9 +5613,9 @@ static void applyTimeTranslate(TransInfo *t, float UNUSED(sval))
if (autosnap == SACTSNAP_STEP) {
if (doTime)
- val= (float)( floor((deltax/secf) + 0.5f) * secf );
+ val= (float)(floor((deltax/secf) + 0.5f) * secf);
else
- val= (float)( floor(val + 0.5f) );
+ val= (float)(floor(val + 0.5f));
}
*(td->val) = td->ival + val;
@@ -5874,9 +5865,9 @@ static void applyTimeScale(TransInfo *t)
if (autosnap == SACTSNAP_STEP) {
if (doTime)
- fac= (float)( floor(fac/secf + 0.5f) * secf );
+ fac= (float)(floor(fac/secf + 0.5f) * secf);
else
- fac= (float)( floor(fac + 0.5f) );
+ fac= (float)(floor(fac + 0.5f));
}
/* check if any need to apply nla-mapping */
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 0bef33149d7..69af8cf2489 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -68,7 +68,7 @@ struct ReportList;
struct SmallHash;
typedef struct TransSnapPoint {
- struct TransSnapPoint *next,*prev;
+ struct TransSnapPoint *next, *prev;
float co[3];
} TransSnapPoint;
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 18e9c1a47b8..b18d132f8df 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -76,8 +76,7 @@ static void drawObjectConstraint(TransInfo *t);
static void constraintAutoValues(TransInfo *t, float vec[3])
{
int mode = t->con.mode;
- if (mode & CON_APPLY)
- {
+ if (mode & CON_APPLY) {
float nval = (t->flag & T_NULL_ONE)?1.0f:0.0f;
if ((mode & CON_AXIS0) == 0) {
@@ -478,7 +477,7 @@ static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3], fl
if (!td && t->con.mode & CON_APPLY) {
int mode = t->con.mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
- switch(mode) {
+ switch (mode) {
case CON_AXIS0:
case (CON_AXIS1|CON_AXIS2):
copy_v3_v3(vec, t->con.mtx[0]);
@@ -525,7 +524,7 @@ static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3],
td= t->data;
}
- switch(mode) {
+ switch (mode) {
case CON_AXIS0:
case (CON_AXIS1|CON_AXIS2):
copy_v3_v3(vec, td->axismtx[0]);
@@ -604,7 +603,7 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
{
char text[40];
- switch(orientation) {
+ switch (orientation) {
case V3D_MANIP_GLOBAL:
{
float mtx[3][3]= MAT3_UNITY;
@@ -665,7 +664,7 @@ void drawConstraint(TransInfo *t)
else {
if (tc->mode & CON_SELECT) {
float vec[3];
- char col2[3] = {255,255,255};
+ char col2[3] = {255, 255, 255};
int depth_test_enabled;
convertViewVec(t, vec, (t->mval[0] - t->con.imval[0]), (t->mval[1] - t->con.imval[1]));
@@ -768,7 +767,7 @@ static void drawObjectConstraint(TransInfo *t)
td++;
- for (i=1;i<t->total;i++,td++) {
+ for (i=1; i < t->total; i++, td++) {
if (t->con.mode & CON_AXIS0) {
drawLine(t, td->ob->obmat[3], td->axismtx[0], 'X', 0);
}
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 062f88f8837..ecd69f0d10c 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -127,8 +127,7 @@ static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, Tra
TransData *itail = tail;
*temp = *head;
- while (head < tail)
- {
+ while (head < tail) {
if (t->flag & T_PROP_CONNECTED) {
while ((tail->dist >= temp->dist) && (head < tail))
tail--;
@@ -138,8 +137,7 @@ static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, Tra
tail--;
}
- if (head != tail)
- {
+ if (head != tail) {
*head = *tail;
head++;
}
@@ -153,8 +151,7 @@ static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, Tra
head++;
}
- if (head != tail)
- {
+ if (head != tail) {
*tail = *head;
tail--;
}
@@ -269,7 +266,7 @@ static void createTransTexspace(TransInfo *t)
}
id = ob->data;
- if (id == NULL || !ELEM3( GS(id->name), ID_ME, ID_CU, ID_MB )) {
+ if (id == NULL || !ELEM3(GS(id->name), ID_ME, ID_CU, ID_MB )) {
t->total = 0;
return;
}
@@ -421,57 +418,12 @@ static short apply_targetless_ik(Object *ob)
/* pose_mat(b) = pose_mat(b-1) * offs_bone * channel * constraint * IK */
/* we put in channel the entire result of rmat= (channel * constraint * IK) */
/* pose_mat(b) = pose_mat(b-1) * offs_bone * rmat */
- /* rmat = pose_mat(b) * inv( pose_mat(b-1) * offs_bone ) */
+ /* rmat = pose_mat(b) * inv(pose_mat(b-1) * offs_bone ) */
parchan= chanlist[segcount-1];
bone= parchan->bone;
bone->flag |= BONE_TRANSFORM; /* ensures it gets an auto key inserted */
- /* XXX Old code. Will remove it later. */
-#if 0
- if (parchan->parent) {
- Bone *parbone= parchan->parent->bone;
- float offs_bone[4][4];
-
- /* offs_bone = yoffs(b-1) + root(b) + bonemat(b) */
- copy_m4_m3(offs_bone, bone->bone_mat);
-
- /* The bone's root offset (is in the parent's coordinate system) */
- copy_v3_v3(offs_bone[3], bone->head);
-
- /* Get the length translation of parent (length along y axis) */
- offs_bone[3][1]+= parbone->length;
-
- /* pose_mat(b-1) * offs_bone */
- if (parchan->bone->flag & BONE_HINGE) {
- /* the rotation of the parent restposition */
- copy_m4_m4(rmat, parbone->arm_mat); /* rmat used as temp */
-
- /* the location of actual parent transform */
- copy_v3_v3(rmat[3], offs_bone[3]);
- offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f;
- mul_m4_v3(parchan->parent->pose_mat, rmat[3]);
-
- mult_m4_m4m4(tmat, rmat, offs_bone);
- }
- else if (parchan->bone->flag & BONE_NO_SCALE) {
- mult_m4_m4m4(tmat, parchan->parent->pose_mat, offs_bone);
- normalize_m4(tmat);
- }
- else
- mult_m4_m4m4(tmat, parchan->parent->pose_mat, offs_bone);
-
- invert_m4_m4(imat, tmat);
- }
- else {
- copy_m4_m3(tmat, bone->bone_mat);
-
- copy_v3_v3(tmat[3], bone->head);
- invert_m4_m4(imat, tmat);
- }
- /* result matrix */
- mult_m4_m4m4(rmat, imat, parchan->pose_mat);
-#endif
armature_mat_pose_to_bone(parchan, parchan->pose_mat, rmat);
/* apply and decompose, doesn't work for constraints or non-uniform scale well */
@@ -487,25 +439,25 @@ static short apply_targetless_ik(Object *ob)
* and applied poses.
*/
if (parchan->rotmode > 0)
- mat3_to_eulO(parchan->eul, parchan->rotmode,rmat3);
+ mat3_to_eulO(parchan->eul, parchan->rotmode, rmat3);
else if (parchan->rotmode == ROT_MODE_AXISANGLE)
- mat3_to_axis_angle(parchan->rotAxis, &parchan->rotAngle,rmat3);
+ mat3_to_axis_angle(parchan->rotAxis, &parchan->rotAngle, rmat3);
else
- mat3_to_quat(parchan->quat,rmat3);
+ mat3_to_quat(parchan->quat, rmat3);
/* for size, remove rotation */
/* causes problems with some constraints (so apply only if needed) */
if (data->flag & CONSTRAINT_IK_STRETCH) {
if (parchan->rotmode > 0)
- eulO_to_mat3( qrmat,parchan->eul, parchan->rotmode);
+ eulO_to_mat3(qrmat, parchan->eul, parchan->rotmode);
else if (parchan->rotmode == ROT_MODE_AXISANGLE)
- axis_angle_to_mat3( qrmat,parchan->rotAxis, parchan->rotAngle);
+ axis_angle_to_mat3(qrmat, parchan->rotAxis, parchan->rotAngle);
else
- quat_to_mat3( qrmat,parchan->quat);
+ quat_to_mat3(qrmat, parchan->quat);
invert_m3_m3(imat3, qrmat);
mul_m3_m3m3(smat, rmat3, imat3);
- mat3_to_size( parchan->size,smat);
+ mat3_to_size(parchan->size, smat);
}
/* causes problems with some constraints (e.g. childof), so disable this */
@@ -535,13 +487,11 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
td->ob = ob;
td->flag = TD_SELECTED;
- if (bone->flag & BONE_HINGE_CHILD_TRANSFORM)
- {
+ if (bone->flag & BONE_HINGE_CHILD_TRANSFORM) {
td->flag |= TD_NOCENTER;
}
- if (bone->flag & BONE_TRANSFORM_CHILD)
- {
+ if (bone->flag & BONE_TRANSFORM_CHILD) {
td->flag |= TD_NOCENTER;
td->flag |= TD_NO_LOC;
}
@@ -598,53 +548,11 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
if (constraints_list_needinv(t, &pchan->constraints)) {
copy_m3_m4(tmat, pchan->constinv);
invert_m3_m3(cmat, tmat);
- mul_serie_m3(td->mtx, pmat, omat, cmat, NULL,NULL,NULL,NULL,NULL);
- }
- else
- mul_serie_m3(td->mtx, pmat, omat, NULL, NULL,NULL,NULL,NULL,NULL);
- }
-
- /* XXX Old code. Will remove it later. */
-#if 0
- if (ELEM(t->mode, TFM_TRANSLATION, TFM_RESIZE) && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION))
- unit_m3(bmat);
- else
- copy_m3_m3(bmat, pchan->bone->bone_mat);
-
- if (pchan->parent) {
- if (pchan->bone->flag & BONE_HINGE) {
- copy_m3_m4(pmat, pchan->parent->bone->arm_mat);
- if (!(pchan->bone->flag & BONE_NO_SCALE)) {
- float tsize[3], tsmat[3][3];
- mat4_to_size(tsize, pchan->parent->pose_mat);
- size_to_mat3(tsmat, tsize);
- mul_m3_m3m3(pmat, tsmat, pmat);
- }
- }
- else {
- copy_m3_m4(pmat, pchan->parent->pose_mat);
- if (pchan->bone->flag & BONE_NO_SCALE)
- normalize_m3(pmat);
- }
-
- if (constraints_list_needinv(t, &pchan->constraints)) {
- copy_m3_m4(tmat, pchan->constinv);
- invert_m3_m3(cmat, tmat);
- mul_serie_m3(td->mtx, bmat, pmat, omat, cmat, NULL,NULL,NULL,NULL);
- }
- else
- mul_serie_m3(td->mtx, bmat, pmat, omat, NULL,NULL,NULL,NULL,NULL);
- }
- else {
- if (constraints_list_needinv(t, &pchan->constraints)) {
- copy_m3_m4(tmat, pchan->constinv);
- invert_m3_m3(cmat, tmat);
- mul_serie_m3(td->mtx, bmat, omat, cmat, NULL,NULL,NULL,NULL,NULL);
+ mul_serie_m3(td->mtx, pmat, omat, cmat, NULL, NULL, NULL, NULL, NULL);
}
else
- mul_m3_m3m3(td->mtx, omat, bmat);
+ mul_serie_m3(td->mtx, pmat, omat, NULL, NULL, NULL, NULL, NULL, NULL);
}
-# endif
invert_m3_m3(td->smtx, td->mtx);
@@ -773,7 +681,7 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob)
total++;
if (mode == TFM_TRANSLATION) {
- if ( has_targetless_ik(pchan)==NULL ) {
+ if (has_targetless_ik(pchan) == NULL) {
if (pchan->parent && (pchan->bone->flag & BONE_CONNECTED)) {
if (pchan->bone->flag & BONE_HINGE_CHILD_TRANSFORM)
hastranslation = 1;
@@ -826,7 +734,7 @@ static void pchan_autoik_adjust (bPoseChannel *pchan, short chainlen)
}
/* change the chain-length of auto-ik */
-void transform_autoik_update (TransInfo *t, short mode)
+void transform_autoik_update(TransInfo *t, short mode)
{
short *chainlen= &t->settings->autoik_chainlen;
bPoseChannel *pchan;
@@ -1443,7 +1351,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
if (cu->editnurb==NULL) return;
/* count total of vertices, check identical as in 2nd loop for making transdata! */
- nurbs= curve_editnurbs(cu);
+ nurbs= BKE_curve_editNurbs_get(cu);
for (nu= nurbs->first; nu; nu= nu->next) {
if (nu->type == CU_BEZIER) {
for (a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
@@ -1593,7 +1501,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
* but for now just don't change handle types */
if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT) == 0) {
/* sets the handles based on their selection, do this after the data is copied to the TransData */
- testhandlesNurb(nu);
+ BKE_nurb_handles_test(nu);
}
}
else {
@@ -1708,7 +1616,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
PTCacheEditPoint *point;
PTCacheEditKey *key;
float mat[4][4];
- int i,k, transformparticle;
+ int i, k, transformparticle;
int count = 0, hasselected = 0;
int propmode = t->flag & T_PROP_EDIT;
@@ -1717,7 +1625,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
psys = edit->psys;
if (psys)
- psmd = psys_get_modifier(ob,psys);
+ psmd = psys_get_modifier(ob, psys);
base->flag |= BA_HAS_RECALC_DATA;
@@ -1757,7 +1665,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
unit_m4(mat);
- invert_m4_m4(ob->imat,ob->obmat);
+ invert_m4_m4(ob->imat, ob->obmat);
for (i=0, point=edit->points; i<edit->totpoint; i++, point++) {
TransData *head, *tail;
@@ -1840,7 +1748,7 @@ void flushTransParticles(TransInfo *t)
if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles + i, mat);
- invert_m4_m4(imat,mat);
+ invert_m4_m4(imat, mat);
for (k=0, key=point->keys; k<point->totkey; k++, key++) {
copy_v3_v3(co, key->world_co);
@@ -2147,7 +2055,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
* the modifiers that support deform matrices (defcos) */
if (totleft > 0) {
mappedcos= crazyspace_get_mapped_editverts(t->scene, t->obedit);
- quats= MEM_mallocN( (t->total)*sizeof(float)*4, "crazy quats");
+ quats= MEM_mallocN((t->total)*sizeof(float)*4, "crazy quats");
crazyspace_set_quats_editmesh(em, (float*)defcos, mappedcos, quats); /* BMESH_TODO, abuses vertex index, should use an int array */
if (mappedcos)
MEM_freeN(mappedcos);
@@ -2225,7 +2133,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
}
/* Mirror? */
- if ( (mirror>0 && tob->iloc[0]>0.0f) || (mirror<0 && tob->iloc[0]<0.0f)) {
+ if ((mirror>0 && tob->iloc[0]>0.0f) || (mirror<0 && tob->iloc[0]<0.0f)) {
BMVert *vmir= EDBM_verts_mirror_get(em, eve); //t->obedit, em, eve, tob->iloc, a);
if (vmir && vmir != eve) {
tob->extra = vmir;
@@ -2239,7 +2147,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
if (mirror != 0)
{
tob = t->data;
- for ( a = 0; a < t->total; a++, tob++ )
+ for (a = 0; a < t->total; a++, tob++ )
{
if (ABS(tob->loc[0]) <= 0.00001f)
{
@@ -2386,7 +2294,7 @@ void flushTransSeq(TransInfo *t)
if (seq->depth==0) {
/* test overlap, displayes red outline */
seq->flag &= ~SEQ_OVERLAP;
- if ( seq_test_overlap(seqbasep, seq) ) {
+ if (seq_test_overlap(seqbasep, seq)) {
seq->flag |= SEQ_OVERLAP;
}
}
@@ -2707,8 +2615,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
center[2]= 0.0f;
/* set td's based on which handles are applicable */
- if (FrameOnMouseSide(t->frame_side, strip->start, (float)CFRA))
- {
+ if (FrameOnMouseSide(t->frame_side, strip->start, (float)CFRA)) {
/* just set tdn to assume that it only has one handle for now */
tdn->handle= -1;
@@ -2739,8 +2646,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
td->extra= tdn;
td++;
}
- if (FrameOnMouseSide(t->frame_side, strip->end, (float)CFRA))
- {
+ if (FrameOnMouseSide(t->frame_side, strip->end, (float)CFRA)) {
/* if tdn is already holding the start handle, then we're doing both, otherwise, only end */
tdn->handle= (tdn->handle) ? 2 : 1;
@@ -3081,14 +2987,14 @@ typedef struct tGPFtransdata {
} tGPFtransdata;
/* This function helps flush transdata written to tempdata into the gp-frames */
-void flushTransGPactionData (TransInfo *t)
+void flushTransGPactionData(TransInfo *t)
{
tGPFtransdata *tfd;
int i;
/* find the first one to start from */
if (t->mode == TFM_TIME_SLIDE)
- tfd= (tGPFtransdata *)( (float *)(t->customData) + 2 );
+ tfd= (tGPFtransdata *)((float *)(t->customData) + 2);
else
tfd= (tGPFtransdata *)(t->customData);
@@ -3207,7 +3113,7 @@ static void createTransActionData(bContext *C, TransInfo *t)
if (ac.datatype == ANIMCONT_GPENCIL) {
if (t->mode == TFM_TIME_SLIDE) {
t->customData= MEM_callocN((sizeof(float)*2)+(sizeof(tGPFtransdata)*count), "TimeSlide + tGPFtransdata");
- tfd= (tGPFtransdata *)( (float *)(t->customData) + 2 );
+ tfd= (tGPFtransdata *)((float *)(t->customData) + 2);
}
else {
t->customData= MEM_callocN(sizeof(tGPFtransdata)*count, "tGPFtransdata");
@@ -3562,9 +3468,9 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
* then check if we're using auto-handles.
* - If so, change them auto-handles to aligned handles so that handles get affected too
*/
- if ( ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) &&
- ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM) &&
- ELEM(t->mode, TFM_ROTATION, TFM_RESIZE))
+ if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) &&
+ ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM) &&
+ ELEM(t->mode, TFM_ROTATION, TFM_RESIZE))
{
if (hdata && (sel1) && (sel3)) {
bezt->h1= HD_ALIGN;
@@ -3653,8 +3559,8 @@ static void sort_time_beztmaps (BeztMap *bezms, int totvert, const short UNUSED(
* optimization: this only needs to be performed in the first loop
*/
if (bezm->swapHs == 0) {
- if ( (bezm->bezt->vec[0][0] > bezm->bezt->vec[1][0]) &&
- (bezm->bezt->vec[2][0] < bezm->bezt->vec[1][0]) )
+ if ((bezm->bezt->vec[0][0] > bezm->bezt->vec[1][0]) &&
+ (bezm->bezt->vec[2][0] < bezm->bezt->vec[1][0]) )
{
/* handles need to be swapped */
bezm->swapHs = 1;
@@ -3753,7 +3659,7 @@ static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totv
* anim_data is the list of channels (F-Curves) retrieved already containing the
* channels to work on. It should not be freed here as it may still need to be used.
*/
-void remake_graph_transdata (TransInfo *t, ListBase *anim_data)
+void remake_graph_transdata(TransInfo *t, ListBase *anim_data)
{
SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
bAnimListElem *ale;
@@ -3808,9 +3714,9 @@ void flushTransGraphData(TransInfo *t)
switch (sipo->autosnap) {
case SACTSNAP_FRAME: /* snap to nearest frame (or second if drawing seconds) */
if (sipo->flag & SIPO_DRAWTIME)
- td2d->loc[0]= (float)( floor((td2d->loc[0]/secf) + 0.5f) * secf );
+ td2d->loc[0]= (float)(floor((td2d->loc[0]/secf) + 0.5f) * secf);
else
- td2d->loc[0]= (float)( floor(td2d->loc[0]+0.5f) );
+ td2d->loc[0]= (float)(floor(td2d->loc[0]+0.5f));
break;
case SACTSNAP_MARKER: /* snap to nearest marker */
@@ -3973,7 +3879,7 @@ static int SeqTransCount(TransInfo *t, Sequence *parent, ListBase *seqbase, int
for (seq= seqbase->first; seq; seq= seq->next) {
seq->depth= depth;
- /* seq->tmp is used by seq_tx_get_final_{left,right} to check sequence's range and clamp to it if needed.
+ /* seq->tmp is used by seq_tx_get_final_{left, right} to check sequence's range and clamp to it if needed.
* it's first place where digging into sequences tree, so store link to parent here */
seq->tmp = parent;
@@ -3993,7 +3899,7 @@ static TransData *SeqToTransData(TransData *td, TransData2D *td2d, TransDataSeq
{
int start_left;
- switch(sel_flag) {
+ switch (sel_flag) {
case SELECT:
/* Use seq_tx_get_final_left() and an offset here
* so transform has the left hand location of the strip.
@@ -4267,9 +4173,9 @@ static void createTransSeqData(bContext *C, TransInfo *t)
int i;
for (i=0; i<3; i++) {
seq_user= *((&seq->seq1) + i);
- if ( seq_user && (seq_user->flag & SELECT) &&
- !(seq_user->flag & SEQ_LOCK) &&
- !(seq_user->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)))
+ if (seq_user && (seq_user->flag & SELECT) &&
+ !(seq_user->flag & SEQ_LOCK) &&
+ !(seq_user->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)))
{
seq->flag |= SELECT;
}
@@ -4447,8 +4353,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
}
/* set active flag */
- if (ob == OBACT)
- {
+ if (ob == OBACT) {
td->flag |= TD_ACTIVE;
}
}
@@ -4500,8 +4405,7 @@ static void set_trans_object_base_flags(TransInfo *t)
parsel= parsel->parent;
}
- if (parsel)
- {
+ if (parsel) {
/* rotation around local centers are allowed to propagate */
if ((t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL) && t->around == V3D_LOCAL) {
base->flag |= BA_TRANSFORM_CHILD;
@@ -4534,10 +4438,8 @@ static int mark_children(Object *ob)
if (ob->flag & (SELECT|BA_TRANSFORM_CHILD))
return 1;
- if (ob->parent)
- {
- if (mark_children(ob->parent))
- {
+ if (ob->parent) {
+ if (mark_children(ob->parent)) {
ob->flag |= BA_TRANSFORM_CHILD;
return 1;
}
@@ -4554,8 +4456,7 @@ static int count_proportional_objects(TransInfo *t)
Base *base;
/* rotations around local centers are allowed to propagate, so we take all objects */
- if (!((t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL) && t->around == V3D_LOCAL))
- {
+ if (!((t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL) && t->around == V3D_LOCAL)) {
/* mark all parents */
for (base= scene->base.first; base; base= base->next) {
if (TESTBASELIB_BGMODE(v3d, scene, base)) {
@@ -4572,8 +4473,8 @@ static int count_proportional_objects(TransInfo *t)
/* mark all children */
for (base= scene->base.first; base; base= base->next) {
/* all base not already selected or marked that is editable */
- if ( (base->object->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 &&
- (BASE_EDITABLE_BGMODE(v3d, scene, base)))
+ if ((base->object->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 &&
+ (BASE_EDITABLE_BGMODE(v3d, scene, base)))
{
mark_children(base->object);
}
@@ -4584,8 +4485,8 @@ static int count_proportional_objects(TransInfo *t)
Object *ob= base->object;
/* if base is not selected, not a parent of selection or not a child of selection and it is editable */
- if ( (ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 &&
- (BASE_EDITABLE_BGMODE(v3d, scene, base)))
+ if ((ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 &&
+ (BASE_EDITABLE_BGMODE(v3d, scene, base)))
{
/* used for flush, depgraph will change recalcs if needed :) */
@@ -4616,8 +4517,7 @@ static void clear_trans_object_base_flags(TransInfo *t)
Scene *sce = t->scene;
Base *base;
- for (base= sce->base.first; base; base = base->next)
- {
+ for (base= sce->base.first; base; base = base->next) {
if (base->flag & BA_WAS_SEL)
base->flag |= SELECT;
@@ -4937,14 +4837,16 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
ED_node_link_intersect_test(t->sa, 0);
}
else if (t->spacetype == SPACE_CLIP) {
- SpaceClip *sc = t->sa->spacedata.first;
- MovieClip *clip = ED_space_clip(sc);
-
- if (t->scene->nodetree) {
- /* tracks can be used for stabilization nodes,
- * flush update for such nodes */
- nodeUpdateID(t->scene->nodetree, &clip->id);
- WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL);
+ if (t->options & CTX_MOVIECLIP) {
+ SpaceClip *sc = t->sa->spacedata.first;
+ MovieClip *clip = ED_space_clip(sc);
+
+ if (t->scene->nodetree) {
+ /* tracks can be used for stabilization nodes,
+ * flush update for such nodes */
+ nodeUpdateID(t->scene->nodetree, &clip->id);
+ WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL);
+ }
}
}
else if (t->spacetype == SPACE_ACTION) {
@@ -4975,8 +4877,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
* 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
* 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
*/
- if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
- ((canceled == 0) || (duplicate)) )
+ if ((saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
+ ((canceled == 0) || (duplicate)) )
{
if (adt) {
ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 1);
@@ -5006,8 +4908,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
* 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
* 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
*/
- if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
- ((canceled == 0) || (duplicate)) )
+ if ((saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
+ ((canceled == 0) || (duplicate)))
{
posttrans_action_clean(&ac, (bAction *)ac.data);
}
@@ -5019,8 +4921,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
* 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
* 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
*/
- if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
- ((canceled == 0) || (duplicate)) )
+ if ((saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
+ ((canceled == 0) || (duplicate)))
{
bGPdata *gpd;
@@ -5070,8 +4972,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
if (ANIM_animdata_get_context(C, &ac) == 0)
return;
- if (ac.datatype)
- {
+ if (ac.datatype) {
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
@@ -5088,8 +4989,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
* 2) canceled == 0 -> user confirmed the transform, so duplicates should be removed
* 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
*/
- if ( (sipo->flag & SIPO_NOTRANSKEYCULL)==0 &&
- ((canceled == 0) || (duplicate)) )
+ if ((sipo->flag & SIPO_NOTRANSKEYCULL)==0 &&
+ ((canceled == 0) || (duplicate)))
{
if (adt) {
ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 0);
@@ -5120,8 +5021,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
if (ANIM_animdata_get_context(C, &ac) == 0)
return;
- if (ac.datatype)
- {
+ if (ac.datatype) {
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT);
@@ -5147,8 +5047,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
}
}
else if (t->obedit) {
- if (t->obedit->type == OB_MESH)
- {
+ if (t->obedit->type == OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(t->obedit);
/* table needs to be created for each edit command, since vertices can move etc */
mesh_octree_table(t->obedit, em, NULL, 'e');
@@ -5202,10 +5101,10 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
- else if ( (t->scene->basact) &&
- (ob = t->scene->basact->object) &&
- (ob->mode & OB_MODE_PARTICLE_EDIT) &&
- PE_get_current(t->scene, ob))
+ else if ((t->scene->basact) &&
+ (ob = t->scene->basact->object) &&
+ (ob->mode & OB_MODE_PARTICLE_EDIT) &&
+ PE_get_current(t->scene, ob))
{
/* do nothing */
}
@@ -5298,16 +5197,14 @@ static void createTransObject(bContext *C, TransInfo *t)
return;
}
- if (propmode)
- {
+ if (propmode) {
t->total += count_proportional_objects(t);
}
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransOb");
tx = t->ext = MEM_callocN(t->total*sizeof(TransDataExtension), "TransObExtension");
- CTX_DATA_BEGIN(C, Base*, base, selected_bases)
- {
+ CTX_DATA_BEGIN (C, Base*, base, selected_bases) {
Object *ob= base->object;
td->flag = TD_SELECTED;
@@ -5315,8 +5212,7 @@ static void createTransObject(bContext *C, TransInfo *t)
td->ext = tx;
td->ext->rotOrder= ob->rotmode;
- if (base->flag & BA_TRANSFORM_CHILD)
- {
+ if (base->flag & BA_TRANSFORM_CHILD) {
td->flag |= TD_NOCENTER;
td->flag |= TD_NO_LOC;
}
@@ -5333,8 +5229,7 @@ static void createTransObject(bContext *C, TransInfo *t)
}
CTX_DATA_END;
- if (propmode)
- {
+ if (propmode) {
Scene *scene = t->scene;
View3D *v3d = t->view;
Base *base;
@@ -5343,7 +5238,8 @@ static void createTransObject(bContext *C, TransInfo *t)
Object *ob= base->object;
/* if base is not selected, not a parent of selection or not a child of selection and it is editable */
- if ((ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && BASE_EDITABLE_BGMODE(v3d, scene, base))
+ if ((ob->flag & (SELECT | BA_TRANSFORM_CHILD | BA_TRANSFORM_PARENT)) == 0 &&
+ BASE_EDITABLE_BGMODE(v3d, scene, base))
{
td->protectflag= ob->protectflag;
td->ext = tx;
@@ -5414,13 +5310,15 @@ static void createTransNodeData(bContext *C, TransInfo *t)
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransNode TransData");
td2d = t->data2d = MEM_callocN(t->total*sizeof(TransData2D), "TransNode TransData2D");
- CTX_DATA_BEGIN(C, bNode *, selnode, selected_nodes)
+ CTX_DATA_BEGIN (C, bNode *, selnode, selected_nodes)
NodeToTransData(td++, td2d++, selnode);
CTX_DATA_END
}
/* *** CLIP EDITOR *** */
+/* * motion tracking * */
+
enum {
transDataTracking_ModeTracks = 0,
transDataTracking_ModeCurves = 1,
@@ -5749,10 +5647,13 @@ static void createTransTrackingData(bContext *C, TransInfo *t)
ARegion *ar = CTX_wm_region(C);
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip(sc);
+ int width, height;
t->total = 0;
- if (!clip || !BKE_movieclip_has_frame(clip, &sc->user))
+ BKE_movieclip_get_size(clip, &sc->user, &width, &height);
+
+ if (!clip || width == 0 || height == 0)
return;
if (!ELEM(t->mode, TFM_RESIZE, TFM_TRANSLATION))
@@ -5939,7 +5840,8 @@ void createTransData(bContext *C, TransInfo *t)
}
else if (t->spacetype == SPACE_CLIP) {
t->flag |= T_POINTS|T_2D_EDIT;
- createTransTrackingData(C, t);
+ if (t->options & CTX_MOVIECLIP)
+ createTransTrackingData(C, t);
}
else if (t->obedit) {
t->ext = NULL;
@@ -6032,12 +5934,10 @@ void createTransData(bContext *C, TransInfo *t)
sort_trans_data_dist(t);
}
- if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW))
- {
+ if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) {
View3D *v3d = t->view;
RegionView3D *rv3d = CTX_wm_region_view3d(C);
- if (rv3d && (t->flag & T_OBJECT) && v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB)
- {
+ if (rv3d && (t->flag & T_OBJECT) && v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB) {
t->flag |= T_CAMERA;
}
}
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index b500398dd76..0bf02d1a2bf 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -111,8 +111,7 @@
void getViewVector(TransInfo *t, float coord[3], float vec[3])
{
- if (t->persp != RV3D_ORTHO)
- {
+ if (t->persp != RV3D_ORTHO) {
float p1[4], p2[4];
copy_v3_v3(p1, coord);
@@ -256,8 +255,7 @@ static void editbmesh_apply_to_mirror(TransInfo *t)
eve->co[2]= td->loc[2];
}
- if (td->flag & TD_MIRROR_EDGE)
- {
+ if (td->flag & TD_MIRROR_EDGE) {
td->loc[0] = 0;
}
}
@@ -635,15 +633,16 @@ static void recalcData_image(TransInfo *t)
}
/* helper for recalcData() - for Movie Clip transforms */
-static void recalcData_clip(TransInfo *t)
+static void recalcData_spaceclip(TransInfo *t)
{
SpaceClip *sc = t->sa->spacedata.first;
+
MovieClip *clip = ED_space_clip(sc);
ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
MovieTrackingTrack *track;
-
+
flushTransTracking(t);
-
+
track = tracksbase->first;
while (track) {
if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
@@ -660,10 +659,10 @@ static void recalcData_clip(TransInfo *t)
BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
}
}
-
+
track = track->next;
}
-
+
DAG_id_tag_update(&clip->id, 0);
}
@@ -675,7 +674,7 @@ static void recalcData_view3d(TransInfo *t)
if (t->obedit) {
if (ELEM(t->obedit->type, OB_CURVE, OB_SURF)) {
Curve *cu= t->obedit->data;
- ListBase *nurbs= curve_editnurbs(cu);
+ ListBase *nurbs= BKE_curve_editNurbs_get(cu);
Nurb *nu= nurbs->first;
if (t->state != TRANS_CANCEL) {
@@ -687,15 +686,15 @@ static void recalcData_view3d(TransInfo *t)
if (t->state == TRANS_CANCEL) {
while (nu) {
- calchandlesNurb(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
+ BKE_nurb_handles_calc(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
nu= nu->next;
}
}
else {
/* Normal updating */
while (nu) {
- test2DNurb(nu);
- calchandlesNurb(nu);
+ BKE_nurb_test2D(nu);
+ BKE_nurb_handles_calc(nu);
nu= nu->next;
}
}
@@ -775,21 +774,17 @@ static void recalcData_view3d(TransInfo *t)
}
- if (t->mode != TFM_BONE_ROLL)
- {
+ if (t->mode != TFM_BONE_ROLL) {
/* fix roll */
- for (i = 0; i < t->total; i++, td++)
- {
- if (td->extra)
- {
+ for (i = 0; i < t->total; i++, td++) {
+ if (td->extra) {
float vec[3], up_axis[3];
float qrot[4];
ebo = td->extra;
copy_v3_v3(up_axis, td->axismtx[2]);
- if (t->mode != TFM_ROTATION)
- {
+ if (t->mode != TFM_ROTATION) {
sub_v3_v3v3(vec, ebo->tail, ebo->head);
normalize_v3(vec);
rotation_between_vecs_to_quat(qrot, td->axismtx[1], vec);
@@ -906,7 +901,7 @@ void recalcData(TransInfo *t)
recalcData_view3d(t);
}
else if (t->spacetype == SPACE_CLIP) {
- recalcData_clip(t);
+ recalcData_spaceclip(t);
}
}
@@ -915,8 +910,7 @@ void drawLine(TransInfo *t, float *center, float *dir, char axis, short options)
float v1[3], v2[3], v3[3];
unsigned char col[3], col2[3];
- if (t->spacetype == SPACE_VIEW3D)
- {
+ if (t->spacetype == SPACE_VIEW3D) {
View3D *v3d = t->view;
glPushMatrix();
@@ -955,7 +949,7 @@ void resetTransRestrictions(TransInfo *t)
}
/* the *op can be NULL */
-int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
+int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
{
Scene *sce = CTX_data_scene(C);
ToolSettings *ts = CTX_data_tool_settings(C);
@@ -984,8 +978,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
t->redraw = 1; /* redraw first time */
- if (event)
- {
+ if (event) {
copy_v2_v2_int(t->imval, event->mval);
t->event_type = event->type;
}
@@ -1043,8 +1036,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
- if (t->spacetype == SPACE_VIEW3D)
- {
+ if (t->spacetype == SPACE_VIEW3D) {
View3D *v3d = sa->spacedata.first;
t->view = v3d;
@@ -1060,12 +1052,12 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
if (v3d->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN;
t->around = v3d->around;
- if (op && RNA_struct_find_property(op->ptr, "constraint_orientation") && RNA_struct_property_is_set(op->ptr, "constraint_orientation"))
+ if (op && (RNA_struct_find_property(op->ptr, "constraint_orientation") &&
+ RNA_struct_property_is_set(op->ptr, "constraint_orientation")))
{
t->current_orientation = RNA_enum_get(op->ptr, "constraint_orientation");
-
- if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C))
- {
+
+ if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C)) {
t->current_orientation = V3D_MANIP_GLOBAL;
}
}
@@ -1124,10 +1116,8 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
t->around = V3D_CENTER;
}
- if (op && RNA_struct_property_is_set(op->ptr, "release_confirm"))
- {
- if (RNA_boolean_get(op->ptr, "release_confirm"))
- {
+ if (op && RNA_struct_property_is_set(op->ptr, "release_confirm")) {
+ if (RNA_boolean_get(op->ptr, "release_confirm")) {
t->flag |= T_RELEASE_CONFIRM;
}
}
@@ -1137,35 +1127,31 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
}
- if (op && RNA_struct_find_property(op->ptr, "mirror") && RNA_struct_property_is_set(op->ptr, "mirror"))
+ if (op && (RNA_struct_find_property(op->ptr, "mirror") &&
+ RNA_struct_property_is_set(op->ptr, "mirror")))
{
- if (RNA_boolean_get(op->ptr, "mirror"))
- {
+ if (RNA_boolean_get(op->ptr, "mirror")) {
t->flag |= T_MIRROR;
t->mirror = 1;
}
}
// Need stuff to take it from edit mesh or whatnot here
else if (t->spacetype == SPACE_VIEW3D) {
- if (t->obedit && t->obedit->type == OB_MESH && (((Mesh *)t->obedit->data)->editflag & ME_EDIT_MIRROR_X))
- {
+ if (t->obedit && t->obedit->type == OB_MESH && (((Mesh *)t->obedit->data)->editflag & ME_EDIT_MIRROR_X)) {
t->flag |= T_MIRROR;
t->mirror = 1;
}
}
/* setting PET flag only if property exist in operator. Otherwise, assume it's not supported */
- if (op && RNA_struct_find_property(op->ptr, "proportional"))
- {
- if (RNA_struct_property_is_set(op->ptr, "proportional"))
- {
- switch(RNA_enum_get(op->ptr, "proportional"))
- {
- case PROP_EDIT_CONNECTED:
- t->flag |= T_PROP_CONNECTED;
- case PROP_EDIT_ON:
- t->flag |= T_PROP_EDIT;
- break;
+ if (op && RNA_struct_find_property(op->ptr, "proportional")) {
+ if (RNA_struct_property_is_set(op->ptr, "proportional")) {
+ switch (RNA_enum_get(op->ptr, "proportional")) {
+ case PROP_EDIT_CONNECTED:
+ t->flag |= T_PROP_CONNECTED;
+ case PROP_EDIT_ON:
+ t->flag |= T_PROP_EDIT;
+ break;
}
}
else {
@@ -1186,7 +1172,8 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
}
- if (op && RNA_struct_find_property(op->ptr, "proportional_size") && RNA_struct_property_is_set(op->ptr, "proportional_size"))
+ if (op && (RNA_struct_find_property(op->ptr, "proportional_size") &&
+ RNA_struct_property_is_set(op->ptr, "proportional_size")))
{
t->prop_size = RNA_float_get(op->ptr, "proportional_size");
}
@@ -1196,13 +1183,13 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
/* TRANSFORM_FIX_ME rna restrictions */
- if (t->prop_size <= 0.00001f)
- {
+ if (t->prop_size <= 0.00001f) {
printf("Proportional size (%f) under 0.00001, reseting to 1!\n", t->prop_size);
t->prop_size = 1.0f;
}
- if (op && RNA_struct_find_property(op->ptr, "proportional_edit_falloff") && RNA_struct_property_is_set(op->ptr, "proportional_edit_falloff"))
+ if (op && (RNA_struct_find_property(op->ptr, "proportional_edit_falloff") &&
+ RNA_struct_property_is_set(op->ptr, "proportional_edit_falloff")))
{
t->prop_mode = RNA_enum_get(op->ptr, "proportional_edit_falloff");
}
@@ -1210,14 +1197,12 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
t->prop_mode = ts->prop_mode;
}
}
- else /* add not pet option to context when not available */
- {
+ else { /* add not pet option to context when not available */
t->options |= CTX_NO_PET;
}
// Mirror is not supported with PET, turn it off.
- if (t->flag & T_PROP_EDIT)
- {
+ if (t->flag & T_PROP_EDIT) {
t->flag &= ~T_MIRROR;
}
@@ -1228,7 +1213,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
/* Here I would suggest only TransInfo related issues, like free data & reset vars. Not redraws */
-void postTrans (bContext *C, TransInfo *t)
+void postTrans(bContext *C, TransInfo *t)
{
TransData *td;
@@ -1282,8 +1267,7 @@ void postTrans (bContext *C, TransInfo *t)
}
}
- if (t->mouse.data)
- {
+ if (t->mouse.data) {
MEM_freeN(t->mouse.data);
}
}
@@ -1440,8 +1424,7 @@ void calculateCenterMedian(TransInfo *t)
for (i = 0; i < t->total; i++) {
if (t->data[i].flag & TD_SELECTED) {
- if (!(t->data[i].flag & TD_NOCENTER))
- {
+ if (!(t->data[i].flag & TD_NOCENTER)) {
add_v3_v3(partial, t->data[i].center);
total++;
}
@@ -1493,7 +1476,7 @@ void calculateCenterBound(TransInfo *t)
void calculateCenter(TransInfo *t)
{
- switch(t->around) {
+ switch (t->around) {
case V3D_CENTER:
calculateCenterBound(t);
break;
@@ -1542,8 +1525,7 @@ void calculateCenter(TransInfo *t)
} /* END EDIT MODE ACTIVE ELEMENT */
calculateCenterMedian(t);
- if ((t->flag & (T_EDIT|T_POSE))==0)
- {
+ if ((t->flag & (T_EDIT|T_POSE))==0) {
Scene *scene = t->scene;
Object *ob= OBACT;
if (ob) {
@@ -1583,8 +1565,7 @@ void calculateCenter(TransInfo *t)
projectIntView(t, axis, t->center2d);
/* rotate only needs correct 2d center, grab needs initgrabz() value */
- if (t->mode==TFM_TRANSLATION)
- {
+ if (t->mode==TFM_TRANSLATION) {
copy_v3_v3(t->center, axis);
copy_v3_v3(t->con.center, t->center);
}
@@ -1625,11 +1606,8 @@ void calculatePropRatio(TransInfo *t)
td->factor = 0.0f;
restoreElement(td);
}
- else if ((connected &&
- (td->flag & TD_NOTCONNECTED || td->dist > t->prop_size))
- ||
- (connected == 0 &&
- td->rdist > t->prop_size))
+ else if ((connected && (td->flag & TD_NOTCONNECTED || td->dist > t->prop_size)) ||
+ (connected == 0 && td->rdist > t->prop_size))
{
/*
* The elements are sorted according to their dist member in the array,
@@ -1656,7 +1634,7 @@ void calculatePropRatio(TransInfo *t)
if (dist < 0.0f)
dist = 0.0f;
- switch(t->prop_mode) {
+ switch (t->prop_mode) {
case PROP_SHARP:
td->factor= dist*dist;
break;
@@ -1676,7 +1654,7 @@ void calculatePropRatio(TransInfo *t)
td->factor = (float)sqrt(2*dist - dist * dist);
break;
case PROP_RANDOM:
- BLI_srand( BLI_rand() ); /* random seed */
+ BLI_srand(BLI_rand()); /* random seed */
td->factor = BLI_frand()*dist;
break;
default:
@@ -1684,7 +1662,7 @@ void calculatePropRatio(TransInfo *t)
}
}
}
- switch(t->prop_mode) {
+ switch (t->prop_mode) {
case PROP_SHARP:
strcpy(t->proptext, "(Sharp)");
break;
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index bd3fb20f77f..467e3dc600e 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -313,8 +313,7 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
}
#endif
- switch(mode)
- {
+ switch (mode) {
case INPUT_VECTOR:
mi->apply = InputVector;
t->helpline = HLP_NONE;
@@ -391,8 +390,7 @@ int handleMouseInput(TransInfo *t, MouseInput *mi, wmEvent *event)
{
int redraw = TREDRAW_NOTHING;
- switch (event->type)
- {
+ switch (event->type) {
case LEFTSHIFTKEY:
case RIGHTSHIFTKEY:
if (event->val == KM_PRESS) {
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 5b70b25c894..093c81c8d37 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -297,7 +297,7 @@ int calc_manipulator_stats(const bContext *C)
if (obedit->type==OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(obedit);
BMEditSelection ese;
- float vec[3]= {0,0,0};
+ float vec[3]= {0, 0, 0};
/* USE LAST SELECTE WITH ACTIVE */
if ((v3d->around == V3D_ACTIVE) && BM_select_history_active_get(em->bm, &ese)) {
@@ -389,7 +389,7 @@ int calc_manipulator_stats(const bContext *C)
Nurb *nu;
BezTriple *bezt;
BPoint *bp;
- ListBase *nurbs= curve_editnurbs(cu);
+ ListBase *nurbs= BKE_curve_editNurbs_get(cu);
nu= nurbs->first;
while (nu) {
@@ -508,7 +508,7 @@ int calc_manipulator_stats(const bContext *C)
if (edit) {
point = edit->points;
- for (a=0; a<edit->totpoint; a++,point++) {
+ for (a=0; a<edit->totpoint; a++, point++) {
if (point->flag & PEP_HIDE) continue;
for (k=0, ek=point->keys; k<point->totkey; k++, ek++) {
@@ -549,7 +549,7 @@ int calc_manipulator_stats(const bContext *C)
/* global, local or normal orientation? */
if (ob && totsel) {
- switch(v3d->twmode) {
+ switch (v3d->twmode) {
case V3D_MANIP_GLOBAL:
break; /* nothing to do */
@@ -643,7 +643,7 @@ static float screen_aligned(RegionView3D *rv3d, float mat[][4])
glTranslatef(mat[3][0], mat[3][1], mat[3][2]);
/* sets view screen aligned */
- glRotatef( -360.0f*saacos(rv3d->viewquat[0])/(float)M_PI, rv3d->viewquat[1], rv3d->viewquat[2], rv3d->viewquat[3]);
+ glRotatef(-360.0f*saacos(rv3d->viewquat[0])/(float)M_PI, rv3d->viewquat[1], rv3d->viewquat[2], rv3d->viewquat[3]);
return len_v3(mat[0]); /* draw scale */
}
@@ -761,7 +761,7 @@ static void manipulator_setcolor(View3D *v3d, char axis, int colcode, unsigned c
UI_GetThemeColor3ubv(TH_TRANSFORM, col);
}
else {
- switch(axis) {
+ switch (axis) {
case 'C':
UI_GetThemeColor3ubv(TH_TRANSFORM, col);
if (v3d->twmode == V3D_MANIP_LOCAL) {
@@ -884,7 +884,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
glClipPlane(GL_CLIP_PLANE0, plane);
}
/* sets view screen aligned */
- glRotatef( -360.0f*saacos(rv3d->viewquat[0])/(float)M_PI, rv3d->viewquat[1], rv3d->viewquat[2], rv3d->viewquat[3]);
+ glRotatef(-360.0f*saacos(rv3d->viewquat[0])/(float)M_PI, rv3d->viewquat[1], rv3d->viewquat[2], rv3d->viewquat[3]);
/* Screen aligned help circle */
if (arcs) {
@@ -1483,7 +1483,7 @@ void BIF_draw_manipulator(const bContext *C)
v3d->twflag |= V3D_DRAW_MANIPULATOR;
/* now we can define center */
- switch(v3d->around) {
+ switch (v3d->around) {
case V3D_CENTER:
case V3D_ACTIVE:
rv3d->twmat[3][0]= (scene->twmin[0] + scene->twmax[0])/2.0f;
@@ -1512,7 +1512,7 @@ void BIF_draw_manipulator(const bContext *C)
if (v3d->twflag & V3D_DRAW_MANIPULATOR) {
- glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
if (v3d->twtype & V3D_MANIP_ROTATE) {
@@ -1553,7 +1553,7 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl
setwinmatrixview3d(ar, v3d, &rect);
mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat);
- glSelectBuffer( 64, buffer);
+ glSelectBuffer(64, buffer);
glRenderMode(GL_SELECT);
glInitNames(); /* these two calls whatfor? It doesnt work otherwise */
glPushName(-2);
@@ -1639,7 +1639,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
if (drawflags==0) drawflags= val;
if (drawflags & MAN_TRANS_C) {
- switch(drawflags) {
+ switch (drawflags) {
case MAN_TRANS_C:
break;
case MAN_TRANS_X:
@@ -1672,7 +1672,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
//wm_operator_invoke(C, WM_operatortype_find("TRANSFORM_OT_translate", 0), event, op->ptr, NULL, FALSE);
}
else if (drawflags & MAN_SCALE_C) {
- switch(drawflags) {
+ switch (drawflags) {
case MAN_SCALE_X:
if (shift) {
constraint_axis[1] = 1;
@@ -1707,7 +1707,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
//wm_operator_invoke(C, WM_operatortype_find("TRANSFORM_OT_trackball", 0), event, op->ptr, NULL, FALSE);
}
else if (drawflags & MAN_ROT_C) {
- switch(drawflags) {
+ switch (drawflags) {
case MAN_ROT_X:
constraint_axis[0] = 1;
break;
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 09078c199c4..83d4a5dfa6e 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -145,7 +145,7 @@ static int snap_type_exec(bContext *C, wmOperator *op)
{
ToolSettings *ts= CTX_data_tool_settings(C);
- ts->snap_mode = RNA_enum_get(op->ptr,"type");
+ ts->snap_mode = RNA_enum_get(op->ptr, "type");
WM_event_add_notifier(C, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
@@ -317,23 +317,19 @@ static void transformops_exit(bContext *C, wmOperator *op)
static int transformops_data(bContext *C, wmOperator *op, wmEvent *event)
{
int retval = 1;
- if (op->customdata == NULL)
- {
+ if (op->customdata == NULL) {
TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data2");
TransformModeItem *tmode;
int mode = -1;
- for (tmode = transform_modes; tmode->idname; tmode++)
- {
- if (op->type->idname == tmode->idname)
- {
+ for (tmode = transform_modes; tmode->idname; tmode++) {
+ if (op->type->idname == tmode->idname) {
mode = tmode->mode;
break;
}
}
- if (mode == -1)
- {
+ if (mode == -1) {
mode = RNA_enum_get(op->ptr, "mode");
}
@@ -376,8 +372,7 @@ static int transform_modal(bContext *C, wmOperator *op, wmEvent *event)
exit_code |= transformEnd(C, t);
- if ((exit_code & OPERATOR_RUNNING_MODAL) == 0)
- {
+ if ((exit_code & OPERATOR_RUNNING_MODAL) == 0) {
transformops_exit(C, op);
exit_code &= ~OPERATOR_PASS_THROUGH; /* preventively remove passthrough */
}
@@ -400,8 +395,7 @@ static int transform_exec(bContext *C, wmOperator *op)
{
TransInfo *t;
- if (!transformops_data(C, op, NULL))
- {
+ if (!transformops_data(C, op, NULL)) {
G.moving = 0;
return OPERATOR_CANCELLED;
}
@@ -423,8 +417,7 @@ static int transform_exec(bContext *C, wmOperator *op)
static int transform_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- if (!transformops_data(C, op, event))
- {
+ if (!transformops_data(C, op, event)) {
G.moving = 0;
return OPERATOR_CANCELLED;
}
@@ -445,8 +438,7 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
{
PropertyRNA *prop;
- if (flags & P_AXIS)
- {
+ if (flags & P_AXIS) {
prop= RNA_def_property(ot->srna, "axis", PROP_FLOAT, PROP_DIRECTION);
RNA_def_property_array(prop, 3);
/* Make this not hidden when there's a nice axis selection widget */
@@ -455,8 +447,7 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
}
- if (flags & P_CONSTRAINT)
- {
+ if (flags & P_CONSTRAINT) {
RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
prop= RNA_def_property(ot->srna, "constraint_orientation", PROP_ENUM, PROP_NONE);
RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
@@ -465,21 +456,18 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
}
- if (flags & P_MIRROR)
- {
+ if (flags & P_MIRROR) {
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
}
- if (flags & P_PROPORTIONAL)
- {
+ if (flags & P_PROPORTIONAL) {
RNA_def_enum(ot->srna, "proportional", proportional_editing_items, 0, "Proportional Editing", "");
RNA_def_enum(ot->srna, "proportional_edit_falloff", proportional_falloff_items, 0, "Proportional Editing Falloff", "Falloff type for proportional editing mode");
RNA_def_float(ot->srna, "proportional_size", 1, 0.00001f, FLT_MAX, "Proportional Size", "", 0.001, 100);
}
- if (flags & P_SNAP)
- {
+ if (flags & P_SNAP) {
prop= RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", "");
RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -497,14 +485,12 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
}
}
}
-
- if (flags & P_OPTIONS)
- {
+
+ if (flags & P_OPTIONS) {
RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Texture Space", "Edit Object data texture space");
}
- if (flags & P_CORRECT_UV)
- {
+ if (flags & P_CORRECT_UV) {
RNA_def_boolean(ot->srna, "correct_uv", 0, "Correct UVs", "Correct UV coordinates when transforming");
}
@@ -827,8 +813,7 @@ void transform_operatortypes(void)
{
TransformModeItem *tmode;
- for (tmode = transform_modes; tmode->idname; tmode++)
- {
+ for (tmode = transform_modes; tmode->idname; tmode++) {
WM_operatortype_append(tmode->opfunc);
}
@@ -853,15 +838,13 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
if (modalmap) {
TransformModeItem *tmode;
- for (tmode = transform_modes; tmode->idname; tmode++)
- {
+ for (tmode = transform_modes; tmode->idname; tmode++) {
WM_modalkeymap_assign(modalmap, tmode->idname);
}
WM_modalkeymap_assign(modalmap, "TRANSFORM_OT_transform");
}
- switch(spaceid)
- {
+ switch (spaceid) {
case SPACE_VIEW3D:
WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 0f929003e8f..04207643aa4 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -176,8 +176,7 @@ TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *na
type = getTransformOrientation(C, normal, plane, 0);
- switch (type)
- {
+ switch (type) {
case ORIENTATION_VERT:
if (createSpaceNormal(mat, normal) == 0) {
BKE_reports_prepend(reports, "Cannot use vertex with zero-length normal");
@@ -493,7 +492,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
Object *ob = CTX_data_active_object(C);
Object *obedit = CTX_data_active_object(C);
- switch(t->current_orientation) {
+ switch (t->current_orientation) {
case V3D_MANIP_GLOBAL:
unit_m3(t->spacemtx);
strcpy(t->spacename, "global");
@@ -574,15 +573,14 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
BMEditMesh *em = me->edit_btmesh;
BMVert *eve;
BMEditSelection ese;
- float vec[3]= {0,0,0};
+ float vec[3]= {0, 0, 0};
/* USE LAST SELECTED WITH ACTIVE */
if (activeOnly && BM_select_history_active_get(em->bm, &ese)) {
BM_editselection_normal(&ese, normal);
BM_editselection_plane(&ese, plane);
- switch (ese.htype)
- {
+ switch (ese.htype) {
case BM_VERT:
result = ORIENTATION_VERT;
break;
@@ -717,15 +715,14 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
Nurb *nu;
BezTriple *bezt;
int a;
- ListBase *nurbs= curve_editnurbs(cu);
+ ListBase *nurbs= BKE_curve_editNurbs_get(cu);
for (nu = nurbs->first; nu; nu = nu->next) {
/* only bezier has a normal */
if (nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;
- while (a--)
- {
+ while (a--) {
/* exception */
if ((bezt->f1 & SELECT) + (bezt->f2 & SELECT) + (bezt->f3 & SELECT) > SELECT) {
sub_v3_v3v3(normal, bezt->vec[0], bezt->vec[2]);
@@ -772,7 +769,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
float mat[4][4];
/* Rotation of MetaElem is stored in quat */
- quat_to_mat4( mat,ml_sel->quat);
+ quat_to_mat4(mat, ml_sel->quat);
copy_v3_v3(normal, mat[2]);
@@ -886,8 +883,7 @@ void ED_getTransformOrientationMatrix(const bContext *C, float orientation_mat[]
type = getTransformOrientation(C, normal, plane, activeOnly);
- switch (type)
- {
+ switch (type) {
case ORIENTATION_NORMAL:
if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0) {
type = ORIENTATION_NONE;
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 7bdd3ddc069..fa579293a73 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -140,8 +140,7 @@ int activeSnap(TransInfo *t)
void drawSnapping(const struct bContext *C, TransInfo *t)
{
- if (validSnap(t) && activeSnap(t))
- {
+ if (validSnap(t) && activeSnap(t)) {
unsigned char col[4], selectedCol[4], activeCol[4];
UI_GetThemeColor3ubv(TH_TRANSFORM, col);
@@ -184,16 +183,15 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
}
/* draw normal if needed */
- if (usingSnappingNormal(t) && validSnappingNormal(t))
- {
+ if (usingSnappingNormal(t) && validSnappingNormal(t)) {
glColor4ubv(activeCol);
glBegin(GL_LINES);
glVertex3f(t->tsnap.snapPoint[0], t->tsnap.snapPoint[1], t->tsnap.snapPoint[2]);
- glVertex3f( t->tsnap.snapPoint[0] + t->tsnap.snapNormal[0],
- t->tsnap.snapPoint[1] + t->tsnap.snapNormal[1],
- t->tsnap.snapPoint[2] + t->tsnap.snapNormal[2]);
- glEnd();
+ glVertex3f(t->tsnap.snapPoint[0] + t->tsnap.snapNormal[0],
+ t->tsnap.snapPoint[1] + t->tsnap.snapNormal[1],
+ t->tsnap.snapPoint[2] + t->tsnap.snapNormal[2]);
+ glEnd();
}
if (v3d->zbuf)
@@ -218,7 +216,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
cpack(0xFFFFFF);
glTranslatef(t->tsnap.snapPoint[0], t->tsnap.snapPoint[1], 0.0f);
- //glRectf(0,0,1,1);
+ //glRectf(0, 0, 1, 1);
setlinestyle(0);
cpack(0x0);
@@ -240,16 +238,14 @@ int handleSnapping(TransInfo *t, wmEvent *event)
int status = 0;
#if 0 // XXX need a proper selector for all snap mode
- if (BIF_snappingSupported(t->obedit) && event->type == TABKEY && event->shift)
- {
+ if (BIF_snappingSupported(t->obedit) && event->type == TABKEY && event->shift) {
/* toggle snap and reinit */
t->settings->snap_flag ^= SCE_SNAP;
initSnapping(t, NULL);
status = 1;
}
#endif
- if (event->type == MOUSEMOVE)
- {
+ if (event->type == MOUSEMOVE) {
status |= updateSelectedSnapPoint(t);
}
@@ -259,8 +255,7 @@ int handleSnapping(TransInfo *t, wmEvent *event)
void applyProject(TransInfo *t)
{
/* XXX FLICKER IN OBJECT MODE */
- if ((t->tsnap.project) && activeSnap(t) && (t->flag & T_NO_PROJECT) == 0)
- {
+ if ((t->tsnap.project) && activeSnap(t) && (t->flag & T_NO_PROJECT) == 0) {
TransData *td = t->data;
float tvec[3];
float imat[4][4];
@@ -283,8 +278,7 @@ void applyProject(TransInfo *t)
continue;
copy_v3_v3(iloc, td->loc);
- if (t->flag & (T_EDIT|T_POSE))
- {
+ if (t->flag & (T_EDIT|T_POSE)) {
Object *ob = t->obedit?t->obedit:t->poseobj;
mul_m4_v3(ob->obmat, iloc);
}
@@ -296,8 +290,7 @@ void applyProject(TransInfo *t)
project_float(t->ar, iloc, mval);
- if (snapObjectsTransform(t, mval, &dist, loc, no, t->tsnap.modeSelect))
- {
+ if (snapObjectsTransform(t, mval, &dist, loc, no, t->tsnap.modeSelect)) {
// if (t->flag & (T_EDIT|T_POSE)) {
// mul_m4_v3(imat, loc);
// }
@@ -320,8 +313,7 @@ void applySnapping(TransInfo *t, float *vec)
if (t->tsnap.project)
return;
- if (t->tsnap.status & SNAP_FORCED)
- {
+ if (t->tsnap.status & SNAP_FORCED) {
t->tsnap.targetSnap(t);
t->tsnap.applySnap(t, vec);
@@ -331,15 +323,13 @@ void applySnapping(TransInfo *t, float *vec)
// Time base quirky code to go around findnearest slowness
/* !TODO! add exception for object mode, no need to slow it down then */
- if (current - t->tsnap.last >= 0.01)
- {
+ if (current - t->tsnap.last >= 0.01) {
t->tsnap.calcSnap(t, vec);
t->tsnap.targetSnap(t);
t->tsnap.last = current;
}
- if (validSnap(t))
- {
+ if (validSnap(t)) {
t->tsnap.applySnap(t, vec);
}
}
@@ -368,10 +358,8 @@ int usingSnappingNormal(TransInfo *t)
int validSnappingNormal(TransInfo *t)
{
- if (validSnap(t))
- {
- if (dot_v3v3(t->tsnap.snapNormal, t->tsnap.snapNormal) > 0)
- {
+ if (validSnap(t)) {
+ if (dot_v3v3(t->tsnap.snapNormal, t->tsnap.snapNormal) > 0) {
return 1;
}
}
@@ -439,38 +427,31 @@ void initSnapping(TransInfo *t, wmOperator *op)
resetSnapping(t);
/* if snap property exists */
- if (op && RNA_struct_find_property(op->ptr, "snap") && RNA_struct_property_is_set(op->ptr, "snap"))
- {
- if (RNA_boolean_get(op->ptr, "snap"))
- {
+ if (op && RNA_struct_find_property(op->ptr, "snap") && RNA_struct_property_is_set(op->ptr, "snap")) {
+ if (RNA_boolean_get(op->ptr, "snap")) {
t->modifiers |= MOD_SNAP;
- if (RNA_struct_property_is_set(op->ptr, "snap_target"))
- {
+ if (RNA_struct_property_is_set(op->ptr, "snap_target")) {
snap_target = RNA_enum_get(op->ptr, "snap_target");
}
- if (RNA_struct_property_is_set(op->ptr, "snap_point"))
- {
+ if (RNA_struct_property_is_set(op->ptr, "snap_point")) {
RNA_float_get_array(op->ptr, "snap_point", t->tsnap.snapPoint);
t->tsnap.status |= SNAP_FORCED|POINT_INIT;
}
/* snap align only defined in specific cases */
- if (RNA_struct_find_property(op->ptr, "snap_align"))
- {
+ if (RNA_struct_find_property(op->ptr, "snap_align")) {
t->tsnap.align = RNA_boolean_get(op->ptr, "snap_align");
RNA_float_get_array(op->ptr, "snap_normal", t->tsnap.snapNormal);
normalize_v3(t->tsnap.snapNormal);
}
- if (RNA_struct_find_property(op->ptr, "use_snap_project"))
- {
+ if (RNA_struct_find_property(op->ptr, "use_snap_project")) {
t->tsnap.project = RNA_boolean_get(op->ptr, "use_snap_project");
}
- if (RNA_struct_find_property(op->ptr, "use_snap_self"))
- {
+ if (RNA_struct_find_property(op->ptr, "use_snap_self")) {
t->tsnap.snap_self = RNA_boolean_get(op->ptr, "use_snap_self");
}
}
@@ -498,8 +479,7 @@ static void setSnappingCallback(TransInfo *t)
{
t->tsnap.calcSnap = CalcSnapGeometry;
- switch(t->tsnap.target)
- {
+ switch (t->tsnap.target) {
case SCE_SNAP_TARGET_CLOSEST:
t->tsnap.targetSnap = TargetSnapClosest;
break;
@@ -515,8 +495,7 @@ static void setSnappingCallback(TransInfo *t)
}
- switch (t->mode)
- {
+ switch (t->mode) {
case TFM_TRANSLATION:
t->tsnap.applySnap = ApplySnapTranslation;
t->tsnap.distance = TranslationBetween;
@@ -721,7 +700,7 @@ static float RotationBetween(TransInfo *t, float p1[3], float p2[3])
mul_m3_v3(mtx, end);
mul_m3_v3(mtx, start);
- angle = atan2(start[1],start[0]) - atan2(end[1],end[0]);
+ angle = atan2(start[1], start[0]) - atan2(end[1], end[0]);
}
if (angle > (float)M_PI) {
@@ -766,8 +745,7 @@ static void UNUSED_FUNCTION(CalcSnapGrid)(TransInfo *t, float *UNUSED(vec))
static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
{
- if (t->spacetype == SPACE_VIEW3D)
- {
+ if (t->spacetype == SPACE_VIEW3D) {
float loc[3];
float no[3];
float mval[2];
@@ -777,8 +755,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
mval[0] = t->mval[0];
mval[1] = t->mval[1];
- if (t->tsnap.mode == SCE_SNAP_MODE_VOLUME)
- {
+ if (t->tsnap.mode == SCE_SNAP_MODE_VOLUME) {
ListBase depth_peels;
DepthPeel *p1, *p2;
float *last_p = NULL;
@@ -799,10 +776,8 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
// }
- for (p1 = depth_peels.first; p1; p1 = p1->next)
- {
- if (p1->flag == 0)
- {
+ for (p1 = depth_peels.first; p1; p1 = p1->next) {
+ if (p1->flag == 0) {
float vec[3];
float new_dist;
@@ -810,13 +785,10 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
p1->flag = 1;
/* if peeling objects, take the first and last from each object */
- if (t->settings->snap_flag & SCE_SNAP_PEEL_OBJECT)
- {
+ if (t->settings->snap_flag & SCE_SNAP_PEEL_OBJECT) {
DepthPeel *peel;
- for (peel = p1->next; peel; peel = peel->next)
- {
- if (peel->ob == p1->ob)
- {
+ for (peel = p1->next; peel; peel = peel->next) {
+ if (peel->ob == p1->ob) {
peel->flag = 1;
p2 = peel;
}
@@ -824,8 +796,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
}
/* otherwise, pair first with second and so on */
else {
- for (p2 = p1->next; p2 && p2->ob != p1->ob; p2 = p2->next)
- {
+ for (p2 = p1->next; p2 && p2->ob != p1->ob; p2 = p2->next) {
/* nothing to do here */
}
}
@@ -839,9 +810,8 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
else {
copy_v3_v3(vec, p1->p);
}
-
- if (last_p == NULL)
- {
+
+ if (last_p == NULL) {
copy_v3_v3(p, vec);
max_dist = 0;
break;
@@ -856,8 +826,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
}
}
- if (max_dist != FLT_MAX)
- {
+ if (max_dist != FLT_MAX) {
copy_v3_v3(loc, p);
/* XXX, is there a correct normal in this case ???, for now just z up */
no[0]= 0.0;
@@ -878,8 +847,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
sub_v3_v3v3(tangent, loc, t->tsnap.snapPoint);
tangent[2] = 0;
- if (dot_v3v3(tangent, tangent) > 0)
- {
+ if (dot_v3v3(tangent, tangent) > 0) {
copy_v3_v3(t->tsnap.snapTangent, tangent);
}
@@ -899,8 +867,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
UI_view2d_region_to_view(&t->ar->v2d, t->mval[0], t->mval[1], co, co+1);
- if (ED_uvedit_nearest_uv(t->scene, t->obedit, ima, co, t->tsnap.snapPoint))
- {
+ if (ED_uvedit_nearest_uv(t->scene, t->obedit, ima, co, t->tsnap.snapPoint)) {
ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
t->tsnap.snapPoint[0] *= aspx;
t->tsnap.snapPoint[1] *= aspy;
@@ -917,9 +884,8 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
static void TargetSnapCenter(TransInfo *t)
{
- // Only need to calculate once
- if ((t->tsnap.status & TARGET_INIT) == 0)
- {
+ /* Only need to calculate once */
+ if ((t->tsnap.status & TARGET_INIT) == 0) {
copy_v3_v3(t->tsnap.snapTarget, t->center);
if (t->flag & (T_EDIT|T_POSE)) {
Object *ob= t->obedit?t->obedit:t->poseobj;
@@ -932,24 +898,20 @@ static void TargetSnapCenter(TransInfo *t)
static void TargetSnapActive(TransInfo *t)
{
- // Only need to calculate once
- if ((t->tsnap.status & TARGET_INIT) == 0)
- {
+ /* Only need to calculate once */
+ if ((t->tsnap.status & TARGET_INIT) == 0) {
TransData *td = NULL;
TransData *active_td = NULL;
int i;
- for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
- {
- if (td->flag & TD_ACTIVE)
- {
+ for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++) {
+ if (td->flag & TD_ACTIVE) {
active_td = td;
break;
}
}
- if (active_td)
- {
+ if (active_td) {
copy_v3_v3(t->tsnap.snapTarget, active_td->center);
if (t->flag & (T_EDIT|T_POSE)) {
@@ -971,8 +933,7 @@ static void TargetSnapActive(TransInfo *t)
static void TargetSnapMedian(TransInfo *t)
{
// Only need to calculate once
- if ((t->tsnap.status & TARGET_INIT) == 0)
- {
+ if ((t->tsnap.status & TARGET_INIT) == 0) {
TransData *td = NULL;
int i;
@@ -980,8 +941,7 @@ static void TargetSnapMedian(TransInfo *t)
t->tsnap.snapTarget[1] = 0;
t->tsnap.snapTarget[2] = 0;
- for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
- {
+ for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++) {
add_v3_v3(t->tsnap.snapTarget, td->center);
}
@@ -999,21 +959,17 @@ static void TargetSnapMedian(TransInfo *t)
static void TargetSnapClosest(TransInfo *t)
{
// Only valid if a snap point has been selected
- if (t->tsnap.status & POINT_INIT)
- {
+ if (t->tsnap.status & POINT_INIT) {
TransData *closest = NULL, *td = NULL;
/* Object mode */
- if (t->flag & T_OBJECT)
- {
+ if (t->flag & T_OBJECT) {
int i;
- for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
- {
+ for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++) {
struct BoundBox *bb = object_get_boundbox(td->ob);
/* use boundbox if possible */
- if (bb)
- {
+ if (bb) {
int j;
for (j = 0; j < 8; j++) {
@@ -1041,8 +997,7 @@ static void TargetSnapClosest(TransInfo *t)
dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
- if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist))
- {
+ if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) {
copy_v3_v3(t->tsnap.snapTarget, loc);
closest = td;
t->tsnap.dist = dist;
@@ -1065,8 +1020,7 @@ static void TargetSnapClosest(TransInfo *t)
dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
- if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist))
- {
+ if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) {
copy_v3_v3(t->tsnap.snapTarget, loc);
closest = td;
t->tsnap.dist = dist;
@@ -1101,9 +1055,9 @@ static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], fl
copy_v3_v3(location, intersect);
if (v4co)
- normal_quad_v3( normal,v1co, v2co, v3co, v4co);
+ normal_quad_v3(normal, v1co, v2co, v3co, v4co);
else
- normal_tri_v3( normal,v1co, v2co, v3co);
+ normal_tri_v3(normal, v1co, v2co, v3co);
mul_m4_v3(obmat, location);
@@ -1112,8 +1066,7 @@ static int snapFace(ARegion *ar, float v1co[3], float v2co[3], float v3co[3], fl
project_int(ar, location, screen_loc);
new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]);
- if (new_dist <= *dist && new_depth < *depth)
- {
+ if (new_dist <= *dist && new_depth < *depth) {
*depth = new_depth;
retval = 1;
@@ -1145,8 +1098,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
result = isect_line_line_v3(v1co, v2co, ray_start_local, ray_end, intersect, dvec); /* dvec used but we don't care about result */
- if (result)
- {
+ if (result) {
float edge_loc[3], vec[3];
float mul;
@@ -1167,8 +1119,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
copy_v3_v3(intersect, v2co);
}
- if (dot_v3v3(ray_normal_local, dvec) > 0)
- {
+ if (dot_v3v3(ray_normal_local, dvec) > 0) {
float location[3];
float new_depth;
int screen_loc[2];
@@ -1187,8 +1138,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
* this takes care of series of connected edges a bit slanted w.r.t the viewport
* otherwise, it would stick to the verts of the closest edge and not slide along merrily
* */
- if (new_dist <= *r_dist && new_depth < *r_depth * 1.001f)
- {
+ if (new_dist <= *r_dist && new_depth < *r_depth * 1.001f) {
float n1[3], n2[3];
*r_depth = new_depth;
@@ -1199,8 +1149,7 @@ static int snapEdge(ARegion *ar, float v1co[3], short v1no[3], float v2co[3], sh
mul = dot_v3v3(vec, edge_loc) / dot_v3v3(edge_loc, edge_loc);
- if (r_no)
- {
+ if (r_no) {
normal_short_to_float_v3(n1, v1no);
normal_short_to_float_v3(n2, v2no);
interp_v3_v3v3(r_no, n2, n1, mul);
@@ -1227,8 +1176,7 @@ static int snapVertex(ARegion *ar, float vco[3], short vno[3], float obmat[][4],
sub_v3_v3v3(dvec, vco, ray_start_local);
- if (dot_v3v3(ray_normal_local, dvec) > 0)
- {
+ if (dot_v3v3(ray_normal_local, dvec) > 0) {
float location[3];
float new_depth;
int screen_loc[2];
@@ -1243,15 +1191,13 @@ static int snapVertex(ARegion *ar, float vco[3], short vno[3], float obmat[][4],
project_int(ar, location, screen_loc);
new_dist = abs(screen_loc[0] - (int)mval[0]) + abs(screen_loc[1] - (int)mval[1]);
- if (new_dist <= *r_dist && new_depth < *r_depth)
- {
+ if (new_dist <= *r_dist && new_depth < *r_depth) {
*r_depth = new_depth;
retval = 1;
copy_v3_v3(r_loc, location);
- if (r_no)
- {
+ if (r_no) {
normal_short_to_float_v3(r_no, vno);
mul_m3_v3(timat, r_no);
normalize_v3(r_no);
@@ -1280,16 +1226,14 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm
mul_m4_v3(imat, ray_start_local);
mul_mat3_m4_v3(imat, ray_normal_local);
- if (arm->edbo)
- {
+ if (arm->edbo) {
EditBone *eBone;
for (eBone=arm->edbo->first; eBone; eBone=eBone->next) {
if (eBone->layer & arm->layer) {
/* skip hidden or moving (selected) bones */
if ((eBone->flag & (BONE_HIDDEN_A|BONE_ROOTSEL|BONE_TIPSEL))==0) {
- switch (snap_mode)
- {
+ switch (snap_mode) {
case SCE_SNAP_MODE_VERTEX:
retval |= snapVertex(ar, eBone->head, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
retval |= snapVertex(ar, eBone->tail, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
@@ -1313,8 +1257,7 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm
float *head_vec = pchan->pose_head;
float *tail_vec = pchan->pose_tail;
- switch (snap_mode)
- {
+ switch (snap_mode) {
case SCE_SNAP_MODE_VERTEX:
retval |= snapVertex(ar, head_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
retval |= snapVertex(ar, tail_vec, NULL, obmat, NULL, ray_start, ray_start_local, ray_normal_local, mval, r_loc, NULL, r_dist, r_depth);
@@ -1366,8 +1309,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
if (test == 1) {
- switch (snap_mode)
- {
+ switch (snap_mode) {
case SCE_SNAP_MODE_FACE:
{
#ifdef USE_BVH_FACE_SNAP // Added for durian
@@ -1383,8 +1325,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
hit.index = -1;
hit.dist = *r_depth * (*r_depth == FLT_MAX ? 1.0f : local_scale);
- if (treeData.tree && BLI_bvhtree_ray_cast(treeData.tree, ray_start_local, ray_normal_local, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1)
- {
+ if (treeData.tree && BLI_bvhtree_ray_cast(treeData.tree, ray_start_local, ray_normal_local, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1) {
if (hit.dist/local_scale <= *r_depth) {
*r_depth= hit.dist/local_scale;
copy_v3_v3(r_loc, hit.co);
@@ -1409,8 +1350,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
int index = 0;
int i;
- if (em != NULL)
- {
+ if (em != NULL) {
index_array = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
EDBM_index_arrays_init(em, 0, 0, 1);
}
@@ -1421,8 +1361,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
test = 1; /* reset for every face */
- if (em != NULL)
- {
+ if (em != NULL) {
if (index_array) {
index = index_array[i];
}
@@ -1436,8 +1375,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
else {
efa = EDBM_face_at_index(em, index);
- if (efa && BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
- {
+ if (efa && BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
test = 0;
}
else if (efa) {
@@ -1456,28 +1394,24 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
}
- if (test)
- {
+ if (test) {
int result;
float *v4co = NULL;
- if (f->v4)
- {
+ if (f->v4) {
v4co = verts[f->v4].co;
}
result = snapFace(ar, verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, v4co, mval, ray_start, ray_start_local, ray_normal_local, obmat, timat, loc, no, dist, depth);
retval |= result;
- if (f->v4 && result == 0)
- {
+ if (f->v4 && result == 0) {
retval |= snapFace(ar, verts[f->v3].co, verts[f->v4].co, verts[f->v1].co, verts[f->v2].co, mval, ray_start, ray_start_local, ray_normal_local, obmat, timat, loc, no, dist, depth);
}
}
}
- if (em != NULL)
- {
+ if (em != NULL) {
EDBM_index_arrays_free(em);
}
#endif
@@ -1490,8 +1424,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
int index = 0;
int i;
- if (em != NULL)
- {
+ if (em != NULL) {
index_array = dm->getVertDataArray(dm, CD_ORIGINDEX);
EDBM_index_arrays_init(em, 1, 0, 0);
}
@@ -1516,22 +1449,19 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
else {
eve = EDBM_vert_at_index(em, index);
- if (eve && (BM_elem_flag_test(eve, BM_ELEM_HIDDEN) || BM_elem_flag_test(eve, BM_ELEM_SELECT)))
- {
+ if (eve && (BM_elem_flag_test(eve, BM_ELEM_HIDDEN) || BM_elem_flag_test(eve, BM_ELEM_SELECT))) {
test = 0;
}
}
}
- if (test)
- {
+ if (test) {
retval |= snapVertex(ar, v->co, v->no, obmat, timat, ray_start, ray_start_local, ray_normal_local, mval, r_loc, r_no, r_dist, r_depth);
}
}
- if (em != NULL)
- {
+ if (em != NULL) {
EDBM_index_arrays_free(em);
}
break;
@@ -1545,8 +1475,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
int index = 0;
int i;
- if (em != NULL)
- {
+ if (em != NULL) {
index_array = dm->getEdgeDataArray(dm, CD_ORIGINDEX);
EDBM_index_arrays_init(em, 0, 1, 0);
}
@@ -1557,8 +1486,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
test = 1; /* reset for every vert */
- if (em != NULL)
- {
+ if (em != NULL) {
if (index_array) {
index = index_array[i];
}
@@ -1580,16 +1508,13 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
}
}
}
-
-
- if (test)
- {
+
+ if (test) {
retval |= snapEdge(ar, verts[e->v1].co, verts[e->v1].no, verts[e->v2].co, verts[e->v2].no, obmat, timat, ray_start, ray_start_local, ray_normal_local, mval, r_loc, r_no, r_dist, r_depth);
}
}
- if (em != NULL)
- {
+ if (em != NULL) {
EDBM_index_arrays_free(em);
}
break;
@@ -1673,8 +1598,7 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, c
DupliObject *dupli_ob;
ListBase *lb = object_duplilist(scene, ob);
- for (dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next)
- {
+ for (dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next) {
Object *dob = dupli_ob->ob;
retval |= snapObject(scene, ar, dob, 0, dupli_ob->mat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth);
@@ -1726,8 +1650,7 @@ static void removeDoublesPeel(ListBase *depth_peels)
{
DepthPeel *peel;
- for (peel = depth_peels->first; peel; peel = peel->next)
- {
+ for (peel = depth_peels->first; peel; peel = peel->next) {
DepthPeel *next_peel = peel->next;
if (next_peel && ABS(peel->depth - next_peel->depth) < 0.0015f) {
@@ -1815,9 +1738,9 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4],
copy_v3_v3(location, intersect);
if (f->v4)
- normal_quad_v3( normal,verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, verts[f->v4].co);
+ normal_quad_v3(normal, verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, verts[f->v4].co);
else
- normal_tri_v3( normal,verts[f->v1].co, verts[f->v2].co, verts[f->v3].co);
+ normal_tri_v3(normal, verts[f->v1].co, verts[f->v2].co, verts[f->v3].co);
mul_m4_v3(obmat, location);
@@ -1844,13 +1767,13 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4],
copy_v3_v3(location, intersect);
if (f->v4)
- normal_quad_v3( normal,verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, verts[f->v4].co);
+ normal_quad_v3(normal, verts[f->v1].co, verts[f->v2].co, verts[f->v3].co, verts[f->v4].co);
else
- normal_tri_v3( normal,verts[f->v1].co, verts[f->v2].co, verts[f->v3].co);
+ normal_tri_v3(normal, verts[f->v1].co, verts[f->v2].co, verts[f->v3].co);
mul_m4_v3(obmat, location);
- new_depth = len_v3v3(location, ray_start);
+ new_depth = len_v3v3(location, ray_start);
mul_m3_v3(timat, normal);
normalize_v3(normal);
@@ -1881,8 +1804,7 @@ static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, L
DupliObject *dupli_ob;
ListBase *lb = object_duplilist(scene, ob);
- for (dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next)
- {
+ for (dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next) {
Object *dob = dupli_ob->ob;
if (dob->type == OB_MESH) {
diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c
index 4b03c846f3e..5430a9a1c90 100644
--- a/source/blender/editors/util/crazyspace.c
+++ b/source/blender/editors/util/crazyspace.c
@@ -187,75 +187,6 @@ void crazyspace_set_quats_editmesh(BMEditMesh *em, float *origcos, float *mapped
em->bm->elem_index_dirty |= BM_VERT;
MEM_freeN(vert_table);
-#if 0
- BMEditVert *eve, *prev;
- BMEditFace *efa;
- BMIter iter;
- float *v1, *v2, *v3, *v4, *co1, *co2, *co3, *co4;
- intptr_t index = 0;
-
- /* two abused locations in vertices */
- for (eve = em->verts.first; eve; eve = eve->next, index++) {
- eve->tmp.p = NULL;
- eve->prev = (EditVert *)index;
- }
-
- /* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */
- for (efa = em->faces.first; efa; efa = efa->next) {
-
- /* retrieve mapped coordinates */
- v1 = mappedcos + 3 * (intptr_t)(efa->v1->prev);
- v2 = mappedcos + 3 * (intptr_t)(efa->v2->prev);
- v3 = mappedcos + 3 * (intptr_t)(efa->v3->prev);
-
- co1 = (origcos) ? origcos + 3 * (intptr_t)(efa->v1->prev) : efa->v1->co;
- co2 = (origcos) ? origcos + 3 * (intptr_t)(efa->v2->prev) : efa->v2->co;
- co3 = (origcos) ? origcos + 3 * (intptr_t)(efa->v3->prev) : efa->v3->co;
-
- if (efa->v2->tmp.p == NULL && efa->v2->f1) {
- set_crazy_vertex_quat(quats, co2, co3, co1, v2, v3, v1);
- efa->v2->tmp.p = (void *)quats;
- quats += 4;
- }
-
- if (efa->v4) {
- v4 = mappedcos + 3 * (intptr_t)(efa->v4->prev);
- co4 = (origcos) ? origcos + 3 * (intptr_t)(efa->v4->prev) : efa->v4->co;
-
- if (efa->v1->tmp.p == NULL && efa->v1->f1) {
- set_crazy_vertex_quat(quats, co1, co2, co4, v1, v2, v4);
- efa->v1->tmp.p = (void *)quats;
- quats += 4;
- }
- if (efa->v3->tmp.p == NULL && efa->v3->f1) {
- set_crazy_vertex_quat(quats, co3, co4, co2, v3, v4, v2);
- efa->v3->tmp.p = (void *)quats;
- quats += 4;
- }
- if (efa->v4->tmp.p == NULL && efa->v4->f1) {
- set_crazy_vertex_quat(quats, co4, co1, co3, v4, v1, v3);
- efa->v4->tmp.p = (void *)quats;
- quats += 4;
- }
- }
- else {
- if (efa->v1->tmp.p == NULL && efa->v1->f1) {
- set_crazy_vertex_quat(quats, co1, co2, co3, v1, v2, v3);
- efa->v1->tmp.p = (void *)quats;
- quats += 4;
- }
- if (efa->v3->tmp.p == NULL && efa->v3->f1) {
- set_crazy_vertex_quat(quats, co3, co1, co2, v3, v1, v2);
- efa->v3->tmp.p = (void *)quats;
- quats += 4;
- }
- }
- }
-
- /* restore abused prev pointer */
- for (prev = NULL, eve = em->verts.first; eve; prev = eve, eve = eve->next)
- eve->prev = prev;
-#endif
}
/* BMESH_TODO - use MPolys over MFace's */
diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c
index c037508687b..1f1d5a0c0c0 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -207,8 +207,7 @@ char handleNumInput(NumInput *n, wmEvent *event)
if (n->flag & NUM_NO_FRACTION)
return 0;
- switch (n->ctrl[idx])
- {
+ switch (n->ctrl[idx]) {
case 0:
case 1:
n->ctrl[idx] = 10;
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index a43d549cba1..cd88614f8fe 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -155,7 +155,7 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
ED_text_undo_step(C, step);
}
else if (obedit) {
- if (ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)) {
+ if (OB_TYPE_SUPPORT_EDITMODE(obedit->type)) {
if (undoname)
undo_editmode_name(C, undoname);
else
@@ -247,7 +247,7 @@ int ED_undo_valid(const bContext *C, const char *undoname)
return 1;
}
else if (obedit) {
- if (ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)) {
+ if (OB_TYPE_SUPPORT_EDITMODE(obedit->type)) {
return undo_editmode_valid(undoname);
}
}
@@ -413,9 +413,11 @@ void ED_undo_operator_repeat_cb_evt(bContext *C, void *arg_op, int UNUSED(arg_ev
/* ************************** */
-#define UNDOSYSTEM_GLOBAL 1
-#define UNDOSYSTEM_EDITMODE 2
-#define UNDOSYSTEM_PARTICLE 3
+enum {
+ UNDOSYSTEM_GLOBAL = 1,
+ UNDOSYSTEM_EDITMODE = 2,
+ UNDOSYSTEM_PARTICLE = 3
+};
static int get_undo_system(bContext *C)
{
@@ -423,8 +425,9 @@ static int get_undo_system(bContext *C)
/* find out which undo system */
if (obedit) {
- if (ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE))
+ if (OB_TYPE_SUPPORT_EDITMODE(obedit->type)) {
return UNDOSYSTEM_EDITMODE;
+ }
}
else {
Object *obact = CTX_data_active_object(C);
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index e772ff5a87a..fb7e2254e45 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -186,8 +186,8 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
BLI_array_empty(tf_uv);
BLI_array_empty(tf_uvorig);
- BLI_array_growitems(tf_uv, efa->len);
- BLI_array_growitems(tf_uvorig, efa->len);
+ BLI_array_grow_items(tf_uv, efa->len);
+ BLI_array_grow_items(tf_uvorig, efa->len);
i = 0;
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
@@ -198,11 +198,11 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
i++;
}
- poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len);
+ uv_poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len);
totarea += BM_face_calc_area(efa);
//totuvarea += tf_area(tf, efa->v4!=0);
- totuvarea += poly_uv_area(tf_uv, efa->len);
+ totuvarea += uv_poly_area(tf_uv, efa->len);
if (uvedit_face_visible_test(scene, ima, efa, tf)) {
BM_elem_flag_enable(efa, BM_ELEM_TAG);
@@ -236,8 +236,8 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
BLI_array_empty(tf_uv);
BLI_array_empty(tf_uvorig);
- BLI_array_growitems(tf_uv, efa->len);
- BLI_array_growitems(tf_uvorig, efa->len);
+ BLI_array_grow_items(tf_uv, efa->len);
+ BLI_array_grow_items(tf_uvorig, efa->len);
i = 0;
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
@@ -248,10 +248,10 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
i++;
}
- poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len);
+ uv_poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len);
//uvarea = tf_area(tf, efa->v4!=0) / totuvarea;
- uvarea = poly_uv_area(tf_uv, efa->len) / totuvarea;
+ uvarea = uv_poly_area(tf_uv, efa->len) / totuvarea;
if (area < FLT_EPSILON || uvarea < FLT_EPSILON)
areadiff = 1.0f;
@@ -303,19 +303,19 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
BLI_array_empty(ang);
BLI_array_empty(av);
BLI_array_empty(auv);
- BLI_array_growitems(tf_uv, nverts);
- BLI_array_growitems(tf_uvorig, nverts);
- BLI_array_growitems(uvang, nverts);
- BLI_array_growitems(ang, nverts);
- BLI_array_growitems(av, nverts);
- BLI_array_growitems(auv, nverts);
+ BLI_array_grow_items(tf_uv, nverts);
+ BLI_array_grow_items(tf_uvorig, nverts);
+ BLI_array_grow_items(uvang, nverts);
+ BLI_array_grow_items(ang, nverts);
+ BLI_array_grow_items(av, nverts);
+ BLI_array_grow_items(auv, nverts);
BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
copy_v2_v2(tf_uvorig[i], luv->uv);
}
- poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, nverts);
+ uv_poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, nverts);
j = nverts - 1;
BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
@@ -742,7 +742,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
continue;
if (!uvedit_face_select_test(scene, em, efa)) {
- poly_uv_center(em, efa, cent);
+ uv_poly_center(em, efa, cent);
bglVertex2fv(cent);
}
}
@@ -757,7 +757,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
continue;
if (uvedit_face_select_test(scene, em, efa)) {
- poly_uv_center(em, efa, cent);
+ uv_poly_center(em, efa, cent);
bglVertex2fv(cent);
}
}
diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h
index fdcb5db1911..d258d271833 100644
--- a/source/blender/editors/uvedit/uvedit_intern.h
+++ b/source/blender/editors/uvedit/uvedit_intern.h
@@ -54,14 +54,9 @@ struct BMVert;
int uvedit_face_visible_nolocal(struct Scene *scene, struct BMFace *efa);
/* geometric utilities */
-
-void uv_center(float uv[][2], float cent[2], int quad);
-float uv_area(float uv[][2], int quad);
-void uv_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy);
-
-float poly_uv_area(float uv[][2], int len);
-void poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len);
-void poly_uv_center(struct BMEditMesh *em, struct BMFace *f, float cent[2]);
+float uv_poly_area(float uv[][2], int len);
+void uv_poly_copy_aspect(float uv_orig [][2], float uv[][2], float aspx, float aspy, int len);
+void uv_poly_center(struct BMEditMesh *em, struct BMFace *f, float r_cent[2]);
/* find nearest */
@@ -74,8 +69,10 @@ typedef struct NearestHit {
int vert1, vert2; //index in mesh of edge vertices
} NearestHit;
-void uv_find_nearest_vert(struct Scene *scene, struct Image *ima, struct BMEditMesh *em, float co[2], float penalty[2], struct NearestHit *hit);
-void uv_find_nearest_edge(struct Scene *scene, struct Image *ima, struct BMEditMesh *em, float co[2], struct NearestHit *hit);
+void uv_find_nearest_vert(struct Scene *scene, struct Image *ima, struct BMEditMesh *em,
+ const float co[2], const float penalty[2], struct NearestHit *hit);
+void uv_find_nearest_edge(struct Scene *scene, struct Image *ima, struct BMEditMesh *em,
+ const float co[2], struct NearestHit *hit);
/* utility tool functions */
@@ -120,4 +117,3 @@ void UV_OT_unwrap(struct wmOperatorType *ot);
void UV_OT_stitch(struct wmOperatorType *ot);
#endif /* __UVEDIT_INTERN_H__ */
-
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 1c62ce3a684..a30274c0f2c 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -47,6 +47,7 @@
#include "DNA_scene_types.h"
#include "BLI_math.h"
+#include "BLI_lasso.h"
#include "BLI_blenlib.h"
#include "BLI_array.h"
#include "BLI_utildefines.h"
@@ -522,44 +523,23 @@ void uvedit_live_unwrap_update(SpaceImage *sima, Scene *scene, Object *obedit)
}
/*********************** geometric utilities ***********************/
-void poly_uv_center(BMEditMesh *em, BMFace *f, float cent[2])
+void uv_poly_center(BMEditMesh *em, BMFace *f, float r_cent[2])
{
BMLoop *l;
MLoopUV *luv;
BMIter liter;
- zero_v2(cent);
+ zero_v2(r_cent);
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- add_v2_v2(cent, luv->uv);
+ add_v2_v2(r_cent, luv->uv);
}
- mul_v2_fl(cent, 1.0f / (float)f->len);
+ mul_v2_fl(r_cent, 1.0f / (float)f->len);
}
-
-void uv_center(float uv[][2], float cent[2], int quad)
-{
- if (quad) {
- cent[0] = (uv[0][0] + uv[1][0] + uv[2][0] + uv[3][0]) / 4.0f;
- cent[1] = (uv[0][1] + uv[1][1] + uv[2][1] + uv[3][1]) / 4.0f;
- }
- else {
- cent[0] = (uv[0][0] + uv[1][0] + uv[2][0]) / 3.0f;
- cent[1] = (uv[0][1] + uv[1][1] + uv[2][1]) / 3.0f;
- }
-}
-
-float uv_area(float uv[][2], int quad)
-{
- if (quad)
- return area_tri_v2(uv[0], uv[1], uv[2]) + area_tri_v2(uv[0], uv[2], uv[3]);
- else
- return area_tri_v2(uv[0], uv[1], uv[2]);
-}
-
-float poly_uv_area(float uv[][2], int len)
+float uv_poly_area(float uv[][2], int len)
{
//BMESH_TODO: make this not suck
//maybe use scanfill? I dunno.
@@ -572,7 +552,7 @@ float poly_uv_area(float uv[][2], int len)
return 1.0;
}
-void poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len)
+void uv_poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len)
{
int i;
for (i = 0; i < len; i++) {
@@ -581,7 +561,7 @@ void poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy,
}
}
-int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float *min, float *max)
+int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float r_min[2], float r_max[2])
{
BMEditMesh *em = BMEdit_FromObject(obedit);
BMFace *efa;
@@ -591,7 +571,7 @@ int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float *min, float
MLoopUV *luv;
int sel;
- INIT_MINMAX2(min, max);
+ INIT_MINMAX2(r_min, r_max);
sel = 0;
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
@@ -602,7 +582,7 @@ int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float *min, float
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if (uvedit_uv_select_test(em, scene, l)) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- DO_MINMAX2(luv->uv, min, max);
+ DO_MINMAX2(luv->uv, r_min, r_max);
sel = 1;
}
}
@@ -663,7 +643,7 @@ static int uvedit_center(Scene *scene, Image *ima, Object *obedit, float cent[2]
/************************** find nearest ****************************/
-void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, float co[2], NearestHit *hit)
+void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, const float co[2], NearestHit *hit)
{
MTexPoly *tf;
BMFace *efa;
@@ -710,13 +690,11 @@ void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, float co[2],
}
}
-static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, float co[2], NearestHit *hit)
+static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, const float co[2], NearestHit *hit)
{
MTexPoly *tf;
BMFace *efa;
- BMLoop *l;
- BMIter iter, liter;
- MLoopUV *luv;
+ BMIter iter;
float mindist, dist, cent[2];
mindist = 1e10f;
@@ -731,16 +709,9 @@ static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, float
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
if (!uvedit_face_visible_test(scene, ima, efa, tf))
continue;
-
- cent[0] = cent[1] = 0.0f;
- BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
- luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- add_v2_v2(cent, luv->uv);
- }
+ uv_poly_center(em, efa, cent);
- cent[0] /= efa->len;
- cent[1] /= efa->len;
dist = fabs(co[0] - cent[0]) + fabs(co[1] - cent[1]);
if (dist < mindist) {
@@ -752,7 +723,7 @@ static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, float
}
static int nearest_uv_between(BMEditMesh *em, BMFace *efa, int UNUSED(nverts), int id,
- float co[2], float uv[2])
+ const float co[2], const float uv[2])
{
BMLoop *l;
MLoopUV *luv;
@@ -798,7 +769,7 @@ static int nearest_uv_between(BMEditMesh *em, BMFace *efa, int UNUSED(nverts), i
}
void uv_find_nearest_vert(Scene *scene, Image *ima, BMEditMesh *em,
- float co[2], float penalty[2], NearestHit *hit)
+ float const co[2], const float penalty[2], NearestHit *hit)
{
BMFace *efa;
BMLoop *l;
@@ -856,7 +827,7 @@ void uv_find_nearest_vert(Scene *scene, Image *ima, BMEditMesh *em,
}
}
-int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, float co[2], float uv[2])
+int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, const float co[2], float r_uv[2])
{
BMEditMesh *em = BMEdit_FromObject(obedit);
BMFace *efa;
@@ -865,11 +836,10 @@ int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, float co[2],
MTexPoly *tf;
MLoopUV *luv;
float mindist, dist;
- int found = 0;
+ int found = FALSE;
mindist = 1e10f;
- uv[0] = co[0];
- uv[1] = co[1];
+ copy_v2_v2(r_uv, co);
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
@@ -883,9 +853,8 @@ int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, float co[2],
if (dist <= mindist) {
mindist = dist;
- uv[0] = luv->uv[0];
- uv[1] = luv->uv[1];
- found = 1;
+ copy_v2_v2(r_uv, luv->uv);
+ found = TRUE;
}
}
}
@@ -1105,7 +1074,7 @@ static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit
/*********************** linked select ***********************/
-static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, float limit[2], NearestHit *hit, int extend)
+static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, const float limit[2], NearestHit *hit, int extend)
{
BMFace *efa;
BMLoop *l;
@@ -1716,11 +1685,11 @@ static int sticky_select(float *limit, int hitv[4], int v, float *hituv[4], floa
return 0;
}
-static int mouse_select(bContext *C, float co[2], int extend, int loop)
+static int mouse_select(bContext *C, const float co[2], int extend, int loop)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
- ToolSettings *ts = CTX_data_tool_settings(C);
+ ToolSettings *ts = scene->toolsettings;
Object *obedit = CTX_data_edit_object(C);
Image *ima = CTX_data_edit_image(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1787,8 +1756,8 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
}
/* mark 1 vertex as being hit */
- BLI_array_growitems(hitv, hit.efa->len);
- BLI_array_growitems(hituv, hit.efa->len);
+ BLI_array_grow_items(hitv, hit.efa->len);
+ BLI_array_grow_items(hituv, hit.efa->len);
for (i = 0; i < hit.efa->len; i++) {
hitv[i] = 0xFFFFFFFF;
}
@@ -1808,8 +1777,8 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
}
/* mark 2 edge vertices as being hit */
- BLI_array_growitems(hitv, hit.efa->len);
- BLI_array_growitems(hituv, hit.efa->len);
+ BLI_array_grow_items(hitv, hit.efa->len);
+ BLI_array_grow_items(hituv, hit.efa->len);
fill_vn_i(hitv, hit.efa->len, 0xFFFFFFFF);
hitv[hit.lindex] = hit.vert1;
@@ -1833,8 +1802,8 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
/* mark all face vertices as being hit */
- BLI_array_growitems(hitv, hit.efa->len);
- BLI_array_growitems(hituv, hit.efa->len);
+ BLI_array_grow_items(hitv, hit.efa->len);
+ BLI_array_grow_items(hituv, hit.efa->len);
i = 0;
BM_ITER_ELEM (l, &liter, hit.efa, BM_LOOPS_OF_FACE) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
@@ -2122,7 +2091,7 @@ static int select_linked_internal(bContext *C, wmOperator *op, wmEvent *event, i
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
- ToolSettings *ts = CTX_data_tool_settings(C);
+ ToolSettings *ts = scene->toolsettings;
Object *obedit = CTX_data_edit_object(C);
Image *ima = CTX_data_edit_image(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -2224,7 +2193,7 @@ static void UV_OT_select_linked_pick(wmOperatorType *ot)
static int unlink_selection_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- ToolSettings *ts = CTX_data_tool_settings(C);
+ ToolSettings *ts = scene->toolsettings;
Object *obedit = CTX_data_edit_object(C);
Image *ima = CTX_data_edit_image(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -2282,6 +2251,25 @@ static void UV_OT_unlink_selected(wmOperatorType *ot)
ot->poll = ED_operator_uvedit;
}
+static void uv_select_sync_flush(ToolSettings *ts, BMEditMesh *em, const short select)
+{
+ /* bmesh API handles flushing but not on de-select */
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
+ if (ts->selectmode != SCE_SELECT_FACE) {
+ if (select == FALSE) {
+ EDBM_deselect_flush(em);
+ }
+ else {
+ EDBM_select_flush(em);
+ }
+ }
+
+ if (select == FALSE) {
+ BM_select_history_validate(em->bm);
+ }
+ }
+}
+
/* ******************** border select operator **************** */
/* This function sets the selection on tagged faces, need because settings the
@@ -2291,7 +2279,7 @@ static void UV_OT_unlink_selected(wmOperatorType *ot)
*
* De-selects faces that have been tagged on efa->tmp.l. */
-static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Object *obedit, short select)
+static void uv_faces_do_sticky(SpaceImage *sima, Scene *scene, Object *obedit, short select)
{
/* Selecting UV Faces with some modes requires us to change
* the selection in other faces (depending on the sticky mode).
@@ -2299,7 +2287,7 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje
* This only needs to be done when the Mesh is not used for
* selection (so for sticky modes, vertex or location based). */
- ToolSettings *ts = CTX_data_tool_settings(C);
+ ToolSettings *ts = scene->toolsettings;
BMEditMesh *em = BMEdit_FromObject(obedit);
BMFace *efa;
BMLoop *l;
@@ -2420,7 +2408,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
- ToolSettings *ts = CTX_data_tool_settings(C);
+ ToolSettings *ts = scene->toolsettings;
Object *obedit = CTX_data_edit_object(C);
Image *ima = CTX_data_edit_image(C);
ARegion *ar = CTX_wm_region(C);
@@ -2469,7 +2457,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
if (uvedit_face_visible_test(scene, ima, efa, tf)) {
- poly_uv_center(em, efa, cent);
+ uv_poly_center(em, efa, cent);
if (BLI_in_rctf(&rectf, cent[0], cent[1])) {
BM_elem_flag_enable(efa, BM_ELEM_TAG);
change = 1;
@@ -2479,7 +2467,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
/* (de)selects all tagged faces and deals with sticky modes */
if (change)
- uv_faces_do_sticky(C, sima, scene, obedit, select);
+ uv_faces_do_sticky(sima, scene, obedit, select);
}
else {
/* other selection modes */
@@ -2512,22 +2500,11 @@ static int border_select_exec(bContext *C, wmOperator *op)
}
if (change) {
- /* bmesh API habdles flushing but not on de-select */
- if (ts->uv_flag & UV_SYNC_SELECTION) {
- if (ts->selectmode != SCE_SELECT_FACE) {
- if (select == FALSE) {
- EDBM_deselect_flush(em);
- }
- }
- }
+ uv_select_sync_flush(ts, em, select);
if (ts->uv_flag & UV_SYNC_SELECTION) {
- if (select == FALSE) {
- BM_select_history_validate(em->bm);
- }
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
}
-
- WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
}
@@ -2560,13 +2537,12 @@ static void UV_OT_select_border(wmOperatorType *ot)
/* ******************** circle select operator **************** */
-static void select_uv_inside_ellipse(BMEditMesh *em, SpaceImage *UNUSED(sima), Scene *scene, int select,
- float *offset, float *ell, BMLoop *l, MLoopUV *luv)
+static int select_uv_inside_ellipse(BMEditMesh *em, SpaceImage *UNUSED(sima), Scene *scene, int select,
+ float *offset, float *ell, BMLoop *l, MLoopUV *luv)
{
/* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */
float x, y, r2, *uv;
-
-
+
uv = luv->uv;
x = (uv[0] - offset[0]) * ell[0];
@@ -2575,7 +2551,11 @@ static void select_uv_inside_ellipse(BMEditMesh *em, SpaceImage *UNUSED(sima), S
r2 = x * x + y * y;
if (r2 < 1.0f) {
if (select) uvedit_uv_select_enable(em, scene, l, FALSE);
- else uvedit_uv_select_disable(em, scene, l);
+ else uvedit_uv_select_disable(em, scene, l);
+ return TRUE;
+ }
+ else {
+ return FALSE;
}
}
@@ -2583,6 +2563,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = scene->toolsettings;
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
ARegion *ar = CTX_wm_region(C);
@@ -2593,6 +2574,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
int x, y, radius, width, height, select;
float zoomx, zoomy, offset[2], ellipse[2];
int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
+ int change = FALSE;
/* get operator properties */
select = (gesture_mode == GESTURE_MODAL_SELECT);
@@ -2614,15 +2596,17 @@ static int circle_select_exec(bContext *C, wmOperator *op)
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- select_uv_inside_ellipse(em, sima, scene, select, offset, ellipse, l, luv);
+ change |= select_uv_inside_ellipse(em, sima, scene, select, offset, ellipse, l, luv);
}
}
-#if 0 //I think the BM_elem_select_set api stuff handles all this as necessary?
- if (select) EM_select_flush(em);
- else EM_deselect_flush(em);
-#endif
- WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+ if (change) {
+ uv_select_sync_flush(ts, em, select);
+
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+ }
+ }
return OPERATOR_FINISHED;
}
@@ -2651,9 +2635,129 @@ static void UV_OT_circle_select(wmOperatorType *ot)
RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX);
}
+
+/* ******************** lasso select operator **************** */
+
+static void do_lasso_select_mesh_uv(bContext *C, int mcords[][2], short moves, short select)
+{
+ Image *ima = CTX_data_edit_image(C);
+ ARegion *ar = CTX_wm_region(C);
+ Object *obedit = CTX_data_edit_object(C);
+ Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = scene->toolsettings;
+ BMEditMesh *em = BMEdit_FromObject(obedit);
+
+ BMIter iter, liter;
+
+ BMFace *efa;
+ BMLoop *l;
+ MTexPoly *tf;
+ int screen_uv[2], change = TRUE;
+ rcti rect;
+
+ BLI_lasso_boundbox(&rect, mcords, moves);
+
+ if (ts->uv_selectmode == UV_SELECT_FACE) { /* Face Center Sel */
+ change = FALSE;
+ BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+ /* assume not touched */
+ if ((select) != (uvedit_face_select_test(scene, em, efa))) {
+ float cent[2];
+ uv_poly_center(em, efa, cent);
+ UI_view2d_view_to_region(&ar->v2d, cent[0], cent[1], &screen_uv[0], &screen_uv[1]);
+ if (BLI_in_rcti(&rect, screen_uv[0], screen_uv[1]) &&
+ BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED))
+ {
+ uvedit_face_select_enable(scene, em, efa, FALSE);
+ change = TRUE;
+ }
+ }
+ }
+ }
+ else { /* Vert Sel */
+ BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+ tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+ if (uvedit_face_visible_test(scene, ima, efa, tf)) {
+ BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+ if ((select) != (uvedit_uv_select_test(em, scene, l))) {
+ MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+ UI_view2d_view_to_region(&ar->v2d, luv->uv[0], luv->uv[1], &screen_uv[0], &screen_uv[1]);
+ if (BLI_in_rcti(&rect, screen_uv[0], screen_uv[1]) &&
+ BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED))
+ {
+ if (select) {
+ uvedit_uv_select_enable(em, scene, l, FALSE);
+ }
+ else {
+ uvedit_uv_select_disable(em, scene, l);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if (change) {
+ uv_select_sync_flush(scene->toolsettings, em, select);
+
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+ }
+ }
+}
+
+static int uv_lasso_select_exec(bContext *C, wmOperator *op)
+{
+ int i = 0;
+ int mcords[1024][2];
+
+ RNA_BEGIN (op->ptr, itemptr, "path") {
+ float loc[2];
+
+ RNA_float_get_array(&itemptr, "loc", loc);
+ mcords[i][0] = (int)loc[0];
+ mcords[i][1] = (int)loc[1];
+ i++;
+ if (i >= 1024) break;
+ }
+ RNA_END;
+
+ if (i > 1) {
+ short select;
+
+ select = !RNA_boolean_get(op->ptr, "deselect");
+ do_lasso_select_mesh_uv(C, mcords, i, select);
+
+ return OPERATOR_FINISHED;
+ }
+ return OPERATOR_PASS_THROUGH;
+}
+
+void UV_OT_select_lasso(wmOperatorType *ot)
+{
+ ot->name = "Lasso Select UV";
+ ot->description = "Select UVs using lasso selection";
+ ot->idname = "UV_OT_select_lasso";
+
+ ot->invoke = WM_gesture_lasso_invoke;
+ ot->modal = WM_gesture_lasso_modal;
+ ot->exec = uv_lasso_select_exec;
+ ot->poll = ED_operator_image_active;
+ ot->cancel = WM_gesture_lasso_cancel;
+
+ /* flags */
+ ot->flag = OPTYPE_UNDO;
+
+ RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
+ RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items");
+ RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first");
+}
+
+
+
/* ******************** snap cursor operator **************** */
-static void snap_uv_to_pixel(float *uvco, float w, float h)
+static void snap_uv_to_pixel(float uvco[2], float w, float h)
{
uvco[0] = ((float)((int)((uvco[0] * w) + 0.5f))) / w;
uvco[1] = ((float)((int)((uvco[1] * h) + 0.5f))) / h;
@@ -3018,9 +3122,9 @@ static int bm_face_is_all_uv_sel(BMesh *bm, BMFace *f, int bool_test)
static int hide_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
- ToolSettings *ts = CTX_data_tool_settings(C);
Object *obedit = CTX_data_edit_object(C);
Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = scene->toolsettings;
BMEditMesh *em = BMEdit_FromObject(obedit);
BMFace *efa;
BMLoop *l;
@@ -3133,9 +3237,9 @@ static void UV_OT_hide(wmOperatorType *ot)
static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceImage *sima = CTX_wm_space_image(C);
- ToolSettings *ts = CTX_data_tool_settings(C);
Object *obedit = CTX_data_edit_object(C);
- /*Scene *scene = CTX_data_scene(C);*/ /*UNUSED*/
+ Scene *scene = CTX_data_scene(C);
+ ToolSettings *ts = scene->toolsettings;
BMEditMesh *em = BMEdit_FromObject(obedit);
BMFace *efa;
BMLoop *l;
@@ -3561,6 +3665,7 @@ void ED_operatortypes_uvedit(void)
WM_operatortype_append(UV_OT_unlink_selected);
WM_operatortype_append(UV_OT_select_pinned);
WM_operatortype_append(UV_OT_select_border);
+ WM_operatortype_append(UV_OT_select_lasso);
WM_operatortype_append(UV_OT_circle_select);
WM_operatortype_append(UV_OT_snap_cursor);
@@ -3621,6 +3726,11 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "UV_OT_circle_select", CKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "UV_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0);
+ RNA_boolean_set(kmi->ptr, "deselect", FALSE);
+ kmi = WM_keymap_add_item(keymap, "UV_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL | KM_SHIFT, 0);
+ RNA_boolean_set(kmi->ptr, "deselect", TRUE);
+
/* selection manipulation */
RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0)->ptr, "extend", FALSE);
RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0)->ptr, "extend", FALSE);
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index 36b1e77e5e5..e1b2d87c4f2 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -1162,7 +1162,7 @@ static int stitch_init(bContext *C, wmOperator *op)
EDBM_index_arrays_init(em, 0, 0, 1);
- RNA_BEGIN(op->ptr, itemptr, "selection") {
+ RNA_BEGIN (op->ptr, itemptr, "selection") {
faceIndex = RNA_int_get(&itemptr, "face_index");
elementIndex = RNA_int_get(&itemptr, "element_index");
efa = EDBM_face_at_index(em, faceIndex);
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 1dee327a066..0b3ee03c8de 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -408,7 +408,7 @@ GPUDrawObject *GPU_drawobject_new( DerivedMesh *dm )
points_per_mat[mface[i].mat_nr] += mface[i].v4 ? 6 : 3;
/* create the GPUDrawObject */
- gdo = MEM_callocN(sizeof(GPUDrawObject),"GPUDrawObject");
+ gdo = MEM_callocN(sizeof(GPUDrawObject), "GPUDrawObject");
gdo->totvert = dm->getNumVerts(dm);
gdo->totedge = dm->getNumEdges(dm);
@@ -601,7 +601,7 @@ static void GPU_buffer_copy_vertex(DerivedMesh *dm, float *varray, int *index, i
j = dm->drawObject->tot_triangle_point*3;
for (i = 0; i < dm->drawObject->totvert; i++) {
if (dm->drawObject->vert_points[i].point_index >= dm->drawObject->tot_triangle_point) {
- copy_v3_v3(&varray[j],mvert[i].co);
+ copy_v3_v3(&varray[j], mvert[i].co);
j+=3;
}
}
@@ -685,16 +685,16 @@ static void GPU_buffer_copy_uv(DerivedMesh *dm, float *varray, int *index, int *
start = index[mat_orig_to_new[f->mat_nr]];
/* v1 v2 v3 */
- copy_v2_v2(&varray[start],mtface[i].uv[0]);
- copy_v2_v2(&varray[start+2],mtface[i].uv[1]);
- copy_v2_v2(&varray[start+4],mtface[i].uv[2]);
+ copy_v2_v2(&varray[start], mtface[i].uv[0]);
+ copy_v2_v2(&varray[start+2], mtface[i].uv[1]);
+ copy_v2_v2(&varray[start+4], mtface[i].uv[2]);
index[mat_orig_to_new[f->mat_nr]] += 6;
if (f->v4) {
/* v3 v4 v1 */
- copy_v2_v2(&varray[start+6],mtface[i].uv[2]);
- copy_v2_v2(&varray[start+8],mtface[i].uv[3]);
- copy_v2_v2(&varray[start+10],mtface[i].uv[0]);
+ copy_v2_v2(&varray[start+6], mtface[i].uv[2]);
+ copy_v2_v2(&varray[start+8], mtface[i].uv[3]);
+ copy_v2_v2(&varray[start+10], mtface[i].uv[0]);
index[mat_orig_to_new[f->mat_nr]] += 6;
}
}
@@ -788,25 +788,25 @@ static void GPU_buffer_copy_uvedge(DerivedMesh *dm, float *varray, int *UNUSED(i
for (i = 0; i < dm->numTessFaceData; i++, tf++) {
MFace mf;
- dm->getTessFace(dm,i,&mf);
+ dm->getTessFace(dm, i, &mf);
- copy_v2_v2(&varray[j],tf->uv[0]);
- copy_v2_v2(&varray[j+2],tf->uv[1]);
+ copy_v2_v2(&varray[j], tf->uv[0]);
+ copy_v2_v2(&varray[j+2], tf->uv[1]);
- copy_v2_v2(&varray[j+4],tf->uv[1]);
- copy_v2_v2(&varray[j+6],tf->uv[2]);
+ copy_v2_v2(&varray[j+4], tf->uv[1]);
+ copy_v2_v2(&varray[j+6], tf->uv[2]);
if (!mf.v4) {
- copy_v2_v2(&varray[j+8],tf->uv[2]);
- copy_v2_v2(&varray[j+10],tf->uv[0]);
+ copy_v2_v2(&varray[j+8], tf->uv[2]);
+ copy_v2_v2(&varray[j+10], tf->uv[0]);
j+=12;
}
else {
- copy_v2_v2(&varray[j+8],tf->uv[2]);
- copy_v2_v2(&varray[j+10],tf->uv[3]);
+ copy_v2_v2(&varray[j+8], tf->uv[2]);
+ copy_v2_v2(&varray[j+10], tf->uv[3]);
- copy_v2_v2(&varray[j+12],tf->uv[3]);
- copy_v2_v2(&varray[j+14],tf->uv[0]);
+ copy_v2_v2(&varray[j+12], tf->uv[3]);
+ copy_v2_v2(&varray[j+14], tf->uv[0]);
j+=16;
}
}
@@ -861,7 +861,7 @@ const GPUBufferTypeSettings gpu_buffer_type_settings[] = {
/* get the GPUDrawObject buffer associated with a type */
static GPUBuffer **gpu_drawobject_buffer_from_type(GPUDrawObject *gdo, GPUBufferType type)
{
- switch(type) {
+ switch (type) {
case GPU_BUFFER_VERTEX:
return &gdo->points;
case GPU_BUFFER_NORMAL:
@@ -882,7 +882,7 @@ static GPUBuffer **gpu_drawobject_buffer_from_type(GPUDrawObject *gdo, GPUBuffer
/* get the amount of space to allocate for a buffer of a particular type */
static int gpu_buffer_size_from_type(DerivedMesh *dm, GPUBufferType type)
{
- switch(type) {
+ switch (type) {
case GPU_BUFFER_VERTEX:
return sizeof(float)*3 * (dm->drawObject->tot_triangle_point + dm->drawObject->tot_loose_point);
case GPU_BUFFER_NORMAL:
@@ -1059,7 +1059,7 @@ void GPU_uvedge_setup(DerivedMesh *dm)
static int GPU_typesize(int type)
{
- switch(type) {
+ switch (type) {
case GL_FLOAT:
return sizeof(float);
case GL_INT:
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index fc3878e2532..4113344760b 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -710,8 +710,10 @@ static void GPU_nodes_extract_dynamic_inputs(GPUPass *pass, ListBase *nodes)
/* attributes don't need to be bound, they already have
* an id that the drawing functions will use */
if (input->source == GPU_SOURCE_ATTRIB ||
- input->source == GPU_SOURCE_BUILTIN)
+ input->source == GPU_SOURCE_BUILTIN)
+ {
continue;
+ }
if (input->ima || input->tex)
BLI_snprintf(input->shadername, sizeof(input->shadername), "samp%d", input->texid);
@@ -1034,8 +1036,10 @@ static void gpu_nodes_get_vertex_attributes(ListBase *nodes, GPUVertexAttribs *a
if (input->source == GPU_SOURCE_ATTRIB) {
for (a=0; a<attribs->totlayer; a++) {
if (attribs->layer[a].type == input->attribtype &&
- strcmp(attribs->layer[a].name, input->attribname) == 0)
+ strcmp(attribs->layer[a].name, input->attribname) == 0)
+ {
break;
+ }
}
if (a == attribs->totlayer && a < GPU_MAX_ATTRIB) {
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 01f000e3314..09ed3c6f5fb 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -441,9 +441,11 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
/* if same image & tile, we're done */
if (compare && ima == GTS.curima && GTS.curtile == GTS.tile &&
- GTS.tilemode == GTS.curtilemode && GTS.curtileXRep == GTS.tileXRep &&
- GTS.curtileYRep == GTS.tileYRep)
+ GTS.tilemode == GTS.curtilemode && GTS.curtileXRep == GTS.tileXRep &&
+ GTS.curtileYRep == GTS.tileYRep)
+ {
return (ima != NULL);
+ }
/* if tiling mode or repeat changed, change texture matrix to fit */
if (GTS.tilemode!=GTS.curtilemode || GTS.curtileXRep!=GTS.tileXRep ||
@@ -618,7 +620,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
/* create image */
glGenTextures(1, (GLuint *)bind);
- glBindTexture( GL_TEXTURE_2D, *bind);
+ glBindTexture(GL_TEXTURE_2D, *bind);
if (!(gpu_get_mipmap() && mipmap)) {
if (use_high_bit_depth)
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index 6c30c95f355..83d9619f217 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -171,14 +171,16 @@ void GPU_extensions_init(void)
* New IDs from MESA's src/gallium/drivers/r300/r300_screen.c
*/
if (strstr(renderer, "R3") || strstr(renderer, "RV3") ||
- strstr(renderer, "R4") || strstr(renderer, "RV4") ||
- strstr(renderer, "RS4") || strstr(renderer, "RC4") ||
- strstr(renderer, "R5") || strstr(renderer, "RV5") ||
- strstr(renderer, "RS600") || strstr(renderer, "RS690") ||
- strstr(renderer, "RS740") || strstr(renderer, "X1") ||
- strstr(renderer, "X2") || strstr(renderer, "Radeon 9") ||
- strstr(renderer, "RADEON 9"))
+ strstr(renderer, "R4") || strstr(renderer, "RV4") ||
+ strstr(renderer, "RS4") || strstr(renderer, "RC4") ||
+ strstr(renderer, "R5") || strstr(renderer, "RV5") ||
+ strstr(renderer, "RS600") || strstr(renderer, "RS690") ||
+ strstr(renderer, "RS740") || strstr(renderer, "X1") ||
+ strstr(renderer, "X2") || strstr(renderer, "Radeon 9") ||
+ strstr(renderer, "RADEON 9"))
+ {
GG.npotdisabled = 1;
+ }
}
/* make sure double side isn't used by default and only getting enabled in places where it's
@@ -236,7 +238,7 @@ static void GPU_print_framebuffer_error(GLenum status, char err_out[256])
{
const char *err= "unknown";
- switch(status) {
+ switch (status) {
case GL_FRAMEBUFFER_COMPLETE_EXT:
break;
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index ab5f2040175..248ab9544e0 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -397,8 +397,7 @@ static GPUNodeLink *lamp_get_visibility(GPUMaterial *mat, GPULamp *lamp, GPUNode
if (lamp->type==LA_AREA)
return visifac;
- switch(lamp->falloff_type)
- {
+ switch (lamp->falloff_type) {
case LA_FALLOFF_CONSTANT:
break;
case LA_FALLOFF_INVLINEAR:
@@ -535,7 +534,7 @@ static void add_to_diffuse(GPUMaterial *mat, Material *ma, GPUShadeInput *shi, G
}
else {
/* input */
- switch(ma->rampin_col) {
+ switch (ma->rampin_col) {
case MA_RAMP_IN_ENERGY:
GPU_link(mat, "ramp_rgbtobw", rgb, &fac);
break;
@@ -588,7 +587,7 @@ static void do_specular_ramp(GPUShadeInput *shi, GPUNodeLink *is, GPUNodeLink *t
if (ma->ramp_spec && (ma->rampin_spec!=MA_RAMP_IN_RESULT)) {
/* input */
- switch(ma->rampin_spec) {
+ switch (ma->rampin_spec) {
case MA_RAMP_IN_ENERGY:
fac = t;
break;
@@ -807,7 +806,7 @@ static void material_lights(GPUShadeInput *shi, GPUShadeResult *shr)
static void texture_rgb_blend(GPUMaterial *mat, GPUNodeLink *tex, GPUNodeLink *out, GPUNodeLink *fact, GPUNodeLink *facg, int blendtype, GPUNodeLink **in)
{
- switch(blendtype) {
+ switch (blendtype) {
case MTEX_BLEND:
GPU_link(mat, "mtex_rgb_blend", out, tex, fact, facg, in);
break;
@@ -858,7 +857,7 @@ static void texture_rgb_blend(GPUMaterial *mat, GPUNodeLink *tex, GPUNodeLink *o
static void texture_value_blend(GPUMaterial *mat, GPUNodeLink *tex, GPUNodeLink *out, GPUNodeLink *fact, GPUNodeLink *facg, int blendtype, GPUNodeLink **in)
{
- switch(blendtype) {
+ switch (blendtype) {
case MTEX_BLEND:
GPU_link(mat, "mtex_value_blend", out, tex, fact, facg, in);
break;
@@ -1049,7 +1048,7 @@ static void do_material_tex(GPUShadeInput *shi)
if (tex->imaflag & TEX_NORMALMAP) {
/* normalmap image */
- GPU_link(mat, "mtex_normal", texco, GPU_image(tex->ima, &tex->iuser), &tnor );
+ GPU_link(mat, "mtex_normal", texco, GPU_image(tex->ima, &tex->iuser), &tnor);
if (mtex->norfac < 0.0f)
GPU_link(mat, "mtex_negate_texnormal", tnor, &tnor);
@@ -1152,70 +1151,70 @@ static void do_material_tex(GPUShadeInput *shi)
if ( iBumpSpacePrev != iBumpSpace ) {
if ( mtex->texflag & MTEX_BUMP_OBJECTSPACE )
- GPU_link( mat, "mtex_bump_init_objspace",
- surf_pos, vNorg,
- GPU_builtin(GPU_VIEW_MATRIX), GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_OBJECT_MATRIX), GPU_builtin(GPU_INVERSE_OBJECT_MATRIX),
- fPrevMagnitude, vNacc,
- &fPrevMagnitude, &vNacc,
- &vR1, &vR2, &fDet );
+ GPU_link(mat, "mtex_bump_init_objspace",
+ surf_pos, vNorg,
+ GPU_builtin(GPU_VIEW_MATRIX), GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_OBJECT_MATRIX), GPU_builtin(GPU_INVERSE_OBJECT_MATRIX),
+ fPrevMagnitude, vNacc,
+ &fPrevMagnitude, &vNacc,
+ &vR1, &vR2, &fDet);
else if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
- GPU_link( mat, "mtex_bump_init_texturespace",
- surf_pos, vNorg,
- fPrevMagnitude, vNacc,
- &fPrevMagnitude, &vNacc,
- &vR1, &vR2, &fDet );
+ GPU_link(mat, "mtex_bump_init_texturespace",
+ surf_pos, vNorg,
+ fPrevMagnitude, vNacc,
+ &fPrevMagnitude, &vNacc,
+ &vR1, &vR2, &fDet);
else
- GPU_link( mat, "mtex_bump_init_viewspace",
- surf_pos, vNorg,
- fPrevMagnitude, vNacc,
- &fPrevMagnitude, &vNacc,
- &vR1, &vR2, &fDet );
+ GPU_link(mat, "mtex_bump_init_viewspace",
+ surf_pos, vNorg,
+ fPrevMagnitude, vNacc,
+ &fPrevMagnitude, &vNacc,
+ &vR1, &vR2, &fDet);
iBumpSpacePrev = iBumpSpace;
}
if (found_deriv_map) {
- GPU_link( mat, "mtex_bump_deriv",
- texco, GPU_image(tex->ima, &tex->iuser), GPU_uniform(&ima_x), GPU_uniform(&ima_y), tnorfac,
- &dBs, &dBt );
+ GPU_link(mat, "mtex_bump_deriv",
+ texco, GPU_image(tex->ima, &tex->iuser), GPU_uniform(&ima_x), GPU_uniform(&ima_y), tnorfac,
+ &dBs, &dBt );
}
- else if ( mtex->texflag & MTEX_3TAP_BUMP )
- GPU_link( mat, "mtex_bump_tap3",
- texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
- &dBs, &dBt );
- else if ( mtex->texflag & MTEX_5TAP_BUMP )
- GPU_link( mat, "mtex_bump_tap5",
- texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
- &dBs, &dBt );
+ else if ( mtex->texflag & MTEX_3TAP_BUMP)
+ GPU_link(mat, "mtex_bump_tap3",
+ texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
+ &dBs, &dBt );
+ else if ( mtex->texflag & MTEX_5TAP_BUMP)
+ GPU_link(mat, "mtex_bump_tap5",
+ texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
+ &dBs, &dBt );
else if ( mtex->texflag & MTEX_BICUBIC_BUMP ) {
if (GPU_bicubic_bump_support()) {
- GPU_link( mat, "mtex_bump_bicubic",
- texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
- &dBs, &dBt );
+ GPU_link(mat, "mtex_bump_bicubic",
+ texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
+ &dBs, &dBt);
}
else {
- GPU_link( mat, "mtex_bump_tap5",
- texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
- &dBs, &dBt );
+ GPU_link(mat, "mtex_bump_tap5",
+ texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
+ &dBs, &dBt);
}
}
if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
float imag_tspace_dimension_y = aspect*imag_tspace_dimension_x;
- GPU_link( mat, "mtex_bump_apply_texspace",
- fDet, dBs, dBt, vR1, vR2,
- GPU_image(tex->ima, &tex->iuser), texco,
- GPU_uniform(&imag_tspace_dimension_x), GPU_uniform(&imag_tspace_dimension_y), vNacc,
- &vNacc, &shi->vn );
+ GPU_link(mat, "mtex_bump_apply_texspace",
+ fDet, dBs, dBt, vR1, vR2,
+ GPU_image(tex->ima, &tex->iuser), texco,
+ GPU_uniform(&imag_tspace_dimension_x), GPU_uniform(&imag_tspace_dimension_y), vNacc,
+ &vNacc, &shi->vn );
}
else
- GPU_link( mat, "mtex_bump_apply",
- fDet, dBs, dBt, vR1, vR2, vNacc,
- &vNacc, &shi->vn );
+ GPU_link(mat, "mtex_bump_apply",
+ fDet, dBs, dBt, vR1, vR2, vNacc,
+ &vNacc, &shi->vn );
}
}
@@ -1568,7 +1567,7 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l
pixsize= (lamp->d)/temp;
wsize= pixsize*0.5f*lamp->size;
- perspective_m4( lamp->winmat,-wsize, wsize, -wsize, wsize, lamp->d, lamp->clipend);
+ perspective_m4(lamp->winmat, -wsize, wsize, -wsize, wsize, lamp->d, lamp->clipend);
}
static void gpu_lamp_shadow_free(GPULamp *lamp)
@@ -1767,7 +1766,7 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
uniform->datatype = GPU_DATA_1I;
BLI_strncpy(uniform->varname, input->shadername, sizeof(uniform->varname));
- switch(input->textype) {
+ switch (input->textype) {
case GPU_SHADOW2D:
uniform->type = GPU_DYNAMIC_SAMPLER_2DSHADOW;
uniform->lamp = input->dynamicdata;
@@ -1788,7 +1787,7 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
else {
uniform->type = input->dynamictype;
BLI_strncpy(uniform->varname, input->shadername, sizeof(uniform->varname));
- switch(input->type) {
+ switch (input->type) {
case 1:
uniform->datatype = GPU_DATA_1F;
break;
@@ -1847,7 +1846,7 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
attribute->number = mat->attribs.layer[i].glindex;
BLI_snprintf(attribute->varname, sizeof(attribute->varname), "att%d", mat->attribs.layer[i].attribid);
- switch(attribute->type) {
+ switch (attribute->type) {
case CD_TANGENT:
attribute->datatype = GPU_DATA_4F;
break;
diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl b/source/blender/gpu/intern/gpu_shader_material.glsl
index 2ac99e2eee2..76dacd4a10d 100644
--- a/source/blender/gpu/intern/gpu_shader_material.glsl
+++ b/source/blender/gpu/intern/gpu_shader_material.glsl
@@ -2041,12 +2041,13 @@ void node_geometry(vec3 I, vec3 N, mat4 toworld,
backfacing = 0.0;
}
-void node_tex_coord(vec3 I, vec3 N, mat4 toworld,
+void node_tex_coord(vec3 I, vec3 N, mat4 viewinvmat, mat4 obinvmat,
vec3 attr_orco, vec3 attr_uv,
- out vec3 generated, out vec3 uv, out vec3 object,
+ out vec3 generated, out vec3 normal, out vec3 uv, out vec3 object,
out vec3 camera, out vec3 window, out vec3 reflection)
{
generated = attr_orco;
+ normal = normalize((obinvmat*(viewinvmat*vec4(N, 0.0))).xyz);
uv = attr_uv;
object = I;
camera = I;
diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl.c b/source/blender/gpu/intern/gpu_shader_material.glsl.c
index a6d962a7bb9..6a6db7eadbb 100644
--- a/source/blender/gpu/intern/gpu_shader_material.glsl.c
+++ b/source/blender/gpu/intern/gpu_shader_material.glsl.c
@@ -1,1484 +1,1487 @@
/* DataToC output of file <gpu_shader_material_glsl> */
-int datatoc_gpu_shader_material_glsl_size= 49395;
-char datatoc_gpu_shader_material_glsl[]= {
- 10,102,108,111, 97,116, 32,101,120,112, 95, 98,108,101,110,100,101,114, 40,
-102,108,111, 97,116, 32,102, 41, 10,123, 10, 9,114,101,116,117,114,110, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56,
- 50, 56, 52, 54, 44, 32,102, 41, 59, 10,125, 10, 10,118,111,105,100, 32,114,103, 98, 95,116,111, 95,104,115,118, 40,118,101, 99,
- 52, 32,114,103, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116,
- 32, 99,109, 97,120, 44, 32, 99,109,105,110, 44, 32,104, 44, 32,115, 44, 32,118, 44, 32, 99,100,101,108,116, 97, 59, 10, 9,118,
-101, 99, 51, 32, 99, 59, 10, 10, 9, 99,109, 97,120, 32, 61, 32,109, 97,120, 40,114,103, 98, 91, 48, 93, 44, 32,109, 97,120, 40,
-114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,109,105,110, 32, 61, 32,109,105,110, 40,114,103,
- 98, 91, 48, 93, 44, 32,109,105,110, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,100,101,
-108,116, 97, 32, 61, 32, 99,109, 97,120, 45, 99,109,105,110, 59, 10, 10, 9,118, 32, 61, 32, 99,109, 97,120, 59, 10, 9,105,102,
- 32, 40, 99,109, 97,120, 33, 61, 48, 46, 48, 41, 10, 9, 9,115, 32, 61, 32, 99,100,101,108,116, 97, 47, 99,109, 97,120, 59, 10,
- 9,101,108,115,101, 32,123, 10, 9, 9,115, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125,
- 10, 10, 9,105,102, 32, 40,115, 32, 61, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125,
- 10, 9,101,108,115,101, 32,123, 10, 9, 9, 99, 32, 61, 32, 40,118,101, 99, 51, 40, 99,109, 97,120, 44, 32, 99,109, 97,120, 44,
- 32, 99,109, 97,120, 41, 32, 45, 32,114,103, 98, 46,120,121,122, 41, 47, 99,100,101,108,116, 97, 59, 10, 10, 9, 9,105,102, 32,
- 40,114,103, 98, 46,120, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 99, 91, 50, 93, 32, 45, 32, 99, 91, 49, 93, 59, 10, 9,
- 9,101,108,115,101, 32,105,102, 32, 40,114,103, 98, 46,121, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 50, 46, 48, 32, 43,
- 32, 99, 91, 48, 93, 32, 45, 32, 32, 99, 91, 50, 93, 59, 10, 9, 9,101,108,115,101, 32,104, 32, 61, 32, 52, 46, 48, 32, 43, 32,
- 99, 91, 49, 93, 32, 45, 32, 99, 91, 48, 93, 59, 10, 10, 9, 9,104, 32, 47, 61, 32, 54, 46, 48, 59, 10, 10, 9, 9,105,102, 32,
- 40,104, 60, 48, 46, 48, 41, 10, 9, 9, 9,104, 32, 43, 61, 32, 49, 46, 48, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108,
- 32, 61, 32,118,101, 99, 52, 40,104, 44, 32,115, 44, 32,118, 44, 32,114,103, 98, 46,119, 41, 59, 10,125, 10, 10,118,111,105,100,
- 32,104,115,118, 95,116,111, 95,114,103, 98, 40,118,101, 99, 52, 32,104,115,118, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,
-117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,105, 44, 32,102, 44, 32,112, 44, 32,113, 44, 32,116, 44, 32,104,
- 44, 32,115, 44, 32,118, 59, 10, 9,118,101, 99, 51, 32,114,103, 98, 59, 10, 10, 9,104, 32, 61, 32,104,115,118, 91, 48, 93, 59,
- 10, 9,115, 32, 61, 32,104,115,118, 91, 49, 93, 59, 10, 9,118, 32, 61, 32,104,115,118, 91, 50, 93, 59, 10, 10, 9,105,102, 40,
-115, 61, 61, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,118, 44, 32,118, 41, 59,
- 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,105,102, 40,104, 61, 61, 49, 46, 48, 41, 10, 9, 9, 9,104, 32, 61, 32,
- 48, 46, 48, 59, 10, 9, 9, 10, 9, 9,104, 32, 42, 61, 32, 54, 46, 48, 59, 10, 9, 9,105, 32, 61, 32,102,108,111,111,114, 40,
-104, 41, 59, 10, 9, 9,102, 32, 61, 32,104, 32, 45, 32,105, 59, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,102, 44,
- 32,102, 44, 32,102, 41, 59, 10, 9, 9,112, 32, 61, 32,118, 42, 40, 49, 46, 48, 45,115, 41, 59, 10, 9, 9,113, 32, 61, 32,118,
- 42, 40, 49, 46, 48, 45, 40,115, 42,102, 41, 41, 59, 10, 9, 9,116, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42, 40, 49,
- 46, 48, 45,102, 41, 41, 41, 59, 10, 9, 9, 10, 9, 9,105,102, 32, 40,105, 32, 61, 61, 32, 48, 46, 48, 41, 32,114,103, 98, 32,
- 61, 32,118,101, 99, 51, 40,118, 44, 32,116, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61,
- 32, 49, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,113, 44, 32,118, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,
-101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 50, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,118, 44,
- 32,116, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 51, 46, 48, 41, 32,114,103, 98, 32, 61, 32,
-118,101, 99, 51, 40,112, 44, 32,113, 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 52,
- 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,116, 44, 32,112, 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,
-114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,112, 44, 32,113, 41, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108,
- 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 44, 32,104,115,118, 46,119, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,115,114,
-103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99,
- 32, 60, 32, 48, 46, 48, 52, 48, 52, 53, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32,
- 48, 46, 48, 58, 32, 99, 32, 42, 32, 40, 49, 46, 48, 47, 49, 50, 46, 57, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,
-116,117,114,110, 32,112,111,119, 40, 40, 99, 32, 43, 32, 48, 46, 48, 53, 53, 41, 42, 40, 49, 46, 48, 47, 49, 46, 48, 53, 53, 41,
- 44, 32, 50, 46, 52, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,
-103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 48, 51, 49, 51, 48, 56, 41,
- 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 49, 50,
- 46, 57, 50, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, 32, 49, 46, 48, 53, 53, 32, 42, 32,112,111,119, 40,
- 99, 44, 32, 49, 46, 48, 47, 50, 46, 52, 41, 32, 45, 32, 48, 46, 48, 53, 53, 59, 10,125, 10, 10,118,111,105,100, 32,115,114,103,
- 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,
-116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,115,114,103,
- 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99,111,108,
- 95,116,111, 46,103, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,
-111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,
-114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,
-108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,
-114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,
-116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,
-114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,108,105,110,
-101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108,
- 95,116,111, 46, 98, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,
-111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125,
- 10, 10, 35,100,101,102,105,110,101, 32, 77, 95, 80, 73, 32, 51, 46, 49, 52, 49, 53, 57, 50, 54, 53, 51, 53, 56, 57, 55, 57, 51,
- 50, 51, 56, 52, 54, 10, 35,100,101,102,105,110,101, 32, 77, 95, 49, 95, 80, 73, 32, 48, 46, 51, 49, 56, 51, 48, 57, 56, 56, 54,
- 49, 56, 51, 55, 57, 48, 54, 57, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79,
- 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,118, 99,111,108, 95,
- 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52,
- 32,118, 99,111,108, 41, 10,123, 10, 9,118, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 97,116,116,118, 99,111,108, 46,120, 47,
- 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,121, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,
-122, 47, 50, 53, 53, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,117,118, 95, 97,116,116,114,105, 98,
-117,116,101, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 41, 10,123, 10, 9,
-117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32,
- 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,103,101,111,109, 40,118,101, 99, 51, 32, 99,111,
- 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,118,101, 99,
- 51, 32, 97,116,116,111,114, 99,111, 44, 32,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,118,101, 99, 52, 32, 97,116,116,118,
- 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,108,
-111, 99, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,114,
- 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108,
- 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 99,111,108, 95,
- 97,108,112,104, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102,114,111,110,116, 98, 97, 99,107, 41, 10,123, 10, 9,108,
-111, 99, 97,108, 32, 61, 32, 99,111, 59, 10, 9,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,111, 99,
- 97,108, 41, 59, 10, 9,103,108,111, 98, 97,108, 32, 61, 32, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40,
-108,111, 99, 97,108, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,
-111, 59, 10, 9,117,118, 95, 97,116,116,114,105, 98,117,116,101, 40, 97,116,116,117,118, 44, 32,117,118, 41, 59, 10, 9,110,111,
-114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,110,111,114, 41, 59, 9, 47, 42, 32, 98,108,101,110,100,
-101,114, 32,114,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,
-118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40, 97,116,116,118, 99,111,108, 44, 32,118, 99,111,108, 41, 59, 10, 9,
-118, 99,111,108, 95, 97,108,112,104, 97, 32, 61, 32, 97,116,116,118, 99,111,108, 46, 97, 59, 10, 9,102,114,111,110,116, 98, 97,
- 99,107, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,
-101, 99, 44, 32,109, 97,116, 52, 32,109, 97,116, 44, 32,118,101, 99, 51, 32,109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,
-109, 97,120,118,101, 99, 44, 32,102,108,111, 97,116, 32,100,111,109,105,110, 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120,
- 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 40,
-109, 97,116, 32, 42, 32,118,101, 99, 52, 40,118,101, 99, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,105,102, 40,100,
-111,109,105,110, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109, 97,120, 40,111,117,116,118,
-101, 99, 44, 32,109,105,110,118,101, 99, 41, 59, 10, 9,105,102, 40,100,111,109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9,
- 9,111,117,116,118,101, 99, 32, 61, 32,109,105,110, 40,111,117,116,118,101, 99, 44, 32,109, 97,120,118,101, 99, 41, 59, 10,125,
- 10, 10,118,111,105,100, 32, 99, 97,109,101,114, 97, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,
-111,117,116,118,105,101,119, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,101,112,116,104, 44, 32,111,117,116,
- 32,102,108,111, 97,116, 32,111,117,116,100,105,115,116, 41, 10,123, 10, 9,111,117,116,100,101,112,116,104, 32, 61, 32, 97, 98,
-115, 40, 99,111, 46,122, 41, 59, 10, 9,111,117,116,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40, 99,111, 41, 59, 10,
- 9,111,117,116,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 59, 10,125, 10, 10,118,111,105,
-100, 32,109, 97,116,104, 95, 97,100,100, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108,
- 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61,
- 32,118, 97,108, 49, 32, 43, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,117, 98,116,114,
- 97, 99,116, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,
-102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 45,
- 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109,117,108,116,105,112,108,121, 40,102,108,111,
- 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,
-117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 42, 32,118, 97,108, 50, 59, 10,
-125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,
-102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,
- 9,105,102, 32, 40,118, 97,108, 50, 32, 61, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48,
- 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 47, 32,118, 97,108, 50, 59, 10,
-125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116,
- 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,115,105,110, 40,118,
- 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 99,111,115,105,110,101, 40,102,108,111, 97,116, 32,118,
- 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32,
- 61, 32, 99,111,115, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,116, 97,110,103,101,110,116,
+int datatoc_gpu_shader_material_glsl_size = 49493;
+char datatoc_gpu_shader_material_glsl[] = {
+ 10,102,108,111, 97,116, 32,101,120,112, 95, 98,108,101,110,100,101,114, 40,102,108,
+111, 97,116, 32,102, 41, 10,123, 10, 9,114,101,116,117,114,110, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 50, 56,
+ 52, 54, 44, 32,102, 41, 59, 10,125, 10, 10,118,111,105,100, 32,114,103, 98, 95,116,111, 95,104,115,118, 40,118,101, 99, 52, 32,
+114,103, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, 99,
+109, 97,120, 44, 32, 99,109,105,110, 44, 32,104, 44, 32,115, 44, 32,118, 44, 32, 99,100,101,108,116, 97, 59, 10, 9,118,101, 99,
+ 51, 32, 99, 59, 10, 10, 9, 99,109, 97,120, 32, 61, 32,109, 97,120, 40,114,103, 98, 91, 48, 93, 44, 32,109, 97,120, 40,114,103,
+ 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,109,105,110, 32, 61, 32,109,105,110, 40,114,103, 98, 91,
+ 48, 93, 44, 32,109,105,110, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,100,101,108,116,
+ 97, 32, 61, 32, 99,109, 97,120, 45, 99,109,105,110, 59, 10, 10, 9,118, 32, 61, 32, 99,109, 97,120, 59, 10, 9,105,102, 32, 40,
+ 99,109, 97,120, 33, 61, 48, 46, 48, 41, 10, 9, 9,115, 32, 61, 32, 99,100,101,108,116, 97, 47, 99,109, 97,120, 59, 10, 9,101,
+108,115,101, 32,123, 10, 9, 9,115, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 10,
+ 9,105,102, 32, 40,115, 32, 61, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,
+101,108,115,101, 32,123, 10, 9, 9, 99, 32, 61, 32, 40,118,101, 99, 51, 40, 99,109, 97,120, 44, 32, 99,109, 97,120, 44, 32, 99,
+109, 97,120, 41, 32, 45, 32,114,103, 98, 46,120,121,122, 41, 47, 99,100,101,108,116, 97, 59, 10, 10, 9, 9,105,102, 32, 40,114,
+103, 98, 46,120, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 99, 91, 50, 93, 32, 45, 32, 99, 91, 49, 93, 59, 10, 9, 9,101,
+108,115,101, 32,105,102, 32, 40,114,103, 98, 46,121, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 50, 46, 48, 32, 43, 32, 99,
+ 91, 48, 93, 32, 45, 32, 32, 99, 91, 50, 93, 59, 10, 9, 9,101,108,115,101, 32,104, 32, 61, 32, 52, 46, 48, 32, 43, 32, 99, 91,
+ 49, 93, 32, 45, 32, 99, 91, 48, 93, 59, 10, 10, 9, 9,104, 32, 47, 61, 32, 54, 46, 48, 59, 10, 10, 9, 9,105,102, 32, 40,104,
+ 60, 48, 46, 48, 41, 10, 9, 9, 9,104, 32, 43, 61, 32, 49, 46, 48, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61,
+ 32,118,101, 99, 52, 40,104, 44, 32,115, 44, 32,118, 44, 32,114,103, 98, 46,119, 41, 59, 10,125, 10, 10,118,111,105,100, 32,104,
+115,118, 95,116,111, 95,114,103, 98, 40,118,101, 99, 52, 32,104,115,118, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,
+ 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,105, 44, 32,102, 44, 32,112, 44, 32,113, 44, 32,116, 44, 32,104, 44, 32,
+115, 44, 32,118, 59, 10, 9,118,101, 99, 51, 32,114,103, 98, 59, 10, 10, 9,104, 32, 61, 32,104,115,118, 91, 48, 93, 59, 10, 9,
+115, 32, 61, 32,104,115,118, 91, 49, 93, 59, 10, 9,118, 32, 61, 32,104,115,118, 91, 50, 93, 59, 10, 10, 9,105,102, 40,115, 61,
+ 61, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,118, 44, 32,118, 41, 59, 10, 9,
+125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,105,102, 40,104, 61, 61, 49, 46, 48, 41, 10, 9, 9, 9,104, 32, 61, 32, 48, 46,
+ 48, 59, 10, 9, 9, 10, 9, 9,104, 32, 42, 61, 32, 54, 46, 48, 59, 10, 9, 9,105, 32, 61, 32,102,108,111,111,114, 40,104, 41,
+ 59, 10, 9, 9,102, 32, 61, 32,104, 32, 45, 32,105, 59, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,102, 44, 32,102,
+ 44, 32,102, 41, 59, 10, 9, 9,112, 32, 61, 32,118, 42, 40, 49, 46, 48, 45,115, 41, 59, 10, 9, 9,113, 32, 61, 32,118, 42, 40,
+ 49, 46, 48, 45, 40,115, 42,102, 41, 41, 59, 10, 9, 9,116, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42, 40, 49, 46, 48,
+ 45,102, 41, 41, 41, 59, 10, 9, 9, 10, 9, 9,105,102, 32, 40,105, 32, 61, 61, 32, 48, 46, 48, 41, 32,114,103, 98, 32, 61, 32,
+118,101, 99, 51, 40,118, 44, 32,116, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 49,
+ 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,113, 44, 32,118, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,
+105,102, 32, 40,105, 32, 61, 61, 32, 50, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,118, 44, 32,116,
+ 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 51, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101,
+ 99, 51, 40,112, 44, 32,113, 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 52, 46, 48,
+ 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,116, 44, 32,112, 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,114,103,
+ 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,112, 44, 32,113, 41, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61,
+ 32,118,101, 99, 52, 40,114,103, 98, 44, 32,104,115,118, 46,119, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,115,114,103, 98,
+ 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60,
+ 32, 48, 46, 48, 52, 48, 52, 53, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46,
+ 48, 58, 32, 99, 32, 42, 32, 40, 49, 46, 48, 47, 49, 50, 46, 57, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,
+114,110, 32,112,111,119, 40, 40, 99, 32, 43, 32, 48, 46, 48, 53, 53, 41, 42, 40, 49, 46, 48, 47, 49, 46, 48, 53, 53, 41, 44, 32,
+ 50, 46, 52, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98,
+ 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 48, 51, 49, 51, 48, 56, 41, 10, 9,
+ 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 49, 50, 46, 57,
+ 50, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, 32, 49, 46, 48, 53, 53, 32, 42, 32,112,111,119, 40, 99, 44,
+ 32, 49, 46, 48, 47, 50, 46, 52, 41, 32, 45, 32, 48, 46, 48, 53, 53, 59, 10,125, 10, 10,118,111,105,100, 32,115,114,103, 98, 95,
+116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,
+118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,115,114,103, 98, 95,
+116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99,111,108, 95,116,
+111, 46,103, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109,
+ 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,
+103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,
+102,114,111,109, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103,
+ 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111,
+ 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103,
+ 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,108,105,110,101, 97,
+114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,
+111, 46, 98, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109,
+ 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10,
+ 35,100,101,102,105,110,101, 32, 77, 95, 80, 73, 32, 51, 46, 49, 52, 49, 53, 57, 50, 54, 53, 51, 53, 56, 57, 55, 57, 51, 50, 51,
+ 56, 52, 54, 10, 35,100,101,102,105,110,101, 32, 77, 95, 49, 95, 80, 73, 32, 48, 46, 51, 49, 56, 51, 48, 57, 56, 56, 54, 49, 56,
+ 51, 55, 57, 48, 54, 57, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79, 68, 69,
+ 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,118, 99,111,108, 95, 97,116,
+116,114,105, 98,117,116,101, 40,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118,
+ 99,111,108, 41, 10,123, 10, 9,118, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 97,116,116,118, 99,111,108, 46,120, 47, 50, 53,
+ 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,121, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,122, 47,
+ 50, 53, 53, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,117,118, 95, 97,116,116,114,105, 98,117,116,
+101, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 41, 10,123, 10, 9,117,118,
+ 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46,
+ 48, 41, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,103,101,111,109, 40,118,101, 99, 51, 32, 99,111, 44, 32,
+118,101, 99, 51, 32,110,111,114, 44, 32,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32,
+ 97,116,116,111,114, 99,111, 44, 32,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,118,101, 99, 52, 32, 97,116,116,118, 99,111,
+108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,108,111, 99,
+ 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,114, 99,111,
+ 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,
+111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 99,111,108, 95, 97,108,
+112,104, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102,114,111,110,116, 98, 97, 99,107, 41, 10,123, 10, 9,108,111, 99,
+ 97,108, 32, 61, 32, 99,111, 59, 10, 9,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,111, 99, 97,108,
+ 41, 59, 10, 9,103,108,111, 98, 97,108, 32, 61, 32, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40,108,111,
+ 99, 97,108, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59,
+ 10, 9,117,118, 95, 97,116,116,114,105, 98,117,116,101, 40, 97,116,116,117,118, 44, 32,117,118, 41, 59, 10, 9,110,111,114,109,
+ 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,110,111,114, 41, 59, 9, 47, 42, 32, 98,108,101,110,100,101,114,
+ 32,114,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,118, 99,
+111,108, 95, 97,116,116,114,105, 98,117,116,101, 40, 97,116,116,118, 99,111,108, 44, 32,118, 99,111,108, 41, 59, 10, 9,118, 99,
+111,108, 95, 97,108,112,104, 97, 32, 61, 32, 97,116,116,118, 99,111,108, 46, 97, 59, 10, 9,102,114,111,110,116, 98, 97, 99,107,
+ 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99,
+ 44, 32,109, 97,116, 52, 32,109, 97,116, 44, 32,118,101, 99, 51, 32,109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,109, 97,
+120,118,101, 99, 44, 32,102,108,111, 97,116, 32,100,111,109,105,110, 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120, 44, 32,
+111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 40,109, 97,
+116, 32, 42, 32,118,101, 99, 52, 40,118,101, 99, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,105,102, 40,100,111,109,
+105,110, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109, 97,120, 40,111,117,116,118,101, 99,
+ 44, 32,109,105,110,118,101, 99, 41, 59, 10, 9,105,102, 40,100,111,109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,
+117,116,118,101, 99, 32, 61, 32,109,105,110, 40,111,117,116,118,101, 99, 44, 32,109, 97,120,118,101, 99, 41, 59, 10,125, 10, 10,
+118,111,105,100, 32, 99, 97,109,101,114, 97, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,
+116,118,105,101,119, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,101,112,116,104, 44, 32,111,117,116, 32,102,
+108,111, 97,116, 32,111,117,116,100,105,115,116, 41, 10,123, 10, 9,111,117,116,100,101,112,116,104, 32, 61, 32, 97, 98,115, 40,
+ 99,111, 46,122, 41, 59, 10, 9,111,117,116,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40, 99,111, 41, 59, 10, 9,111,
+117,116,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 59, 10,125, 10, 10,118,111,105,100, 32,
+109, 97,116,104, 95, 97,100,100, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44,
+ 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118,
+ 97,108, 49, 32, 43, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,117, 98,116,114, 97, 99,
+116, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,
+111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 45, 32,118,
+ 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109,117,108,116,105,112,108,121, 40,102,108,111, 97,116,
+ 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,
+118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 42, 32,118, 97,108, 50, 59, 10,125, 10,
+ 10,118,111,105,100, 32,109, 97,116,104, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,
+111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,
+102, 32, 40,118, 97,108, 50, 32, 61, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,
+ 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 47, 32,118, 97,108, 50, 59, 10,125, 10,
+ 10,118,111,105,100, 32,109, 97,116,104, 95,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,
+108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,115,105,110, 40,118, 97,108,
+ 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 99,111,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108,
+ 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,
+ 99,111,115, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,116, 97,110,103,101,110,116, 40,102,
+108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,
+117,116,118, 97,108, 32, 61, 32,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,
+115,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41,
+ 10,123, 10, 9,105,102, 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46,
+ 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 97,115,105,110, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9,
+ 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97, 99,111,115,
40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,
- 9,111,117,116,118, 97,108, 32, 61, 32,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104,
- 95, 97,115,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,
-108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45,
- 49, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 97,115,105,110, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101,
- 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97, 99,
-111,115, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,
-123, 10, 9,105,102, 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48,
- 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 97, 99,111,115, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,
-111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,116, 97,110, 40,
-102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,
-111,117,116,118, 97,108, 32, 61, 32, 97,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104,
- 95,112,111,119, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116,
- 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 49, 32, 62, 61, 32, 48, 46,
- 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32,112,111,119, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10, 9,
-101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,
-104, 95,108,111,103, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,
-116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32, 48, 46, 48,
- 32, 32, 38, 38, 32,118, 97,108, 50, 32, 62, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 61, 32,108,111,103, 50, 40,
-118, 97,108, 49, 41, 32, 47, 32,108,111,103, 50, 40,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118,
- 97,108, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109, 97,120, 40,102,108,111, 97,116, 32,
-118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118,
- 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,109, 97,120, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59,
- 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,
-111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,
-117,116,118, 97,108, 32, 61, 32,109,105,110, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100,
- 32,109, 97,116,104, 95,114,111,117,110,100, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116,
- 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 61, 32,102,108,111,111,114, 40,118, 97,108, 32, 43, 32,
- 48, 46, 53, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,101,115,115, 95,116,104, 97,110, 40,102,108,111,
- 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,
-117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 60, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118,
- 97,108, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,
-125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,103,114,101, 97,116,101,114, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,
-118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118,
- 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32,
- 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,
-118,111,105,100, 32,115,113,117,101,101,122,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,102,108,111, 97,116, 32,119,105,
-100,116,104, 44, 32,102,108,111, 97,116, 32, 99,101,110,116,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,
-118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 47, 40, 49, 46, 48, 32, 43, 32,112,111,119, 40,
- 50, 46, 55, 49, 56, 50, 56, 49, 56, 51, 44, 32, 45, 40, 40,118, 97,108, 45, 99,101,110,116,101,114, 41, 42,119,105,100,116,104,
- 41, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,100,100, 40,118,101, 99, 51, 32,118,
- 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116,
- 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,
-118, 50, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32,
- 97, 98,115, 40,111,117,116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41,
- 47, 51, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,115,117, 98, 40,118,101, 99, 51, 32,
-118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,
-116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 45,
- 32,118, 50, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43,
- 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41,
- 41, 47, 51, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,118,101,114, 97,103,101, 40,
-118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101,
- 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61,
- 32,118, 49, 32, 43, 32,118, 50, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101,
- 99, 41, 59, 10, 9,111,117,116,118,101, 99, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,118,101, 99, 41, 59,
- 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,100,111,116, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,
-101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111,
- 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 44, 32, 48,
- 44, 32, 48, 41, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,100,111,116, 40,118, 49, 44, 32,118, 50, 41, 59, 10,125, 10, 10,
-118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 99,114,111,115,115, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99,
+ 9,105,102, 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10,
+ 9, 9,111,117,116,118, 97,108, 32, 61, 32, 97, 99,111,115, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,
+116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,116, 97,110, 40,102,108,
+111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,
+116,118, 97,108, 32, 61, 32, 97,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,112,
+111,119, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,
+108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 49, 32, 62, 61, 32, 48, 46, 48, 41,
+ 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32,112,111,119, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10, 9,101,108,
+115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,
+108,111,103, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,
+102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32, 48, 46, 48, 32, 32,
+ 38, 38, 32,118, 97,108, 50, 32, 62, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 61, 32,108,111,103, 50, 40,118, 97,
+108, 49, 41, 32, 47, 32,108,111,103, 50, 40,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108,
+ 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109, 97,120, 40,102,108,111, 97,116, 32,118, 97,
+108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108,
+ 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,109, 97,120, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125,
+ 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,
+116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,
+118, 97,108, 32, 61, 32,109,105,110, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,
+ 97,116,104, 95,114,111,117,110,100, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,
+117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 61, 32,102,108,111,111,114, 40,118, 97,108, 32, 43, 32, 48, 46,
+ 53, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,101,115,115, 95,116,104, 97,110, 40,102,108,111, 97,116,
+ 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,
+118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 60, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108,
+ 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10,
+ 10,118,111,105,100, 32,109, 97,116,104, 95,103,114,101, 97,116,101,114, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,
+108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108,
+ 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32,
+ 49, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,
+105,100, 32,115,113,117,101,101,122,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,102,108,111, 97,116, 32,119,105,100,116,
+104, 44, 32,102,108,111, 97,116, 32, 99,101,110,116,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,
+108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 47, 40, 49, 46, 48, 32, 43, 32,112,111,119, 40, 50, 46,
+ 55, 49, 56, 50, 56, 49, 56, 51, 44, 32, 45, 40, 40,118, 97,108, 45, 99,101,110,116,101,114, 41, 42,119,105,100,116,104, 41, 41,
+ 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,100,100, 40,118,101, 99, 51, 32,118, 49, 44,
+ 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,
+108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50,
+ 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,
+115, 40,111,117,116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51,
+ 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,115,117, 98, 40,118,101, 99, 51, 32,118, 49,
+ 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,
+102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 45, 32,118,
+ 50, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97,
+ 98,115, 40,111,117,116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47,
+ 51, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,118,101,114, 97,103,101, 40,118,101,
+ 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44,
+ 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,
+ 49, 32, 43, 32,118, 50, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41,
+ 59, 10, 9,111,117,116,118,101, 99, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,118,101, 99, 41, 59, 10,125,
+ 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,100,111,116, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99,
51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116,
- 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 99,114,111,115,115, 40,118, 49, 44, 32,118,
- 50, 41, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10,
- 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,110,111,114,109, 97,108,105,122,101, 40,118,101, 99, 51, 32,118, 44,
- 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118,
- 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,118, 41, 59, 10, 9,111,117,116,118,
-101, 99, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109,
- 97,116,104, 95,110,101,103, 97,116,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,
- 41, 10,123, 10, 9,111,117,116,118, 32, 61, 32, 45,118, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,114,109, 97,108, 40,118,
-101, 99, 51, 32,100,105,114, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,
-111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,111,116, 41, 10,123, 10, 9,111,117,116,110,111,114, 32,
- 61, 32,110,111,114, 59, 10, 9,111,117,116,100,111,116, 32, 61, 32, 45,100,111,116, 40,100,105,114, 44, 32,110,111,114, 41, 59,
- 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,118,101, 99, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,
-101, 99, 51, 32,118,101, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116,
- 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 46,120, 32, 61, 32,116,101,120,116,
-117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,120, 32, 43, 32, 49, 46,
- 48, 41, 42, 48, 46, 53, 44, 32, 48, 46, 48, 41, 41, 46,120, 59, 10, 9,111,117,116,118,101, 99, 46,121, 32, 61, 32,116,101,120,
-116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,121, 32, 43, 32, 49,
- 46, 48, 41, 42, 48, 46, 53, 44, 32, 48, 46, 48, 41, 41, 46,121, 59, 10, 9,111,117,116,118,101, 99, 46,122, 32, 61, 32,116,101,
-120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,122, 32, 43, 32,
- 49, 46, 48, 41, 42, 48, 46, 53, 44, 32, 48, 46, 48, 41, 41, 46,122, 59, 10, 10, 9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32,
- 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32, 40,111,117,116,118,101, 99, 42,102, 97, 99, 41, 32, 43, 32, 40,
-118,101, 99, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,
-114,103, 98, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,115, 97,109,112,108,101,114,
- 50, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,
- 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,
-118,101, 99, 50, 40,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,
-108, 46,114, 44, 32, 48, 46, 48, 41, 41, 46, 97, 44, 32, 48, 46, 48, 41, 41, 46,114, 59, 10, 9,111,117,116, 99,111,108, 46,103,
- 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,116,101,120,116,
-117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,108, 46,103, 44, 32, 48, 46, 48, 41,
- 41, 46, 97, 44, 32, 48, 46, 48, 41, 41, 46,103, 59, 10, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,101,120,116,117,114,
-101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,
-118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,108, 46, 98, 44, 32, 48, 46, 48, 41, 41, 46, 97, 44, 32, 48, 46, 48, 41,
- 41, 46, 98, 59, 10, 10, 9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 32,
- 61, 32, 40,111,117,116, 99,111,108, 42,102, 97, 99, 41, 32, 43, 32, 40, 99,111,108, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41,
- 59, 10, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,
-116, 95,118, 97,108,117,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,
-118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,
-116, 95,114,103, 98, 40,118,101, 99, 51, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41,
- 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103,
- 98, 97, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,
- 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101,
- 95,122,101,114,111, 40,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,
-108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,111,110,101, 40,111,
-117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48,
- 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 51, 32,
-111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10,125,
- 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 97, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 52, 32,111,117,
-116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118,101, 99, 52, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,
-118,111,105,100, 32,109,105,120, 95, 98,108,101,110,100, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,
-111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41,
- 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,
- 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10,
- 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,
- 97,100,100, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,
-111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,
-108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,
-105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 49, 32, 43, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116,
- 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,109,117,108,116,
+ 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 44, 32, 48, 44, 32,
+ 48, 41, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,100,111,116, 40,118, 49, 44, 32,118, 50, 41, 59, 10,125, 10, 10,118,111,
+105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 99,114,111,115,115, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,
+118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,
+117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 99,114,111,115,115, 40,118, 49, 44, 32,118, 50, 41,
+ 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,
+111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,110,111,114,109, 97,108,105,122,101, 40,118,101, 99, 51, 32,118, 44, 32,111,
+117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108,
+ 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,118, 41, 59, 10, 9,111,117,116,118,101, 99,
+ 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,
+104, 95,110,101,103, 97,116,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 41, 10,
+123, 10, 9,111,117,116,118, 32, 61, 32, 45,118, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,114,109, 97,108, 40,118,101, 99,
+ 51, 32,100,105,114, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,
+ 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,111,116, 41, 10,123, 10, 9,111,117,116,110,111,114, 32, 61, 32,
+110,111,114, 59, 10, 9,111,117,116,100,111,116, 32, 61, 32, 45,100,111,116, 40,100,105,114, 44, 32,110,111,114, 41, 59, 10,125,
+ 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,118,101, 99, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99,
+ 51, 32,118,101, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,
+101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 46,120, 32, 61, 32,116,101,120,116,117,114,
+101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,120, 32, 43, 32, 49, 46, 48, 41,
+ 42, 48, 46, 53, 44, 32, 48, 46, 48, 41, 41, 46,120, 59, 10, 9,111,117,116,118,101, 99, 46,121, 32, 61, 32,116,101,120,116,117,
+114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,121, 32, 43, 32, 49, 46, 48,
+ 41, 42, 48, 46, 53, 44, 32, 48, 46, 48, 41, 41, 46,121, 59, 10, 9,111,117,116,118,101, 99, 46,122, 32, 61, 32,116,101,120,116,
+117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,122, 32, 43, 32, 49, 46,
+ 48, 41, 42, 48, 46, 53, 44, 32, 48, 46, 48, 41, 41, 46,122, 59, 10, 10, 9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46,
+ 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32, 40,111,117,116,118,101, 99, 42,102, 97, 99, 41, 32, 43, 32, 40,118,101,
+ 99, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,114,103,
+ 98, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,115, 97,109,112,108,101,114, 50, 68,
+ 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,
+117,116, 99,111,108, 46,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101,
+ 99, 50, 40,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,108, 46,
+114, 44, 32, 48, 46, 48, 41, 41, 46, 97, 44, 32, 48, 46, 48, 41, 41, 46,114, 59, 10, 9,111,117,116, 99,111,108, 46,103, 32, 61,
+ 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,116,101,120,116,117,114,
+101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,108, 46,103, 44, 32, 48, 46, 48, 41, 41, 46,
+ 97, 44, 32, 48, 46, 48, 41, 41, 46,103, 59, 10, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,101,120,116,117,114,101, 50,
+ 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,
+109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,108, 46, 98, 44, 32, 48, 46, 48, 41, 41, 46, 97, 44, 32, 48, 46, 48, 41, 41, 46,
+ 98, 59, 10, 10, 9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,
+ 40,111,117,116, 99,111,108, 42,102, 97, 99, 41, 32, 43, 32, 40, 99,111,108, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10,
+ 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,
+118, 97,108,117,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,
+108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,
+114,103, 98, 40,118,101, 99, 51, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123,
+ 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 97,
+ 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,
+117,116, 99,111,108, 32, 61, 32, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,122,
+101,114,111, 40,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32,
+ 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,111,110,101, 40,111,117,116,
+ 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10,
+125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 51, 32,111,117,
+116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,
+118,111,105,100, 32,115,101,116, 95,114,103, 98, 97, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 52, 32,111,117,116,118,
+ 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118,101, 99, 52, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,
+105,100, 32,109,105,120, 95, 98,108,101,110,100, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108,
+ 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123,
+ 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,
+117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,
+117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 97,100,
+100, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108,
+ 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,
+109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120,
+ 40, 99,111,108, 49, 44, 32, 99,111,108, 49, 32, 43, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,
+108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,109,117,108,116, 40,102,
+108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,
+111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,
+102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,
+108, 49, 44, 32, 99,111,108, 49, 32, 42, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97,
+ 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115, 99,114,101,101,110, 40,102,108,
+111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,
+117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102,
+ 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48,
+ 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 40,
+118,101, 99, 52, 40,102, 97, 99,109, 41, 32, 43, 32,102, 97, 99, 42, 40,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 99,111,
+108, 50, 41, 41, 42, 40,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 49, 41, 59, 10, 9,111,117,116, 99,111,108,
+ 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,111,118,101,114,108, 97,121,
40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50,
44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,
-112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40,
- 99,111,108, 49, 44, 32, 99,111,108, 49, 32, 42, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108,
- 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115, 99,114,101,101,110, 40,
-102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44,
- 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112,
- 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49,
- 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45,
- 32, 40,118,101, 99, 52, 40,102, 97, 99,109, 41, 32, 43, 32,102, 97, 99, 42, 40,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32,
- 99,111,108, 50, 41, 41, 42, 40,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 49, 41, 59, 10, 9,111,117,116, 99,
-111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,111,118,101,114,108,
- 97,121, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,
-108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108,
- 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32,
- 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,
-105,102, 40,111,117,116, 99,111,108, 46,114, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 42, 61,
- 32,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10, 9,101,108,115,101, 10, 9, 9,
-111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,
- 42, 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46,114, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114,
- 41, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,103, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108,
- 46,103, 32, 42, 61, 32,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9,101,108,
-115,101, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46,
- 48, 42,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46,103, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116,
- 99,111,108, 46,103, 41, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,
-117,116, 99,111,108, 46, 98, 32, 42, 61, 32,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46, 98,
- 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109,
- 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46, 98, 41, 41, 42, 40, 49, 46, 48, 32,
- 45, 32,111,117,116, 99,111,108, 46, 98, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115,117, 98, 40,102,108,111,
- 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,
-116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97,
- 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49,
- 44, 32, 99,111,108, 49, 32, 45, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61,
- 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,100,105,118, 40,102,108,111, 97,116, 32,102,
- 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101,
- 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48,
- 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97,
- 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46,114, 32,
- 33, 61, 32, 48, 46, 48, 41, 32,111,117,116, 99,111,108, 46,114, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,114,
- 32, 43, 32,102, 97, 99, 42,111,117,116, 99,111,108, 46,114, 47, 99,111,108, 50, 46,114, 59, 10, 9,105,102, 40, 99,111,108, 50,
- 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,111,117,116, 99,111,108, 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,
-108, 46,103, 32, 43, 32,102, 97, 99, 42,111,117,116, 99,111,108, 46,103, 47, 99,111,108, 50, 46,103, 59, 10, 9,105,102, 40, 99,
-111,108, 50, 46, 98, 32, 33, 61, 32, 48, 46, 48, 41, 32,111,117,116, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109, 42,111,117,
-116, 99,111,108, 46, 98, 32, 43, 32,102, 97, 99, 42,111,117,116, 99,111,108, 46, 98, 47, 99,111,108, 50, 46, 98, 59, 10,125, 10,
- 10,118,111,105,100, 32,109,105,120, 95,100,105,102,102, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,
+112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32,
+ 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102,
+ 40,111,117,116, 99,111,108, 46,114, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 42, 61, 32,102,
+ 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,
+116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 40,
+ 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46,114, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 59,
+ 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,103, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103,
+ 32, 42, 61, 32,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9,101,108,115,101,
+ 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,
+102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46,103, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,
+108, 46,103, 41, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116,
+ 99,111,108, 46, 98, 32, 42, 61, 32,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10,
+ 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43,
+ 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46, 98, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,
+111,117,116, 99,111,108, 46, 98, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115,117, 98, 40,102,108,111, 97,116,
+ 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,
+118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44,
+ 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32,
+ 99,111,108, 49, 32, 45, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,
+111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,100,105,118, 40,102,108,111, 97,116, 32,102, 97, 99,
+ 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52,
+ 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48,
+ 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59,
+ 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46,114, 32, 33, 61,
+ 32, 48, 46, 48, 41, 32,111,117,116, 99,111,108, 46,114, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,114, 32, 43,
+ 32,102, 97, 99, 42,111,117,116, 99,111,108, 46,114, 47, 99,111,108, 50, 46,114, 59, 10, 9,105,102, 40, 99,111,108, 50, 46,103,
+ 32, 33, 61, 32, 48, 46, 48, 41, 32,111,117,116, 99,111,108, 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,
+103, 32, 43, 32,102, 97, 99, 42,111,117,116, 99,111,108, 46,103, 47, 99,111,108, 50, 46,103, 59, 10, 9,105,102, 40, 99,111,108,
+ 50, 46, 98, 32, 33, 61, 32, 48, 46, 48, 41, 32,111,117,116, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,
+111,108, 46, 98, 32, 43, 32,102, 97, 99, 42,111,117,116, 99,111,108, 46, 98, 47, 99,111,108, 50, 46, 98, 59, 10,125, 10, 10,118,
+111,105,100, 32,109,105,120, 95,100,105,102,102, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108,
+ 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123,
+ 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,
+117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 97, 98,115, 40, 99,111,108, 49, 32, 45, 32, 99,111,108,
+ 50, 41, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10,
+ 10,118,111,105,100, 32,109,105,120, 95,100, 97,114,107, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,
111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41,
10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,
- 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 97, 98,115, 40, 99,111,108, 49, 32, 45, 32, 99,
-111,108, 50, 41, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,
-125, 10, 10,118,111,105,100, 32,109,105,120, 95,100, 97,114,107, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52,
+ 9,111,117,116, 99,111,108, 46,114,103, 98, 32, 61, 32,109,105,110, 40, 99,111,108, 49, 46,114,103, 98, 44, 32, 99,111,108, 50,
+ 46,114,103, 98, 42,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125,
+ 10, 10,118,111,105,100, 32,109,105,120, 95,108,105,103,104,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52,
32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,
108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41,
- 59, 10, 9,111,117,116, 99,111,108, 46,114,103, 98, 32, 61, 32,109,105,110, 40, 99,111,108, 49, 46,114,103, 98, 44, 32, 99,111,
+ 59, 10, 9,111,117,116, 99,111,108, 46,114,103, 98, 32, 61, 32,109, 97,120, 40, 99,111,108, 49, 46,114,103, 98, 44, 32, 99,111,
108, 50, 46,114,103, 98, 42,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59,
- 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,108,105,103,104,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101,
+ 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,100,111,100,103,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101,
99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,
99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46,
- 48, 41, 59, 10, 9,111,117,116, 99,111,108, 46,114,103, 98, 32, 61, 32,109, 97,120, 40, 99,111,108, 49, 46,114,103, 98, 44, 32,
- 99,111,108, 50, 46,114,103, 98, 42,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46,
- 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,100,111,100,103,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,
-118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,
-117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32,
- 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,
-108, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32,
- 45, 32,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9,
- 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112,
- 32, 61, 32,111,117,116, 99,111,108, 46,114, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,
-108, 46,114, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,
-116,109,112, 59, 10, 9,125, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9,
- 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9,
- 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46,
- 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, 99,111,108, 46,103, 47,116,109,112,
- 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,
-115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32,116,109,112, 59, 10, 9,125, 10, 9,105,102, 40,111,117,116,
- 99,111,108, 46, 98, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46,
- 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41,
- 10, 9, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,
-109,112, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116,
- 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46, 98, 32,
- 61, 32,116,109,112, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 98,117,114,110, 40,102,108,111, 97,116,
- 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,
-118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44,
- 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,116,109,112, 44, 32,102, 97, 99,109, 32, 61, 32, 49,
- 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,116,109,112,
- 32, 61, 32,102, 97, 99,109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61,
- 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102,
- 40, 40,116,109,112, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 47,
-116,109,112, 41, 41, 32, 60, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10, 9,
-101,108,115,101, 32,105,102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,
- 49, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,109,112, 59, 10, 10, 9,116,
-109,112, 32, 61, 32,102, 97, 99,109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9,105,102, 40,116,109,112, 32,
- 60, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,
-105,102, 40, 40,116,109,112, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103,
- 41, 47,116,109,112, 41, 41, 32, 60, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59,
- 10, 9,101,108,115,101, 32,105,102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32,
- 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32,116,109,112, 59, 10, 10,
- 9,116,109,112, 32, 61, 32,102, 97, 99,109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10, 9,105,102, 40,116,109,
-112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,
-101, 32,105,102, 40, 40,116,109,112, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108,
- 46, 98, 41, 47,116,109,112, 41, 41, 32, 60, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46,
- 48, 59, 10, 9,101,108,115,101, 32,105,102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,
- 98, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,109,112, 59,
- 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,104,117,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52,
- 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,
-108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41,
- 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116,
- 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 44, 32,116,109,
-112, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,105,102,
- 40,104,115,118, 50, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,
-117,116, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 9, 9,104,115,118, 46,120, 32, 61, 32,104,115,118, 50, 46,120, 59, 10, 9,
- 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,116,109,112, 41, 59, 32, 10, 10, 9, 9,111,117,116, 99,111,
-108, 32, 61, 32,109,105,120, 40,111,117,116, 99,111,108, 44, 32,116,109,112, 44, 32,102, 97, 99, 41, 59, 10, 9, 9,111,117,116,
- 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115,
- 97,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,
-108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108,
- 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32,
- 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,
-118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,
-111,108, 44, 32,104,115,118, 41, 59, 10, 10, 9,105,102, 40,104,115,118, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9,
- 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9, 9,104,115,118, 46,
-121, 32, 61, 32,102, 97, 99,109, 42,104,115,118, 46,121, 32, 43, 32,102, 97, 99, 42,104,115,118, 50, 46,121, 59, 10, 9, 9,104,
-115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10, 9,125, 10,125, 10, 10,118,111,
-105,100, 32,109,105,120, 95,118, 97,108, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44,
- 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,
-102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111,
- 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44,
- 32,104,115,118, 50, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 49, 44, 32,104,115,118, 41, 59, 10, 9,
-114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,104,115,118, 46,122, 32,
- 61, 32,102, 97, 99,109, 42,104,115,118, 46,122, 32, 43, 32,102, 97, 99, 42,104,115,118, 50, 46,122, 59, 10, 9,104,115,118, 95,
-116,111, 95,114,103, 98, 40,104,115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120,
- 95, 99,111,108,111,114, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99,
- 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32,
- 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102,
- 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49,
- 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 44, 32,116,109,112, 59, 10, 9,114,103, 98, 95,116,111,
- 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,105,102, 40,104,115,118, 50, 46,121, 32, 33, 61,
- 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115,118,
- 41, 59, 10, 9, 9,104,115,118, 46,120, 32, 61, 32,104,115,118, 50, 46,120, 59, 10, 9, 9,104,115,118, 46,121, 32, 61, 32,104,
-115,118, 50, 46,121, 59, 10, 9, 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,116,109,112, 41, 59, 32, 10,
- 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40,111,117,116, 99,111,108, 44, 32,116,109,112, 44, 32,102, 97, 99,
- 41, 59, 10, 9, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10, 9,125, 10,125, 10, 10,118,111,
-105,100, 32,109,105,120, 95,115,111,102,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49,
- 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,
- 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,
-111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,118,101, 99, 52, 32,111,110,101,
- 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 59, 10, 9,118,101, 99, 52, 32,115, 99,114, 61, 32,111,110,101, 32, 45, 32, 40,111,
-110,101, 32, 45, 32, 99,111,108, 50, 41, 42, 40,111,110,101, 32, 45, 32, 99,111,108, 49, 41, 59, 10, 9,111,117,116, 99,111,108,
- 32, 61, 32,102, 97, 99,109, 42, 99,111,108, 49, 32, 43, 32,102, 97, 99, 42, 40, 40,111,110,101, 32, 45, 32, 99,111,108, 49, 41,
- 42, 99,111,108, 50, 42, 99,111,108, 49, 32, 43, 32, 99,111,108, 49, 42,115, 99,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32,
-109,105,120, 95,108,105,110,101, 97,114, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44,
- 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,
-102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 10, 9,111,117,
-116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46,114, 32, 62, 32, 48, 46, 53, 41, 10,
- 9, 9,111,117,116, 99,111,108, 46,114, 61, 32, 99,111,108, 49, 46,114, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,
-111,108, 50, 46,114, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,114, 61,
- 32, 99,111,108, 49, 46,114, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,114, 41, 32, 45, 32, 49, 46,
- 48, 41, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46,103, 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,
-103, 61, 32, 99,111,108, 49, 46,103, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,103, 32, 45, 32, 48,
- 46, 53, 41, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,103, 61, 32, 99,111,108, 49, 46,103, 32, 43,
- 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,103, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10, 10, 9,105,102, 40,
- 99,111,108, 50, 46, 98, 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 61, 32, 99,111,108, 49, 46, 98,
- 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46, 98, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10, 9,101,108,
-115,101, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 61, 32, 99,111,108, 49, 46, 98, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48,
- 42, 40, 99,111,108, 50, 46, 98, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118, 97,108,116,111,114,
-103, 98, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,111,108,111,114,109, 97,112,
- 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,
- 97,108,112,104, 97, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,111,108,
-111,114,109, 97,112, 44, 32,118,101, 99, 50, 40,102, 97, 99, 44, 32, 48, 46, 48, 41, 41, 59, 10, 9,111,117,116, 97,108,112,104,
- 97, 32, 61, 32,111,117,116, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,114,103, 98,116,111, 98,119, 40,118,101,
- 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 32, 32, 10,123, 10,
- 9,111,117,116,118, 97,108, 32, 61, 32, 99,111,108,111,114, 46,114, 42, 48, 46, 51, 53, 32, 43, 32, 99,111,108,111,114, 46,103,
- 42, 48, 46, 52, 53, 32, 43, 32, 99,111,108,111,114, 46, 98, 42, 48, 46, 50, 59, 32, 47, 42, 32,107,101,101,112, 32,116,104,101,
-115,101, 32,102, 97, 99,116,111,114,115, 32,105,110, 32,115,121,110, 99, 32,119,105,116,104, 32,116,101,120,116,117,114,101, 46,
-104, 58, 82, 71, 66, 84, 79, 66, 87, 32, 42, 47, 10,125, 10, 10,118,111,105,100, 32,105,110,118,101,114,116, 40,102,108,111, 97,
-116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108,
- 41, 10,123, 10, 9,111,117,116, 99,111,108, 46,120,121,122, 32, 61, 32,109,105,120, 40, 99,111,108, 46,120,121,122, 44, 32,118,
-101, 99, 51, 40, 49, 46, 48, 44, 32, 49, 46, 48, 44, 32, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 46,120,121,122, 44, 32,102, 97,
- 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46,119, 32, 61, 32, 99,111,108, 46,119, 59, 10,125, 10, 10,118,111,105,100, 32,104,
-117,101, 95,115, 97,116, 40,102,108,111, 97,116, 32,104,117,101, 44, 32,102,108,111, 97,116, 32,115, 97,116, 44, 32,102,108,111,
- 97,116, 32,118, 97,108,117,101, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,
-117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32,104,115,118, 59, 10, 10, 9,114,
-103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 10, 9,104,115,118, 91, 48, 93, 32, 43, 61,
- 32, 40,104,117,101, 32, 45, 32, 48, 46, 53, 41, 59, 10, 9,105,102, 40,104,115,118, 91, 48, 93, 62, 49, 46, 48, 41, 32,104,115,
-118, 91, 48, 93, 45, 61, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, 48, 93, 60, 48, 46, 48, 41, 32,104,
-115,118, 91, 48, 93, 43, 61, 32, 49, 46, 48, 59, 10, 9,104,115,118, 91, 49, 93, 32, 42, 61, 32,115, 97,116, 59, 10, 9,105,102,
- 40,104,115,118, 91, 49, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 49, 93, 61, 32, 49, 46, 48, 59, 32,101,108,115,101, 32,105,
-102, 40,104,115,118, 91, 49, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91, 49, 93, 61, 32, 48, 46, 48, 59, 10, 9,104,115,118, 91,
- 50, 93, 32, 42, 61, 32,118, 97,108,117,101, 59, 10, 9,105,102, 40,104,115,118, 91, 50, 93, 62, 49, 46, 48, 41, 32,104,115,118,
- 91, 50, 93, 61, 32, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, 50, 93, 60, 48, 46, 48, 41, 32,104,115,
-118, 91, 50, 93, 61, 32, 48, 46, 48, 59, 10, 10, 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,111,117,116,
- 99,111,108, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 44, 32,111,117,116, 99,111,108,
- 44, 32,102, 97, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,112, 97,114, 97,116,101, 95,114,103, 98, 40,118,101, 99,
- 52, 32, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,103, 44,
- 32,111,117,116, 32,102,108,111, 97,116, 32, 98, 41, 10,123, 10, 9,114, 32, 61, 32, 99,111,108, 46,114, 59, 10, 9,103, 32, 61,
- 32, 99,111,108, 46,103, 59, 10, 9, 98, 32, 61, 32, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32, 99,111,109, 98,
-105,110,101, 95,114,103, 98, 40,102,108,111, 97,116, 32,114, 44, 32,102,108,111, 97,116, 32,103, 44, 32,102,108,111, 97,116, 32,
- 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 41, 10,123, 10, 9, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114,
- 44, 32,103, 44, 32, 98, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,111,117,116,112,117,116, 95,110,111,100,
-101, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,102,108,111, 97,116, 32, 97,108,112,104, 97, 44, 32,111,117,116, 32,118,101, 99,
- 52, 32,111,117,116,114,103, 98, 41, 10,123, 10, 9,111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 46,114,
-103, 98, 44, 32, 97,108,112,104, 97, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 84, 69, 88, 84,
- 85, 82, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,116,101,120,116,
-117,114,101, 95,102,108,105,112, 95, 98,108,101,110,100, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,118,101, 99,
- 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 46,121,120,122, 59, 10,125,
- 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95, 98,108,101,110,100, 95,108,105,110, 40,118,101, 99, 51, 32,118,101,
- 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61,
- 32, 40, 49, 46, 48, 43,118,101, 99, 46,120, 41, 47, 50, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,
-101, 95, 98,108,101,110,100, 95,113,117, 97,100, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116,
- 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,109, 97,120, 40, 40, 49, 46, 48, 43,118,101,
- 99, 46,120, 41, 47, 50, 46, 48, 44, 32, 48, 46, 48, 41, 59, 10, 9,111,117,116,118, 97,108, 32, 42, 61, 32,111,117,116,118, 97,
-108, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,119,111,111,100, 95,115,105,110, 40,118,101, 99, 51,
- 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32,
- 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10, 9,102,108,111, 97,116,
- 32, 97, 32, 61, 32,115,113,114,116, 40,118,101, 99, 46,120, 42,118,101, 99, 46,120, 32, 43, 32,118,101, 99, 46,121, 42,118,101,
- 99, 46,121, 32, 43, 32,118,101, 99, 46,122, 42,118,101, 99, 46,122, 41, 42, 50, 48, 46, 48, 59, 10, 9,102,108,111, 97,116, 32,
-119,105, 32, 61, 32, 48, 46, 53, 32, 43, 32, 48, 46, 53, 42,115,105,110, 40, 97, 41, 59, 10, 10, 9,118, 97,108,117,101, 32, 61,
- 32,119,105, 59, 10, 9, 99,111,108,111,114, 32, 61, 32,118,101, 99, 52, 40,119,105, 44, 32,119,105, 44, 32,119,105, 44, 32, 49,
- 46, 48, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46,
- 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,105,109, 97,103,101, 40,118,101, 99, 51, 32,118,
-101, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,
-117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,
-109, 97,108, 41, 10,123, 10, 9, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 40,
-118,101, 99, 46,120,121, 32, 43, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 41, 42, 48, 46, 53, 41, 59, 10, 9,
-118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 59, 10, 10, 9,110,111,114,109, 97,108, 46,120, 32, 61, 32, 50, 46, 48, 42, 40, 99,
-111,108,111,114, 46,114, 32, 45, 32, 48, 46, 53, 41, 59, 10, 9,110,111,114,109, 97,108, 46,121, 32, 61, 32, 50, 46, 48, 42, 40,
- 48, 46, 53, 32, 45, 32, 99,111,108,111,114, 46,103, 41, 59, 10, 9,110,111,114,109, 97,108, 46,122, 32, 61, 32, 50, 46, 48, 42,
- 40, 99,111,108,111,114, 46, 98, 32, 45, 32, 48, 46, 53, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 32, 77, 84, 69, 88, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100,
- 32,116,101,120, 99,111, 95,111,114, 99,111, 40,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,111,117,116, 32,118,101,
- 99, 51, 32,111,114, 99,111, 41, 10,123, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10,125, 10, 10,118,
-111,105,100, 32,116,101,120, 99,111, 95,117,118, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99,
- 51, 32,117,118, 41, 10,123, 10, 9, 47, 42, 32,100,105,115, 97, 98,108,101,100, 32,102,111,114, 32,110,111,119, 44, 32,119,111,
-114,107,115, 32,116,111,103,101,116,104,101,114, 32,119,105,116,104, 32,108,101, 97,118,105,110,103, 32,111,117,116, 32,109,116,
-101,120, 95, 50,100, 95,109, 97,112,112,105,110,103, 10, 9, 32, 32, 32,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,
-118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 32, 42, 47,
- 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100,
- 32,116,101,120, 99,111, 95,110,111,114,109, 40,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99,
- 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9, 47, 42, 32, 99,111,114,114,101,115,112,111,110,100,115, 32,116,
-111, 32,115,104,105, 45, 62,111,114,110, 44, 32,119,104,105, 99,104, 32,105,115, 32,110,101,103, 97,116,101,100, 32,115,111, 32,
- 99, 97,110, 99,101,108,115, 10, 9, 32, 32, 32,111,117,116, 32, 98,108,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,110,
-101,103, 97,116,105,111,110, 32, 42, 47, 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32,110,111,114,109, 97,108,105,122,
-101, 40,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,116, 97,110,103,101,110,116,
- 40,118,101, 99, 52, 32,116, 97,110,103,101,110,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116, 97,110,103,101,
-110,116, 41, 10,123, 10, 9,111,117,116,116, 97,110,103,101,110,116, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,116, 97,
-110,103,101,110,116, 46,120,121,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,103,108,111, 98, 97,108,
- 40,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,
-101, 99, 51, 32,103,108,111, 98, 97,108, 41, 10,123, 10, 9,103,108,111, 98, 97,108, 32, 61, 32, 40,118,105,101,119,105,110,118,
-109, 97,116, 42,118,101, 99, 52, 40, 99,111, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10,125, 10, 10,118,111,105,100, 32,
-116,101,120, 99,111, 95,111, 98,106,101, 99,116, 40,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,109, 97,
-116, 52, 32,111, 98,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,
- 98,106,101, 99,116, 41, 10,123, 10, 9,111, 98,106,101, 99,116, 32, 61, 32, 40,111, 98,105,110,118,109, 97,116, 42, 40,118,105,
-101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40, 99,111, 44, 32, 49, 46, 48, 41, 41, 41, 46,120,121,122, 59, 10,125, 10,
- 10,118,111,105,100, 32,116,101,120, 99,111, 95,114,101,102,108, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,118,
-105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,114,101,102, 41, 10,123, 10, 9,114,101,102, 32, 61, 32,118,105,101,119,
- 32, 45, 32, 50, 46, 48, 42,100,111,116, 40,118,110, 44, 32,118,105,101,119, 41, 42,118,110, 59, 10,125, 10, 10,118,111,105,100,
- 32,115,104, 97,100,101, 95,110,111,114,109, 40,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99,
- 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101,
-114, 32,110,111,114,109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,111,117,116,110,111,114,109, 97,
-108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,
-109,116,101,120, 95,114,103, 98, 95, 98,108,101,110,100, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51,
- 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44,
- 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10,
- 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116,
- 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,102, 97, 99,109, 42,111,
-117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,109,117,108, 40,118,101, 99, 51,
- 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116,
- 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,
- 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97,
- 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32, 40,102, 97, 99,109, 32, 43,
- 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 41, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
-101,120, 95,114,103, 98, 95,115, 99,114,101,101,110, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,
-116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,
-111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10,
- 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59,
- 10, 10, 9,105,110, 99,111,108, 32, 61, 32,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32, 40,118,101, 99, 51, 40,102, 97, 99,
-109, 41, 32, 43, 32,102, 97, 99,116, 42, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,116,101,120, 99,111,108, 41, 41, 42,
- 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
-101,120, 95,114,103, 98, 95,111,118,101,114,108, 97,121, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51,
- 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44,
- 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10,
- 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103,
- 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,114, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105,110, 99,111,108, 46,114,
- 32, 61, 32,111,117,116, 99,111,108, 46,114, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120,
- 99,111,108, 46,114, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 32, 45, 32,
- 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 46,114,
- 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108,
- 46,103, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99,111,108, 46,103, 42, 40,
-102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,103, 41, 59, 10, 9,101,108,115,101,
- 10, 9, 9,105,110, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102,
- 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 46,103, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116,
- 99,111,108, 46,103, 41, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105,
-110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97,
- 99,116, 42,116,101,120, 99,111,108, 46, 98, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 46, 98, 32, 61, 32,
- 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,
-120, 99,111,108, 46, 98, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, 59, 10,125, 10, 10,118,111,
-105,100, 32,109,116,101,120, 95,114,103, 98, 95,115,117, 98, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99,
- 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103,
- 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,105,110, 99,111,108, 32, 61, 32, 45,102, 97,
- 99,116, 42,102, 97, 99,103, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100,
- 32,109,116,101,120, 95,114,103, 98, 95, 97,100,100, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,
+ 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,
+114, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,
+102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,
+111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61,
+ 32,111,117,116, 99,111,108, 46,114, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,
+114, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,109,
+112, 59, 10, 9,125, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,
+108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9, 9,105,
+102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59,
+ 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, 99,111,108, 46,103, 47,116,109,112, 41, 32,
+ 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101,
+ 10, 9, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32,116,109,112, 59, 10, 9,125, 10, 9,105,102, 40,111,117,116, 99,111,
+108, 46, 98, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32,
+ 45, 32,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9,
+ 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112,
+ 32, 61, 32,111,117,116, 99,111,108, 46, 98, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,
+108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,
+116,109,112, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 98,117,114,110, 40,102,108,111, 97,116, 32,102,
+ 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101,
+ 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48,
+ 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,116,109,112, 44, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48,
+ 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,116,109,112, 32, 61,
+ 32,102, 97, 99,109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48,
+ 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,
+116,109,112, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 47,116,109,
+112, 41, 41, 32, 60, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,
+115,101, 32,105,102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46,
+ 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,109,112, 59, 10, 10, 9,116,109,112,
+ 32, 61, 32,102, 97, 99,109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61,
+ 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102,
+ 40, 40,116,109,112, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 47,
+116,109,112, 41, 41, 32, 60, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59, 10, 9,
+101,108,115,101, 32,105,102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32,
+ 49, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32,116,109,112, 59, 10, 10, 9,116,
+109,112, 32, 61, 32,102, 97, 99,109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10, 9,105,102, 40,116,109,112, 32,
+ 60, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,
+105,102, 40, 40,116,109,112, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98,
+ 41, 47,116,109,112, 41, 41, 32, 60, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46, 48, 59,
+ 10, 9,101,108,115,101, 32,105,102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32,
+ 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,109,112, 59, 10,125,
+ 10, 10,118,111,105,100, 32,109,105,120, 95,104,117,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,
+111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41,
+ 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,
+ 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,
+108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 44, 32,116,109,112, 59,
+ 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,105,102, 40,104,
+115,118, 50, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116,
+ 99,111,108, 44, 32,104,115,118, 41, 59, 10, 9, 9,104,115,118, 46,120, 32, 61, 32,104,115,118, 50, 46,120, 59, 10, 9, 9,104,
+115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,116,109,112, 41, 59, 32, 10, 10, 9, 9,111,117,116, 99,111,108, 32,
+ 61, 32,109,105,120, 40,111,117,116, 99,111,108, 44, 32,116,109,112, 44, 32,102, 97, 99, 41, 59, 10, 9, 9,111,117,116, 99,111,
+108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115, 97,116,
+ 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50,
+ 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,
+112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32,
+ 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,118,101,
+ 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108,
+ 44, 32,104,115,118, 41, 59, 10, 10, 9,105,102, 40,104,115,118, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,
+103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9, 9,104,115,118, 46,121, 32,
+ 61, 32,102, 97, 99,109, 42,104,115,118, 46,121, 32, 43, 32,102, 97, 99, 42,104,115,118, 50, 46,121, 59, 10, 9, 9,104,115,118,
+ 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100,
+ 32,109,105,120, 95,118, 97,108, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,
+101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97,
+ 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116,
+ 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,
+115,118, 50, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 49, 44, 32,104,115,118, 41, 59, 10, 9,114,103,
+ 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,104,115,118, 46,122, 32, 61, 32,
+102, 97, 99,109, 42,104,115,118, 46,122, 32, 43, 32,102, 97, 99, 42,104,115,118, 50, 46,122, 59, 10, 9,104,115,118, 95,116,111,
+ 95,114,103, 98, 40,104,115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 99,
+111,108,111,114, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32,
+ 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32,
+ 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,
+109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10,
+ 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 44, 32,116,109,112, 59, 10, 9,114,103, 98, 95,116,111, 95,104,
+115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,105,102, 40,104,115,118, 50, 46,121, 32, 33, 61, 32, 48,
+ 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115,118, 41, 59,
+ 10, 9, 9,104,115,118, 46,120, 32, 61, 32,104,115,118, 50, 46,120, 59, 10, 9, 9,104,115,118, 46,121, 32, 61, 32,104,115,118,
+ 50, 46,121, 59, 10, 9, 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,116,109,112, 41, 59, 32, 10, 10, 9,
+ 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40,111,117,116, 99,111,108, 44, 32,116,109,112, 44, 32,102, 97, 99, 41, 59,
+ 10, 9, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100,
+ 32,109,105,120, 95,115,111,102,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,
+118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,
+ 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,
+116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,118,101, 99, 52, 32,111,110,101, 61, 32,
+118,101, 99, 52, 40, 49, 46, 48, 41, 59, 10, 9,118,101, 99, 52, 32,115, 99,114, 61, 32,111,110,101, 32, 45, 32, 40,111,110,101,
+ 32, 45, 32, 99,111,108, 50, 41, 42, 40,111,110,101, 32, 45, 32, 99,111,108, 49, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61,
+ 32,102, 97, 99,109, 42, 99,111,108, 49, 32, 43, 32,102, 97, 99, 42, 40, 40,111,110,101, 32, 45, 32, 99,111,108, 49, 41, 42, 99,
+111,108, 50, 42, 99,111,108, 49, 32, 43, 32, 99,111,108, 49, 42,115, 99,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,
+120, 95,108,105,110,101, 97,114, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,
+101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97,
+ 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 10, 9,111,117,116, 99,
+111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46,114, 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,
+111,117,116, 99,111,108, 46,114, 61, 32, 99,111,108, 49, 46,114, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108,
+ 50, 46,114, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,114, 61, 32, 99,
+111,108, 49, 46,114, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,114, 41, 32, 45, 32, 49, 46, 48, 41,
+ 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46,103, 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 61,
+ 32, 99,111,108, 49, 46,103, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,103, 32, 45, 32, 48, 46, 53,
+ 41, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,103, 61, 32, 99,111,108, 49, 46,103, 32, 43, 32,102,
+ 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,103, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10, 10, 9,105,102, 40, 99,111,
+108, 50, 46, 98, 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 61, 32, 99,111,108, 49, 46, 98, 32, 43,
+ 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46, 98, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10, 9,101,108,115,101,
+ 10, 9, 9,111,117,116, 99,111,108, 46, 98, 61, 32, 99,111,108, 49, 46, 98, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40,
+ 99,111,108, 50, 46, 98, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118, 97,108,116,111,114,103, 98,
+ 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,111,108,111,114,109, 97,112, 44, 32,
+111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, 97,108,
+112,104, 97, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,111,108,111,114,
+109, 97,112, 44, 32,118,101, 99, 50, 40,102, 97, 99, 44, 32, 48, 46, 48, 41, 41, 59, 10, 9,111,117,116, 97,108,112,104, 97, 32,
+ 61, 32,111,117,116, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,114,103, 98,116,111, 98,119, 40,118,101, 99, 52,
+ 32, 99,111,108,111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 32, 32, 10,123, 10, 9,111,
+117,116,118, 97,108, 32, 61, 32, 99,111,108,111,114, 46,114, 42, 48, 46, 51, 53, 32, 43, 32, 99,111,108,111,114, 46,103, 42, 48,
+ 46, 52, 53, 32, 43, 32, 99,111,108,111,114, 46, 98, 42, 48, 46, 50, 59, 32, 47, 42, 32,107,101,101,112, 32,116,104,101,115,101,
+ 32,102, 97, 99,116,111,114,115, 32,105,110, 32,115,121,110, 99, 32,119,105,116,104, 32,116,101,120,116,117,114,101, 46,104, 58,
+ 82, 71, 66, 84, 79, 66, 87, 32, 42, 47, 10,125, 10, 10,118,111,105,100, 32,105,110,118,101,114,116, 40,102,108,111, 97,116, 32,
+102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,
+123, 10, 9,111,117,116, 99,111,108, 46,120,121,122, 32, 61, 32,109,105,120, 40, 99,111,108, 46,120,121,122, 44, 32,118,101, 99,
+ 51, 40, 49, 46, 48, 44, 32, 49, 46, 48, 44, 32, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 46,120,121,122, 44, 32,102, 97, 99, 41,
+ 59, 10, 9,111,117,116, 99,111,108, 46,119, 32, 61, 32, 99,111,108, 46,119, 59, 10,125, 10, 10,118,111,105,100, 32,104,117,101,
+ 95,115, 97,116, 40,102,108,111, 97,116, 32,104,117,101, 44, 32,102,108,111, 97,116, 32,115, 97,116, 44, 32,102,108,111, 97,116,
+ 32,118, 97,108,117,101, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116,
+ 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32,104,115,118, 59, 10, 10, 9,114,103, 98,
+ 95,116,111, 95,104,115,118, 40, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 10, 9,104,115,118, 91, 48, 93, 32, 43, 61, 32, 40,
+104,117,101, 32, 45, 32, 48, 46, 53, 41, 59, 10, 9,105,102, 40,104,115,118, 91, 48, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91,
+ 48, 93, 45, 61, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, 48, 93, 60, 48, 46, 48, 41, 32,104,115,118,
+ 91, 48, 93, 43, 61, 32, 49, 46, 48, 59, 10, 9,104,115,118, 91, 49, 93, 32, 42, 61, 32,115, 97,116, 59, 10, 9,105,102, 40,104,
+115,118, 91, 49, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 49, 93, 61, 32, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,
+104,115,118, 91, 49, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91, 49, 93, 61, 32, 48, 46, 48, 59, 10, 9,104,115,118, 91, 50, 93,
+ 32, 42, 61, 32,118, 97,108,117,101, 59, 10, 9,105,102, 40,104,115,118, 91, 50, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 50,
+ 93, 61, 32, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, 50, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91,
+ 50, 93, 61, 32, 48, 46, 48, 59, 10, 10, 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,111,117,116, 99,111,
+108, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 44, 32,111,117,116, 99,111,108, 44, 32,
+102, 97, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,112, 97,114, 97,116,101, 95,114,103, 98, 40,118,101, 99, 52, 32,
+ 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,103, 44, 32,111,
+117,116, 32,102,108,111, 97,116, 32, 98, 41, 10,123, 10, 9,114, 32, 61, 32, 99,111,108, 46,114, 59, 10, 9,103, 32, 61, 32, 99,
+111,108, 46,103, 59, 10, 9, 98, 32, 61, 32, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32, 99,111,109, 98,105,110,
+101, 95,114,103, 98, 40,102,108,111, 97,116, 32,114, 44, 32,102,108,111, 97,116, 32,103, 44, 32,102,108,111, 97,116, 32, 98, 44,
+ 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 41, 10,123, 10, 9, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114, 44, 32,
+103, 44, 32, 98, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,111,117,116,112,117,116, 95,110,111,100,101, 40,
+118,101, 99, 52, 32,114,103, 98, 44, 32,102,108,111, 97,116, 32, 97,108,112,104, 97, 44, 32,111,117,116, 32,118,101, 99, 52, 32,
+111,117,116,114,103, 98, 41, 10,123, 10, 9,111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 46,114,103, 98,
+ 44, 32, 97,108,112,104, 97, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 84, 69, 88, 84, 85, 82,
+ 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,
+101, 95,102,108,105,112, 95, 98,108,101,110,100, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,
+111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 46,121,120,122, 59, 10,125, 10, 10,
+118,111,105,100, 32,116,101,120,116,117,114,101, 95, 98,108,101,110,100, 95,108,105,110, 40,118,101, 99, 51, 32,118,101, 99, 44,
+ 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 40,
+ 49, 46, 48, 43,118,101, 99, 46,120, 41, 47, 50, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,
+ 98,108,101,110,100, 95,113,117, 97,100, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,
+117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,109, 97,120, 40, 40, 49, 46, 48, 43,118,101, 99, 46,
+120, 41, 47, 50, 46, 48, 44, 32, 48, 46, 48, 41, 59, 10, 9,111,117,116,118, 97,108, 32, 42, 61, 32,111,117,116,118, 97,108, 59,
+ 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,119,111,111,100, 95,115,105,110, 40,118,101, 99, 51, 32,118,
+101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,
+108,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, 97,
+ 32, 61, 32,115,113,114,116, 40,118,101, 99, 46,120, 42,118,101, 99, 46,120, 32, 43, 32,118,101, 99, 46,121, 42,118,101, 99, 46,
+121, 32, 43, 32,118,101, 99, 46,122, 42,118,101, 99, 46,122, 41, 42, 50, 48, 46, 48, 59, 10, 9,102,108,111, 97,116, 32,119,105,
+ 32, 61, 32, 48, 46, 53, 32, 43, 32, 48, 46, 53, 42,115,105,110, 40, 97, 41, 59, 10, 10, 9,118, 97,108,117,101, 32, 61, 32,119,
+105, 59, 10, 9, 99,111,108,111,114, 32, 61, 32,118,101, 99, 52, 40,119,105, 44, 32,119,105, 44, 32,119,105, 44, 32, 49, 46, 48,
+ 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 41,
+ 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,105,109, 97,103,101, 40,118,101, 99, 51, 32,118,101, 99,
+ 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101,
+ 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,
+108, 41, 10,123, 10, 9, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 40,118,101,
+ 99, 46,120,121, 32, 43, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 41, 42, 48, 46, 53, 41, 59, 10, 9,118, 97,
+108,117,101, 32, 61, 32, 49, 46, 48, 59, 10, 10, 9,110,111,114,109, 97,108, 46,120, 32, 61, 32, 50, 46, 48, 42, 40, 99,111,108,
+111,114, 46,114, 32, 45, 32, 48, 46, 53, 41, 59, 10, 9,110,111,114,109, 97,108, 46,121, 32, 61, 32, 50, 46, 48, 42, 40, 48, 46,
+ 53, 32, 45, 32, 99,111,108,111,114, 46,103, 41, 59, 10, 9,110,111,114,109, 97,108, 46,122, 32, 61, 32, 50, 46, 48, 42, 40, 99,
+111,108,111,114, 46, 98, 32, 45, 32, 48, 46, 53, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+ 32, 77, 84, 69, 88, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,116,
+101,120, 99,111, 95,111,114, 99,111, 40,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51,
+ 32,111,114, 99,111, 41, 10,123, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10,125, 10, 10,118,111,105,
+100, 32,116,101,120, 99,111, 95,117,118, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,
+117,118, 41, 10,123, 10, 9, 47, 42, 32,100,105,115, 97, 98,108,101,100, 32,102,111,114, 32,110,111,119, 44, 32,119,111,114,107,
+115, 32,116,111,103,101,116,104,101,114, 32,119,105,116,104, 32,108,101, 97,118,105,110,103, 32,111,117,116, 32,109,116,101,120,
+ 95, 50,100, 95,109, 97,112,112,105,110,103, 10, 9, 32, 32, 32,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42,
+ 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 32, 42, 47, 10, 9,
+117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,
+101,120, 99,111, 95,110,111,114,109, 40,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,
+111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9, 47, 42, 32, 99,111,114,114,101,115,112,111,110,100,115, 32,116,111, 32,
+115,104,105, 45, 62,111,114,110, 44, 32,119,104,105, 99,104, 32,105,115, 32,110,101,103, 97,116,101,100, 32,115,111, 32, 99, 97,
+110, 99,101,108,115, 10, 9, 32, 32, 32,111,117,116, 32, 98,108,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,110,101,103,
+ 97,116,105,111,110, 32, 42, 47, 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,
+110,111,114,109, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,116, 97,110,103,101,110,116, 40,118,
+101, 99, 52, 32,116, 97,110,103,101,110,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116, 97,110,103,101,110,116,
+ 41, 10,123, 10, 9,111,117,116,116, 97,110,103,101,110,116, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,116, 97,110,103,
+101,110,116, 46,120,121,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,103,108,111, 98, 97,108, 40,109,
+ 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99,
+ 51, 32,103,108,111, 98, 97,108, 41, 10,123, 10, 9,103,108,111, 98, 97,108, 32, 61, 32, 40,118,105,101,119,105,110,118,109, 97,
+116, 42,118,101, 99, 52, 40, 99,111, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,
+120, 99,111, 95,111, 98,106,101, 99,116, 40,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,109, 97,116, 52,
+ 32,111, 98,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111, 98,106,
+101, 99,116, 41, 10,123, 10, 9,111, 98,106,101, 99,116, 32, 61, 32, 40,111, 98,105,110,118,109, 97,116, 42, 40,118,105,101,119,
+105,110,118,109, 97,116, 42,118,101, 99, 52, 40, 99,111, 44, 32, 49, 46, 48, 41, 41, 41, 46,120,121,122, 59, 10,125, 10, 10,118,
+111,105,100, 32,116,101,120, 99,111, 95,114,101,102,108, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,118,105,101,
+119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,114,101,102, 41, 10,123, 10, 9,114,101,102, 32, 61, 32,118,105,101,119, 32, 45,
+ 32, 50, 46, 48, 42,100,111,116, 40,118,110, 44, 32,118,105,101,119, 41, 42,118,110, 59, 10,125, 10, 10,118,111,105,100, 32,115,
+104, 97,100,101, 95,110,111,114,109, 40,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,
+111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101,114, 32,
+110,111,114,109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,111,117,116,110,111,114,109, 97,108, 32,
+ 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
+101,120, 95,114,103, 98, 95, 98,108,101,110,100, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,
+101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,
+117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,
+102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10,
+ 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,102, 97, 99,109, 42,111,117,116,
+ 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,109,117,108, 40,118,101, 99, 51, 32,111,
+117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,
+102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,
+108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109,
+ 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32, 40,102, 97, 99,109, 32, 43, 32,102,
+ 97, 99,116, 42,116,101,120, 99,111,108, 41, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120,
+ 95,114,103, 98, 95,115, 99,114,101,101,110, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,
+120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,
+116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102,
+ 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10, 10,
+ 9,105,110, 99,111,108, 32, 61, 32,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32, 40,118,101, 99, 51, 40,102, 97, 99,109, 41,
+ 32, 43, 32,102, 97, 99,116, 42, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,116,101,120, 99,111,108, 41, 41, 42, 40,118,
+101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120,
+ 95,114,103, 98, 95,111,118,101,114,108, 97,121, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,
+101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,
+117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,
+102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10,
+ 10, 9,105,102, 40,111,117,116, 99,111,108, 46,114, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105,110, 99,111,108, 46,114, 32, 61,
+ 32,111,117,116, 99,111,108, 46,114, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111,
+108, 46,114, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102,
+ 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 46,114, 41, 41,
+ 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,103,
+ 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99,111,108, 46,103, 42, 40,102, 97,
+ 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,103, 41, 59, 10, 9,101,108,115,101, 10, 9,
+ 9,105,110, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,
+116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 46,103, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,
+108, 46,103, 41, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105,110, 99,
+111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116,
+ 42,116,101,120, 99,111,108, 46, 98, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 46, 98, 32, 61, 32, 49, 46,
+ 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,
+111,108, 46, 98, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, 59, 10,125, 10, 10,118,111,105,100,
+ 32,109,116,101,120, 95,114,103, 98, 95,115,117, 98, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,
116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,
-111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,
-102, 97, 99,103, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
-101,120, 95,114,103, 98, 95,100,105,118, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120,
- 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116,
- 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97,
- 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,
-105,102, 40,116,101,120, 99,111,108, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32,102, 97,
- 99,109, 42,111,117,116, 99,111,108, 46,114, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46,114, 47,116,101,120, 99,
-111,108, 46,114, 59, 10, 9,105,102, 40,116,101,120, 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108,
- 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,103, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108,
- 46,103, 47,116,101,120, 99,111,108, 46,103, 59, 10, 9,105,102, 40,116,101,120, 99,111,108, 46, 98, 32, 33, 61, 32, 48, 46, 48,
- 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46, 98, 32, 43, 32,102, 97, 99,116,
- 42,111,117,116, 99,111,108, 46, 98, 47,116,101,120, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120,
- 95,114,103, 98, 95,100,105,102,102, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,
-111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,
-118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,
-116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,
-110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42, 97, 98,115, 40,116,101,
-120, 99,111,108, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98,
- 95,100, 97,114,107, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,
-102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51,
- 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 44, 32, 99,111,108, 59, 10, 10, 9,102, 97,
- 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,
- 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,
-117,116, 99,111,108, 46,114, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,
-111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120,
- 99,111,108, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 46,103, 41, 32,105,110, 99,111,108,
- 46,103, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99,111,108, 46,
-103, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 59, 10, 9,105,102, 40, 99,111,108,
- 32, 60, 32,111,117,116, 99,111,108, 46, 98, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101,
- 32,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,
-120, 95,114,103, 98, 95,108,105,103,104,116, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,
+111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,105,110, 99,111,108, 32, 61, 32, 45,102, 97, 99,116,
+ 42,102, 97, 99,103, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,
+116,101,120, 95,114,103, 98, 95, 97,100,100, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,
120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,
-116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 44, 32, 99,111,108,
- 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97,
- 99,116, 59, 10, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 59, 10, 9,105,102, 40, 99,
-111,108, 32, 62, 32,111,117,116, 99,111,108, 46,114, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32, 99,111,108, 59, 32,101,108,
-115,101, 32,105,110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97,
- 99,116, 42,116,101,120, 99,111,108, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46,103, 41,
- 32,105,110, 99,111,108, 46,103, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,103, 32, 61, 32,111,
-117,116, 99,111,108, 46,103, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 59, 10, 9,
-105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46, 98, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32, 99,111,108,
- 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,
-105,100, 32,109,116,101,120, 95,114,103, 98, 95,104,117,101, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99,
- 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103,
- 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10,
- 9,109,105,120, 95,104,117,101, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44,
- 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10,
- 9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
-101,120, 95,114,103, 98, 95,115, 97,116, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120,
- 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116,
- 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95,
-115, 97,116, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41,
- 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,
-108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103,
- 98, 95,118, 97,108, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,
-102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51,
- 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95,118, 97,108, 40,102,
- 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99,
- 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,114,103, 98,
- 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95, 99,111,108,
-111,114, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111,
- 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110,
- 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95, 99,111,108,111,114, 40,102, 97,
- 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52,
- 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,114,103, 98, 32,
- 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,
-114,115, 40,105,110,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44,
- 32,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99,109, 41, 10,123, 10, 9,102, 97, 99,116, 32, 42, 61, 32, 97, 98,115, 40,
-102, 97, 99,103, 41, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,102, 40,102, 97,
- 99,103, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32,102, 97, 99,116, 59, 10,
- 9, 9,102, 97, 99,116, 32, 61, 32,102, 97, 99,109, 59, 10, 9, 9,102, 97, 99,109, 32, 61, 32,116,109,112, 59, 10, 9,125, 10,
-125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 98,108,101,110,100, 40,102,108,111, 97,116, 32,111,
-117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44,
- 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10,
- 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97,
- 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,
-116,101,120, 99,111,108, 32, 43, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
-101,120, 95,118, 97,108,117,101, 95,109,117,108, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116,
- 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44,
- 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59,
- 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97,
- 99,109, 41, 59, 10, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99,103, 59, 10, 9,105,110, 99,111,108,
- 32, 61, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 41, 42,111,117,116, 99,111,108, 59, 10,
-125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115, 99,114,101,101,110, 40,102,108,111, 97,116, 32,
-111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116,
- 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123,
- 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102,
- 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45,
- 32,102, 97, 99,103, 59, 10, 9,105,110, 99,111,108, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97,
- 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108,
- 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115,117, 98, 40,102,108,111, 97,116, 32,
-111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116,
- 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123,
- 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102,
- 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,116, 32, 61, 32, 45,102, 97, 99,116,
- 59, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59,
- 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 97,100,100, 40,102,108,111, 97,116, 32,111,117,
+116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,102, 97,
+ 99,103, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120,
+ 95,114,103, 98, 95,100,105,118, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,
+108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,
+101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116,
+ 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,102,
+ 40,116,101,120, 99,111,108, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32,102, 97, 99,109,
+ 42,111,117,116, 99,111,108, 46,114, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46,114, 47,116,101,120, 99,111,108,
+ 46,114, 59, 10, 9,105,102, 40,116,101,120, 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46,103,
+ 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,103, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46,103,
+ 47,116,101,120, 99,111,108, 46,103, 59, 10, 9,105,102, 40,116,101,120, 99,111,108, 46, 98, 32, 33, 61, 32, 48, 46, 48, 41, 32,
+105,110, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46, 98, 32, 43, 32,102, 97, 99,116, 42,111,
+117,116, 99,111,108, 46, 98, 47,116,101,120, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,
+103, 98, 95,100,105,102,102, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108,
+ 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101,
+ 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32,
+ 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,110, 99,
+111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42, 97, 98,115, 40,116,101,120, 99,
+111,108, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,100,
+ 97,114,107, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,
+111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,
+110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 44, 32, 99,111,108, 59, 10, 10, 9,102, 97, 99,116,
+ 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9, 99,111,
+108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116,
+ 99,111,108, 46,114, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108,
+ 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,
+108, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 46,103, 41, 32,105,110, 99,111,108, 46,103,
+ 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99,111,108, 46,103, 59,
+ 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 59, 10, 9,105,102, 40, 99,111,108, 32, 60,
+ 32,111,117,116, 99,111,108, 46, 98, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,
+110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,
+114,103, 98, 95,108,105,103,104,116, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,
+111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,
+118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 44, 32, 99,111,108, 59, 10,
+ 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116,
+ 59, 10, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 59, 10, 9,105,102, 40, 99,111,108,
+ 32, 62, 32,111,117,116, 99,111,108, 46,114, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101,
+ 32,105,110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116,
+ 42,116,101,120, 99,111,108, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46,103, 41, 32,105,
+110, 99,111,108, 46,103, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116,
+ 99,111,108, 46,103, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 59, 10, 9,105,102,
+ 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46, 98, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32, 99,111,108, 59, 32,
+101,108,115,101, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100,
+ 32,109,116,101,120, 95,114,103, 98, 95,104,117,101, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,
+116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,
+111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,
+105,120, 95,104,117,101, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49,
+ 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,
+110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120,
+ 95,114,103, 98, 95,115, 97,116, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,
+108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,
+101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95,115, 97,
+116, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,
+118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,
+114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,
+118, 97,108, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,
+111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,
+110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95,118, 97,108, 40,102, 97, 99,
+116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,
+116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,114,103, 98, 32, 61,
+ 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95, 99,111,108,111,114,
+ 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116,
+ 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,
+108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95, 99,111,108,111,114, 40,102, 97, 99,116,
+ 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,
+101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32,
+ 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115,
+ 40,105,110,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,
+117,116, 32,102,108,111, 97,116, 32,102, 97, 99,109, 41, 10,123, 10, 9,102, 97, 99,116, 32, 42, 61, 32, 97, 98,115, 40,102, 97,
+ 99,103, 41, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,102, 40,102, 97, 99,103,
+ 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32,102, 97, 99,116, 59, 10, 9, 9,
+102, 97, 99,116, 32, 61, 32,102, 97, 99,109, 59, 10, 9, 9,102, 97, 99,109, 32, 61, 32,116,109,112, 59, 10, 9,125, 10,125, 10,
+ 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 98,108,101,110,100, 40,102,108,111, 97,116, 32,111,117,116,
+ 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,
+108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,
+108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116,
+ 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,
+120, 99,111,108, 32, 43, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120,
+ 95,118, 97,108,117,101, 95,109,117,108, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,
+101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,
+117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,
+109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109,
+ 41, 59, 10, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99,103, 59, 10, 9,105,110, 99,111,108, 32, 61,
+ 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 41, 42,111,117,116, 99,111,108, 59, 10,125, 10,
+ 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115, 99,114,101,101,110, 40,102,108,111, 97,116, 32,111,117,
+116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,
+102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,
+102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,
+116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102,
+ 97, 99,103, 59, 10, 9,105,110, 99,111,108, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, 99,116,
+ 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 41, 59,
+ 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115,117, 98, 40,102,108,111, 97,116, 32,111,117,
+116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,
+102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,
+102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,
+116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,116, 32, 61, 32, 45,102, 97, 99,116, 59, 10,
+ 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125,
+ 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 97,100,100, 40,102,108,111, 97,116, 32,111,117,116, 99,
+111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,
+111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,
+111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44,
+ 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,116, 32, 61, 32,102, 97, 99,116, 59, 10, 9,105,110,
+ 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,
+111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100,105,118, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44,
+ 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116,
+ 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116,
+ 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97,
+ 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105,102, 40,116,101,120, 99,111,108, 32, 33, 61, 32, 48, 46, 48, 41, 10, 9,
+ 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,
+111,108, 47,116,101,120, 99,111,108, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 32, 61, 32, 48, 46, 48, 59, 10,
+125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100,105,102,102, 40,102,108,111, 97,116, 32,111,117,
116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,
102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,
102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,
-116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,116, 32, 61, 32,102, 97, 99,116, 59, 10, 9,
-105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10,
- 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100,105,118, 40,102,108,111, 97,116, 32,111,117,116, 99,111,
-108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111,
- 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111,
- 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,
-102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105,102, 40,116,101,120, 99,111,108, 32, 33, 61, 32, 48, 46, 48, 41,
- 10, 9, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42,111,117,
-116, 99,111,108, 47,116,101,120, 99,111,108, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 32, 61, 32, 48, 46, 48,
- 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100,105,102,102, 40,102,108,111, 97,116, 32,
-111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116,
- 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123,
- 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102,
- 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109,
- 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42, 97, 98,115, 40,116,101,120, 99,111,108, 32, 45, 32,111,117,116, 99,
-111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100, 97,114,107, 40,102,108,111,
- 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102,
- 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108,
- 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,
-115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102,108,111, 97,116, 32, 99,111,108,
- 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108,
- 41, 32,105,110, 99,111,108, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 32, 61, 32,111,117,116, 99,
-111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,108,105,103,104,116, 40,102,108,111,
- 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102,
- 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108,
- 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,
-115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102,108,111, 97,116, 32, 99,111,108,
- 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108,
- 41, 32,105,110, 99,111,108, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 32, 61, 32,111,117,116, 99,
-111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 99,108, 97,109,112, 95,112,111,115,
-105,116,105,118,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97,
- 99, 41, 10,123, 10, 9,111,117,116,102, 97, 99, 32, 61, 32,109, 97,120, 40,102, 97, 99, 44, 32, 48, 46, 48, 41, 59, 10,125, 10,
- 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32,102, 97, 99,
- 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41, 10,123, 10, 9,111,117,116,102, 97, 99, 32, 61, 32,
- 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
-101,120, 95,104, 97,114, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,104, 97,114, 44, 32,111,117,116, 32,102,108,111,
- 97,116, 32,111,117,116,104, 97,114, 41, 10,123, 10, 9,111,117,116,104, 97,114, 32, 61, 32,104, 97,114, 47, 49, 50, 56, 46, 48,
- 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,104, 97,114, 95,109,117,108,116,105,112,108,121, 95, 99,108, 97,109,
-112, 40,102,108,111, 97,116, 32,104, 97,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,104, 97,114, 41, 10,123,
- 10, 9,104, 97,114, 32, 42, 61, 32, 49, 50, 56, 46, 48, 59, 10, 10, 9,105,102, 40,104, 97,114, 32, 60, 32, 49, 46, 48, 41, 32,
-111,117,116,104, 97,114, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40,104, 97,114, 32, 62, 32, 53, 49, 49,
- 46, 48, 41, 32,111,117,116,104, 97,114, 32, 61, 32, 53, 49, 49, 46, 48, 59, 10, 9,101,108,115,101, 32,111,117,116,104, 97,114,
- 32, 61, 32,104, 97,114, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 97,108,112,104, 97, 95,102,114,111,109, 95,
- 99,111,108, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, 97,108,112,104, 97, 41, 10,123,
- 10, 9, 97,108,112,104, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 97,108,
-112,104, 97, 95,116,111, 95, 99,111,108, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,102,108,111, 97,116, 32, 97,108,112,104, 97,
- 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,
-101, 99, 52, 40, 99,111,108, 46,114,103, 98, 44, 32, 97,108,112,104, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,
-120, 95,114,103, 98,116,111,105,110,116, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,
-110,116,101,110,115,105,116,121, 41, 10,123, 10, 9,105,110,116,101,110,115,105,116,121, 32, 61, 32,100,111,116, 40,118,101, 99,
- 51, 40, 48, 46, 51, 53, 44, 32, 48, 46, 52, 53, 44, 32, 48, 46, 50, 41, 44, 32,114,103, 98, 46,114,103, 98, 41, 59, 10,125, 10,
- 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,105,110,118,101,114,116, 40,102,108,111, 97,116, 32,105,110,
-118, 97,108,117,101, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108,117,101, 41, 10,123, 10, 9,111,117,
-116,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 32, 45, 32,105,110,118, 97,108,117,101, 59, 10,125, 10, 10,118,111,105,100, 32,
-109,116,101,120, 95,114,103, 98, 95,105,110,118,101,114,116, 40,118,101, 99, 52, 32,105,110,114,103, 98, 44, 32,111,117,116, 32,
-118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10, 9,111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52, 40,118,101,
- 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,105,110,114,103, 98, 46,114,103, 98, 44, 32,105,110,114,103, 98, 46, 97, 41, 59, 10,125,
- 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115,116,101,110, 99,105,108, 40,102,108,111, 97,116, 32,
-115,116,101,110, 99,105,108, 44, 32,102,108,111, 97,116, 32,105,110,116,101,110,115,105,116,121, 44, 32,111,117,116, 32,102,108,
-111, 97,116, 32,111,117,116,115,116,101,110, 99,105,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,105,110,116,
-101,110,115,105,116,121, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,116, 32, 61, 32,105,110,116,101,110,115,105,116,
-121, 59, 10, 9,111,117,116,105,110,116,101,110,115,105,116,121, 32, 61, 32,105,110,116,101,110,115,105,116,121, 42,115,116,101,
-110, 99,105,108, 59, 10, 9,111,117,116,115,116,101,110, 99,105,108, 32, 61, 32,115,116,101,110, 99,105,108, 42,102, 97, 99,116,
- 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115,116,101,110, 99,105,108, 40,102,108,111, 97,116,
- 32,115,116,101,110, 99,105,108, 44, 32,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,
-116,115,116,101,110, 99,105,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10, 9,102,108,
-111, 97,116, 32,102, 97, 99,116, 32, 61, 32,114,103, 98, 46, 97, 59, 10, 9,111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52,
- 40,114,103, 98, 46,114,103, 98, 44, 32,114,103, 98, 46, 97, 42,115,116,101,110, 99,105,108, 41, 59, 10, 9,111,117,116,115,116,
-101,110, 99,105,108, 32, 61, 32,115,116,101,110, 99,105,108, 42,102, 97, 99,116, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
-101,120, 95,109, 97,112,112,105,110,103, 95,111,102,115, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,118,101, 99, 51, 32,
-111,102,115, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116,101,120, 99,111, 41, 10,123, 10, 9,111,117,116,116,101,
-120, 99,111, 32, 61, 32,116,101,120, 99,111, 32, 43, 32,111,102,115, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,
-109, 97,112,112,105,110,103, 95,115,105,122,101, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,118,101, 99, 51, 32,115,105,
-122,101, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116,101,120, 99,111, 41, 10,123, 10, 9,111,117,116,116,101,120,
- 99,111, 32, 61, 32,115,105,122,101, 42,116,101,120, 99,111, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 50,100,
- 95,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,
-101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40,118,101, 99, 46,120,121, 42, 48, 46, 53, 32,
- 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 32, 48, 46, 53, 41, 44, 32,118,101, 99, 46,122, 41, 59, 10,125, 10, 10,118,111,105,
-100, 32,109,116,101,120, 95,105,109, 97,103,101, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114,
- 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32,118,101, 99,
- 52, 32, 99,111,108,111,114, 41, 10,123, 10, 9, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109,
- 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,
-111,105,100, 32,109,116,101,120, 95,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,
-108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10, 9, 47,
- 47, 32, 84,104,101, 32,105,110,118,101,114,116, 32,111,102, 32,116,104,101, 32,114,101,100, 32, 99,104, 97,110,110,101,108, 32,
-105,115, 32,116,111, 32,109, 97,107,101, 10, 9, 47, 47, 32,116,104,101, 32,110,111,114,109, 97,108, 32,109, 97,112, 32, 99,111,
-109,112,108,105, 97,110,116, 32,119,105,116,104, 32,116,104,101, 32,111,117,116,115,105,100,101, 32,119,111,114,108,100, 46, 10,
- 9, 47, 47, 32, 73,116, 32,110,101,101,100,115, 32,116,111, 32, 98,101, 32,100,111,110,101, 32, 98,101, 99, 97,117,115,101, 32,
-105,110, 32, 66,108,101,110,100,101,114, 10, 9, 47, 47, 32,116,104,101, 32,110,111,114,109, 97,108, 32,117,115,101,100, 32,112,
-111,105,110,116,115, 32,105,110,119, 97,114,100, 46, 10, 9, 47, 47, 32, 83,104,111,117,108,100, 32,116,104,105,115, 32,101,118,
-101,114, 32, 99,104, 97,110,103,101, 32,116,104,105,115, 32,110,101,103, 97,116,101, 32,109,117,115,116, 32, 98,101, 32,114,101,
-109,111,118,101,100, 46, 10, 32, 32, 32, 32,118,101, 99, 52, 32, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50,
- 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 50, 46, 48, 42,
- 40,118,101, 99, 51, 40, 45, 99,111,108,111,114, 46,114, 44, 32, 99,111,108,111,114, 46,103, 44, 32, 99,111,108,111,114, 46, 98,
- 41, 32, 45, 32,118,101, 99, 51, 40, 45, 48, 46, 53, 44, 32, 48, 46, 53, 44, 32, 48, 46, 53, 41, 41, 59, 10,125, 10, 10,118,111,
-105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,110,111,114,109, 97,108,115, 95,105,110,105,116, 40, 32,118,101, 99, 51, 32,
-118, 78, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78,111,114,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97,
- 99, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 32, 41, 10,123,
- 10, 9,118, 78,111,114,103, 32, 61, 32,118, 78, 59, 10, 9,118, 78, 97, 99, 99, 32, 61, 32,118, 78, 59, 10, 9,102, 80,114,101,
-118, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10, 47, 42, 42, 32,104,101,108,112,101,114, 32,
-109,101,116,104,111,100, 32,116,111, 32,101,120,116,114, 97, 99,116, 32,116,104,101, 32,117,112,112,101,114, 32,108,101,102,116,
- 32, 51,120, 51, 32,109, 97,116,114,105,120, 32,102,114,111,109, 32, 97, 32, 52,120, 52, 32,109, 97,116,114,105,120, 32, 42, 47,
- 10,109, 97,116, 51, 32,116,111, 95,109, 97,116, 51, 40,109, 97,116, 52, 32,109, 52, 41, 10,123, 10, 9,109, 97,116, 51, 32,109,
- 51, 59, 10, 9,109, 51, 91, 48, 93, 32, 61, 32,109, 52, 91, 48, 93, 46,120,121,122, 59, 10, 9,109, 51, 91, 49, 93, 32, 61, 32,
-109, 52, 91, 49, 93, 46,120,121,122, 59, 10, 9,109, 51, 91, 50, 93, 32, 61, 32,109, 52, 91, 50, 93, 46,120,121,122, 59, 10, 9,
-114,101,116,117,114,110, 32,109, 51, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,105,110,105,
-116, 95,111, 98,106,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,
-115,117,114,102, 95,110,111,114,109, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,109, 97,116, 52, 32,109, 86,105,101,119, 44, 32,
-109, 97,116, 52, 32,109, 86,105,101,119, 73,110,118, 44, 32,109, 97,116, 52, 32,109, 79, 98,106, 44, 32,109, 97,116, 52, 32,109,
- 79, 98,106, 73,110,118, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,
-110,105,116,117,100,101, 95,105,110, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9,
- 9, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44,
- 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,
-117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,
-108,111, 97,116, 32,102, 68,101,116, 32, 41, 32, 10,123, 10, 9,109, 97,116, 51, 32,111, 98,106, 50,118,105,101,119, 32, 61, 32,
-116,111, 95,109, 97,116, 51, 40,103,108, 95, 77,111,100,101,108, 86,105,101,119, 77, 97,116,114,105,120, 41, 59, 10, 9,109, 97,
-116, 51, 32,118,105,101,119, 50,111, 98,106, 32, 61, 32,116,111, 95,109, 97,116, 51, 40,103,108, 95, 77,111,100,101,108, 86,105,
-101,119, 77, 97,116,114,105,120, 73,110,118,101,114,115,101, 41, 59, 10, 9, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97,
- 83, 32, 61, 32,118,105,101,119, 50,111, 98,106, 32, 42, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59,
- 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,118,105,101,119, 50,111, 98,106, 32, 42, 32,100, 70,100,121,
- 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 78, 32, 61, 32,110,111,114,109, 97,108,105,
-122,101, 40, 32,115,117,114,102, 95,110,111,114,109, 32, 42, 32,111, 98,106, 50,118,105,101,119, 32, 41, 59, 10, 10, 9,118, 82,
- 49, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 59, 10, 9,118, 82, 50, 32, 61,
- 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 59, 10, 9,102, 68,101,116, 32, 61, 32,
-100,111,116, 32, 40, 32,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 32, 41, 59, 10, 9, 10, 9, 47, 42, 32,112,114,101,116,
-114, 97,110,115,102,111,114,109, 32,118, 78, 97, 99, 99, 32, 40,105,110, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,
-108,121, 41, 32,117,115,105,110,103, 32,116,104,101, 32,105,110,118,101,114,115,101, 32,116,114, 97,110,115,112,111,115,101,100,
- 32, 42, 47, 10, 9,118, 82, 49, 32, 61, 32,118, 82, 49, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10, 9,118, 82, 50, 32,
- 61, 32,118, 82, 50, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10, 9,118, 78, 32, 61, 32,118, 78, 32, 42, 32,118,105,101,
-119, 50,111, 98,106, 59, 10, 9, 10, 9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115,
- 40,102, 68,101,116, 41, 32, 42, 32,108,101,110,103,116,104, 40,118, 78, 41, 59, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32,
- 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80,114,101,118,
- 77, 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, 10, 9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,
-117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,
-109,112, 95,105,110,105,116, 95,116,101,120,116,117,114,101,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95,
-112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32,
-102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,118,101, 99, 51, 32,118, 78,
- 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,
-118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,
-117,116, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116,
- 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116, 32, 41, 32, 10,123, 10, 9,
-118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59,
- 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,100, 70,100,121, 40, 32,115,117,114,102, 95,112,111,115, 32,
- 41, 59, 10, 9,118,101, 99, 51, 32,118, 78, 32, 61, 32,115,117,114,102, 95,110,111,114,109, 59, 32, 47, 42, 32,110,111,114,109,
- 97,108,105,122,101,100, 32,105,110,116,101,114,112,111,108, 97,116,101,100, 32,118,101,114,116,101,120, 32,110,111,114,109, 97,
-108, 32, 42, 47, 10, 9, 10, 9,118, 82, 49, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32, 99,114,111,115,115, 40, 32,
-118, 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32,110,111,114,109, 97,108,105,122,
-101, 40, 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 41, 59, 10, 9,102, 68,101,116,
- 32, 61, 32,115,105,103,110, 40, 32,100,111,116, 40,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 41, 32, 41, 59, 10, 9, 10,
- 9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115, 40,102, 68,101,116, 41, 59, 10, 9,
-118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105,116,117,
-100,101, 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, 10, 9,102, 80,114,101,118, 77,
- 97,103,110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10,118,111,
-105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,105,110,105,116, 95,118,105,101,119,115,112, 97, 99,101, 40, 32,118,101, 99,
- 51, 32,115,117,114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 32, 10, 9, 9, 9,
- 9, 9, 9, 9, 32, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,
-118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,111,117,116, 32,102,108,111,
- 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,
-118, 78, 97, 99, 99, 95,111,117,116, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118,
- 82, 49, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116,
- 32, 41, 32, 10,123, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,100, 70,100,120, 40, 32,115,117,114,102,
- 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,100, 70,100,121, 40, 32,115,117,
-114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 78, 32, 61, 32,115,117,114,102, 95,110,111,114,109, 59, 32,
- 47, 42, 32,110,111,114,109, 97,108,105,122,101,100, 32,105,110,116,101,114,112,111,108, 97,116,101,100, 32,118,101,114,116,101,
-120, 32,110,111,114,109, 97,108, 32, 42, 47, 10, 9, 10, 9,118, 82, 49, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 83,105,103,
-109, 97, 84, 44, 32,118, 78, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,
-103,109, 97, 83, 32, 41, 32, 59, 10, 9,102, 68,101,116, 32, 61, 32,100,111,116, 32, 40, 32,118, 83,105,103,109, 97, 83, 44, 32,
-118, 82, 49, 32, 41, 59, 10, 9, 10, 9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115,
- 40,102, 68,101,116, 41, 59, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32,
- 40,102, 77, 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 41,
- 59, 10, 9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,
-100,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,116, 97,112, 51, 40, 32,118,101, 99, 51,
- 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,104, 83, 99,
- 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,102,
-108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10, 9,118,101,
- 99, 50, 32, 83, 84,108,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10, 9,118,101, 99, 50, 32, 83, 84,108,114, 32, 61,
- 32,116,101,120, 99,111, 46,120,121, 32, 43, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 32, 59, 10, 9,118,101,
- 99, 50, 32, 83, 84,117,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,
-120,121, 41, 32, 59, 10, 9, 10, 9,102,108,111, 97,116, 32, 72,108,108, 44, 72,108,114, 44, 72,117,108, 59, 10, 9,114,103, 98,
-116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108,108, 41, 44, 32, 72,108,108, 32,
- 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108,114,
- 41, 44, 32, 72,108,114, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109,
- 97, 44, 32, 83, 84,117,108, 41, 44, 32, 72,117,108, 32, 41, 59, 10, 9, 10, 9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108,101,
- 32, 42, 32, 40, 72,108,114, 32, 45, 32, 72,108,108, 41, 59, 10, 9,100, 66,116, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32,
- 40, 72,117,108, 32, 45, 32, 72,108,108, 41, 59, 10,125, 10, 10, 35,105,102,100,101,102, 32, 66, 85, 77, 80, 95, 66, 73, 67, 85,
- 66, 73, 67, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, 98,105, 99,117, 98,105, 99, 40, 32,118,101, 99,
- 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,104, 83,
- 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,
-102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10, 9,102,
-108,111, 97,116, 32, 72,108, 59, 10, 9,102,108,111, 97,116, 32, 72,114, 59, 10, 9,102,108,111, 97,116, 32, 72,100, 59, 10, 9,
-102,108,111, 97,116, 32, 72,117, 59, 10, 9, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,
-101,120, 99,111, 46,120,121, 41, 59, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120,
- 99,111, 46,120,121, 41, 59, 10, 32, 10, 9,118,101, 99, 50, 32, 83, 84,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45,
- 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,114, 32, 61, 32,116,101,120, 99,111,
- 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,100, 32, 61, 32,
-116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, 10, 9,118,101, 99, 50, 32, 83,
- 84,117, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, 10, 9, 10,
- 9,114,103, 98,116,111, 98,119, 40,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108, 41, 44, 32, 72,108,
- 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,114, 41, 44,
- 32, 72,114, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,
-100, 41, 44, 32, 72,100, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44,
- 32, 83, 84,117, 41, 44, 32, 72,117, 41, 59, 10, 9, 10, 9,118,101, 99, 50, 32,100, 72,100,120,121, 32, 61, 32,118,101, 99, 50,
- 40, 72,114, 32, 45, 32, 72,108, 44, 32, 72,117, 32, 45, 32, 72,100, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 66,108,101,110,
-100, 32, 61, 32, 99,108, 97,109,112, 40, 49, 46, 48, 45,116,101,120,116,117,114,101, 81,117,101,114,121, 76, 79, 68, 40,105,109,
- 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 46,120, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,105,102, 40,102,
- 66,108,101,110,100, 33, 61, 48, 46, 48, 41, 10, 9,123, 10, 9, 9, 47, 47, 32,116,104,101, 32,100,101,114,105,118, 97,116,105,
-118,101, 32,111,102, 32,116,104,101, 32, 98,105, 99,117, 98,105, 99, 32,115, 97,109,112,108,105,110,103, 32,111,102, 32,108,101,
-118,101,108, 32, 48, 10, 9, 9,105,118,101, 99, 50, 32,118, 68,105,109, 59, 10, 9, 9,118, 68,105,109, 32, 61, 32,116,101,120,
-116,117,114,101, 83,105,122,101, 40,105,109, 97, 44, 32, 48, 41, 59, 10, 10, 9, 9, 47, 47, 32,116, 97,107,105,110,103, 32,116,
-104,101, 32,102,114, 97, 99,116, 32,112, 97,114,116, 32,111,102, 32,116,104,101, 32,116,101,120,116,117,114,101, 32, 99,111,111,
-114,100,105,110, 97,116,101, 32,105,115, 32, 97, 32,104, 97,114,100, 99,111,100,101,100, 32,119,114, 97,112, 32,109,111,100,101,
- 46, 10, 9, 9, 47, 47, 32,116,104,105,115, 32,105,115, 32, 97, 99, 99,101,112,116, 97, 98,108,101, 32, 97,115, 32,116,101,120,
-116,117,114,101,115, 32,117,115,101, 32,119,114, 97,112, 32,109,111,100,101, 32,101,120, 99,108,117,115,105,118,101,108,121, 32,
-105,110, 32, 51, 68, 32,118,105,101,119, 32,101,108,115,101,119,104,101,114,101, 32,105,110, 32, 98,108,101,110,100,101,114, 46,
- 32, 10, 9, 9, 47, 47, 32,116,104,105,115, 32,105,115, 32,100,111,110,101, 32,115,111, 32,116,104, 97,116, 32,119,101, 32, 99,
- 97,110, 32,115,116,105,108,108, 32,103,101,116, 32, 97, 32,118, 97,108,105,100, 32,116,101,120,101,108, 32,119,105,116,104, 32,
-117,118,115, 32,111,117,116,115,105,100,101, 32,116,104,101, 32, 48, 44, 49, 32,114, 97,110,103,101, 10, 9, 9, 47, 47, 32, 98,
-121, 32,116,101,120,101,108, 70,101,116, 99,104, 32, 98,101,108,111,119, 44, 32, 97,115, 32, 99,111,111,114,100,105,110, 97,116,
-101,115, 32, 97,114,101, 32, 99,108, 97,109,112,101,100, 32,119,104,101,110, 32,117,115,105,110,103, 32,116,104,105,115, 32,102,
-117,110, 99,116,105,111,110, 46, 10, 9, 9,118,101, 99, 50, 32,102, 84,101,120, 76,111, 99, 32, 61, 32,118, 68,105,109, 42,102,
-114, 97, 99,116, 40,116,101,120, 99,111, 46,120,121, 41, 32, 45, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 32, 48, 46, 53, 41, 59,
- 10, 9, 9,105,118,101, 99, 50, 32,105, 84,101,120, 76,111, 99, 32, 61, 32,105,118,101, 99, 50, 40,102,108,111,111,114, 40,102,
- 84,101,120, 76,111, 99, 41, 41, 59, 10, 9, 9,118,101, 99, 50, 32,116, 32, 61, 32, 99,108, 97,109,112, 40,102, 84,101,120, 76,
-111, 99, 32, 45, 32,105, 84,101,120, 76,111, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 9, 9, 47, 47, 32,115, 97,116,
- 32,106,117,115,116, 32,116,111, 32, 98,101, 32,112,101,100, 97,110,116,105, 99, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,
+117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42, 97, 98,115, 40,116,101,120, 99,111,108, 32, 45, 32,111,117,116, 99,111,108,
+ 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100, 97,114,107, 40,102,108,111, 97,116,
+ 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,
+116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,
+123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,
+102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102,108,111, 97,116, 32, 99,111,108, 32, 61,
+ 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 41, 32,
+105,110, 99,111,108, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 32, 61, 32,111,117,116, 99,111,108,
+ 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,108,105,103,104,116, 40,102,108,111, 97,116,
+ 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,
+116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,
+123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,
+102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102,108,111, 97,116, 32, 99,111,108, 32, 61,
+ 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 41, 32,
+105,110, 99,111,108, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 32, 61, 32,111,117,116, 99,111,108,
+ 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 99,108, 97,109,112, 95,112,111,115,105,116,
+105,118,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41,
+ 10,123, 10, 9,111,117,116,102, 97, 99, 32, 61, 32,109, 97,120, 40,102, 97, 99, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,
+111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,
+111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41, 10,123, 10, 9,111,117,116,102, 97, 99, 32, 61, 32, 99,108,
+ 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120,
+ 95,104, 97,114, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,104, 97,114, 44, 32,111,117,116, 32,102,108,111, 97,116,
+ 32,111,117,116,104, 97,114, 41, 10,123, 10, 9,111,117,116,104, 97,114, 32, 61, 32,104, 97,114, 47, 49, 50, 56, 46, 48, 59, 10,
+125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,104, 97,114, 95,109,117,108,116,105,112,108,121, 95, 99,108, 97,109,112, 40,
+102,108,111, 97,116, 32,104, 97,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,104, 97,114, 41, 10,123, 10, 9,
+104, 97,114, 32, 42, 61, 32, 49, 50, 56, 46, 48, 59, 10, 10, 9,105,102, 40,104, 97,114, 32, 60, 32, 49, 46, 48, 41, 32,111,117,
+116,104, 97,114, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40,104, 97,114, 32, 62, 32, 53, 49, 49, 46, 48,
+ 41, 32,111,117,116,104, 97,114, 32, 61, 32, 53, 49, 49, 46, 48, 59, 10, 9,101,108,115,101, 32,111,117,116,104, 97,114, 32, 61,
+ 32,104, 97,114, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 97,108,112,104, 97, 95,102,114,111,109, 95, 99,111,
+108, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, 97,108,112,104, 97, 41, 10,123, 10, 9,
+ 97,108,112,104, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 97,108,112,104,
+ 97, 95,116,111, 95, 99,111,108, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,102,108,111, 97,116, 32, 97,108,112,104, 97, 44, 32,
+111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99,
+ 52, 40, 99,111,108, 46,114,103, 98, 44, 32, 97,108,112,104, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,
+114,103, 98,116,111,105,110,116, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,116,
+101,110,115,105,116,121, 41, 10,123, 10, 9,105,110,116,101,110,115,105,116,121, 32, 61, 32,100,111,116, 40,118,101, 99, 51, 40,
+ 48, 46, 51, 53, 44, 32, 48, 46, 52, 53, 44, 32, 48, 46, 50, 41, 44, 32,114,103, 98, 46,114,103, 98, 41, 59, 10,125, 10, 10,118,
+111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,105,110,118,101,114,116, 40,102,108,111, 97,116, 32,105,110,118, 97,
+108,117,101, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108,117,101, 41, 10,123, 10, 9,111,117,116,118,
+ 97,108,117,101, 32, 61, 32, 49, 46, 48, 32, 45, 32,105,110,118, 97,108,117,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
+101,120, 95,114,103, 98, 95,105,110,118,101,114,116, 40,118,101, 99, 52, 32,105,110,114,103, 98, 44, 32,111,117,116, 32,118,101,
+ 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10, 9,111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52, 40,118,101, 99, 51,
+ 40, 49, 46, 48, 41, 32, 45, 32,105,110,114,103, 98, 46,114,103, 98, 44, 32,105,110,114,103, 98, 46, 97, 41, 59, 10,125, 10, 10,
+118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115,116,101,110, 99,105,108, 40,102,108,111, 97,116, 32,115,116,
+101,110, 99,105,108, 44, 32,102,108,111, 97,116, 32,105,110,116,101,110,115,105,116,121, 44, 32,111,117,116, 32,102,108,111, 97,
+116, 32,111,117,116,115,116,101,110, 99,105,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,105,110,116,101,110,
+115,105,116,121, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,116, 32, 61, 32,105,110,116,101,110,115,105,116,121, 59,
+ 10, 9,111,117,116,105,110,116,101,110,115,105,116,121, 32, 61, 32,105,110,116,101,110,115,105,116,121, 42,115,116,101,110, 99,
+105,108, 59, 10, 9,111,117,116,115,116,101,110, 99,105,108, 32, 61, 32,115,116,101,110, 99,105,108, 42,102, 97, 99,116, 59, 10,
+125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115,116,101,110, 99,105,108, 40,102,108,111, 97,116, 32,115,
+116,101,110, 99,105,108, 44, 32,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,
+116,101,110, 99,105,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10, 9,102,108,111, 97,
+116, 32,102, 97, 99,116, 32, 61, 32,114,103, 98, 46, 97, 59, 10, 9,111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52, 40,114,
+103, 98, 46,114,103, 98, 44, 32,114,103, 98, 46, 97, 42,115,116,101,110, 99,105,108, 41, 59, 10, 9,111,117,116,115,116,101,110,
+ 99,105,108, 32, 61, 32,115,116,101,110, 99,105,108, 42,102, 97, 99,116, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120,
+ 95,109, 97,112,112,105,110,103, 95,111,102,115, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,118,101, 99, 51, 32,111,102,
+115, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116,101,120, 99,111, 41, 10,123, 10, 9,111,117,116,116,101,120, 99,
+111, 32, 61, 32,116,101,120, 99,111, 32, 43, 32,111,102,115, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,109, 97,
+112,112,105,110,103, 95,115,105,122,101, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,118,101, 99, 51, 32,115,105,122,101,
+ 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116,101,120, 99,111, 41, 10,123, 10, 9,111,117,116,116,101,120, 99,111,
+ 32, 61, 32,115,105,122,101, 42,116,101,120, 99,111, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 50,100, 95,109,
+ 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99,
+ 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40,118,101, 99, 46,120,121, 42, 48, 46, 53, 32, 43, 32,
+118,101, 99, 50, 40, 48, 46, 53, 44, 32, 48, 46, 53, 41, 44, 32,118,101, 99, 46,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32,
+109,116,101,120, 95,105,109, 97,103,101, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68,
+ 32,105,109, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32,
+ 99,111,108,111,114, 41, 10,123, 10, 9, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44,
+ 32,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,
+100, 32,109,116,101,120, 95,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,
+114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10, 9, 47, 47, 32,
+ 84,104,101, 32,105,110,118,101,114,116, 32,111,102, 32,116,104,101, 32,114,101,100, 32, 99,104, 97,110,110,101,108, 32,105,115,
+ 32,116,111, 32,109, 97,107,101, 10, 9, 47, 47, 32,116,104,101, 32,110,111,114,109, 97,108, 32,109, 97,112, 32, 99,111,109,112,
+108,105, 97,110,116, 32,119,105,116,104, 32,116,104,101, 32,111,117,116,115,105,100,101, 32,119,111,114,108,100, 46, 10, 9, 47,
+ 47, 32, 73,116, 32,110,101,101,100,115, 32,116,111, 32, 98,101, 32,100,111,110,101, 32, 98,101, 99, 97,117,115,101, 32,105,110,
+ 32, 66,108,101,110,100,101,114, 10, 9, 47, 47, 32,116,104,101, 32,110,111,114,109, 97,108, 32,117,115,101,100, 32,112,111,105,
+110,116,115, 32,105,110,119, 97,114,100, 46, 10, 9, 47, 47, 32, 83,104,111,117,108,100, 32,116,104,105,115, 32,101,118,101,114,
+ 32, 99,104, 97,110,103,101, 32,116,104,105,115, 32,110,101,103, 97,116,101, 32,109,117,115,116, 32, 98,101, 32,114,101,109,111,
+118,101,100, 46, 10, 32, 32, 32, 32,118,101, 99, 52, 32, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,
+105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 50, 46, 48, 42, 40,118,
+101, 99, 51, 40, 45, 99,111,108,111,114, 46,114, 44, 32, 99,111,108,111,114, 46,103, 44, 32, 99,111,108,111,114, 46, 98, 41, 32,
+ 45, 32,118,101, 99, 51, 40, 45, 48, 46, 53, 44, 32, 48, 46, 53, 44, 32, 48, 46, 53, 41, 41, 59, 10,125, 10, 10,118,111,105,100,
+ 32,109,116,101,120, 95, 98,117,109,112, 95,110,111,114,109, 97,108,115, 95,105,110,105,116, 40, 32,118,101, 99, 51, 32,118, 78,
+ 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78,111,114,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99,
+ 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 32, 41, 10,123, 10, 9,
+118, 78,111,114,103, 32, 61, 32,118, 78, 59, 10, 9,118, 78, 97, 99, 99, 32, 61, 32,118, 78, 59, 10, 9,102, 80,114,101,118, 77,
+ 97,103,110,105,116,117,100,101, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10, 47, 42, 42, 32,104,101,108,112,101,114, 32,109,101,
+116,104,111,100, 32,116,111, 32,101,120,116,114, 97, 99,116, 32,116,104,101, 32,117,112,112,101,114, 32,108,101,102,116, 32, 51,
+120, 51, 32,109, 97,116,114,105,120, 32,102,114,111,109, 32, 97, 32, 52,120, 52, 32,109, 97,116,114,105,120, 32, 42, 47, 10,109,
+ 97,116, 51, 32,116,111, 95,109, 97,116, 51, 40,109, 97,116, 52, 32,109, 52, 41, 10,123, 10, 9,109, 97,116, 51, 32,109, 51, 59,
+ 10, 9,109, 51, 91, 48, 93, 32, 61, 32,109, 52, 91, 48, 93, 46,120,121,122, 59, 10, 9,109, 51, 91, 49, 93, 32, 61, 32,109, 52,
+ 91, 49, 93, 46,120,121,122, 59, 10, 9,109, 51, 91, 50, 93, 32, 61, 32,109, 52, 91, 50, 93, 46,120,121,122, 59, 10, 9,114,101,
+116,117,114,110, 32,109, 51, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,105,110,105,116, 95,
+111, 98,106,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,115,117,
+114,102, 95,110,111,114,109, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,109, 97,116, 52, 32,109, 86,105,101,119, 44, 32,109, 97,
+116, 52, 32,109, 86,105,101,119, 73,110,118, 44, 32,109, 97,116, 52, 32,109, 79, 98,106, 44, 32,109, 97,116, 52, 32,109, 79, 98,
+106, 73,110,118, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,
+116,117,100,101, 95,105,110, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32,
+ 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,
+117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116,
+ 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111,
+ 97,116, 32,102, 68,101,116, 32, 41, 32, 10,123, 10, 9,109, 97,116, 51, 32,111, 98,106, 50,118,105,101,119, 32, 61, 32,116,111,
+ 95,109, 97,116, 51, 40,103,108, 95, 77,111,100,101,108, 86,105,101,119, 77, 97,116,114,105,120, 41, 59, 10, 9,109, 97,116, 51,
+ 32,118,105,101,119, 50,111, 98,106, 32, 61, 32,116,111, 95,109, 97,116, 51, 40,103,108, 95, 77,111,100,101,108, 86,105,101,119,
+ 77, 97,116,114,105,120, 73,110,118,101,114,115,101, 41, 59, 10, 9, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32,
+ 61, 32,118,105,101,119, 50,111, 98,106, 32, 42, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,
+118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,118,105,101,119, 50,111, 98,106, 32, 42, 32,100, 70,100,121, 40, 32,
+115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 78, 32, 61, 32,110,111,114,109, 97,108,105,122,101,
+ 40, 32,115,117,114,102, 95,110,111,114,109, 32, 42, 32,111, 98,106, 50,118,105,101,119, 32, 41, 59, 10, 10, 9,118, 82, 49, 32,
+ 61, 32, 99,114,111,115,115, 40, 32,118, 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32, 99,
+114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 59, 10, 9,102, 68,101,116, 32, 61, 32,100,111,
+116, 32, 40, 32,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 32, 41, 59, 10, 9, 10, 9, 47, 42, 32,112,114,101,116,114, 97,
+110,115,102,111,114,109, 32,118, 78, 97, 99, 99, 32, 40,105,110, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108,121,
+ 41, 32,117,115,105,110,103, 32,116,104,101, 32,105,110,118,101,114,115,101, 32,116,114, 97,110,115,112,111,115,101,100, 32, 42,
+ 47, 10, 9,118, 82, 49, 32, 61, 32,118, 82, 49, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10, 9,118, 82, 50, 32, 61, 32,
+118, 82, 50, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10, 9,118, 78, 32, 61, 32,118, 78, 32, 42, 32,118,105,101,119, 50,
+111, 98,106, 59, 10, 9, 10, 9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115, 40,102,
+ 68,101,116, 41, 32, 42, 32,108,101,110,103,116,104, 40,118, 78, 41, 59, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,
+118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80,114,101,118, 77, 97,
+103,110,105,116,117,100,101, 95,105,110, 41, 59, 10, 9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116,
+ 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112,
+ 95,105,110,105,116, 95,116,101,120,116,117,114,101,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95,112,111,
+115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32,102,108,
+111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99,
+ 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77,
+ 97,103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116,
+ 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116, 32,118,
+101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116, 32, 41, 32, 10,123, 10, 9,118,101,
+ 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,
+118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,100, 70,100,121, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59,
+ 10, 9,118,101, 99, 51, 32,118, 78, 32, 61, 32,115,117,114,102, 95,110,111,114,109, 59, 32, 47, 42, 32,110,111,114,109, 97,108,
+105,122,101,100, 32,105,110,116,101,114,112,111,108, 97,116,101,100, 32,118,101,114,116,101,120, 32,110,111,114,109, 97,108, 32,
+ 42, 47, 10, 9, 10, 9,118, 82, 49, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32, 99,114,111,115,115, 40, 32,118, 83,
+105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,
+ 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 41, 59, 10, 9,102, 68,101,116, 32, 61,
+ 32,115,105,103,110, 40, 32,100,111,116, 40,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 41, 32, 41, 59, 10, 9, 10, 9,102,
+108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115, 40,102, 68,101,116, 41, 59, 10, 9,118, 78,
+ 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105,116,117,100,101,
+ 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, 10, 9,102, 80,114,101,118, 77, 97,103,
+110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10,118,111,105,100,
+ 32,109,116,101,120, 95, 98,117,109,112, 95,105,110,105,116, 95,118,105,101,119,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,
+115,117,114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 32, 10, 9, 9, 9, 9, 9,
+ 9, 9, 32, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,118,101,
+ 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,111,117,116, 32,102,108,111, 97,116,
+ 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78,
+ 97, 99, 99, 95,111,117,116, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49,
+ 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116, 32, 41,
+ 32, 10,123, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,
+111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,100, 70,100,121, 40, 32,115,117,114,102,
+ 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 78, 32, 61, 32,115,117,114,102, 95,110,111,114,109, 59, 32, 47, 42,
+ 32,110,111,114,109, 97,108,105,122,101,100, 32,105,110,116,101,114,112,111,108, 97,116,101,100, 32,118,101,114,116,101,120, 32,
+110,111,114,109, 97,108, 32, 42, 47, 10, 9, 10, 9,118, 82, 49, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 83,105,103,109, 97,
+ 84, 44, 32,118, 78, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109,
+ 97, 83, 32, 41, 32, 59, 10, 9,102, 68,101,116, 32, 61, 32,100,111,116, 32, 40, 32,118, 83,105,103,109, 97, 83, 44, 32,118, 82,
+ 49, 32, 41, 59, 10, 9, 10, 9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115, 40,102,
+ 68,101,116, 41, 59, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102,
+ 77, 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, 10,
+ 9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101,
+ 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,116, 97,112, 51, 40, 32,118,101, 99, 51, 32,116,
+101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97,108,
+101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108,111,
+ 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10, 9,118,101, 99, 50,
+ 32, 83, 84,108,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10, 9,118,101, 99, 50, 32, 83, 84,108,114, 32, 61, 32,116,
+101,120, 99,111, 46,120,121, 32, 43, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 32, 59, 10, 9,118,101, 99, 50,
+ 32, 83, 84,117,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,121,
+ 41, 32, 59, 10, 9, 10, 9,102,108,111, 97,116, 32, 72,108,108, 44, 72,108,114, 44, 72,117,108, 59, 10, 9,114,103, 98,116,111,
+ 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108,108, 41, 44, 32, 72,108,108, 32, 41, 59,
+ 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108,114, 41, 44,
+ 32, 72,108,114, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44,
+ 32, 83, 84,117,108, 41, 44, 32, 72,117,108, 32, 41, 59, 10, 9, 10, 9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42,
+ 32, 40, 72,108,114, 32, 45, 32, 72,108,108, 41, 59, 10, 9,100, 66,116, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,
+117,108, 32, 45, 32, 72,108,108, 41, 59, 10,125, 10, 10, 35,105,102,100,101,102, 32, 66, 85, 77, 80, 95, 66, 73, 67, 85, 66, 73,
+ 67, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, 98,105, 99,117, 98,105, 99, 40, 32,118,101, 99, 51, 32,
+116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97,
+108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108,
+111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10, 9,102,108,111,
+ 97,116, 32, 72,108, 59, 10, 9,102,108,111, 97,116, 32, 72,114, 59, 10, 9,102,108,111, 97,116, 32, 72,100, 59, 10, 9,102,108,
+111, 97,116, 32, 72,117, 59, 10, 9, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120,
+ 99,111, 46,120,121, 41, 59, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,111,
+ 46,120,121, 41, 59, 10, 32, 10, 9,118,101, 99, 50, 32, 83, 84,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48,
+ 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,114, 32, 61, 32,116,101,120, 99,111, 46,120,
+121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,100, 32, 61, 32,116,101,
+120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,117,
+ 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, 10, 9, 10, 9,114,
+103, 98,116,111, 98,119, 40,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108, 41, 44, 32, 72,108, 41, 59,
+ 10, 9,114,103, 98,116,111, 98,119, 40,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,114, 41, 44, 32, 72,
+114, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,100, 41,
+ 44, 32, 72,100, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83,
+ 84,117, 41, 44, 32, 72,117, 41, 59, 10, 9, 10, 9,118,101, 99, 50, 32,100, 72,100,120,121, 32, 61, 32,118,101, 99, 50, 40, 72,
+114, 32, 45, 32, 72,108, 44, 32, 72,117, 32, 45, 32, 72,100, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 66,108,101,110,100, 32,
+ 61, 32, 99,108, 97,109,112, 40, 49, 46, 48, 45,116,101,120,116,117,114,101, 81,117,101,114,121, 76, 79, 68, 40,105,109, 97, 44,
+ 32,116,101,120, 99,111, 46,120,121, 41, 46,120, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,105,102, 40,102, 66,108,
+101,110,100, 33, 61, 48, 46, 48, 41, 10, 9,123, 10, 9, 9, 47, 47, 32,116,104,101, 32,100,101,114,105,118, 97,116,105,118,101,
+ 32,111,102, 32,116,104,101, 32, 98,105, 99,117, 98,105, 99, 32,115, 97,109,112,108,105,110,103, 32,111,102, 32,108,101,118,101,
+108, 32, 48, 10, 9, 9,105,118,101, 99, 50, 32,118, 68,105,109, 59, 10, 9, 9,118, 68,105,109, 32, 61, 32,116,101,120,116,117,
+114,101, 83,105,122,101, 40,105,109, 97, 44, 32, 48, 41, 59, 10, 10, 9, 9, 47, 47, 32,116, 97,107,105,110,103, 32,116,104,101,
+ 32,102,114, 97, 99,116, 32,112, 97,114,116, 32,111,102, 32,116,104,101, 32,116,101,120,116,117,114,101, 32, 99,111,111,114,100,
+105,110, 97,116,101, 32,105,115, 32, 97, 32,104, 97,114,100, 99,111,100,101,100, 32,119,114, 97,112, 32,109,111,100,101, 46, 10,
+ 9, 9, 47, 47, 32,116,104,105,115, 32,105,115, 32, 97, 99, 99,101,112,116, 97, 98,108,101, 32, 97,115, 32,116,101,120,116,117,
+114,101,115, 32,117,115,101, 32,119,114, 97,112, 32,109,111,100,101, 32,101,120, 99,108,117,115,105,118,101,108,121, 32,105,110,
+ 32, 51, 68, 32,118,105,101,119, 32,101,108,115,101,119,104,101,114,101, 32,105,110, 32, 98,108,101,110,100,101,114, 46, 32, 10,
+ 9, 9, 47, 47, 32,116,104,105,115, 32,105,115, 32,100,111,110,101, 32,115,111, 32,116,104, 97,116, 32,119,101, 32, 99, 97,110,
+ 32,115,116,105,108,108, 32,103,101,116, 32, 97, 32,118, 97,108,105,100, 32,116,101,120,101,108, 32,119,105,116,104, 32,117,118,
+115, 32,111,117,116,115,105,100,101, 32,116,104,101, 32, 48, 44, 49, 32,114, 97,110,103,101, 10, 9, 9, 47, 47, 32, 98,121, 32,
+116,101,120,101,108, 70,101,116, 99,104, 32, 98,101,108,111,119, 44, 32, 97,115, 32, 99,111,111,114,100,105,110, 97,116,101,115,
+ 32, 97,114,101, 32, 99,108, 97,109,112,101,100, 32,119,104,101,110, 32,117,115,105,110,103, 32,116,104,105,115, 32,102,117,110,
+ 99,116,105,111,110, 46, 10, 9, 9,118,101, 99, 50, 32,102, 84,101,120, 76,111, 99, 32, 61, 32,118, 68,105,109, 42,102,114, 97,
+ 99,116, 40,116,101,120, 99,111, 46,120,121, 41, 32, 45, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 32, 48, 46, 53, 41, 59, 10, 9,
+ 9,105,118,101, 99, 50, 32,105, 84,101,120, 76,111, 99, 32, 61, 32,105,118,101, 99, 50, 40,102,108,111,111,114, 40,102, 84,101,
+120, 76,111, 99, 41, 41, 59, 10, 9, 9,118,101, 99, 50, 32,116, 32, 61, 32, 99,108, 97,109,112, 40,102, 84,101,120, 76,111, 99,
+ 32, 45, 32,105, 84,101,120, 76,111, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 9, 9, 47, 47, 32,115, 97,116, 32,106,
+117,115,116, 32,116,111, 32, 98,101, 32,112,101,100, 97,110,116,105, 99, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 10, 32, 42, 32, 84,104,105,115, 32, 98,108,111, 99,107,
- 32,119,105,108,108, 32,114,101,112,108, 97, 99,101, 32,116,104,101, 32,111,110,101, 32, 98,101,108,111,119, 32,119,104,101,110,
- 32,111,110,101, 32, 99,104, 97,110,110,101,108, 32,116,101,120,116,117,114,101,115, 32, 97,114,101, 32,112,114,111,112,101,114,
-108,121, 32,115,117,112,112,111,114,116,101,100, 46, 32, 42, 10, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 10, 32, 42, 32, 84,104,105,115, 32, 98,108,111, 99,107, 32,119,
+105,108,108, 32,114,101,112,108, 97, 99,101, 32,116,104,101, 32,111,110,101, 32, 98,101,108,111,119, 32,119,104,101,110, 32,111,
+110,101, 32, 99,104, 97,110,110,101,108, 32,116,101,120,116,117,114,101,115, 32, 97,114,101, 32,112,114,111,112,101,114,108,121,
+ 32,115,117,112,112,111,114,116,101,100, 46, 32, 42, 10, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 10, 9, 9,118,101, 99, 52, 32,118, 83, 97,109,112,108,101,115, 85, 76, 32, 61,
- 32,116,101,120,116,117,114,101, 71, 97,116,104,101,114, 40,105,109, 97, 44, 32, 40,105, 84,101,120, 76,111, 99, 43,105,118,101,
- 99, 50, 40, 45, 49, 44, 45, 49, 41, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 48, 46, 53, 41, 41, 47,118, 68,105,109, 32,
- 41, 59, 10, 9, 9,118,101, 99, 52, 32,118, 83, 97,109,112,108,101,115, 85, 82, 32, 61, 32,116,101,120,116,117,114,101, 71, 97,
-116,104,101,114, 40,105,109, 97, 44, 32, 40,105, 84,101,120, 76,111, 99, 43,105,118,101, 99, 50, 40, 49, 44, 45, 49, 41, 32, 43,
- 32,118,101, 99, 50, 40, 48, 46, 53, 44, 48, 46, 53, 41, 41, 47,118, 68,105,109, 32, 41, 59, 10, 9, 9,118,101, 99, 52, 32,118,
- 83, 97,109,112,108,101,115, 76, 76, 32, 61, 32,116,101,120,116,117,114,101, 71, 97,116,104,101,114, 40,105,109, 97, 44, 32, 40,
-105, 84,101,120, 76,111, 99, 43,105,118,101, 99, 50, 40, 45, 49, 44, 49, 41, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 48,
- 46, 53, 41, 41, 47,118, 68,105,109, 32, 41, 59, 10, 9, 9,118,101, 99, 52, 32,118, 83, 97,109,112,108,101,115, 76, 82, 32, 61,
- 32,116,101,120,116,117,114,101, 71, 97,116,104,101,114, 40,105,109, 97, 44, 32, 40,105, 84,101,120, 76,111, 99, 43,105,118,101,
- 99, 50, 40, 49, 44, 49, 41, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 48, 46, 53, 41, 41, 47,118, 68,105,109, 32, 41, 59,
- 10, 10, 9, 9,109, 97,116, 52, 32, 72, 32, 61, 32,109, 97,116, 52, 40,118, 83, 97,109,112,108,101,115, 85, 76, 46,119, 44, 32,
-118, 83, 97,109,112,108,101,115, 85, 76, 46,120, 44, 32,118, 83, 97,109,112,108,101,115, 76, 76, 46,119, 44, 32,118, 83, 97,109,
-112,108,101,115, 76, 76, 46,120, 44, 10, 9, 9, 9, 9, 9,118, 83, 97,109,112,108,101,115, 85, 76, 46,122, 44, 32,118, 83, 97,
-109,112,108,101,115, 85, 76, 46,121, 44, 32,118, 83, 97,109,112,108,101,115, 76, 76, 46,122, 44, 32,118, 83, 97,109,112,108,101,
-115, 76, 76, 46,121, 44, 10, 9, 9, 9, 9, 9,118, 83, 97,109,112,108,101,115, 85, 82, 46,119, 44, 32,118, 83, 97,109,112,108,
-101,115, 85, 82, 46,120, 44, 32,118, 83, 97,109,112,108,101,115, 76, 82, 46,119, 44, 32,118, 83, 97,109,112,108,101,115, 76, 82,
- 46,120, 44, 10, 9, 9, 9, 9, 9,118, 83, 97,109,112,108,101,115, 85, 82, 46,122, 44, 32,118, 83, 97,109,112,108,101,115, 85,
- 82, 46,121, 44, 32,118, 83, 97,109,112,108,101,115, 76, 82, 46,122, 44, 32,118, 83, 97,109,112,108,101,115, 76, 82, 46,121, 41,
- 59, 10, 42, 47, 9, 10, 9, 9,105,118,101, 99, 50, 32,105, 84,101,120, 76,111, 99, 77,111,100, 32, 61, 32,105, 84,101,120, 76,
-111, 99, 32, 43, 32,105,118,101, 99, 50, 40, 45, 49, 44, 32, 45, 49, 41, 59, 10, 10, 9, 9,109, 97,116, 52, 32, 72, 59, 10, 9,
- 9, 10, 9, 9,102,111,114, 40,105,110,116, 32,105, 32, 61, 32, 48, 59, 32,105, 32, 60, 32, 52, 59, 32,105, 43, 43, 41,123, 10,
- 9, 9, 9,102,111,114, 40,105,110,116, 32,106, 32, 61, 32, 48, 59, 32,106, 32, 60, 32, 52, 59, 32,106, 43, 43, 41,123, 10, 9,
- 9, 9, 9,105,118,101, 99, 50, 32,105, 84,101,120, 84,109,112, 32, 61, 32,105, 84,101,120, 76,111, 99, 77,111,100, 32, 43, 32,
-105,118,101, 99, 50, 40,105, 44,106, 41, 59, 10, 9, 9, 9, 9, 10, 9, 9, 9, 9, 47, 47, 32,119,114, 97,112, 32,116,101,120,
-116,117,114,101, 32, 99,111,111,114,100,105,110, 97,116,101,115, 32,109, 97,110,117, 97,108,108,121, 32,102,111,114, 32,116,101,
-120,101,108, 70,101,116, 99,104, 32,116,111, 32,119,111,114,107, 32,111,110, 32,117,118,115, 32,111,105,116,115,105,100,101, 32,
-116,104,101, 32, 48, 44, 49, 32,114, 97,110,103,101, 46, 10, 9, 9, 9, 9, 47, 47, 32,116,104,105,115, 32,105,115, 32,103,117,
- 97,114, 97,110,116,101,101,100, 32,116,111, 32,119,111,114,107, 32,115,105,110, 99,101, 32,119,101, 32,116, 97,107,101, 32,116,
-104,101, 32,102,114, 97, 99,116,105,111,110, 97,108, 32,112, 97,114,116, 32,111,102, 32,116,104,101, 32,117,118, 32, 97, 98,111,
-118,101, 46, 10, 9, 9, 9, 9,105, 84,101,120, 84,109,112, 46,120, 32, 61, 32, 40,105, 84,101,120, 84,109,112, 46,120, 32, 60,
- 32, 48, 41, 63, 32,105, 84,101,120, 84,109,112, 46,120, 32, 43, 32,118, 68,105,109, 46,120, 32, 58, 32, 40, 40,105, 84,101,120,
- 84,109,112, 46,120, 32, 62, 61, 32,118, 68,105,109, 46,120, 41, 63, 32,105, 84,101,120, 84,109,112, 46,120, 32, 45, 32,118, 68,
-105,109, 46,120, 32, 58, 32,105, 84,101,120, 84,109,112, 46,120, 41, 59, 10, 9, 9, 9, 9,105, 84,101,120, 84,109,112, 46,121,
- 32, 61, 32, 40,105, 84,101,120, 84,109,112, 46,121, 32, 60, 32, 48, 41, 63, 32,105, 84,101,120, 84,109,112, 46,121, 32, 43, 32,
-118, 68,105,109, 46,121, 32, 58, 32, 40, 40,105, 84,101,120, 84,109,112, 46,121, 32, 62, 61, 32,118, 68,105,109, 46,121, 41, 63,
- 32,105, 84,101,120, 84,109,112, 46,121, 32, 45, 32,118, 68,105,109, 46,121, 32, 58, 32,105, 84,101,120, 84,109,112, 46,121, 41,
- 59, 10, 10, 9, 9, 9, 9,114,103, 98,116,111, 98,119, 40,116,101,120,101,108, 70,101,116, 99,104, 40,105,109, 97, 44, 32,105,
- 84,101,120, 84,109,112, 44, 32, 48, 41, 44, 32, 72, 91,105, 93, 91,106, 93, 41, 59, 10, 9, 9, 9,125, 10, 9, 9,125, 10, 9,
- 9, 10, 9, 9,102,108,111, 97,116, 32,120, 32, 61, 32,116, 46,120, 44, 32,121, 32, 61, 32,116, 46,121, 59, 10, 9, 9,102,108,
-111, 97,116, 32,120, 50, 32, 61, 32,120, 32, 42, 32,120, 44, 32,120, 51, 32, 61, 32,120, 50, 32, 42, 32,120, 44, 32,121, 50, 32,
- 61, 32,121, 32, 42, 32,121, 44, 32,121, 51, 32, 61, 32,121, 50, 32, 42, 32,121, 59, 10, 10, 9, 9,118,101, 99, 52, 32, 88, 32,
- 61, 32,118,101, 99, 52, 40, 45, 48, 46, 53, 42, 40,120, 51, 43,120, 41, 43,120, 50, 44, 9, 9, 49, 46, 53, 42,120, 51, 45, 50,
- 46, 53, 42,120, 50, 43, 49, 44, 9, 45, 49, 46, 53, 42,120, 51, 43, 50, 42,120, 50, 43, 48, 46, 53, 42,120, 44, 9, 9, 48, 46,
- 53, 42, 40,120, 51, 45,120, 50, 41, 41, 59, 10, 9, 9,118,101, 99, 52, 32, 89, 32, 61, 32,118,101, 99, 52, 40, 45, 48, 46, 53,
- 42, 40,121, 51, 43,121, 41, 43,121, 50, 44, 9, 9, 49, 46, 53, 42,121, 51, 45, 50, 46, 53, 42,121, 50, 43, 49, 44, 9, 45, 49,
- 46, 53, 42,121, 51, 43, 50, 42,121, 50, 43, 48, 46, 53, 42,121, 44, 9, 9, 48, 46, 53, 42, 40,121, 51, 45,121, 50, 41, 41, 59,
- 10, 9, 9,118,101, 99, 52, 32,100, 88, 32, 61, 32,118,101, 99, 52, 40, 45, 49, 46, 53, 42,120, 50, 43, 50, 42,120, 45, 48, 46,
- 53, 44, 9, 9, 52, 46, 53, 42,120, 50, 45, 53, 42,120, 44, 9, 9, 9, 45, 52, 46, 53, 42,120, 50, 43, 52, 42,120, 43, 48, 46,
- 53, 44, 9, 9, 49, 46, 53, 42,120, 50, 45,120, 41, 59, 10, 9, 9,118,101, 99, 52, 32,100, 89, 32, 61, 32,118,101, 99, 52, 40,
- 45, 49, 46, 53, 42,121, 50, 43, 50, 42,121, 45, 48, 46, 53, 44, 9, 9, 52, 46, 53, 42,121, 50, 45, 53, 42,121, 44, 9, 9, 9,
- 45, 52, 46, 53, 42,121, 50, 43, 52, 42,121, 43, 48, 46, 53, 44, 9, 9, 49, 46, 53, 42,121, 50, 45,121, 41, 59, 10, 9, 10, 9,
- 9, 47, 47, 32, 99,111,109,112,108,101,116,101, 32,100,101,114,105,118, 97,116,105,118,101, 32,105,110, 32,110,111,114,109, 97,
-108,105,122,101,100, 32, 99,111,111,114,100,105,110, 97,116,101,115, 32, 40,109,117,108, 32, 98,121, 32,118, 68,105,109, 41, 10,
- 9, 9,118,101, 99, 50, 32,100, 72,100, 83, 84, 32, 61, 32,118, 68,105,109, 32, 42, 32,118,101, 99, 50, 40,100,111,116, 40, 89,
- 44, 32, 72, 32, 42, 32,100, 88, 41, 44, 32,100,111,116, 40,100, 89, 44, 32, 72, 32, 42, 32, 88, 41, 41, 59, 10, 10, 9, 9, 47,
- 47, 32,116,114, 97,110,115,102,111,114,109, 32,100,101,114,105,118, 97,116,105,118,101, 32,116,111, 32,115, 99,114,101,101,110,
- 45,115,112, 97, 99,101, 10, 9, 9,118,101, 99, 50, 32,100, 72,100,120,121, 95, 98,105, 99,117, 98,105, 99, 32, 61, 32,118,101,
- 99, 50, 40, 32,100, 72,100, 83, 84, 46,120, 32, 42, 32, 84,101,120, 68,120, 46,120, 32, 43, 32,100, 72,100, 83, 84, 46,121, 32,
- 42, 32, 84,101,120, 68,120, 46,121, 44, 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,100, 72,100, 83, 84, 46,120, 32, 42, 32,
- 84,101,120, 68,121, 46,120, 32, 43, 32,100, 72,100, 83, 84, 46,121, 32, 42, 32, 84,101,120, 68,121, 46,121, 32, 41, 59, 10, 10,
- 9, 9, 47, 47, 32, 98,108,101,110,100, 32, 98,101,116,119,101,101,110, 32,116,104,101, 32,116,119,111, 10, 9, 9,100, 72,100,
-120,121, 32, 61, 32,100, 72,100,120,121, 42, 40, 49, 45,102, 66,108,101,110,100, 41, 32, 43, 32,100, 72,100,120,121, 95, 98,105,
- 99,117, 98,105, 99, 42,102, 66,108,101,110,100, 59, 10, 9,125, 10, 10, 9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108,101, 32,
- 42, 32,100, 72,100,120,121, 46,120, 59, 10, 9,100, 66,116, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32,100, 72,100,120,121,
- 46,121, 59, 10,125, 10, 10, 35,101,110,100,105,102, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,116, 97,
-112, 53, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,
-108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
- 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32,
- 41, 32, 10,123, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121,
- 41, 59, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41, 59,
- 10, 10, 9,118,101, 99, 50, 32, 83, 84, 99, 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10, 9,118,101, 99, 50, 32, 83, 84,
-108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10, 9,118,101,
- 99, 50, 32, 83, 84,114, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32,
- 59, 10, 9,118,101, 99, 50, 32, 83, 84,100, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,
-101,120, 68,121, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,117, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46,
- 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, 10, 9, 10, 9,102,108,111, 97,116, 32, 72, 99, 44, 72,108, 44, 72,114, 44, 72,100,
- 44, 72,117, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,
- 99, 41, 44, 32, 72, 99, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109,
- 97, 44, 32, 83, 84,108, 41, 44, 32, 72,108, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101,
- 50, 68, 40,105,109, 97, 44, 32, 83, 84,114, 41, 44, 32, 72,114, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,
-120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,100, 41, 44, 32, 72,100, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,
-119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,117, 41, 44, 32, 72,117, 32, 41, 59, 10, 9, 10,
- 9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,114, 32, 45, 32, 72,108, 41, 59, 10, 9,100, 66,116, 32,
- 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,117, 32, 45, 32, 72,100, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
-101,120, 95, 98,117,109,112, 95,100,101,114,105,118, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,
-101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,120, 44, 32,102,108,111, 97,116, 32,105,109, 97,
- 95,121, 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
- 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116,
- 32,100, 66,116, 32, 41, 32, 10,123, 10, 9,102,108,111, 97,116, 32,115, 32, 61, 32, 49, 46, 48, 59, 9, 9, 47, 47, 32,110,101,
-103, 97,116,101, 32,116,104,105,115, 32,105,102, 32,102,108,105,112,112,101,100, 32,116,101,120,116,117,114,101, 32, 99,111,111,
-114,100,105,110, 97,116,101, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120, 99,111,
- 46,120,121, 41, 59, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,
-121, 41, 59, 10, 9, 10, 9, 47, 47, 32,116,104,105,115, 32,118, 97,114,105, 97,110,116, 32,117,115,105,110,103, 32, 97, 32,100,
-101,114,105,118, 97,116,105,118,101, 32,109, 97,112, 32,105,115, 32,100,101,115, 99,114,105, 98,101,100, 32,104,101,114,101, 10,
- 9, 47, 47, 32,104,116,116,112, 58, 47, 47,109,109,105,107,107,101,108,115,101,110, 51,100, 46, 98,108,111,103,115,112,111,116,
- 46, 99,111,109, 47, 50, 48, 49, 49, 47, 48, 55, 47,100,101,114,105,118, 97,116,105,118,101, 45,109, 97,112,115, 46,104,116,109,
-108, 10, 9,118,101, 99, 50, 32,100,105,109, 32, 61, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 44, 32,105,109, 97, 95,121, 41,
- 59, 10, 9,118,101, 99, 50, 32,100, 66,100,117,118, 32, 61, 32,104, 83, 99, 97,108,101, 42,100,105,109, 42, 40, 50, 46, 48, 42,
-116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 46,120,121, 45, 49, 46, 48, 41,
- 59, 10, 9, 10, 9,100, 66,115, 32, 61, 32,100, 66,100,117,118, 46,120, 42, 84,101,120, 68,120, 46,120, 32, 43, 32,115, 42,100,
- 66,100,117,118, 46,121, 42, 84,101,120, 68,120, 46,121, 59, 10, 9,100, 66,116, 32, 61, 32,100, 66,100,117,118, 46,120, 42, 84,
-101,120, 68,121, 46,120, 32, 43, 32,115, 42,100, 66,100,117,118, 46,121, 42, 84,101,120, 68,121, 46,121, 59, 10,125, 10, 10,118,
-111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 40, 32,102,108,111, 97,116, 32,102, 68,101,116, 44,
- 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,102,108,111, 97,116, 32,100, 66,116, 44, 32,118,101, 99, 51, 32,118, 82, 49, 44,
- 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 32,
- 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,112,101,
-114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 41, 32, 10,123, 10, 9,118,101, 99, 51, 32,118, 83,117,114,102, 71,114, 97,
-100, 32, 61, 32,115,105,103,110, 40,102, 68,101,116, 41, 32, 42, 32, 40, 32,100, 66,115, 32, 42, 32,118, 82, 49, 32, 43, 32,100,
- 66,116, 32, 42, 32,118, 82, 50, 32, 41, 59, 10, 9, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99,
- 95,105,110, 32, 45, 32,118, 83,117,114,102, 71,114, 97,100, 59, 10, 9,112,101,114,116,117,114, 98,101,100, 95,110,111,114,109,
- 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32,118, 78, 97, 99, 99, 95,111,117,116, 32, 41, 59, 10,125, 10, 10,118,111,
-105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 95,116,101,120,115,112, 97, 99,101, 40, 32,102,108,111,
- 97,116, 32,102, 68,101,116, 44, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,102,108,111, 97,116, 32,100, 66,116, 44, 32,118,
-101, 99, 51, 32,118, 82, 49, 44, 32,118,101, 99, 51, 32,118, 82, 50, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
- 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44,
- 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,120, 44, 32,102,108,111, 97,116, 32,
-105,109, 97, 95,121, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,
-111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,112,101,114,
-116,117,114, 98,101,100, 95,110,111,114,109, 32, 41, 32, 10,123, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100,
- 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,
-121, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 10, 9,118,101, 99, 51, 32,118, 83,117,114,102, 71,114, 97,100, 32, 61, 32,
-115,105,103,110, 40,102, 68,101,116, 41, 32, 42, 32, 40, 32, 10, 9, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,100, 66,115,
- 32, 47, 32,108,101,110,103,116,104, 40, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 42, 84,101,120, 68,120, 46,120, 44, 32,105,
-109, 97, 95,121, 42, 84,101,120, 68,120, 46,121, 41, 32, 41, 32, 42, 32,118, 82, 49, 32, 43, 32, 10, 9, 32, 32, 32, 32, 32, 32,
- 32, 32, 32, 32, 32, 32,100, 66,116, 32, 47, 32,108,101,110,103,116,104, 40, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 42, 84,
-101,120, 68,121, 46,120, 44, 32,105,109, 97, 95,121, 42, 84,101,120, 68,121, 46,121, 41, 32, 41, 32, 42, 32,118, 82, 50, 32, 41,
- 59, 10, 9, 9, 9, 9, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 45, 32,118,
- 83,117,114,102, 71,114, 97,100, 59, 10, 9,112,101,114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 61, 32,110,111,114,109,
- 97,108,105,122,101, 40, 32,118, 78, 97, 99, 99, 95,111,117,116, 32, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120,
- 95,110,101,103, 97,116,101, 95,116,101,120,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,
-117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9,111,117,116,110,111,114,109, 97,108, 32,
- 61, 32,118,101, 99, 51, 40, 45,110,111,114,109, 97,108, 46,120, 44, 32, 45,110,111,114,109, 97,108, 46,121, 44, 32,110,111,114,
-109, 97,108, 46,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,110,115,112, 97, 99,101, 95,116, 97,110,103,
-101,110,116, 40,118,101, 99, 52, 32,116, 97,110,103,101,110,116, 44, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,118,
-101, 99, 51, 32,116,101,120,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,
-108, 41, 10,123, 10, 9,118,101, 99, 51, 32, 66, 32, 61, 32,116, 97,110,103,101,110,116, 46,119, 32, 42, 32, 99,114,111,115,115,
- 40,110,111,114,109, 97,108, 44, 32,116, 97,110,103,101,110,116, 46,120,121,122, 41, 59, 10, 10, 9,111,117,116,110,111,114,109,
- 97,108, 32, 61, 32,116,101,120,110,111,114,109, 97,108, 46,120, 42,116, 97,110,103,101,110,116, 46,120,121,122, 32, 43, 32,116,
-101,120,110,111,114,109, 97,108, 46,121, 42, 66, 32, 43, 32,116,101,120,110,111,114,109, 97,108, 46,122, 42,110,111,114,109, 97,
-108, 59, 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,110,111,114,
-109, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,108,101,110,100, 95,110,111,114,109, 97,108, 40,
-102,108,111, 97,116, 32,110,111,114,102, 97, 99, 44, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,118,101, 99, 51, 32,
-110,101,119,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123,
- 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32,110,111,114,102, 97, 99, 41, 42,110,111,114,
-109, 97,108, 32, 43, 32,110,111,114,102, 97, 99, 42,110,101,119,110,111,114,109, 97,108, 59, 10, 9,111,117,116,110,111,114,109,
- 97,108, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10, 47, 42,
- 42, 42, 42, 42, 42, 42, 32, 77, 65, 84, 69, 82, 73, 65, 76, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100,
- 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,117,110, 95,104,101,109,105, 40,118,101, 99, 51, 32,108,
- 97,109,112,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100,
-105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,108,118, 32, 61, 32,
-108, 97,109,112,118,101, 99, 59, 10, 9,100,105,115,116, 32, 61, 32, 49, 46, 48, 59, 10, 9,118,105,115,105,102, 97, 99, 32, 61,
- 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,111,116,
-104,101,114, 40,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111, 44, 32,111,117,116, 32,118,101,
- 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116,
- 32,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,108,118, 32, 61, 32, 99,111, 32, 45, 32,108, 97,109,112, 99,111, 59, 10, 9,
-100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40,108,118, 41, 59, 10, 9,108,118, 32, 61, 32,110,111,114,109, 97,108,105,
-122,101, 40,108,118, 41, 59, 10, 9,118,105,115,105,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,
-108, 97,109,112, 95,102, 97,108,108,111,102,102, 95,105,110,118,108,105,110,101, 97,114, 40,102,108,111, 97,116, 32,108, 97,109,
-112,100,105,115,116, 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,
-105,102, 97, 99, 41, 10,123, 10, 9,118,105,115,105,102, 97, 99, 32, 61, 32,108, 97,109,112,100,105,115,116, 47, 40,108, 97,109,
-112,100,105,115,116, 32, 43, 32,100,105,115,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,102, 97,108,108,
-111,102,102, 95,105,110,118,115,113,117, 97,114,101, 40,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116, 44, 32,102,108,
-111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,
-118,105,115,105,102, 97, 99, 32, 61, 32,108, 97,109,112,100,105,115,116, 47, 40,108, 97,109,112,100,105,115,116, 32, 43, 32,100,
-105,115,116, 42,100,105,115,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,102, 97,108,108,111,102,102, 95,
-115,108,105,100,101,114,115, 40,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116, 44, 32,102,108,111, 97,116, 32,108,100,
- 49, 44, 32,102,108,111, 97,116, 32,108,100, 50, 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,
-111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116,107,119,
- 32, 61, 32,108, 97,109,112,100,105,115,116, 42,108, 97,109,112,100,105,115,116, 59, 10, 10, 9,118,105,115,105,102, 97, 99, 32,
- 61, 32,108, 97,109,112,100,105,115,116, 47, 40,108, 97,109,112,100,105,115,116, 32, 43, 32,108,100, 49, 42,100,105,115,116, 41,
- 59, 10, 9,118,105,115,105,102, 97, 99, 32, 42, 61, 32,108, 97,109,112,100,105,115,116,107,119, 47, 40,108, 97,109,112,100,105,
-115,116,107,119, 32, 43, 32,108,100, 50, 42,100,105,115,116, 42,100,105,115,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,108,
- 97,109,112, 95,102, 97,108,108,111,102,102, 95, 99,117,114,118,101, 40,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116,
- 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,102,108,111, 97,116, 32,100,105,115,116,
- 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,118,105,115,105,102, 97, 99, 32,
- 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,100,105,115,116, 47,
-108, 97,109,112,100,105,115,116, 44, 32, 48, 46, 48, 41, 41, 46,120, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,
-118,105,115,105, 98,105,108,105,116,121, 95,115,112,104,101,114,101, 40,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116,
- 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,111,117,116,
- 32,102,108,111, 97,116, 32,111,117,116,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,102,108,111, 97,116, 32,116, 61, 32,108,
- 97,109,112,100,105,115,116, 32, 45, 32,100,105,115,116, 59, 10, 10, 9,111,117,116,118,105,115,105,102, 97, 99, 61, 32,118,105,
-115,105,102, 97, 99, 42,109, 97,120, 40,116, 44, 32, 48, 46, 48, 41, 47,108, 97,109,112,100,105,115,116, 59, 10,125, 10, 10,118,
-111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,111,116, 95,115,113,117, 97,114,101, 40,
-118,101, 99, 51, 32,108, 97,109,112,118,101, 99, 44, 32,109, 97,116, 52, 32,108, 97,109,112,105,109, 97,116, 44, 32,118,101, 99,
- 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,112,114, 41, 10,123, 10, 9,105,102, 40,100,111,116, 40,
-108,118, 44, 32,108, 97,109,112,118,101, 99, 41, 32, 62, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,118,101, 99, 51, 32,108,118,114,
-111,116, 32, 61, 32, 40,108, 97,109,112,105,109, 97,116, 42,118,101, 99, 52, 40,108,118, 44, 32, 48, 46, 48, 41, 41, 46,120,121,
-122, 59, 10, 9, 9,102,108,111, 97,116, 32,120, 32, 61, 32,109, 97,120, 40, 97, 98,115, 40,108,118,114,111,116, 46,120, 47,108,
-118,114,111,116, 46,122, 41, 44, 32, 97, 98,115, 40,108,118,114,111,116, 46,121, 47,108,118,114,111,116, 46,122, 41, 41, 59, 10,
- 10, 9, 9,105,110,112,114, 32, 61, 32, 49, 46, 48, 47,115,113,114,116, 40, 49, 46, 48, 32, 43, 32,120, 42,120, 41, 59, 10, 9,
-125, 10, 9,101,108,115,101, 10, 9, 9,105,110,112,114, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,
-109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,111,116, 95, 99,105,114, 99,108,101, 40,118,101, 99, 51, 32,108,
- 97,109,112,118,101, 99, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,112,114, 41,
- 10,123, 10, 9,105,110,112,114, 32, 61, 32,100,111,116, 40,108,118, 44, 32,108, 97,109,112,118,101, 99, 41, 59, 10,125, 10, 10,
-118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,111,116, 40,102,108,111, 97,116, 32,
-115,112,111,116,115,105, 44, 32,102,108,111, 97,116, 32,115,112,111,116, 98,108, 44, 32,102,108,111, 97,116, 32,105,110,112,114,
- 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118,105,
-115,105,102, 97, 99, 41, 10,123, 10, 9,102,108,111, 97,116, 32,116, 32, 61, 32,115,112,111,116,115,105, 59, 10, 10, 9,105,102,
- 40,105,110,112,114, 32, 60, 61, 32,116, 41, 32,123, 10, 9, 9,111,117,116,118,105,115,105,102, 97, 99, 32, 61, 32, 48, 46, 48,
- 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,116, 32, 61, 32,105,110,112,114, 32, 45, 32,116, 59, 10, 10, 9, 9,
- 47, 42, 32,115,111,102,116, 32, 97,114,101, 97, 32, 42, 47, 10, 9, 9,105,102, 40,115,112,111,116, 98,108, 32, 33, 61, 32, 48,
- 46, 48, 41, 10, 9, 9, 9,105,110,112,114, 32, 42, 61, 32,115,109,111,111,116,104,115,116,101,112, 40, 48, 46, 48, 44, 32, 49,
- 46, 48, 44, 32,116, 47,115,112,111,116, 98,108, 41, 59, 10, 10, 9, 9,111,117,116,118,105,115,105,102, 97, 99, 32, 61, 32,118,
-105,115,105,102, 97, 99, 42,105,110,112,114, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,
-105, 98,105,108,105,116,121, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,111,117,116,
- 32,102,108,111, 97,116, 32,111,117,116,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,111,117,116,118,105,115,105,102, 97, 99,
- 32, 61, 32, 40,118,105,115,105,102, 97, 99, 32, 60, 32, 48, 46, 48, 48, 49, 41, 63, 32, 48, 46, 48, 58, 32,118,105,115,105,102,
- 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,118,105,101,119, 40,118,101, 99, 51, 32, 99,111, 44, 32,
-111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 41, 10,123, 10, 9, 47, 42, 32,104, 97,110,100,108,101, 32,112,101,114,115,
-112,101, 99,116,105,118,101, 47,111,114,116,104,111,103,114, 97,112,104,105, 99, 32, 42, 47, 10, 9,118,105,101,119, 32, 61, 32,
- 40,103,108, 95, 80,114,111,106,101, 99,116,105,111,110, 77, 97,116,114,105,120, 91, 51, 93, 91, 51, 93, 32, 61, 61, 32, 48, 46,
- 48, 41, 63, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 58, 32,118,101, 99, 51, 40, 48, 46, 48, 44, 32, 48, 46, 48,
- 44, 32, 45, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,116, 97,110,103,101,110,116, 95,118,
- 40,118,101, 99, 51, 32,108,118, 44, 32,118,101, 99, 51, 32,116, 97,110,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,110,
- 41, 10,123, 10, 9,118,101, 99, 51, 32, 99, 32, 61, 32, 99,114,111,115,115, 40,108,118, 44, 32,116, 97,110,103, 41, 59, 10, 9,
-118,101, 99, 51, 32,118,110,111,114, 32, 61, 32, 99,114,111,115,115, 40, 99, 44, 32,116, 97,110,103, 41, 59, 10, 10, 9,118,110,
- 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,118,110,111,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,
-100,101, 95,105,110,112, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111,
- 97,116, 32,105,110,112, 41, 10,123, 10, 9,105,110,112, 32, 61, 32,100,111,116, 40,118,110, 44, 32,108,118, 41, 59, 10,125, 10,
- 10,118,111,105,100, 32,115,104, 97,100,101, 95,105,115, 95,110,111, 95,100,105,102,102,117,115,101, 40,111,117,116, 32,102,108,
-111, 97,116, 32,105,115, 41, 10,123, 10, 9,105,115, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,
-100,101, 95,105,115, 95,104,101,109,105, 40,102,108,111, 97,116, 32,105,110,112, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,
-105,115, 41, 10,123, 10, 9,105,115, 32, 61, 32, 48, 46, 53, 42,105,110,112, 32, 43, 32, 48, 46, 53, 59, 10,125, 10, 10,102,108,
-111, 97,116, 32, 97,114,101, 97, 95,108, 97,109,112, 95,101,110,101,114,103,121, 40,109, 97,116, 52, 32, 97,114,101, 97, 44, 32,
-118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,118,110, 41, 10,123, 10, 9,118,101, 99, 51, 32,118,101, 99, 91, 52, 93,
- 44, 32, 99, 91, 52, 93, 59, 10, 9,102,108,111, 97,116, 32,114, 97,100, 91, 52, 93, 44, 32,102, 97, 99, 59, 10, 9, 10, 9,118,
-101, 99, 91, 48, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 32, 45, 32, 97,114,101, 97, 91, 48, 93, 46,120,
-121,122, 41, 59, 10, 9,118,101, 99, 91, 49, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 32, 45, 32, 97,114,
-101, 97, 91, 49, 93, 46,120,121,122, 41, 59, 10, 9,118,101, 99, 91, 50, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,
- 99,111, 32, 45, 32, 97,114,101, 97, 91, 50, 93, 46,120,121,122, 41, 59, 10, 9,118,101, 99, 91, 51, 93, 32, 61, 32,110,111,114,
-109, 97,108,105,122,101, 40, 99,111, 32, 45, 32, 97,114,101, 97, 91, 51, 93, 46,120,121,122, 41, 59, 10, 10, 9, 99, 91, 48, 93,
- 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,118,101, 99, 91, 48, 93, 44, 32,118,101, 99, 91, 49,
- 93, 41, 41, 59, 10, 9, 99, 91, 49, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,118,101, 99,
- 91, 49, 93, 44, 32,118,101, 99, 91, 50, 93, 41, 41, 59, 10, 9, 99, 91, 50, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101,
- 40, 99,114,111,115,115, 40,118,101, 99, 91, 50, 93, 44, 32,118,101, 99, 91, 51, 93, 41, 41, 59, 10, 9, 99, 91, 51, 93, 32, 61,
- 32,110,111,114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,118,101, 99, 91, 51, 93, 44, 32,118,101, 99, 91, 48, 93, 41,
- 41, 59, 10, 10, 9,114, 97,100, 91, 48, 93, 32, 61, 32, 97, 99,111,115, 40,100,111,116, 40,118,101, 99, 91, 48, 93, 44, 32,118,
-101, 99, 91, 49, 93, 41, 41, 59, 10, 9,114, 97,100, 91, 49, 93, 32, 61, 32, 97, 99,111,115, 40,100,111,116, 40,118,101, 99, 91,
- 49, 93, 44, 32,118,101, 99, 91, 50, 93, 41, 41, 59, 10, 9,114, 97,100, 91, 50, 93, 32, 61, 32, 97, 99,111,115, 40,100,111,116,
- 40,118,101, 99, 91, 50, 93, 44, 32,118,101, 99, 91, 51, 93, 41, 41, 59, 10, 9,114, 97,100, 91, 51, 93, 32, 61, 32, 97, 99,111,
-115, 40,100,111,116, 40,118,101, 99, 91, 51, 93, 44, 32,118,101, 99, 91, 48, 93, 41, 41, 59, 10, 10, 9,102, 97, 99, 61, 32, 32,
-114, 97,100, 91, 48, 93, 42,100,111,116, 40,118,110, 44, 32, 99, 91, 48, 93, 41, 59, 10, 9,102, 97, 99, 43, 61, 32,114, 97,100,
- 91, 49, 93, 42,100,111,116, 40,118,110, 44, 32, 99, 91, 49, 93, 41, 59, 10, 9,102, 97, 99, 43, 61, 32,114, 97,100, 91, 50, 93,
- 42,100,111,116, 40,118,110, 44, 32, 99, 91, 50, 93, 41, 59, 10, 9,102, 97, 99, 43, 61, 32,114, 97,100, 91, 51, 93, 42,100,111,
-116, 40,118,110, 44, 32, 99, 91, 51, 93, 41, 59, 10, 10, 9,114,101,116,117,114,110, 32,109, 97,120, 40,102, 97, 99, 44, 32, 48,
- 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,105,110,112, 95, 97,114,101, 97, 40,118,101, 99, 51,
- 32,112,111,115,105,116,105,111,110, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111, 44, 32,118,101, 99, 51, 32,108, 97,109,
-112,118,101, 99, 44, 32,118,101, 99, 51, 32,118,110, 44, 32,109, 97,116, 52, 32, 97,114,101, 97, 44, 32,102,108,111, 97,116, 32,
- 97,114,101, 97,115,105,122,101, 44, 32,102,108,111, 97,116, 32,107, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,112,
- 41, 10,123, 10, 9,118,101, 99, 51, 32, 99,111, 32, 61, 32,112,111,115,105,116,105,111,110, 59, 10, 9,118,101, 99, 51, 32,118,
-101, 99, 32, 61, 32, 99,111, 32, 45, 32,108, 97,109,112, 99,111, 59, 10, 10, 9,105,102, 40,100,111,116, 40,118,101, 99, 44, 32,
-108, 97,109,112,118,101, 99, 41, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,105,110,112, 32, 61, 32, 48, 46, 48, 59, 10, 9,
-125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,102,108,111, 97,116, 32,105,110,116,101,110,115, 32, 61, 32, 97,114,101, 97, 95,
-108, 97,109,112, 95,101,110,101,114,103,121, 40, 97,114,101, 97, 44, 32, 99,111, 44, 32,118,110, 41, 59, 10, 10, 9, 9,105,110,
-112, 32, 61, 32,112,111,119, 40,105,110,116,101,110,115, 42, 97,114,101, 97,115,105,122,101, 44, 32,107, 41, 59, 10, 9,125, 10,
-125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115,101, 95,111,114,101,110, 95,110, 97,121,101,114,
- 40,102,108,111, 97,116, 32,110,108, 44, 32,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,
-118, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,115, 41, 10,123, 10,
- 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 32, 43, 32,108, 41, 59, 10, 9,102,108,111,
- 97,116, 32,110,104, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,104, 41, 44, 32, 48, 46, 48, 41, 59, 10, 9,102,108,
-111, 97,116, 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 41, 59, 10, 9,102,
-108,111, 97,116, 32,114,101, 97,108,110,108, 32, 61, 32,100,111,116, 40,110, 44, 32,108, 41, 59, 10, 10, 9,105,102, 40,114,101,
- 97,108,110,108, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,105,115, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,
-115,101, 32,105,102, 40,110,108, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,105,115, 32, 61, 32, 48, 46, 48, 59, 10, 9,125,
- 10, 9,101,108,115,101, 32,123, 10, 9, 9,102,108,111, 97,116, 32,118,104, 32, 61, 32,109, 97,120, 40,100,111,116, 40,118, 44,
- 32,104, 41, 44, 32, 48, 46, 48, 41, 59, 10, 9, 9,102,108,111, 97,116, 32, 76,105,116, 95, 65, 32, 61, 32, 97, 99,111,115, 40,
-114,101, 97,108,110,108, 41, 59, 10, 9, 9,102,108,111, 97,116, 32, 86,105,101,119, 95, 65, 32, 61, 32, 97, 99,111,115, 40,110,
-118, 41, 59, 10, 10, 9, 9,118,101, 99, 51, 32, 76,105,116, 95, 66, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108, 32,
- 45, 32,114,101, 97,108,110,108, 42,110, 41, 59, 10, 9, 9,118,101, 99, 51, 32, 86,105,101,119, 95, 66, 32, 61, 32,110,111,114,
-109, 97,108,105,122,101, 40,118, 32, 45, 32,110,118, 42,110, 41, 59, 10, 10, 9, 9,102,108,111, 97,116, 32,116, 32, 61, 32,109,
- 97,120, 40,100,111,116, 40, 76,105,116, 95, 66, 44, 32, 86,105,101,119, 95, 66, 41, 44, 32, 48, 46, 48, 41, 59, 10, 10, 9, 9,
-102,108,111, 97,116, 32, 97, 44, 32, 98, 59, 10, 10, 9, 9,105,102, 40, 76,105,116, 95, 65, 32, 62, 32, 86,105,101,119, 95, 65,
- 41, 32,123, 10, 9, 9, 9, 97, 32, 61, 32, 76,105,116, 95, 65, 59, 10, 9, 9, 9, 98, 32, 61, 32, 86,105,101,119, 95, 65, 59,
- 10, 9, 9,125, 10, 9, 9,101,108,115,101, 32,123, 10, 9, 9, 9, 97, 32, 61, 32, 86,105,101,119, 95, 65, 59, 10, 9, 9, 9,
- 98, 32, 61, 32, 76,105,116, 95, 65, 59, 10, 9, 9,125, 10, 10, 9, 9,102,108,111, 97,116, 32, 65, 32, 61, 32, 49, 46, 48, 32,
- 45, 32, 40, 48, 46, 53, 42, 40, 40,114,111,117,103,104, 42,114,111,117,103,104, 41, 47, 40, 40,114,111,117,103,104, 42,114,111,
-117,103,104, 41, 32, 43, 32, 48, 46, 51, 51, 41, 41, 41, 59, 10, 9, 9,102,108,111, 97,116, 32, 66, 32, 61, 32, 48, 46, 52, 53,
- 42, 40, 40,114,111,117,103,104, 42,114,111,117,103,104, 41, 47, 40, 40,114,111,117,103,104, 42,114,111,117,103,104, 41, 32, 43,
- 32, 48, 46, 48, 57, 41, 41, 59, 10, 10, 9, 9, 98, 32, 42, 61, 32, 48, 46, 57, 53, 59, 10, 9, 9,105,115, 32, 61, 32,110,108,
- 42, 40, 65, 32, 43, 32, 40, 66, 32, 42, 32,116, 32, 42, 32,115,105,110, 40, 97, 41, 32, 42, 32,116, 97,110, 40, 98, 41, 41, 41,
- 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115,101, 95,116,111,111,110, 40,
-118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,115,105,
-122,101, 44, 32,102,108,111, 97,116, 32,116,115,109,111,111,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,115, 41,
- 10,123, 10, 9,102,108,111, 97,116, 32,114,115,108,116, 32, 61, 32,100,111,116, 40,110, 44, 32,108, 41, 59, 10, 9,102,108,111,
- 97,116, 32, 97,110,103, 32, 61, 32, 97, 99,111,115, 40,114,115,108,116, 41, 59, 10, 10, 9,105,102, 40, 97,110,103, 32, 60, 32,
-115,105,122,101, 41, 32,105,115, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 97,110,103, 32, 62, 32, 40,
-115,105,122,101, 32, 43, 32,116,115,109,111,111,116,104, 41, 32,124,124, 32,116,115,109,111,111,116,104, 32, 61, 61, 32, 48, 46,
- 48, 41, 32,105,115, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,115, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40, 40,
- 97,110,103, 32, 45, 32,115,105,122,101, 41, 47,116,115,109,111,111,116,104, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104,
- 97,100,101, 95,100,105,102,102,117,115,101, 95,109,105,110,110, 97,101,114,116, 40,102,108,111, 97,116, 32,110,108, 44, 32,118,
-101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,100, 97,114,107,110,101,115,115, 44, 32,111,
-117,116, 32,102,108,111, 97,116, 32,105,115, 41, 10,123, 10, 9,105,102, 40,110,108, 32, 60, 61, 32, 48, 46, 48, 41, 32,123, 10,
- 9, 9,105,115, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,102,108,111, 97,116, 32,110,
-118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 41, 59, 10, 10, 9, 9,105,102, 40,100,
- 97,114,107,110,101,115,115, 32, 60, 61, 32, 49, 46, 48, 41, 10, 9, 9, 9,105,115, 32, 61, 32,110,108, 42,112,111,119, 40,109,
- 97,120, 40,110,118, 42,110,108, 44, 32, 48, 46, 49, 41, 44, 32,100, 97,114,107,110,101,115,115, 32, 45, 32, 49, 46, 48, 41, 59,
- 10, 9, 9,101,108,115,101, 10, 9, 9, 9,105,115, 32, 61, 32,110,108, 42,112,111,119, 40, 49, 46, 48, 48, 48, 49, 32, 45, 32,
-110,118, 44, 32,100, 97,114,107,110,101,115,115, 32, 45, 32, 49, 46, 48, 41, 59, 10, 9,125, 10,125, 10, 10,102,108,111, 97,116,
- 32,102,114,101,115,110,101,108, 95,102, 97, 99, 40,118,101, 99, 51, 32,118,105,101,119, 44, 32,118,101, 99, 51, 32,118,110, 44,
- 32,102,108,111, 97,116, 32,103,114, 97,100, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 41, 10,123, 10, 9,102,108,111, 97,116,
- 32,116, 49, 44, 32,116, 50, 59, 10, 9,102,108,111, 97,116, 32,102,102, 97, 99, 59, 10, 10, 9,105,102, 40,102, 97, 99, 61, 61,
- 48, 46, 48, 41, 32,123, 10, 9, 9,102,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10,
- 9, 9,116, 49, 61, 32,100,111,116, 40,118,105,101,119, 44, 32,118,110, 41, 59, 10, 9, 9,105,102, 40,116, 49, 62, 48, 46, 48,
- 41, 32, 32,116, 50, 61, 32, 49, 46, 48, 43,116, 49, 59, 10, 9, 9,101,108,115,101, 32,116, 50, 61, 32, 49, 46, 48, 45,116, 49,
- 59, 10, 10, 9, 9,116, 50, 61, 32,103,114, 97,100, 32, 43, 32, 40, 49, 46, 48, 45,103,114, 97,100, 41, 42,112,111,119, 40,116,
- 50, 44, 32,102, 97, 99, 41, 59, 10, 10, 9, 9,105,102, 40,116, 50, 60, 48, 46, 48, 41, 32,102,102, 97, 99, 32, 61, 32, 48, 46,
- 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40,116, 50, 62, 49, 46, 48, 41, 32,102,102, 97, 99, 32, 61, 32, 49, 46, 48, 59,
- 10, 9, 9,101,108,115,101, 32,102,102, 97, 99, 32, 61, 32,116, 50, 59, 10, 9,125, 10, 10, 9,114,101,116,117,114,110, 32,102,
-102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115,101, 95,102,114,101,115,110,
-101,108, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,
-102,108,111, 97,116, 32,102, 97, 99, 95,105, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,
-116, 32,105,115, 41, 10,123, 10, 9,105,115, 32, 61, 32,102,114,101,115,110,101,108, 95,102, 97, 99, 40,108,118, 44, 32,118,110,
- 44, 32,102, 97, 99, 95,105, 44, 32,102, 97, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 99,117, 98,
-105, 99, 40,102,108,111, 97,116, 32,105,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,105,115, 41, 10,123, 10,
- 9,105,102, 40,105,115, 62, 48, 46, 48, 32, 38, 38, 32,105,115, 60, 49, 46, 48, 41, 10, 9, 9,111,117,116,105,115, 61, 32,115,
-109,111,111,116,104,115,116,101,112, 40, 48, 46, 48, 44, 32, 49, 46, 48, 44, 32,105,115, 41, 59, 10, 9,101,108,115,101, 10, 9,
- 9,111,117,116,105,115, 61, 32,105,115, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,118,105,115,105,102, 97,
- 99, 40,102,108,111, 97,116, 32,105, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,102,108,111, 97,116, 32,
-114,101,102,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,105, 41, 10,123, 10, 9, 47, 42,105,102, 40,105, 32,
- 62, 32, 48, 46, 48, 41, 42, 47, 10, 9, 9,111,117,116,105, 32, 61, 32,109, 97,120, 40,105, 42,118,105,115,105,102, 97, 99, 42,
-114,101,102,108, 44, 32, 48, 46, 48, 41, 59, 10, 9, 47, 42,101,108,115,101, 10, 9, 9,111,117,116,105, 32, 61, 32,105, 59, 42,
- 47, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,116, 97,110,103,101,110,116, 95,118, 95,115,112,101, 99, 40,118,
-101, 99, 51, 32,116, 97,110,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,110, 41, 10,123, 10, 9,118,110, 32, 61, 32,116,
- 97,110,103, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,100,100, 95,116,111, 95,100,105,102,102,117,115,
-101, 40,102,108,111, 97,116, 32,105, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111,108, 44, 32,118,101, 99, 51, 32, 99,111,
-108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,105,102, 40,105, 32, 62, 32, 48, 46,
- 48, 41, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,105, 42,108, 97,109,112, 99,111,108, 42, 99,111,108, 59, 10, 9,101,108,
-115,101, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48,
- 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,104,101,109,105, 95,115,112,101, 99, 40,118,101, 99, 51, 32,
-118,110, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,102,108,111, 97,116, 32,115,112,
-101, 99, 44, 32,102,108,111, 97,116, 32,104, 97,114,100, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,111,
-117,116, 32,102,108,111, 97,116, 32,116, 41, 10,123, 10, 9,108,118, 32, 43, 61, 32,118,105,101,119, 59, 10, 9,108,118, 32, 61,
- 32,110,111,114,109, 97,108,105,122,101, 40,108,118, 41, 59, 10, 10, 9,116, 32, 61, 32,100,111,116, 40,118,110, 44, 32,108,118,
- 41, 59, 10, 9,116, 32, 61, 32, 48, 46, 53, 42,116, 32, 43, 32, 48, 46, 53, 59, 10, 10, 9,116, 32, 61, 32,118,105,115,105,102,
- 97, 99, 42,115,112,101, 99, 42,112,111,119, 40,116, 44, 32,104, 97,114,100, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104,
- 97,100,101, 95,112,104,111,110,103, 95,115,112,101, 99, 40,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,
-101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,104, 97,114,100, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101,
- 99,102, 97, 99, 41, 10,123, 10, 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108, 32, 43, 32,
-118, 41, 59, 10, 9,102,108,111, 97,116, 32,114,115,108,116, 32, 61, 32,109, 97,120, 40,100,111,116, 40,104, 44, 32,110, 41, 44,
- 32, 48, 46, 48, 41, 59, 10, 10, 9,115,112,101, 99,102, 97, 99, 32, 61, 32,112,111,119, 40,114,115,108,116, 44, 32,104, 97,114,
-100, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 99,111,111,107,116,111,114,114, 95,115,112,101, 99, 40,
-118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,104, 97,
-114,100, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10, 9,118,101, 99, 51, 32,104,
- 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 32, 43, 32,108, 41, 59, 10, 9,102,108,111, 97,116, 32,110,104, 32, 61,
- 32,100,111,116, 40,110, 44, 32,104, 41, 59, 10, 10, 9,105,102, 40,110,104, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,115,
-112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,102,108,111, 97,116,
- 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 41, 59, 10, 9, 9,102,108,111,
- 97,116, 32,105, 32, 61, 32,112,111,119, 40,110,104, 44, 32,104, 97,114,100, 41, 59, 10, 10, 9, 9,105, 32, 61, 32,105, 47, 40,
- 48, 46, 49, 43,110,118, 41, 59, 10, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32,105, 59, 10, 9,125, 10,125, 10, 10,118,111,
-105,100, 32,115,104, 97,100,101, 95, 98,108,105,110,110, 95,115,112,101, 99, 40,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51,
- 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,114,101,102,114, 97, 99, 44, 32,102,108,111, 97,116, 32,
-115,112,101, 99, 95,112,111,119,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123,
- 10, 9,105,102, 40,114,101,102,114, 97, 99, 32, 60, 32, 49, 46, 48, 41, 32,123, 10, 9, 9,115,112,101, 99,102, 97, 99, 32, 61,
- 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,105,102, 40,115,112,101, 99, 95,112,111,119,101,114, 32, 61, 61, 32,
- 48, 46, 48, 41, 32,123, 10, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101,
- 32,123, 10, 9, 9,105,102, 40,115,112,101, 99, 95,112,111,119,101,114, 60, 49, 48, 48, 46, 48, 41, 10, 9, 9, 9,115,112,101,
- 99, 95,112,111,119,101,114, 61, 32,115,113,114,116, 40, 49, 46, 48, 47,115,112,101, 99, 95,112,111,119,101,114, 41, 59, 10, 9,
- 9,101,108,115,101, 10, 9, 9, 9,115,112,101, 99, 95,112,111,119,101,114, 61, 32, 49, 48, 46, 48, 47,115,112,101, 99, 95,112,
-111,119,101,114, 59, 10, 10, 9, 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 32, 43, 32,
-108, 41, 59, 10, 9, 9,102,108,111, 97,116, 32,110,104, 32, 61, 32,100,111,116, 40,110, 44, 32,104, 41, 59, 10, 9, 9,105,102,
- 40,110,104, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9,
- 9,125, 10, 9, 9,101,108,115,101, 32,123, 10, 9, 9, 9,102,108,111, 97,116, 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,
-116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 49, 41, 59, 10, 9, 9, 9,102,108,111, 97,116, 32,110,108, 32, 61, 32,100,111,
-116, 40,110, 44, 32,108, 41, 59, 10, 9, 9, 9,105,102, 40,110,108, 32, 60, 61, 32, 48, 46, 48, 49, 41, 32,123, 10, 9, 9, 9,
- 9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9, 9,125, 10, 9, 9, 9,101,108,115,101, 32,123, 10, 9,
- 9, 9, 9,102,108,111, 97,116, 32,118,104, 32, 61, 32,109, 97,120, 40,100,111,116, 40,118, 44, 32,104, 41, 44, 32, 48, 46, 48,
- 49, 41, 59, 10, 10, 9, 9, 9, 9,102,108,111, 97,116, 32, 97, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9, 9, 9,102,108,111, 97,
-116, 32, 98, 32, 61, 32, 40, 50, 46, 48, 42,110,104, 42,110,118, 41, 47,118,104, 59, 10, 9, 9, 9, 9,102,108,111, 97,116, 32,
- 99, 32, 61, 32, 40, 50, 46, 48, 42,110,104, 42,110,108, 41, 47,118,104, 59, 10, 10, 9, 9, 9, 9,102,108,111, 97,116, 32,103,
- 32, 61, 32, 48, 46, 48, 59, 10, 10, 9, 9, 9, 9,105,102, 40, 97, 32, 60, 32, 98, 32, 38, 38, 32, 97, 32, 60, 32, 99, 41, 32,
-103, 32, 61, 32, 97, 59, 10, 9, 9, 9, 9,101,108,115,101, 32,105,102, 40, 98, 32, 60, 32, 97, 32, 38, 38, 32, 98, 32, 60, 32,
- 99, 41, 32,103, 32, 61, 32, 98, 59, 10, 9, 9, 9, 9,101,108,115,101, 32,105,102, 40, 99, 32, 60, 32, 97, 32, 38, 38, 32, 99,
- 32, 60, 32, 98, 41, 32,103, 32, 61, 32, 99, 59, 10, 10, 9, 9, 9, 9,102,108,111, 97,116, 32,112, 32, 61, 32,115,113,114,116,
- 40, 40, 40,114,101,102,114, 97, 99, 32, 42, 32,114,101,102,114, 97, 99, 41, 43, 40,118,104, 42,118,104, 41, 45, 49, 46, 48, 41,
- 41, 59, 10, 9, 9, 9, 9,102,108,111, 97,116, 32,102, 32, 61, 32, 40, 40, 40,112, 45,118,104, 41, 42, 40,112, 45,118,104, 41,
- 41, 47, 40, 40,112, 43,118,104, 41, 42, 40,112, 43,118,104, 41, 41, 41, 42, 40, 49, 46, 48, 43, 40, 40, 40, 40,118,104, 42, 40,
-112, 43,118,104, 41, 41, 45, 49, 46, 48, 41, 42, 40, 40,118,104, 42, 40,112, 43,118,104, 41, 41, 45, 49, 46, 48, 41, 41, 47, 40,
- 40, 40,118,104, 42, 40,112, 45,118,104, 41, 41, 43, 49, 46, 48, 41, 42, 40, 40,118,104, 42, 40,112, 45,118,104, 41, 41, 43, 49,
- 46, 48, 41, 41, 41, 41, 59, 10, 9, 9, 9, 9,102,108,111, 97,116, 32, 97,110,103, 32, 61, 32, 97, 99,111,115, 40,110,104, 41,
- 59, 10, 10, 9, 9, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32,109, 97,120, 40,102, 42,103, 42,101,120,112, 95, 98,108,101,
-110,100,101,114, 40, 40, 45, 40, 97,110,103, 42, 97,110,103, 41, 47, 40, 50, 46, 48, 42,115,112,101, 99, 95,112,111,119,101,114,
- 42,115,112,101, 99, 95,112,111,119,101,114, 41, 41, 41, 44, 32, 48, 46, 48, 41, 59, 10, 9, 9, 9,125, 10, 9, 9,125, 10, 9,
-125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,119, 97,114,100,105,115,111, 95,115,112,101, 99, 40,118,101, 99,
- 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,114,109,115, 44, 32,
-111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10, 9,118,101, 99, 51, 32,104, 32, 61, 32,110,
-111,114,109, 97,108,105,122,101, 40,108, 32, 43, 32,118, 41, 59, 10, 9,102,108,111, 97,116, 32,110,104, 32, 61, 32,109, 97,120,
- 40,100,111,116, 40,110, 44, 32,104, 41, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10, 9,102,108,111, 97,116, 32,110,118, 32, 61, 32,
-109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10, 9,102,108,111, 97,116, 32,110,108,
- 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,108, 41, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10, 9,102,108,111, 97,116,
- 32, 97,110,103,108,101, 32, 61, 32,116, 97,110, 40, 97, 99,111,115, 40,110,104, 41, 41, 59, 10, 9,102,108,111, 97,116, 32, 97,
-108,112,104, 97, 32, 61, 32,109, 97,120, 40,114,109,115, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10, 10, 9,115,112,101, 99,102, 97,
- 99, 61, 32,110,108, 32, 42, 32, 40, 49, 46, 48, 47, 40, 52, 46, 48, 42, 77, 95, 80, 73, 42, 97,108,112,104, 97, 42, 97,108,112,
-104, 97, 41, 41, 42, 40,101,120,112, 95, 98,108,101,110,100,101,114, 40, 45, 40, 97,110,103,108,101, 42, 97,110,103,108,101, 41,
- 47, 40, 97,108,112,104, 97, 42, 97,108,112,104, 97, 41, 41, 47, 40,115,113,114,116, 40,110,118, 42,110,108, 41, 41, 41, 59, 10,
-125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,116,111,111,110, 95,115,112,101, 99, 40,118,101, 99, 51, 32,110, 44, 32,
-118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,115,105,122,101, 44, 32,102,108,111, 97,
-116, 32,116,115,109,111,111,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10,
- 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108, 32, 43, 32,118, 41, 59, 10, 9,102,108,111,
- 97,116, 32,114,115,108,116, 32, 61, 32,100,111,116, 40,104, 44, 32,110, 41, 59, 10, 9,102,108,111, 97,116, 32, 97,110,103, 32,
- 61, 32, 97, 99,111,115, 40,114,115,108,116, 41, 59, 10, 10, 9,105,102, 40, 97,110,103, 32, 60, 32,115,105,122,101, 41, 32,114,
-115,108,116, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 97,110,103, 32, 62, 61, 32, 40,115,105,122,101,
- 32, 43, 32,116,115,109,111,111,116,104, 41, 32,124,124, 32,116,115,109,111,111,116,104, 32, 61, 61, 32, 48, 46, 48, 41, 32,114,
-115,108,116, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,114,115,108,116, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40, 40,
- 97,110,103, 32, 45, 32,115,105,122,101, 41, 47,116,115,109,111,111,116,104, 41, 59, 10, 10, 9,115,112,101, 99,102, 97, 99, 32,
- 61, 32,114,115,108,116, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,115,112,101, 99, 95, 97,114,101, 97, 95,
-105,110,112, 40,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 44, 32,102,108,111, 97,116, 32,105,110,112, 44, 32,111,117,
-116, 32,102,108,111, 97,116, 32,111,117,116,115,112,101, 99,102, 97, 99, 41, 10,123, 10, 9,111,117,116,115,112,101, 99,102, 97,
- 99, 32, 61, 32,115,112,101, 99,102, 97, 99, 42,105,110,112, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,115,
-112,101, 99, 95,116, 40,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,102,108,111, 97,116, 32,115,112,101, 99, 44,
- 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 44, 32,111,
-117,116, 32,102,108,111, 97,116, 32,116, 41, 10,123, 10, 9,116, 32, 61, 32,115,104, 97,100,102, 97, 99, 42,115,112,101, 99, 42,
-118,105,115,105,102, 97, 99, 42,115,112,101, 99,102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,
-100,100, 95,115,112,101, 99, 40,102,108,111, 97,116, 32,116, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111,108, 44, 32,118,
-101, 99, 51, 32,115,112,101, 99, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10,
- 9,111,117,116, 99,111,108, 32, 61, 32,116, 42,108, 97,109,112, 99,111,108, 42,115,112,101, 99, 99,111,108, 59, 10,125, 10, 10,
-118,111,105,100, 32,115,104, 97,100,101, 95, 97,100,100, 40,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,
-111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32,
- 61, 32, 99,111,108, 49, 32, 43, 32, 99,111,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109, 97,100,
+ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 10, 9, 9,118,101, 99, 52, 32,118, 83, 97,109,112,108,101,115, 85, 76, 32, 61, 32,116,
+101,120,116,117,114,101, 71, 97,116,104,101,114, 40,105,109, 97, 44, 32, 40,105, 84,101,120, 76,111, 99, 43,105,118,101, 99, 50,
+ 40, 45, 49, 44, 45, 49, 41, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 48, 46, 53, 41, 41, 47,118, 68,105,109, 32, 41, 59,
+ 10, 9, 9,118,101, 99, 52, 32,118, 83, 97,109,112,108,101,115, 85, 82, 32, 61, 32,116,101,120,116,117,114,101, 71, 97,116,104,
+101,114, 40,105,109, 97, 44, 32, 40,105, 84,101,120, 76,111, 99, 43,105,118,101, 99, 50, 40, 49, 44, 45, 49, 41, 32, 43, 32,118,
+101, 99, 50, 40, 48, 46, 53, 44, 48, 46, 53, 41, 41, 47,118, 68,105,109, 32, 41, 59, 10, 9, 9,118,101, 99, 52, 32,118, 83, 97,
+109,112,108,101,115, 76, 76, 32, 61, 32,116,101,120,116,117,114,101, 71, 97,116,104,101,114, 40,105,109, 97, 44, 32, 40,105, 84,
+101,120, 76,111, 99, 43,105,118,101, 99, 50, 40, 45, 49, 44, 49, 41, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 48, 46, 53,
+ 41, 41, 47,118, 68,105,109, 32, 41, 59, 10, 9, 9,118,101, 99, 52, 32,118, 83, 97,109,112,108,101,115, 76, 82, 32, 61, 32,116,
+101,120,116,117,114,101, 71, 97,116,104,101,114, 40,105,109, 97, 44, 32, 40,105, 84,101,120, 76,111, 99, 43,105,118,101, 99, 50,
+ 40, 49, 44, 49, 41, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 48, 46, 53, 41, 41, 47,118, 68,105,109, 32, 41, 59, 10, 10,
+ 9, 9,109, 97,116, 52, 32, 72, 32, 61, 32,109, 97,116, 52, 40,118, 83, 97,109,112,108,101,115, 85, 76, 46,119, 44, 32,118, 83,
+ 97,109,112,108,101,115, 85, 76, 46,120, 44, 32,118, 83, 97,109,112,108,101,115, 76, 76, 46,119, 44, 32,118, 83, 97,109,112,108,
+101,115, 76, 76, 46,120, 44, 10, 9, 9, 9, 9, 9,118, 83, 97,109,112,108,101,115, 85, 76, 46,122, 44, 32,118, 83, 97,109,112,
+108,101,115, 85, 76, 46,121, 44, 32,118, 83, 97,109,112,108,101,115, 76, 76, 46,122, 44, 32,118, 83, 97,109,112,108,101,115, 76,
+ 76, 46,121, 44, 10, 9, 9, 9, 9, 9,118, 83, 97,109,112,108,101,115, 85, 82, 46,119, 44, 32,118, 83, 97,109,112,108,101,115,
+ 85, 82, 46,120, 44, 32,118, 83, 97,109,112,108,101,115, 76, 82, 46,119, 44, 32,118, 83, 97,109,112,108,101,115, 76, 82, 46,120,
+ 44, 10, 9, 9, 9, 9, 9,118, 83, 97,109,112,108,101,115, 85, 82, 46,122, 44, 32,118, 83, 97,109,112,108,101,115, 85, 82, 46,
+121, 44, 32,118, 83, 97,109,112,108,101,115, 76, 82, 46,122, 44, 32,118, 83, 97,109,112,108,101,115, 76, 82, 46,121, 41, 59, 10,
+ 42, 47, 9, 10, 9, 9,105,118,101, 99, 50, 32,105, 84,101,120, 76,111, 99, 77,111,100, 32, 61, 32,105, 84,101,120, 76,111, 99,
+ 32, 43, 32,105,118,101, 99, 50, 40, 45, 49, 44, 32, 45, 49, 41, 59, 10, 10, 9, 9,109, 97,116, 52, 32, 72, 59, 10, 9, 9, 10,
+ 9, 9,102,111,114, 40,105,110,116, 32,105, 32, 61, 32, 48, 59, 32,105, 32, 60, 32, 52, 59, 32,105, 43, 43, 41,123, 10, 9, 9,
+ 9,102,111,114, 40,105,110,116, 32,106, 32, 61, 32, 48, 59, 32,106, 32, 60, 32, 52, 59, 32,106, 43, 43, 41,123, 10, 9, 9, 9,
+ 9,105,118,101, 99, 50, 32,105, 84,101,120, 84,109,112, 32, 61, 32,105, 84,101,120, 76,111, 99, 77,111,100, 32, 43, 32,105,118,
+101, 99, 50, 40,105, 44,106, 41, 59, 10, 9, 9, 9, 9, 10, 9, 9, 9, 9, 47, 47, 32,119,114, 97,112, 32,116,101,120,116,117,
+114,101, 32, 99,111,111,114,100,105,110, 97,116,101,115, 32,109, 97,110,117, 97,108,108,121, 32,102,111,114, 32,116,101,120,101,
+108, 70,101,116, 99,104, 32,116,111, 32,119,111,114,107, 32,111,110, 32,117,118,115, 32,111,105,116,115,105,100,101, 32,116,104,
+101, 32, 48, 44, 49, 32,114, 97,110,103,101, 46, 10, 9, 9, 9, 9, 47, 47, 32,116,104,105,115, 32,105,115, 32,103,117, 97,114,
+ 97,110,116,101,101,100, 32,116,111, 32,119,111,114,107, 32,115,105,110, 99,101, 32,119,101, 32,116, 97,107,101, 32,116,104,101,
+ 32,102,114, 97, 99,116,105,111,110, 97,108, 32,112, 97,114,116, 32,111,102, 32,116,104,101, 32,117,118, 32, 97, 98,111,118,101,
+ 46, 10, 9, 9, 9, 9,105, 84,101,120, 84,109,112, 46,120, 32, 61, 32, 40,105, 84,101,120, 84,109,112, 46,120, 32, 60, 32, 48,
+ 41, 63, 32,105, 84,101,120, 84,109,112, 46,120, 32, 43, 32,118, 68,105,109, 46,120, 32, 58, 32, 40, 40,105, 84,101,120, 84,109,
+112, 46,120, 32, 62, 61, 32,118, 68,105,109, 46,120, 41, 63, 32,105, 84,101,120, 84,109,112, 46,120, 32, 45, 32,118, 68,105,109,
+ 46,120, 32, 58, 32,105, 84,101,120, 84,109,112, 46,120, 41, 59, 10, 9, 9, 9, 9,105, 84,101,120, 84,109,112, 46,121, 32, 61,
+ 32, 40,105, 84,101,120, 84,109,112, 46,121, 32, 60, 32, 48, 41, 63, 32,105, 84,101,120, 84,109,112, 46,121, 32, 43, 32,118, 68,
+105,109, 46,121, 32, 58, 32, 40, 40,105, 84,101,120, 84,109,112, 46,121, 32, 62, 61, 32,118, 68,105,109, 46,121, 41, 63, 32,105,
+ 84,101,120, 84,109,112, 46,121, 32, 45, 32,118, 68,105,109, 46,121, 32, 58, 32,105, 84,101,120, 84,109,112, 46,121, 41, 59, 10,
+ 10, 9, 9, 9, 9,114,103, 98,116,111, 98,119, 40,116,101,120,101,108, 70,101,116, 99,104, 40,105,109, 97, 44, 32,105, 84,101,
+120, 84,109,112, 44, 32, 48, 41, 44, 32, 72, 91,105, 93, 91,106, 93, 41, 59, 10, 9, 9, 9,125, 10, 9, 9,125, 10, 9, 9, 10,
+ 9, 9,102,108,111, 97,116, 32,120, 32, 61, 32,116, 46,120, 44, 32,121, 32, 61, 32,116, 46,121, 59, 10, 9, 9,102,108,111, 97,
+116, 32,120, 50, 32, 61, 32,120, 32, 42, 32,120, 44, 32,120, 51, 32, 61, 32,120, 50, 32, 42, 32,120, 44, 32,121, 50, 32, 61, 32,
+121, 32, 42, 32,121, 44, 32,121, 51, 32, 61, 32,121, 50, 32, 42, 32,121, 59, 10, 10, 9, 9,118,101, 99, 52, 32, 88, 32, 61, 32,
+118,101, 99, 52, 40, 45, 48, 46, 53, 42, 40,120, 51, 43,120, 41, 43,120, 50, 44, 9, 9, 49, 46, 53, 42,120, 51, 45, 50, 46, 53,
+ 42,120, 50, 43, 49, 44, 9, 45, 49, 46, 53, 42,120, 51, 43, 50, 42,120, 50, 43, 48, 46, 53, 42,120, 44, 9, 9, 48, 46, 53, 42,
+ 40,120, 51, 45,120, 50, 41, 41, 59, 10, 9, 9,118,101, 99, 52, 32, 89, 32, 61, 32,118,101, 99, 52, 40, 45, 48, 46, 53, 42, 40,
+121, 51, 43,121, 41, 43,121, 50, 44, 9, 9, 49, 46, 53, 42,121, 51, 45, 50, 46, 53, 42,121, 50, 43, 49, 44, 9, 45, 49, 46, 53,
+ 42,121, 51, 43, 50, 42,121, 50, 43, 48, 46, 53, 42,121, 44, 9, 9, 48, 46, 53, 42, 40,121, 51, 45,121, 50, 41, 41, 59, 10, 9,
+ 9,118,101, 99, 52, 32,100, 88, 32, 61, 32,118,101, 99, 52, 40, 45, 49, 46, 53, 42,120, 50, 43, 50, 42,120, 45, 48, 46, 53, 44,
+ 9, 9, 52, 46, 53, 42,120, 50, 45, 53, 42,120, 44, 9, 9, 9, 45, 52, 46, 53, 42,120, 50, 43, 52, 42,120, 43, 48, 46, 53, 44,
+ 9, 9, 49, 46, 53, 42,120, 50, 45,120, 41, 59, 10, 9, 9,118,101, 99, 52, 32,100, 89, 32, 61, 32,118,101, 99, 52, 40, 45, 49,
+ 46, 53, 42,121, 50, 43, 50, 42,121, 45, 48, 46, 53, 44, 9, 9, 52, 46, 53, 42,121, 50, 45, 53, 42,121, 44, 9, 9, 9, 45, 52,
+ 46, 53, 42,121, 50, 43, 52, 42,121, 43, 48, 46, 53, 44, 9, 9, 49, 46, 53, 42,121, 50, 45,121, 41, 59, 10, 9, 10, 9, 9, 47,
+ 47, 32, 99,111,109,112,108,101,116,101, 32,100,101,114,105,118, 97,116,105,118,101, 32,105,110, 32,110,111,114,109, 97,108,105,
+122,101,100, 32, 99,111,111,114,100,105,110, 97,116,101,115, 32, 40,109,117,108, 32, 98,121, 32,118, 68,105,109, 41, 10, 9, 9,
+118,101, 99, 50, 32,100, 72,100, 83, 84, 32, 61, 32,118, 68,105,109, 32, 42, 32,118,101, 99, 50, 40,100,111,116, 40, 89, 44, 32,
+ 72, 32, 42, 32,100, 88, 41, 44, 32,100,111,116, 40,100, 89, 44, 32, 72, 32, 42, 32, 88, 41, 41, 59, 10, 10, 9, 9, 47, 47, 32,
+116,114, 97,110,115,102,111,114,109, 32,100,101,114,105,118, 97,116,105,118,101, 32,116,111, 32,115, 99,114,101,101,110, 45,115,
+112, 97, 99,101, 10, 9, 9,118,101, 99, 50, 32,100, 72,100,120,121, 95, 98,105, 99,117, 98,105, 99, 32, 61, 32,118,101, 99, 50,
+ 40, 32,100, 72,100, 83, 84, 46,120, 32, 42, 32, 84,101,120, 68,120, 46,120, 32, 43, 32,100, 72,100, 83, 84, 46,121, 32, 42, 32,
+ 84,101,120, 68,120, 46,121, 44, 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,100, 72,100, 83, 84, 46,120, 32, 42, 32, 84,101,
+120, 68,121, 46,120, 32, 43, 32,100, 72,100, 83, 84, 46,121, 32, 42, 32, 84,101,120, 68,121, 46,121, 32, 41, 59, 10, 10, 9, 9,
+ 47, 47, 32, 98,108,101,110,100, 32, 98,101,116,119,101,101,110, 32,116,104,101, 32,116,119,111, 10, 9, 9,100, 72,100,120,121,
+ 32, 61, 32,100, 72,100,120,121, 42, 40, 49, 45,102, 66,108,101,110,100, 41, 32, 43, 32,100, 72,100,120,121, 95, 98,105, 99,117,
+ 98,105, 99, 42,102, 66,108,101,110,100, 59, 10, 9,125, 10, 10, 9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32,
+100, 72,100,120,121, 46,120, 59, 10, 9,100, 66,116, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32,100, 72,100,120,121, 46,121,
+ 59, 10,125, 10, 10, 35,101,110,100,105,102, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,116, 97,112, 53,
+ 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111,
+ 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32,
+ 10,123, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 59,
+ 10, 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 10,
+ 9,118,101, 99, 50, 32, 83, 84, 99, 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10, 9,118,101, 99, 50, 32, 83, 84,108, 32,
+ 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10, 9,118,101, 99, 50,
+ 32, 83, 84,114, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10,
+ 9,118,101, 99, 50, 32, 83, 84,100, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120,
+ 68,121, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,117, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32,
+ 42, 32, 84,101,120, 68,121, 32, 59, 10, 9, 10, 9,102,108,111, 97,116, 32, 72, 99, 44, 72,108, 44, 72,114, 44, 72,100, 44, 72,
+117, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84, 99, 41,
+ 44, 32, 72, 99, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44,
+ 32, 83, 84,108, 41, 44, 32, 72,108, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68,
+ 40,105,109, 97, 44, 32, 83, 84,114, 41, 44, 32, 72,114, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,
+117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,100, 41, 44, 32, 72,100, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40,
+ 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,117, 41, 44, 32, 72,117, 32, 41, 59, 10, 9, 10, 9,100,
+ 66,115, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,114, 32, 45, 32, 72,108, 41, 59, 10, 9,100, 66,116, 32, 61, 32,
+104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,117, 32, 45, 32, 72,100, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120,
+ 95, 98,117,109,112, 95,100,101,114,105,118, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114,
+ 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,120, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,121,
+ 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100,
+ 66,116, 32, 41, 32, 10,123, 10, 9,102,108,111, 97,116, 32,115, 32, 61, 32, 49, 46, 48, 59, 9, 9, 47, 47, 32,110,101,103, 97,
+116,101, 32,116,104,105,115, 32,105,102, 32,102,108,105,112,112,101,100, 32,116,101,120,116,117,114,101, 32, 99,111,111,114,100,
+105,110, 97,116,101, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,
+121, 41, 59, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41,
+ 59, 10, 9, 10, 9, 47, 47, 32,116,104,105,115, 32,118, 97,114,105, 97,110,116, 32,117,115,105,110,103, 32, 97, 32,100,101,114,
+105,118, 97,116,105,118,101, 32,109, 97,112, 32,105,115, 32,100,101,115, 99,114,105, 98,101,100, 32,104,101,114,101, 10, 9, 47,
+ 47, 32,104,116,116,112, 58, 47, 47,109,109,105,107,107,101,108,115,101,110, 51,100, 46, 98,108,111,103,115,112,111,116, 46, 99,
+111,109, 47, 50, 48, 49, 49, 47, 48, 55, 47,100,101,114,105,118, 97,116,105,118,101, 45,109, 97,112,115, 46,104,116,109,108, 10,
+ 9,118,101, 99, 50, 32,100,105,109, 32, 61, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 44, 32,105,109, 97, 95,121, 41, 59, 10,
+ 9,118,101, 99, 50, 32,100, 66,100,117,118, 32, 61, 32,104, 83, 99, 97,108,101, 42,100,105,109, 42, 40, 50, 46, 48, 42,116,101,
+120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 46,120,121, 45, 49, 46, 48, 41, 59, 10,
+ 9, 10, 9,100, 66,115, 32, 61, 32,100, 66,100,117,118, 46,120, 42, 84,101,120, 68,120, 46,120, 32, 43, 32,115, 42,100, 66,100,
+117,118, 46,121, 42, 84,101,120, 68,120, 46,121, 59, 10, 9,100, 66,116, 32, 61, 32,100, 66,100,117,118, 46,120, 42, 84,101,120,
+ 68,121, 46,120, 32, 43, 32,115, 42,100, 66,100,117,118, 46,121, 42, 84,101,120, 68,121, 46,121, 59, 10,125, 10, 10,118,111,105,
+100, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 40, 32,102,108,111, 97,116, 32,102, 68,101,116, 44, 32,102,
+108,111, 97,116, 32,100, 66,115, 44, 32,102,108,111, 97,116, 32,100, 66,116, 44, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,118,
+101, 99, 51, 32,118, 82, 50, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 32, 32,111,
+117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,112,101,114,116,
+117,114, 98,101,100, 95,110,111,114,109, 32, 41, 32, 10,123, 10, 9,118,101, 99, 51, 32,118, 83,117,114,102, 71,114, 97,100, 32,
+ 61, 32,115,105,103,110, 40,102, 68,101,116, 41, 32, 42, 32, 40, 32,100, 66,115, 32, 42, 32,118, 82, 49, 32, 43, 32,100, 66,116,
+ 32, 42, 32,118, 82, 50, 32, 41, 59, 10, 9, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,
+110, 32, 45, 32,118, 83,117,114,102, 71,114, 97,100, 59, 10, 9,112,101,114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 61,
+ 32,110,111,114,109, 97,108,105,122,101, 40, 32,118, 78, 97, 99, 99, 95,111,117,116, 32, 41, 59, 10,125, 10, 10,118,111,105,100,
+ 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 95,116,101,120,115,112, 97, 99,101, 40, 32,102,108,111, 97,116,
+ 32,102, 68,101,116, 44, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,102,108,111, 97,116, 32,100, 66,116, 44, 32,118,101, 99,
+ 51, 32,118, 82, 49, 44, 32,118,101, 99, 51, 32,118, 82, 50, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,118,
+101, 99, 51, 32,116,101,120, 99,111, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,120, 44, 32,102,108,111, 97,116, 32,105,109,
+ 97, 95,121, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,111,117,
+116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,112,101,114,116,117,
+114, 98,101,100, 95,110,111,114,109, 32, 41, 32, 10,123, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,
+120, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,
+116,101,120, 99,111, 46,120,121, 41, 59, 10, 10, 9,118,101, 99, 51, 32,118, 83,117,114,102, 71,114, 97,100, 32, 61, 32,115,105,
+103,110, 40,102, 68,101,116, 41, 32, 42, 32, 40, 32, 10, 9, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,100, 66,115, 32, 47,
+ 32,108,101,110,103,116,104, 40, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 42, 84,101,120, 68,120, 46,120, 44, 32,105,109, 97,
+ 95,121, 42, 84,101,120, 68,120, 46,121, 41, 32, 41, 32, 42, 32,118, 82, 49, 32, 43, 32, 10, 9, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32,100, 66,116, 32, 47, 32,108,101,110,103,116,104, 40, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 42, 84,101,120,
+ 68,121, 46,120, 44, 32,105,109, 97, 95,121, 42, 84,101,120, 68,121, 46,121, 41, 32, 41, 32, 42, 32,118, 82, 50, 32, 41, 59, 10,
+ 9, 9, 9, 9, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 45, 32,118, 83,117,
+114,102, 71,114, 97,100, 59, 10, 9,112,101,114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 61, 32,110,111,114,109, 97,108,
+105,122,101, 40, 32,118, 78, 97, 99, 99, 95,111,117,116, 32, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,110,
+101,103, 97,116,101, 95,116,101,120,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116,
+ 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32,
+118,101, 99, 51, 40, 45,110,111,114,109, 97,108, 46,120, 44, 32, 45,110,111,114,109, 97,108, 46,121, 44, 32,110,111,114,109, 97,
+108, 46,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,110,115,112, 97, 99,101, 95,116, 97,110,103,101,110,
+116, 40,118,101, 99, 52, 32,116, 97,110,103,101,110,116, 44, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,118,101, 99,
+ 51, 32,116,101,120,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41,
+ 10,123, 10, 9,118,101, 99, 51, 32, 66, 32, 61, 32,116, 97,110,103,101,110,116, 46,119, 32, 42, 32, 99,114,111,115,115, 40,110,
+111,114,109, 97,108, 44, 32,116, 97,110,103,101,110,116, 46,120,121,122, 41, 59, 10, 10, 9,111,117,116,110,111,114,109, 97,108,
+ 32, 61, 32,116,101,120,110,111,114,109, 97,108, 46,120, 42,116, 97,110,103,101,110,116, 46,120,121,122, 32, 43, 32,116,101,120,
+110,111,114,109, 97,108, 46,121, 42, 66, 32, 43, 32,116,101,120,110,111,114,109, 97,108, 46,122, 42,110,111,114,109, 97,108, 59,
+ 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,110,111,114,109, 97,
+108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,108,101,110,100, 95,110,111,114,109, 97,108, 40,102,108,
+111, 97,116, 32,110,111,114,102, 97, 99, 44, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,118,101, 99, 51, 32,110,101,
+119,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9,
+111,117,116,110,111,114,109, 97,108, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32,110,111,114,102, 97, 99, 41, 42,110,111,114,109, 97,
+108, 32, 43, 32,110,111,114,102, 97, 99, 42,110,101,119,110,111,114,109, 97,108, 59, 10, 9,111,117,116,110,111,114,109, 97,108,
+ 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10, 47, 42, 42, 42,
+ 42, 42, 42, 42, 32, 77, 65, 84, 69, 82, 73, 65, 76, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,108,
+ 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,117,110, 95,104,101,109,105, 40,118,101, 99, 51, 32,108, 97,109,
+112,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100,105,115,
+116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,108,118, 32, 61, 32,108, 97,
+109,112,118,101, 99, 59, 10, 9,100,105,115,116, 32, 61, 32, 49, 46, 48, 59, 10, 9,118,105,115,105,102, 97, 99, 32, 61, 32, 49,
+ 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,111,116,104,101,
+114, 40,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51,
+ 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,
+105,115,105,102, 97, 99, 41, 10,123, 10, 9,108,118, 32, 61, 32, 99,111, 32, 45, 32,108, 97,109,112, 99,111, 59, 10, 9,100,105,
+115,116, 32, 61, 32,108,101,110,103,116,104, 40,108,118, 41, 59, 10, 9,108,118, 32, 61, 32,110,111,114,109, 97,108,105,122,101,
+ 40,108,118, 41, 59, 10, 9,118,105,115,105,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,
+109,112, 95,102, 97,108,108,111,102,102, 95,105,110,118,108,105,110,101, 97,114, 40,102,108,111, 97,116, 32,108, 97,109,112,100,
+105,115,116, 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102,
+ 97, 99, 41, 10,123, 10, 9,118,105,115,105,102, 97, 99, 32, 61, 32,108, 97,109,112,100,105,115,116, 47, 40,108, 97,109,112,100,
+105,115,116, 32, 43, 32,100,105,115,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,102, 97,108,108,111,102,
+102, 95,105,110,118,115,113,117, 97,114,101, 40,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116, 44, 32,102,108,111, 97,
+116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,118,105,
+115,105,102, 97, 99, 32, 61, 32,108, 97,109,112,100,105,115,116, 47, 40,108, 97,109,112,100,105,115,116, 32, 43, 32,100,105,115,
+116, 42,100,105,115,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,102, 97,108,108,111,102,102, 95,115,108,
+105,100,101,114,115, 40,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116, 44, 32,102,108,111, 97,116, 32,108,100, 49, 44,
+ 32,102,108,111, 97,116, 32,108,100, 50, 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,
+116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116,107,119, 32, 61,
+ 32,108, 97,109,112,100,105,115,116, 42,108, 97,109,112,100,105,115,116, 59, 10, 10, 9,118,105,115,105,102, 97, 99, 32, 61, 32,
+108, 97,109,112,100,105,115,116, 47, 40,108, 97,109,112,100,105,115,116, 32, 43, 32,108,100, 49, 42,100,105,115,116, 41, 59, 10,
+ 9,118,105,115,105,102, 97, 99, 32, 42, 61, 32,108, 97,109,112,100,105,115,116,107,119, 47, 40,108, 97,109,112,100,105,115,116,
+107,119, 32, 43, 32,108,100, 50, 42,100,105,115,116, 42,100,105,115,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,
+112, 95,102, 97,108,108,111,102,102, 95, 99,117,114,118,101, 40,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116, 44, 32,
+115, 97,109,112,108,101,114, 50, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,
+111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,118,105,115,105,102, 97, 99, 32, 61, 32,
+116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,100,105,115,116, 47,108, 97,
+109,112,100,105,115,116, 44, 32, 48, 46, 48, 41, 41, 46,120, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,
+115,105, 98,105,108,105,116,121, 95,115,112,104,101,114,101, 40,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116, 44, 32,
+102,108,111, 97,116, 32,100,105,115,116, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,111,117,116, 32,102,
+108,111, 97,116, 32,111,117,116,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,102,108,111, 97,116, 32,116, 61, 32,108, 97,109,
+112,100,105,115,116, 32, 45, 32,100,105,115,116, 59, 10, 10, 9,111,117,116,118,105,115,105,102, 97, 99, 61, 32,118,105,115,105,
+102, 97, 99, 42,109, 97,120, 40,116, 44, 32, 48, 46, 48, 41, 47,108, 97,109,112,100,105,115,116, 59, 10,125, 10, 10,118,111,105,
+100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,111,116, 95,115,113,117, 97,114,101, 40,118,101,
+ 99, 51, 32,108, 97,109,112,118,101, 99, 44, 32,109, 97,116, 52, 32,108, 97,109,112,105,109, 97,116, 44, 32,118,101, 99, 51, 32,
+108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,112,114, 41, 10,123, 10, 9,105,102, 40,100,111,116, 40,108,118,
+ 44, 32,108, 97,109,112,118,101, 99, 41, 32, 62, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,118,101, 99, 51, 32,108,118,114,111,116,
+ 32, 61, 32, 40,108, 97,109,112,105,109, 97,116, 42,118,101, 99, 52, 40,108,118, 44, 32, 48, 46, 48, 41, 41, 46,120,121,122, 59,
+ 10, 9, 9,102,108,111, 97,116, 32,120, 32, 61, 32,109, 97,120, 40, 97, 98,115, 40,108,118,114,111,116, 46,120, 47,108,118,114,
+111,116, 46,122, 41, 44, 32, 97, 98,115, 40,108,118,114,111,116, 46,121, 47,108,118,114,111,116, 46,122, 41, 41, 59, 10, 10, 9,
+ 9,105,110,112,114, 32, 61, 32, 49, 46, 48, 47,115,113,114,116, 40, 49, 46, 48, 32, 43, 32,120, 42,120, 41, 59, 10, 9,125, 10,
+ 9,101,108,115,101, 10, 9, 9,105,110,112,114, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112,
+ 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,111,116, 95, 99,105,114, 99,108,101, 40,118,101, 99, 51, 32,108, 97,109,
+112,118,101, 99, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,112,114, 41, 10,123,
+ 10, 9,105,110,112,114, 32, 61, 32,100,111,116, 40,108,118, 44, 32,108, 97,109,112,118,101, 99, 41, 59, 10,125, 10, 10,118,111,
+105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,111,116, 40,102,108,111, 97,116, 32,115,112,
+111,116,115,105, 44, 32,102,108,111, 97,116, 32,115,112,111,116, 98,108, 44, 32,102,108,111, 97,116, 32,105,110,112,114, 44, 32,
+102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118,105,115,105,
+102, 97, 99, 41, 10,123, 10, 9,102,108,111, 97,116, 32,116, 32, 61, 32,115,112,111,116,115,105, 59, 10, 10, 9,105,102, 40,105,
+110,112,114, 32, 60, 61, 32,116, 41, 32,123, 10, 9, 9,111,117,116,118,105,115,105,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10,
+ 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,116, 32, 61, 32,105,110,112,114, 32, 45, 32,116, 59, 10, 10, 9, 9, 47, 42,
+ 32,115,111,102,116, 32, 97,114,101, 97, 32, 42, 47, 10, 9, 9,105,102, 40,115,112,111,116, 98,108, 32, 33, 61, 32, 48, 46, 48,
+ 41, 10, 9, 9, 9,105,110,112,114, 32, 42, 61, 32,115,109,111,111,116,104,115,116,101,112, 40, 48, 46, 48, 44, 32, 49, 46, 48,
+ 44, 32,116, 47,115,112,111,116, 98,108, 41, 59, 10, 10, 9, 9,111,117,116,118,105,115,105,102, 97, 99, 32, 61, 32,118,105,115,
+105,102, 97, 99, 42,105,110,112,114, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,
+105,108,105,116,121, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,111,117,116, 32,102,
+108,111, 97,116, 32,111,117,116,118,105,115,105,102, 97, 99, 41, 10,123, 10, 9,111,117,116,118,105,115,105,102, 97, 99, 32, 61,
+ 32, 40,118,105,115,105,102, 97, 99, 32, 60, 32, 48, 46, 48, 48, 49, 41, 63, 32, 48, 46, 48, 58, 32,118,105,115,105,102, 97, 99,
+ 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,118,105,101,119, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,
+116, 32,118,101, 99, 51, 32,118,105,101,119, 41, 10,123, 10, 9, 47, 42, 32,104, 97,110,100,108,101, 32,112,101,114,115,112,101,
+ 99,116,105,118,101, 47,111,114,116,104,111,103,114, 97,112,104,105, 99, 32, 42, 47, 10, 9,118,105,101,119, 32, 61, 32, 40,103,
+108, 95, 80,114,111,106,101, 99,116,105,111,110, 77, 97,116,114,105,120, 91, 51, 93, 91, 51, 93, 32, 61, 61, 32, 48, 46, 48, 41,
+ 63, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 58, 32,118,101, 99, 51, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32,
+ 45, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,116, 97,110,103,101,110,116, 95,118, 40,118,
+101, 99, 51, 32,108,118, 44, 32,118,101, 99, 51, 32,116, 97,110,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,110, 41, 10,
+123, 10, 9,118,101, 99, 51, 32, 99, 32, 61, 32, 99,114,111,115,115, 40,108,118, 44, 32,116, 97,110,103, 41, 59, 10, 9,118,101,
+ 99, 51, 32,118,110,111,114, 32, 61, 32, 99,114,111,115,115, 40, 99, 44, 32,116, 97,110,103, 41, 59, 10, 10, 9,118,110, 32, 61,
+ 32, 45,110,111,114,109, 97,108,105,122,101, 40,118,110,111,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101,
+ 95,105,110,112, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116,
+ 32,105,110,112, 41, 10,123, 10, 9,105,110,112, 32, 61, 32,100,111,116, 40,118,110, 44, 32,108,118, 41, 59, 10,125, 10, 10,118,
+111,105,100, 32,115,104, 97,100,101, 95,105,115, 95,110,111, 95,100,105,102,102,117,115,101, 40,111,117,116, 32,102,108,111, 97,
+116, 32,105,115, 41, 10,123, 10, 9,105,115, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101,
+ 95,105,115, 95,104,101,109,105, 40,102,108,111, 97,116, 32,105,110,112, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,115,
+ 41, 10,123, 10, 9,105,115, 32, 61, 32, 48, 46, 53, 42,105,110,112, 32, 43, 32, 48, 46, 53, 59, 10,125, 10, 10,102,108,111, 97,
+116, 32, 97,114,101, 97, 95,108, 97,109,112, 95,101,110,101,114,103,121, 40,109, 97,116, 52, 32, 97,114,101, 97, 44, 32,118,101,
+ 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,118,110, 41, 10,123, 10, 9,118,101, 99, 51, 32,118,101, 99, 91, 52, 93, 44, 32,
+ 99, 91, 52, 93, 59, 10, 9,102,108,111, 97,116, 32,114, 97,100, 91, 52, 93, 44, 32,102, 97, 99, 59, 10, 9, 10, 9,118,101, 99,
+ 91, 48, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 32, 45, 32, 97,114,101, 97, 91, 48, 93, 46,120,121,122,
+ 41, 59, 10, 9,118,101, 99, 91, 49, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 32, 45, 32, 97,114,101, 97,
+ 91, 49, 93, 46,120,121,122, 41, 59, 10, 9,118,101, 99, 91, 50, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111,
+ 32, 45, 32, 97,114,101, 97, 91, 50, 93, 46,120,121,122, 41, 59, 10, 9,118,101, 99, 91, 51, 93, 32, 61, 32,110,111,114,109, 97,
+108,105,122,101, 40, 99,111, 32, 45, 32, 97,114,101, 97, 91, 51, 93, 46,120,121,122, 41, 59, 10, 10, 9, 99, 91, 48, 93, 32, 61,
+ 32,110,111,114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,118,101, 99, 91, 48, 93, 44, 32,118,101, 99, 91, 49, 93, 41,
+ 41, 59, 10, 9, 99, 91, 49, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,118,101, 99, 91, 49,
+ 93, 44, 32,118,101, 99, 91, 50, 93, 41, 41, 59, 10, 9, 99, 91, 50, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,
+114,111,115,115, 40,118,101, 99, 91, 50, 93, 44, 32,118,101, 99, 91, 51, 93, 41, 41, 59, 10, 9, 99, 91, 51, 93, 32, 61, 32,110,
+111,114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,118,101, 99, 91, 51, 93, 44, 32,118,101, 99, 91, 48, 93, 41, 41, 59,
+ 10, 10, 9,114, 97,100, 91, 48, 93, 32, 61, 32, 97, 99,111,115, 40,100,111,116, 40,118,101, 99, 91, 48, 93, 44, 32,118,101, 99,
+ 91, 49, 93, 41, 41, 59, 10, 9,114, 97,100, 91, 49, 93, 32, 61, 32, 97, 99,111,115, 40,100,111,116, 40,118,101, 99, 91, 49, 93,
+ 44, 32,118,101, 99, 91, 50, 93, 41, 41, 59, 10, 9,114, 97,100, 91, 50, 93, 32, 61, 32, 97, 99,111,115, 40,100,111,116, 40,118,
+101, 99, 91, 50, 93, 44, 32,118,101, 99, 91, 51, 93, 41, 41, 59, 10, 9,114, 97,100, 91, 51, 93, 32, 61, 32, 97, 99,111,115, 40,
+100,111,116, 40,118,101, 99, 91, 51, 93, 44, 32,118,101, 99, 91, 48, 93, 41, 41, 59, 10, 10, 9,102, 97, 99, 61, 32, 32,114, 97,
+100, 91, 48, 93, 42,100,111,116, 40,118,110, 44, 32, 99, 91, 48, 93, 41, 59, 10, 9,102, 97, 99, 43, 61, 32,114, 97,100, 91, 49,
+ 93, 42,100,111,116, 40,118,110, 44, 32, 99, 91, 49, 93, 41, 59, 10, 9,102, 97, 99, 43, 61, 32,114, 97,100, 91, 50, 93, 42,100,
+111,116, 40,118,110, 44, 32, 99, 91, 50, 93, 41, 59, 10, 9,102, 97, 99, 43, 61, 32,114, 97,100, 91, 51, 93, 42,100,111,116, 40,
+118,110, 44, 32, 99, 91, 51, 93, 41, 59, 10, 10, 9,114,101,116,117,114,110, 32,109, 97,120, 40,102, 97, 99, 44, 32, 48, 46, 48,
+ 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,105,110,112, 95, 97,114,101, 97, 40,118,101, 99, 51, 32,112,
+111,115,105,116,105,111,110, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111, 44, 32,118,101, 99, 51, 32,108, 97,109,112,118,
+101, 99, 44, 32,118,101, 99, 51, 32,118,110, 44, 32,109, 97,116, 52, 32, 97,114,101, 97, 44, 32,102,108,111, 97,116, 32, 97,114,
+101, 97,115,105,122,101, 44, 32,102,108,111, 97,116, 32,107, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,112, 41, 10,
+123, 10, 9,118,101, 99, 51, 32, 99,111, 32, 61, 32,112,111,115,105,116,105,111,110, 59, 10, 9,118,101, 99, 51, 32,118,101, 99,
+ 32, 61, 32, 99,111, 32, 45, 32,108, 97,109,112, 99,111, 59, 10, 10, 9,105,102, 40,100,111,116, 40,118,101, 99, 44, 32,108, 97,
+109,112,118,101, 99, 41, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,105,110,112, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10,
+ 9,101,108,115,101, 32,123, 10, 9, 9,102,108,111, 97,116, 32,105,110,116,101,110,115, 32, 61, 32, 97,114,101, 97, 95,108, 97,
+109,112, 95,101,110,101,114,103,121, 40, 97,114,101, 97, 44, 32, 99,111, 44, 32,118,110, 41, 59, 10, 10, 9, 9,105,110,112, 32,
+ 61, 32,112,111,119, 40,105,110,116,101,110,115, 42, 97,114,101, 97,115,105,122,101, 44, 32,107, 41, 59, 10, 9,125, 10,125, 10,
+ 10,118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115,101, 95,111,114,101,110, 95,110, 97,121,101,114, 40,102,
+108,111, 97,116, 32,110,108, 44, 32,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44,
+ 32,102,108,111, 97,116, 32,114,111,117,103,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,115, 41, 10,123, 10, 9,118,
+101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 32, 43, 32,108, 41, 59, 10, 9,102,108,111, 97,116,
+ 32,110,104, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,104, 41, 44, 32, 48, 46, 48, 41, 59, 10, 9,102,108,111, 97,
+116, 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 41, 59, 10, 9,102,108,111,
+ 97,116, 32,114,101, 97,108,110,108, 32, 61, 32,100,111,116, 40,110, 44, 32,108, 41, 59, 10, 10, 9,105,102, 40,114,101, 97,108,
+110,108, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,105,115, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101,
+ 32,105,102, 40,110,108, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,105,115, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,
+101,108,115,101, 32,123, 10, 9, 9,102,108,111, 97,116, 32,118,104, 32, 61, 32,109, 97,120, 40,100,111,116, 40,118, 44, 32,104,
+ 41, 44, 32, 48, 46, 48, 41, 59, 10, 9, 9,102,108,111, 97,116, 32, 76,105,116, 95, 65, 32, 61, 32, 97, 99,111,115, 40,114,101,
+ 97,108,110,108, 41, 59, 10, 9, 9,102,108,111, 97,116, 32, 86,105,101,119, 95, 65, 32, 61, 32, 97, 99,111,115, 40,110,118, 41,
+ 59, 10, 10, 9, 9,118,101, 99, 51, 32, 76,105,116, 95, 66, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108, 32, 45, 32,
+114,101, 97,108,110,108, 42,110, 41, 59, 10, 9, 9,118,101, 99, 51, 32, 86,105,101,119, 95, 66, 32, 61, 32,110,111,114,109, 97,
+108,105,122,101, 40,118, 32, 45, 32,110,118, 42,110, 41, 59, 10, 10, 9, 9,102,108,111, 97,116, 32,116, 32, 61, 32,109, 97,120,
+ 40,100,111,116, 40, 76,105,116, 95, 66, 44, 32, 86,105,101,119, 95, 66, 41, 44, 32, 48, 46, 48, 41, 59, 10, 10, 9, 9,102,108,
+111, 97,116, 32, 97, 44, 32, 98, 59, 10, 10, 9, 9,105,102, 40, 76,105,116, 95, 65, 32, 62, 32, 86,105,101,119, 95, 65, 41, 32,
+123, 10, 9, 9, 9, 97, 32, 61, 32, 76,105,116, 95, 65, 59, 10, 9, 9, 9, 98, 32, 61, 32, 86,105,101,119, 95, 65, 59, 10, 9,
+ 9,125, 10, 9, 9,101,108,115,101, 32,123, 10, 9, 9, 9, 97, 32, 61, 32, 86,105,101,119, 95, 65, 59, 10, 9, 9, 9, 98, 32,
+ 61, 32, 76,105,116, 95, 65, 59, 10, 9, 9,125, 10, 10, 9, 9,102,108,111, 97,116, 32, 65, 32, 61, 32, 49, 46, 48, 32, 45, 32,
+ 40, 48, 46, 53, 42, 40, 40,114,111,117,103,104, 42,114,111,117,103,104, 41, 47, 40, 40,114,111,117,103,104, 42,114,111,117,103,
+104, 41, 32, 43, 32, 48, 46, 51, 51, 41, 41, 41, 59, 10, 9, 9,102,108,111, 97,116, 32, 66, 32, 61, 32, 48, 46, 52, 53, 42, 40,
+ 40,114,111,117,103,104, 42,114,111,117,103,104, 41, 47, 40, 40,114,111,117,103,104, 42,114,111,117,103,104, 41, 32, 43, 32, 48,
+ 46, 48, 57, 41, 41, 59, 10, 10, 9, 9, 98, 32, 42, 61, 32, 48, 46, 57, 53, 59, 10, 9, 9,105,115, 32, 61, 32,110,108, 42, 40,
+ 65, 32, 43, 32, 40, 66, 32, 42, 32,116, 32, 42, 32,115,105,110, 40, 97, 41, 32, 42, 32,116, 97,110, 40, 98, 41, 41, 41, 59, 10,
+ 9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115,101, 95,116,111,111,110, 40,118,101,
+ 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,115,105,122,101,
+ 44, 32,102,108,111, 97,116, 32,116,115,109,111,111,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,115, 41, 10,123,
+ 10, 9,102,108,111, 97,116, 32,114,115,108,116, 32, 61, 32,100,111,116, 40,110, 44, 32,108, 41, 59, 10, 9,102,108,111, 97,116,
+ 32, 97,110,103, 32, 61, 32, 97, 99,111,115, 40,114,115,108,116, 41, 59, 10, 10, 9,105,102, 40, 97,110,103, 32, 60, 32,115,105,
+122,101, 41, 32,105,115, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 97,110,103, 32, 62, 32, 40,115,105,
+122,101, 32, 43, 32,116,115,109,111,111,116,104, 41, 32,124,124, 32,116,115,109,111,111,116,104, 32, 61, 61, 32, 48, 46, 48, 41,
+ 32,105,115, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,115, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40, 40, 97,110,
+103, 32, 45, 32,115,105,122,101, 41, 47,116,115,109,111,111,116,104, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,
+101, 95,100,105,102,102,117,115,101, 95,109,105,110,110, 97,101,114,116, 40,102,108,111, 97,116, 32,110,108, 44, 32,118,101, 99,
+ 51, 32,110, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,100, 97,114,107,110,101,115,115, 44, 32,111,117,116,
+ 32,102,108,111, 97,116, 32,105,115, 41, 10,123, 10, 9,105,102, 40,110,108, 32, 60, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,
+105,115, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,102,108,111, 97,116, 32,110,118, 32,
+ 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 41, 59, 10, 10, 9, 9,105,102, 40,100, 97,114,
+107,110,101,115,115, 32, 60, 61, 32, 49, 46, 48, 41, 10, 9, 9, 9,105,115, 32, 61, 32,110,108, 42,112,111,119, 40,109, 97,120,
+ 40,110,118, 42,110,108, 44, 32, 48, 46, 49, 41, 44, 32,100, 97,114,107,110,101,115,115, 32, 45, 32, 49, 46, 48, 41, 59, 10, 9,
+ 9,101,108,115,101, 10, 9, 9, 9,105,115, 32, 61, 32,110,108, 42,112,111,119, 40, 49, 46, 48, 48, 48, 49, 32, 45, 32,110,118,
+ 44, 32,100, 97,114,107,110,101,115,115, 32, 45, 32, 49, 46, 48, 41, 59, 10, 9,125, 10,125, 10, 10,102,108,111, 97,116, 32,102,
+114,101,115,110,101,108, 95,102, 97, 99, 40,118,101, 99, 51, 32,118,105,101,119, 44, 32,118,101, 99, 51, 32,118,110, 44, 32,102,
+108,111, 97,116, 32,103,114, 97,100, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 41, 10,123, 10, 9,102,108,111, 97,116, 32,116,
+ 49, 44, 32,116, 50, 59, 10, 9,102,108,111, 97,116, 32,102,102, 97, 99, 59, 10, 10, 9,105,102, 40,102, 97, 99, 61, 61, 48, 46,
+ 48, 41, 32,123, 10, 9, 9,102,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,
+116, 49, 61, 32,100,111,116, 40,118,105,101,119, 44, 32,118,110, 41, 59, 10, 9, 9,105,102, 40,116, 49, 62, 48, 46, 48, 41, 32,
+ 32,116, 50, 61, 32, 49, 46, 48, 43,116, 49, 59, 10, 9, 9,101,108,115,101, 32,116, 50, 61, 32, 49, 46, 48, 45,116, 49, 59, 10,
+ 10, 9, 9,116, 50, 61, 32,103,114, 97,100, 32, 43, 32, 40, 49, 46, 48, 45,103,114, 97,100, 41, 42,112,111,119, 40,116, 50, 44,
+ 32,102, 97, 99, 41, 59, 10, 10, 9, 9,105,102, 40,116, 50, 60, 48, 46, 48, 41, 32,102,102, 97, 99, 32, 61, 32, 48, 46, 48, 59,
+ 10, 9, 9,101,108,115,101, 32,105,102, 40,116, 50, 62, 49, 46, 48, 41, 32,102,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10, 9,
+ 9,101,108,115,101, 32,102,102, 97, 99, 32, 61, 32,116, 50, 59, 10, 9,125, 10, 10, 9,114,101,116,117,114,110, 32,102,102, 97,
+ 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115,101, 95,102,114,101,115,110,101,108,
+ 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,102,108,
+111, 97,116, 32,102, 97, 99, 95,105, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,
+105,115, 41, 10,123, 10, 9,105,115, 32, 61, 32,102,114,101,115,110,101,108, 95,102, 97, 99, 40,108,118, 44, 32,118,110, 44, 32,
+102, 97, 99, 95,105, 44, 32,102, 97, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 99,117, 98,105, 99,
+ 40,102,108,111, 97,116, 32,105,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,105,115, 41, 10,123, 10, 9,105,
+102, 40,105,115, 62, 48, 46, 48, 32, 38, 38, 32,105,115, 60, 49, 46, 48, 41, 10, 9, 9,111,117,116,105,115, 61, 32,115,109,111,
+111,116,104,115,116,101,112, 40, 48, 46, 48, 44, 32, 49, 46, 48, 44, 32,105,115, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,
+117,116,105,115, 61, 32,105,115, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,118,105,115,105,102, 97, 99, 40,
+102,108,111, 97,116, 32,105, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,102,108,111, 97,116, 32,114,101,
+102,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,105, 41, 10,123, 10, 9, 47, 42,105,102, 40,105, 32, 62, 32,
+ 48, 46, 48, 41, 42, 47, 10, 9, 9,111,117,116,105, 32, 61, 32,109, 97,120, 40,105, 42,118,105,115,105,102, 97, 99, 42,114,101,
+102,108, 44, 32, 48, 46, 48, 41, 59, 10, 9, 47, 42,101,108,115,101, 10, 9, 9,111,117,116,105, 32, 61, 32,105, 59, 42, 47, 10,
+125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,116, 97,110,103,101,110,116, 95,118, 95,115,112,101, 99, 40,118,101, 99,
+ 51, 32,116, 97,110,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,110, 41, 10,123, 10, 9,118,110, 32, 61, 32,116, 97,110,
+103, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,100,100, 95,116,111, 95,100,105,102,102,117,115,101, 40,
+102,108,111, 97,116, 32,105, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111,108, 44, 32,118,101, 99, 51, 32, 99,111,108, 44,
+ 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,105,102, 40,105, 32, 62, 32, 48, 46, 48, 41,
+ 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,105, 42,108, 97,109,112, 99,111,108, 42, 99,111,108, 59, 10, 9,101,108,115,101,
+ 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 41, 59,
+ 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,104,101,109,105, 95,115,112,101, 99, 40,118,101, 99, 51, 32,118,110,
+ 44, 32,118,101, 99, 51, 32,108,118, 44, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,102,108,111, 97,116, 32,115,112,101, 99,
+ 44, 32,102,108,111, 97,116, 32,104, 97,114,100, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,111,117,116,
+ 32,102,108,111, 97,116, 32,116, 41, 10,123, 10, 9,108,118, 32, 43, 61, 32,118,105,101,119, 59, 10, 9,108,118, 32, 61, 32,110,
+111,114,109, 97,108,105,122,101, 40,108,118, 41, 59, 10, 10, 9,116, 32, 61, 32,100,111,116, 40,118,110, 44, 32,108,118, 41, 59,
+ 10, 9,116, 32, 61, 32, 48, 46, 53, 42,116, 32, 43, 32, 48, 46, 53, 59, 10, 10, 9,116, 32, 61, 32,118,105,115,105,102, 97, 99,
+ 42,115,112,101, 99, 42,112,111,119, 40,116, 44, 32,104, 97,114,100, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,
+101, 95,112,104,111,110,103, 95,115,112,101, 99, 40,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99,
+ 51, 32,118, 44, 32,102,108,111, 97,116, 32,104, 97,114,100, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102,
+ 97, 99, 41, 10,123, 10, 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108, 32, 43, 32,118, 41,
+ 59, 10, 9,102,108,111, 97,116, 32,114,115,108,116, 32, 61, 32,109, 97,120, 40,100,111,116, 40,104, 44, 32,110, 41, 44, 32, 48,
+ 46, 48, 41, 59, 10, 10, 9,115,112,101, 99,102, 97, 99, 32, 61, 32,112,111,119, 40,114,115,108,116, 44, 32,104, 97,114,100, 41,
+ 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 99,111,111,107,116,111,114,114, 95,115,112,101, 99, 40,118,101,
+ 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,104, 97,114,100,
+ 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10, 9,118,101, 99, 51, 32,104, 32, 61,
+ 32,110,111,114,109, 97,108,105,122,101, 40,118, 32, 43, 32,108, 41, 59, 10, 9,102,108,111, 97,116, 32,110,104, 32, 61, 32,100,
+111,116, 40,110, 44, 32,104, 41, 59, 10, 10, 9,105,102, 40,110,104, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,115,112,101,
+ 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,102,108,111, 97,116, 32,110,
+118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 41, 59, 10, 9, 9,102,108,111, 97,116,
+ 32,105, 32, 61, 32,112,111,119, 40,110,104, 44, 32,104, 97,114,100, 41, 59, 10, 10, 9, 9,105, 32, 61, 32,105, 47, 40, 48, 46,
+ 49, 43,110,118, 41, 59, 10, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32,105, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100,
+ 32,115,104, 97,100,101, 95, 98,108,105,110,110, 95,115,112,101, 99, 40,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108,
+ 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,114,101,102,114, 97, 99, 44, 32,102,108,111, 97,116, 32,115,112,
+101, 99, 95,112,111,119,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10, 9,
+105,102, 40,114,101,102,114, 97, 99, 32, 60, 32, 49, 46, 48, 41, 32,123, 10, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48,
+ 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,105,102, 40,115,112,101, 99, 95,112,111,119,101,114, 32, 61, 61, 32, 48, 46,
+ 48, 41, 32,123, 10, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123,
+ 10, 9, 9,105,102, 40,115,112,101, 99, 95,112,111,119,101,114, 60, 49, 48, 48, 46, 48, 41, 10, 9, 9, 9,115,112,101, 99, 95,
+112,111,119,101,114, 61, 32,115,113,114,116, 40, 49, 46, 48, 47,115,112,101, 99, 95,112,111,119,101,114, 41, 59, 10, 9, 9,101,
+108,115,101, 10, 9, 9, 9,115,112,101, 99, 95,112,111,119,101,114, 61, 32, 49, 48, 46, 48, 47,115,112,101, 99, 95,112,111,119,
+101,114, 59, 10, 10, 9, 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 32, 43, 32,108, 41,
+ 59, 10, 9, 9,102,108,111, 97,116, 32,110,104, 32, 61, 32,100,111,116, 40,110, 44, 32,104, 41, 59, 10, 9, 9,105,102, 40,110,
+104, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9,125,
+ 10, 9, 9,101,108,115,101, 32,123, 10, 9, 9, 9,102,108,111, 97,116, 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,
+110, 44, 32,118, 41, 44, 32, 48, 46, 48, 49, 41, 59, 10, 9, 9, 9,102,108,111, 97,116, 32,110,108, 32, 61, 32,100,111,116, 40,
+110, 44, 32,108, 41, 59, 10, 9, 9, 9,105,102, 40,110,108, 32, 60, 61, 32, 48, 46, 48, 49, 41, 32,123, 10, 9, 9, 9, 9,115,
+112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9, 9,125, 10, 9, 9, 9,101,108,115,101, 32,123, 10, 9, 9, 9,
+ 9,102,108,111, 97,116, 32,118,104, 32, 61, 32,109, 97,120, 40,100,111,116, 40,118, 44, 32,104, 41, 44, 32, 48, 46, 48, 49, 41,
+ 59, 10, 10, 9, 9, 9, 9,102,108,111, 97,116, 32, 97, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9, 9, 9,102,108,111, 97,116, 32,
+ 98, 32, 61, 32, 40, 50, 46, 48, 42,110,104, 42,110,118, 41, 47,118,104, 59, 10, 9, 9, 9, 9,102,108,111, 97,116, 32, 99, 32,
+ 61, 32, 40, 50, 46, 48, 42,110,104, 42,110,108, 41, 47,118,104, 59, 10, 10, 9, 9, 9, 9,102,108,111, 97,116, 32,103, 32, 61,
+ 32, 48, 46, 48, 59, 10, 10, 9, 9, 9, 9,105,102, 40, 97, 32, 60, 32, 98, 32, 38, 38, 32, 97, 32, 60, 32, 99, 41, 32,103, 32,
+ 61, 32, 97, 59, 10, 9, 9, 9, 9,101,108,115,101, 32,105,102, 40, 98, 32, 60, 32, 97, 32, 38, 38, 32, 98, 32, 60, 32, 99, 41,
+ 32,103, 32, 61, 32, 98, 59, 10, 9, 9, 9, 9,101,108,115,101, 32,105,102, 40, 99, 32, 60, 32, 97, 32, 38, 38, 32, 99, 32, 60,
+ 32, 98, 41, 32,103, 32, 61, 32, 99, 59, 10, 10, 9, 9, 9, 9,102,108,111, 97,116, 32,112, 32, 61, 32,115,113,114,116, 40, 40,
+ 40,114,101,102,114, 97, 99, 32, 42, 32,114,101,102,114, 97, 99, 41, 43, 40,118,104, 42,118,104, 41, 45, 49, 46, 48, 41, 41, 59,
+ 10, 9, 9, 9, 9,102,108,111, 97,116, 32,102, 32, 61, 32, 40, 40, 40,112, 45,118,104, 41, 42, 40,112, 45,118,104, 41, 41, 47,
+ 40, 40,112, 43,118,104, 41, 42, 40,112, 43,118,104, 41, 41, 41, 42, 40, 49, 46, 48, 43, 40, 40, 40, 40,118,104, 42, 40,112, 43,
+118,104, 41, 41, 45, 49, 46, 48, 41, 42, 40, 40,118,104, 42, 40,112, 43,118,104, 41, 41, 45, 49, 46, 48, 41, 41, 47, 40, 40, 40,
+118,104, 42, 40,112, 45,118,104, 41, 41, 43, 49, 46, 48, 41, 42, 40, 40,118,104, 42, 40,112, 45,118,104, 41, 41, 43, 49, 46, 48,
+ 41, 41, 41, 41, 59, 10, 9, 9, 9, 9,102,108,111, 97,116, 32, 97,110,103, 32, 61, 32, 97, 99,111,115, 40,110,104, 41, 59, 10,
+ 10, 9, 9, 9, 9,115,112,101, 99,102, 97, 99, 32, 61, 32,109, 97,120, 40,102, 42,103, 42,101,120,112, 95, 98,108,101,110,100,
+101,114, 40, 40, 45, 40, 97,110,103, 42, 97,110,103, 41, 47, 40, 50, 46, 48, 42,115,112,101, 99, 95,112,111,119,101,114, 42,115,
+112,101, 99, 95,112,111,119,101,114, 41, 41, 41, 44, 32, 48, 46, 48, 41, 59, 10, 9, 9, 9,125, 10, 9, 9,125, 10, 9,125, 10,
+125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,119, 97,114,100,105,115,111, 95,115,112,101, 99, 40,118,101, 99, 51, 32,
+110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,114,109,115, 44, 32,111,117,
+116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10, 9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,
+109, 97,108,105,122,101, 40,108, 32, 43, 32,118, 41, 59, 10, 9,102,108,111, 97,116, 32,110,104, 32, 61, 32,109, 97,120, 40,100,
+111,116, 40,110, 44, 32,104, 41, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10, 9,102,108,111, 97,116, 32,110,118, 32, 61, 32,109, 97,
+120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10, 9,102,108,111, 97,116, 32,110,108, 32, 61,
+ 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,108, 41, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10, 9,102,108,111, 97,116, 32, 97,
+110,103,108,101, 32, 61, 32,116, 97,110, 40, 97, 99,111,115, 40,110,104, 41, 41, 59, 10, 9,102,108,111, 97,116, 32, 97,108,112,
+104, 97, 32, 61, 32,109, 97,120, 40,114,109,115, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10, 10, 9,115,112,101, 99,102, 97, 99, 61,
+ 32,110,108, 32, 42, 32, 40, 49, 46, 48, 47, 40, 52, 46, 48, 42, 77, 95, 80, 73, 42, 97,108,112,104, 97, 42, 97,108,112,104, 97,
+ 41, 41, 42, 40,101,120,112, 95, 98,108,101,110,100,101,114, 40, 45, 40, 97,110,103,108,101, 42, 97,110,103,108,101, 41, 47, 40,
+ 97,108,112,104, 97, 42, 97,108,112,104, 97, 41, 41, 47, 40,115,113,114,116, 40,110,118, 42,110,108, 41, 41, 41, 59, 10,125, 10,
+ 10,118,111,105,100, 32,115,104, 97,100,101, 95,116,111,111,110, 95,115,112,101, 99, 40,118,101, 99, 51, 32,110, 44, 32,118,101,
+ 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,115,105,122,101, 44, 32,102,108,111, 97,116, 32,
+116,115,109,111,111,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10, 9,118,
+101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108, 32, 43, 32,118, 41, 59, 10, 9,102,108,111, 97,116,
+ 32,114,115,108,116, 32, 61, 32,100,111,116, 40,104, 44, 32,110, 41, 59, 10, 9,102,108,111, 97,116, 32, 97,110,103, 32, 61, 32,
+ 97, 99,111,115, 40,114,115,108,116, 41, 59, 10, 10, 9,105,102, 40, 97,110,103, 32, 60, 32,115,105,122,101, 41, 32,114,115,108,
+116, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 97,110,103, 32, 62, 61, 32, 40,115,105,122,101, 32, 43,
+ 32,116,115,109,111,111,116,104, 41, 32,124,124, 32,116,115,109,111,111,116,104, 32, 61, 61, 32, 48, 46, 48, 41, 32,114,115,108,
+116, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,114,115,108,116, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40, 40, 97,110,
+103, 32, 45, 32,115,105,122,101, 41, 47,116,115,109,111,111,116,104, 41, 59, 10, 10, 9,115,112,101, 99,102, 97, 99, 32, 61, 32,
+114,115,108,116, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,115,112,101, 99, 95, 97,114,101, 97, 95,105,110,
+112, 40,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 44, 32,102,108,111, 97,116, 32,105,110,112, 44, 32,111,117,116, 32,
+102,108,111, 97,116, 32,111,117,116,115,112,101, 99,102, 97, 99, 41, 10,123, 10, 9,111,117,116,115,112,101, 99,102, 97, 99, 32,
+ 61, 32,115,112,101, 99,102, 97, 99, 42,105,110,112, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,115,112,101,
+ 99, 95,116, 40,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,102,108,111, 97,116, 32,115,112,101, 99, 44, 32,102,
+108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 44, 32,111,117,116,
+ 32,102,108,111, 97,116, 32,116, 41, 10,123, 10, 9,116, 32, 61, 32,115,104, 97,100,102, 97, 99, 42,115,112,101, 99, 42,118,105,
+115,105,102, 97, 99, 42,115,112,101, 99,102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,100,100,
+ 95,115,112,101, 99, 40,102,108,111, 97,116, 32,116, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111,108, 44, 32,118,101, 99,
+ 51, 32,115,112,101, 99, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,
+117,116, 99,111,108, 32, 61, 32,116, 42,108, 97,109,112, 99,111,108, 42,115,112,101, 99, 99,111,108, 59, 10,125, 10, 10,118,111,
+105,100, 32,115,104, 97,100,101, 95, 97,100,100, 40,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108,
+ 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,
+ 99,111,108, 49, 32, 43, 32, 99,111,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109, 97,100,100, 40,
+118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,
+111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108,
+ 32, 43, 32, 99,111,108, 49, 42, 99,111,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,100,100, 95,
+ 99,108, 97,109,112,101,100, 40,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,
+116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 32,
+ 43, 32,109, 97,120, 40, 99,111,108, 50, 44, 32,118,101, 99, 52, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32,
+ 48, 46, 48, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109, 97,100,100, 95, 99,108, 97,109,112,101,
100, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50,
44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,
-111,108, 32, 43, 32, 99,111,108, 49, 42, 99,111,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,100,
-100, 95, 99,108, 97,109,112,101,100, 40,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,
-111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108,
- 49, 32, 43, 32,109, 97,120, 40, 99,111,108, 50, 44, 32,118,101, 99, 52, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48,
- 44, 32, 48, 46, 48, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109, 97,100,100, 95, 99,108, 97,109,
-112,101,100, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,
-108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61,
- 32, 99,111,108, 32, 43, 32,109, 97,120, 40, 99,111,108, 49, 42, 99,111,108, 50, 44, 32,118,101, 99, 52, 40, 48, 46, 48, 44, 32,
- 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109,
- 97,100,100,102, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 44, 32,118,101, 99, 52, 32, 99,111,108,
- 49, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,
- 99,111,108, 32, 43, 32,102, 42, 99,111,108, 49, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109,117,108, 40,
-118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,
-117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 42, 99,111,108, 50, 59, 10,125, 10,
- 10,118,111,105,100, 32,115,104, 97,100,101, 95,109,117,108, 95,118, 97,108,117,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44,
- 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,
-117,116, 99,111,108, 32, 61, 32, 99,111,108, 42,102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,
- 98, 99,111,108,111,114, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32,111, 98, 99,111,108, 44, 32,111,117,116,
- 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,
-111,108, 46,114,103, 98, 42,111, 98, 99,111,108, 46,114,103, 98, 44, 32, 99,111,108, 46, 97, 41, 59, 10,125, 10, 10,118,111,105,
-100, 32,114, 97,109,112, 95,114,103, 98,116,111, 98,119, 40,118,101, 99, 51, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,102,
-108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99,111,108,111,114, 46,114,
- 42, 48, 46, 51, 32, 43, 32, 99,111,108,111,114, 46,103, 42, 48, 46, 53, 56, 32, 43, 32, 99,111,108,111,114, 46, 98, 42, 48, 46,
- 49, 50, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,110,108,121, 95,115,104, 97,100,111,119, 40,102,108,
-111, 97,116, 32,105, 44, 32,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,102,108,111, 97,116, 32,101,110,101,114,
-103,121, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,104, 97,100,102, 97, 99, 41, 10,123, 10, 9,111,117,116,
-115,104, 97,100,102, 97, 99, 32, 61, 32,105, 42,101,110,101,114,103,121, 42, 40, 49, 46, 48, 32, 45, 32,115,104, 97,100,102, 97,
- 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,110,108,121, 95,115,104, 97,100,111,119, 95,100,105,
-102,102,117,115,101, 40,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,118,101, 99, 51, 32,114,103, 98, 44, 32,118,
-101, 99, 52, 32,100,105,102,102, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,100,105,102,102, 41, 10,123, 10, 9,111,
-117,116,100,105,102,102, 32, 61, 32,100,105,102,102, 32, 45, 32,118,101, 99, 52, 40,114,103, 98, 42,115,104, 97,100,102, 97, 99,
- 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,110,108,121, 95,115,104, 97,100,111,
-119, 95,115,112,101, 99,117,108, 97,114, 40,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,118,101, 99, 51, 32,115,
-112,101, 99,114,103, 98, 44, 32,118,101, 99, 52, 32,115,112,101, 99, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,115,
-112,101, 99, 41, 10,123, 10, 9,111,117,116,115,112,101, 99, 32, 61, 32,115,112,101, 99, 32, 45, 32,118,101, 99, 52, 40,115,112,
-101, 99,114,103, 98, 42,115,104, 97,100,102, 97, 99, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,115,
-116, 95,115,104, 97,100,111,119, 98,117,102, 40,118,101, 99, 51, 32,114, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 83,
-104, 97,100,111,119, 32,115,104, 97,100,111,119,109, 97,112, 44, 32,109, 97,116, 52, 32,115,104, 97,100,111,119,112,101,114,115,
-109, 97,116, 44, 32,102,108,111, 97,116, 32,115,104, 97,100,111,119, 98,105, 97,115, 44, 32,102,108,111, 97,116, 32,105,110,112,
- 44, 32,111,117,116, 32,102,108,111, 97,116, 32,114,101,115,117,108,116, 41, 10,123, 10, 9,105,102, 40,105,110,112, 32, 60, 61,
- 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,101,115,117,108,116, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101,
- 32,123, 10, 9, 9,118,101, 99, 52, 32, 99,111, 32, 61, 32,115,104, 97,100,111,119,112,101,114,115,109, 97,116, 42,118,101, 99,
- 52, 40,114, 99,111, 44, 32, 49, 46, 48, 41, 59, 10, 10, 9, 9, 47, 47,102,108,111, 97,116, 32, 98,105, 97,115, 32, 61, 32, 40,
- 49, 46, 53, 32, 45, 32,105,110,112, 42,105,110,112, 41, 42,115,104, 97,100,111,119, 98,105, 97,115, 59, 10, 9, 9, 99,111, 46,
-122, 32, 45, 61, 32,115,104, 97,100,111,119, 98,105, 97,115, 42, 99,111, 46,119, 59, 10, 10, 9, 9,114,101,115,117,108,116, 32,
- 61, 32,115,104, 97,100,111,119, 50, 68, 80,114,111,106, 40,115,104, 97,100,111,119,109, 97,112, 44, 32, 99,111, 41, 46,120, 59,
- 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,101,120,112,111,115,117,114,101, 95, 99,111,114,114,101,
- 99,116, 40,118,101, 99, 51, 32, 99,111,108, 44, 32,102,108,111, 97,116, 32,108,105,110,102, 97, 99, 44, 32,102,108,111, 97,116,
- 32,108,111,103,102, 97, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116,
- 99,111,108, 32, 61, 32,108,105,110,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32,101,120,112, 40, 99,111,108, 42,108,111,103,102,
- 97, 99, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109,105,115,116, 95,102, 97, 99,116,111,114, 40,
-118,101, 99, 51, 32, 99,111, 44, 32,102,108,111, 97,116, 32,109,105,115,116,115,116, 97, 44, 32,102,108,111, 97,116, 32,109,105,
-115,116,100,105,115,116, 44, 32,102,108,111, 97,116, 32,109,105,115,116,116,121,112,101, 44, 32,102,108,111, 97,116, 32,109,105,
-115,105, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102,
- 97, 99, 44, 32,122, 99,111,114, 59, 10, 10, 9,122, 99,111,114, 32, 61, 32, 40,103,108, 95, 80,114,111,106,101, 99,116,105,111,
-110, 77, 97,116,114,105,120, 91, 51, 93, 91, 51, 93, 32, 61, 61, 32, 48, 46, 48, 41, 63, 32,108,101,110,103,116,104, 40, 99,111,
- 41, 58, 32, 45, 99,111, 91, 50, 93, 59, 10, 9, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40, 40,122, 99,111,114, 45,
-109,105,115,116,115,116, 97, 41, 47,109,105,115,116,100,105,115,116, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,105,
-102, 40,109,105,115,116,116,121,112,101, 32, 61, 61, 32, 48, 46, 48, 41, 32,102, 97, 99, 32, 42, 61, 32,102, 97, 99, 59, 10, 9,
-101,108,115,101, 32,105,102, 40,109,105,115,116,116,121,112,101, 32, 61, 61, 32, 49, 46, 48, 41, 59, 10, 9,101,108,115,101, 32,
-102, 97, 99, 32, 61, 32,115,113,114,116, 40,102, 97, 99, 41, 59, 10, 10, 9,111,117,116,102, 97, 99, 32, 61, 32, 49, 46, 48, 32,
- 45, 32, 40, 49, 46, 48, 45,102, 97, 99, 41, 42, 40, 49, 46, 48, 45,109,105,115,105, 41, 59, 10,125, 10, 10,118,111,105,100, 32,
-115,104, 97,100,101, 95,119,111,114,108,100, 95,109,105,120, 40,118,101, 99, 51, 32,104,111,114, 44, 32,118,101, 99, 52, 32, 99,
-111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97,
- 99, 32, 61, 32, 99,108, 97,109,112, 40, 99,111,108, 46, 97, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116,
- 99,111,108, 32, 61, 32,118,101, 99, 52, 40,109,105,120, 40,104,111,114, 44, 32, 99,111,108, 46,114,103, 98, 44, 32,102, 97, 99,
- 41, 44, 32, 99,111,108, 46, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,108,112,104, 97, 95,111,
-112, 97,113,117,101, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41,
- 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111,108, 46,114,103, 98, 44, 32, 49, 46, 48, 41, 59,
- 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,108,112,104, 97, 95,111, 98, 99,111,108,111,114, 40,118,101, 99,
- 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32,111, 98, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,
-111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111,108, 46,114,103, 98, 44, 32, 99,111,
-108, 46, 97, 42,111, 98, 99,111,108, 46, 97, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 78, 69,
- 87, 32, 83, 72, 65, 68, 69, 82, 32, 85, 84, 73, 76, 73, 84, 73, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 47, 10, 10,102,108,111, 97,116, 32,102,114,101,115,110,101,108, 95,100,105,101,108,101, 99,116,114,105, 99, 40,118,101, 99,
- 51, 32, 73,110, 99,111,109,105,110,103, 44, 32,118,101, 99, 51, 32, 78,111,114,109, 97,108, 44, 32,102,108,111, 97,116, 32,101,
-116, 97, 41, 10,123, 10, 32, 32, 32, 32, 47, 42, 32, 99,111,109,112,117,116,101, 32,102,114,101,115,110,101,108, 32,114,101,102,
-108,101, 99,116, 97,110, 99,101, 32,119,105,116,104,111,117,116, 32,101,120,112,108,105, 99,105,116,108,121, 32, 99,111,109,112,
-117,116,105,110,103, 10, 32, 32, 32, 32, 32, 32, 32,116,104,101, 32,114,101,102,114, 97, 99,116,101,100, 32,100,105,114,101, 99,
-116,105,111,110, 32, 42, 47, 10, 32, 32, 32, 32,102,108,111, 97,116, 32, 99, 32, 61, 32, 97, 98,115, 40,100,111,116, 40, 73,110,
- 99,111,109,105,110,103, 44, 32, 78,111,114,109, 97,108, 41, 41, 59, 10, 32, 32, 32, 32,102,108,111, 97,116, 32,103, 32, 61, 32,
-101,116, 97, 32, 42, 32,101,116, 97, 32, 45, 32, 49, 46, 48, 32, 43, 32, 99, 32, 42, 32, 99, 59, 10, 32, 32, 32, 32,102,108,111,
- 97,116, 32,114,101,115,117,108,116, 59, 10, 10, 32, 32, 32, 32,105,102, 40,103, 32, 62, 32, 48, 46, 48, 41, 32,123, 10, 32, 32,
- 32, 32, 32, 32, 32, 32,103, 32, 61, 32,115,113,114,116, 40,103, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32,102,108,111, 97,116,
- 32, 65, 32, 61, 40,103, 32, 45, 32, 99, 41, 47, 40,103, 32, 43, 32, 99, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32,102,108,111,
- 97,116, 32, 66, 32, 61, 40, 99, 32, 42, 40,103, 32, 43, 32, 99, 41, 45, 32, 49, 46, 48, 41, 47, 40, 99, 32, 42, 40,103, 32, 45,
- 32, 99, 41, 43, 32, 49, 46, 48, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,115,117,108,116, 32, 61, 32, 48, 46, 53, 32,
- 42, 32, 65, 32, 42, 32, 65, 32, 42, 40, 49, 46, 48, 32, 43, 32, 66, 32, 42, 32, 66, 41, 59, 10, 32, 32, 32, 32,125, 10, 32, 32,
- 32, 32,101,108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,115,117,108,116, 32, 61, 32, 49, 46, 48, 59, 32, 32, 47, 42,
- 32, 84, 73, 82, 32, 40,110,111, 32,114,101,102,114, 97, 99,116,101,100, 32, 99,111,109,112,111,110,101,110,116, 41, 32, 42, 47,
- 10, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,114,101,115,117,108,116, 59, 10,125, 10, 10,102,108,111, 97,116, 32,104,121,
-112,111,116, 40,102,108,111, 97,116, 32,120, 44, 32,102,108,111, 97,116, 32,121, 41, 10,123, 10, 9,114,101,116,117,114,110, 32,
-115,113,114,116, 40,120, 42,120, 32, 43, 32,121, 42,121, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
- 32, 78, 69, 87, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 47, 10, 10, 35,100,101,102,105,110,101, 32, 78, 85, 77, 95, 76, 73, 71, 72, 84, 83, 32, 51, 10, 10, 47, 42, 32, 98,115,100,
-102,115, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,100,105,102,102,117,115,101, 40,118,101,
- 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 44, 32,118,101, 99, 51, 32,
- 78, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9, 47, 42, 32, 97,109, 98,105,101,110,
-116, 32,108,105,103,104,116, 32, 42, 47, 10, 9,118,101, 99, 51, 32, 76, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 50, 41, 59, 10,
- 10, 9, 47, 42, 32,100,105,114,101, 99,116,105,111,110, 97,108, 32,108,105,103,104,116,115, 32, 42, 47, 10, 9,102,111,114, 40,
-105,110,116, 32,105, 32, 61, 32, 48, 59, 32,105, 32, 60, 32, 78, 85, 77, 95, 76, 73, 71, 72, 84, 83, 59, 32,105, 43, 43, 41, 32,
-123, 10, 9, 9,118,101, 99, 51, 32,108,105,103,104,116, 95,112,111,115,105,116,105,111,110, 32, 61, 32,103,108, 95, 76,105,103,
-104,116, 83,111,117,114, 99,101, 91,105, 93, 46,112,111,115,105,116,105,111,110, 46,120,121,122, 59, 10, 9, 9,118,101, 99, 51,
- 32,108,105,103,104,116, 95,100,105,102,102,117,115,101, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,
-105, 93, 46,100,105,102,102,117,115,101, 46,114,103, 98, 59, 10, 10, 9, 9,102,108,111, 97,116, 32, 98,115,100,102, 32, 61, 32,
-109, 97,120, 40,100,111,116, 40, 78, 44, 32,108,105,103,104,116, 95,112,111,115,105,116,105,111,110, 41, 44, 32, 48, 46, 48, 41,
- 59, 10, 9, 9, 76, 32, 43, 61, 32,108,105,103,104,116, 95,100,105,102,102,117,115,101, 42, 98,115,100,102, 59, 10, 9,125, 10,
- 10, 9,114,101,115,117,108,116, 32, 61, 32,118,101, 99, 52, 40, 76, 42, 99,111,108,111,114, 46,114,103, 98, 44, 32, 49, 46, 48,
- 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,103,108,111,115,115,121, 40,118,101, 99, 52,
+111,108, 32, 43, 32,109, 97,120, 40, 99,111,108, 49, 42, 99,111,108, 50, 44, 32,118,101, 99, 52, 40, 48, 46, 48, 44, 32, 48, 46,
+ 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109, 97,100,
+100,102, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44,
+ 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,
+108, 32, 43, 32,102, 42, 99,111,108, 49, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109,117,108, 40,118,101,
+ 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,
+ 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 42, 99,111,108, 50, 59, 10,125, 10, 10,118,
+111,105,100, 32,115,104, 97,100,101, 95,109,117,108, 95,118, 97,108,117,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,
+101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116,
+ 99,111,108, 32, 61, 32, 99,111,108, 42,102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111, 98, 99,
+111,108,111,114, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32,111, 98, 99,111,108, 44, 32,111,117,116, 32,118,
+101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111,108,
+ 46,114,103, 98, 42,111, 98, 99,111,108, 46,114,103, 98, 44, 32, 99,111,108, 46, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,
+114, 97,109,112, 95,114,103, 98,116,111, 98,119, 40,118,101, 99, 51, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,102,108,111,
+ 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99,111,108,111,114, 46,114, 42, 48,
+ 46, 51, 32, 43, 32, 99,111,108,111,114, 46,103, 42, 48, 46, 53, 56, 32, 43, 32, 99,111,108,111,114, 46, 98, 42, 48, 46, 49, 50,
+ 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,110,108,121, 95,115,104, 97,100,111,119, 40,102,108,111, 97,
+116, 32,105, 44, 32,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,102,108,111, 97,116, 32,101,110,101,114,103,121,
+ 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,104, 97,100,102, 97, 99, 41, 10,123, 10, 9,111,117,116,115,104,
+ 97,100,102, 97, 99, 32, 61, 32,105, 42,101,110,101,114,103,121, 42, 40, 49, 46, 48, 32, 45, 32,115,104, 97,100,102, 97, 99, 41,
+ 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,110,108,121, 95,115,104, 97,100,111,119, 95,100,105,102,102,
+117,115,101, 40,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,118,101, 99, 51, 32,114,103, 98, 44, 32,118,101, 99,
+ 52, 32,100,105,102,102, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,100,105,102,102, 41, 10,123, 10, 9,111,117,116,
+100,105,102,102, 32, 61, 32,100,105,102,102, 32, 45, 32,118,101, 99, 52, 40,114,103, 98, 42,115,104, 97,100,102, 97, 99, 44, 32,
+ 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,110,108,121, 95,115,104, 97,100,111,119, 95,
+115,112,101, 99,117,108, 97,114, 40,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,118,101, 99, 51, 32,115,112,101,
+ 99,114,103, 98, 44, 32,118,101, 99, 52, 32,115,112,101, 99, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,115,112,101,
+ 99, 41, 10,123, 10, 9,111,117,116,115,112,101, 99, 32, 61, 32,115,112,101, 99, 32, 45, 32,118,101, 99, 52, 40,115,112,101, 99,
+114,103, 98, 42,115,104, 97,100,102, 97, 99, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,115,116, 95,
+115,104, 97,100,111,119, 98,117,102, 40,118,101, 99, 51, 32,114, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 83,104, 97,
+100,111,119, 32,115,104, 97,100,111,119,109, 97,112, 44, 32,109, 97,116, 52, 32,115,104, 97,100,111,119,112,101,114,115,109, 97,
+116, 44, 32,102,108,111, 97,116, 32,115,104, 97,100,111,119, 98,105, 97,115, 44, 32,102,108,111, 97,116, 32,105,110,112, 44, 32,
+111,117,116, 32,102,108,111, 97,116, 32,114,101,115,117,108,116, 41, 10,123, 10, 9,105,102, 40,105,110,112, 32, 60, 61, 32, 48,
+ 46, 48, 41, 32,123, 10, 9, 9,114,101,115,117,108,116, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123,
+ 10, 9, 9,118,101, 99, 52, 32, 99,111, 32, 61, 32,115,104, 97,100,111,119,112,101,114,115,109, 97,116, 42,118,101, 99, 52, 40,
+114, 99,111, 44, 32, 49, 46, 48, 41, 59, 10, 10, 9, 9, 47, 47,102,108,111, 97,116, 32, 98,105, 97,115, 32, 61, 32, 40, 49, 46,
+ 53, 32, 45, 32,105,110,112, 42,105,110,112, 41, 42,115,104, 97,100,111,119, 98,105, 97,115, 59, 10, 9, 9, 99,111, 46,122, 32,
+ 45, 61, 32,115,104, 97,100,111,119, 98,105, 97,115, 42, 99,111, 46,119, 59, 10, 10, 9, 9,114,101,115,117,108,116, 32, 61, 32,
+115,104, 97,100,111,119, 50, 68, 80,114,111,106, 40,115,104, 97,100,111,119,109, 97,112, 44, 32, 99,111, 41, 46,120, 59, 10, 9,
+125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,101,120,112,111,115,117,114,101, 95, 99,111,114,114,101, 99,116,
+ 40,118,101, 99, 51, 32, 99,111,108, 44, 32,102,108,111, 97,116, 32,108,105,110,102, 97, 99, 44, 32,102,108,111, 97,116, 32,108,
+111,103,102, 97, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,
+108, 32, 61, 32,108,105,110,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32,101,120,112, 40, 99,111,108, 42,108,111,103,102, 97, 99,
+ 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109,105,115,116, 95,102, 97, 99,116,111,114, 40,118,101,
+ 99, 51, 32, 99,111, 44, 32,102,108,111, 97,116, 32,109,105,115,116,115,116, 97, 44, 32,102,108,111, 97,116, 32,109,105,115,116,
+100,105,115,116, 44, 32,102,108,111, 97,116, 32,109,105,115,116,116,121,112,101, 44, 32,102,108,111, 97,116, 32,109,105,115,105,
+ 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,
+ 44, 32,122, 99,111,114, 59, 10, 10, 9,122, 99,111,114, 32, 61, 32, 40,103,108, 95, 80,114,111,106,101, 99,116,105,111,110, 77,
+ 97,116,114,105,120, 91, 51, 93, 91, 51, 93, 32, 61, 61, 32, 48, 46, 48, 41, 63, 32,108,101,110,103,116,104, 40, 99,111, 41, 58,
+ 32, 45, 99,111, 91, 50, 93, 59, 10, 9, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40, 40,122, 99,111,114, 45,109,105,
+115,116,115,116, 97, 41, 47,109,105,115,116,100,105,115,116, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,105,102, 40,
+109,105,115,116,116,121,112,101, 32, 61, 61, 32, 48, 46, 48, 41, 32,102, 97, 99, 32, 42, 61, 32,102, 97, 99, 59, 10, 9,101,108,
+115,101, 32,105,102, 40,109,105,115,116,116,121,112,101, 32, 61, 61, 32, 49, 46, 48, 41, 59, 10, 9,101,108,115,101, 32,102, 97,
+ 99, 32, 61, 32,115,113,114,116, 40,102, 97, 99, 41, 59, 10, 10, 9,111,117,116,102, 97, 99, 32, 61, 32, 49, 46, 48, 32, 45, 32,
+ 40, 49, 46, 48, 45,102, 97, 99, 41, 42, 40, 49, 46, 48, 45,109,105,115,105, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104,
+ 97,100,101, 95,119,111,114,108,100, 95,109,105,120, 40,118,101, 99, 51, 32,104,111,114, 44, 32,118,101, 99, 52, 32, 99,111,108,
+ 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99, 32,
+ 61, 32, 99,108, 97,109,112, 40, 99,111,108, 46, 97, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,
+108, 32, 61, 32,118,101, 99, 52, 40,109,105,120, 40,104,111,114, 44, 32, 99,111,108, 46,114,103, 98, 44, 32,102, 97, 99, 41, 44,
+ 32, 99,111,108, 46, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,108,112,104, 97, 95,111,112, 97,
+113,117,101, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123,
+ 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111,108, 46,114,103, 98, 44, 32, 49, 46, 48, 41, 59, 10,125,
+ 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,108,112,104, 97, 95,111, 98, 99,111,108,111,114, 40,118,101, 99, 52, 32,
+ 99,111,108, 44, 32,118,101, 99, 52, 32,111, 98, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108,
+ 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111,108, 46,114,103, 98, 44, 32, 99,111,108, 46,
+ 97, 42,111, 98, 99,111,108, 46, 97, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 78, 69, 87, 32,
+ 83, 72, 65, 68, 69, 82, 32, 85, 84, 73, 76, 73, 84, 73, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47,
+ 10, 10,102,108,111, 97,116, 32,102,114,101,115,110,101,108, 95,100,105,101,108,101, 99,116,114,105, 99, 40,118,101, 99, 51, 32,
+ 73,110, 99,111,109,105,110,103, 44, 32,118,101, 99, 51, 32, 78,111,114,109, 97,108, 44, 32,102,108,111, 97,116, 32,101,116, 97,
+ 41, 10,123, 10, 32, 32, 32, 32, 47, 42, 32, 99,111,109,112,117,116,101, 32,102,114,101,115,110,101,108, 32,114,101,102,108,101,
+ 99,116, 97,110, 99,101, 32,119,105,116,104,111,117,116, 32,101,120,112,108,105, 99,105,116,108,121, 32, 99,111,109,112,117,116,
+105,110,103, 10, 32, 32, 32, 32, 32, 32, 32,116,104,101, 32,114,101,102,114, 97, 99,116,101,100, 32,100,105,114,101, 99,116,105,
+111,110, 32, 42, 47, 10, 32, 32, 32, 32,102,108,111, 97,116, 32, 99, 32, 61, 32, 97, 98,115, 40,100,111,116, 40, 73,110, 99,111,
+109,105,110,103, 44, 32, 78,111,114,109, 97,108, 41, 41, 59, 10, 32, 32, 32, 32,102,108,111, 97,116, 32,103, 32, 61, 32,101,116,
+ 97, 32, 42, 32,101,116, 97, 32, 45, 32, 49, 46, 48, 32, 43, 32, 99, 32, 42, 32, 99, 59, 10, 32, 32, 32, 32,102,108,111, 97,116,
+ 32,114,101,115,117,108,116, 59, 10, 10, 32, 32, 32, 32,105,102, 40,103, 32, 62, 32, 48, 46, 48, 41, 32,123, 10, 32, 32, 32, 32,
+ 32, 32, 32, 32,103, 32, 61, 32,115,113,114,116, 40,103, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32,102,108,111, 97,116, 32, 65,
+ 32, 61, 40,103, 32, 45, 32, 99, 41, 47, 40,103, 32, 43, 32, 99, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32,102,108,111, 97,116,
+ 32, 66, 32, 61, 40, 99, 32, 42, 40,103, 32, 43, 32, 99, 41, 45, 32, 49, 46, 48, 41, 47, 40, 99, 32, 42, 40,103, 32, 45, 32, 99,
+ 41, 43, 32, 49, 46, 48, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,115,117,108,116, 32, 61, 32, 48, 46, 53, 32, 42, 32,
+ 65, 32, 42, 32, 65, 32, 42, 40, 49, 46, 48, 32, 43, 32, 66, 32, 42, 32, 66, 41, 59, 10, 32, 32, 32, 32,125, 10, 32, 32, 32, 32,
+101,108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,115,117,108,116, 32, 61, 32, 49, 46, 48, 59, 32, 32, 47, 42, 32, 84,
+ 73, 82, 32, 40,110,111, 32,114,101,102,114, 97, 99,116,101,100, 32, 99,111,109,112,111,110,101,110,116, 41, 32, 42, 47, 10, 10,
+ 32, 32, 32, 32,114,101,116,117,114,110, 32,114,101,115,117,108,116, 59, 10,125, 10, 10,102,108,111, 97,116, 32,104,121,112,111,
+116, 40,102,108,111, 97,116, 32,120, 44, 32,102,108,111, 97,116, 32,121, 41, 10,123, 10, 9,114,101,116,117,114,110, 32,115,113,
+114,116, 40,120, 42,120, 32, 43, 32,121, 42,121, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 78,
+ 69, 87, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47,
+ 10, 10, 35,100,101,102,105,110,101, 32, 78, 85, 77, 95, 76, 73, 71, 72, 84, 83, 32, 51, 10, 10, 47, 42, 32, 98,115,100,102,115,
+ 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,100,105,102,102,117,115,101, 40,118,101, 99, 52,
32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 44, 32,118,101, 99, 51, 32, 78, 44,
- 32,118,101, 99, 51, 32, 73, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9, 47, 42, 32,
- 97,109, 98,105,101,110,116, 32,108,105,103,104,116, 32, 42, 47, 10, 9,118,101, 99, 51, 32, 76, 32, 61, 32,118,101, 99, 51, 40,
- 48, 46, 50, 41, 59, 10, 10, 9, 47, 42, 32,100,105,114,101, 99,116,105,111,110, 97,108, 32,108,105,103,104,116,115, 32, 42, 47,
- 10, 9,102,111,114, 40,105,110,116, 32,105, 32, 61, 32, 48, 59, 32,105, 32, 60, 32, 78, 85, 77, 95, 76, 73, 71, 72, 84, 83, 59,
- 32,105, 43, 43, 41, 32,123, 10, 9, 9,118,101, 99, 51, 32,108,105,103,104,116, 95,112,111,115,105,116,105,111,110, 32, 61, 32,
-103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,112,111,115,105,116,105,111,110, 46,120,121,122, 59, 10,
- 9, 9,118,101, 99, 51, 32, 72, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,104, 97,108,
-102, 86,101, 99,116,111,114, 46,120,121,122, 59, 10, 9, 9,118,101, 99, 51, 32,108,105,103,104,116, 95,100,105,102,102,117,115,
-101, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,100,105,102,102,117,115,101, 46,114,103,
- 98, 59, 10, 9, 9,118,101, 99, 51, 32,108,105,103,104,116, 95,115,112,101, 99,117,108, 97,114, 32, 61, 32,103,108, 95, 76,105,
-103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,115,112,101, 99,117,108, 97,114, 46,114,103, 98, 59, 10, 10, 9, 9, 47, 42,
- 32,119,101, 32,109,105,120, 32,105,110, 32,115,111,109,101, 32,100,105,102,102,117,115,101, 32,115,111, 32,108,111,119, 32,114,
-111,117,103,104,110,101,115,115, 32,115,116,105,108,108, 32,115,104,111,119,115, 32,117,112, 32, 42, 47, 10, 9, 9,102,108,111,
- 97,116, 32, 98,115,100,102, 32, 61, 32, 48, 46, 53, 42,112,111,119, 40,109, 97,120, 40,100,111,116, 40, 78, 44, 32, 72, 41, 44,
- 32, 48, 46, 48, 41, 44, 32, 49, 46, 48, 47,114,111,117,103,104,110,101,115,115, 41, 59, 10, 9, 9, 98,115,100,102, 32, 43, 61,
- 32, 48, 46, 53, 42,109, 97,120, 40,100,111,116, 40, 78, 44, 32,108,105,103,104,116, 95,112,111,115,105,116,105,111,110, 41, 44,
- 32, 48, 46, 48, 41, 59, 10, 9, 9, 76, 32, 43, 61, 32,108,105,103,104,116, 95,115,112,101, 99,117,108, 97,114, 42, 98,115,100,
-102, 59, 10, 9,125, 10, 10, 9,114,101,115,117,108,116, 32, 61, 32,118,101, 99, 52, 40, 76, 42, 99,111,108,111,114, 46,114,103,
- 98, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95, 97,110,105,115,111,
-116,114,111,112,105, 99, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,
-115,115, 85, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 86, 44, 32,118,101, 99, 51, 32, 78, 44, 32,118,
-101, 99, 51, 32, 73, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9,110,111,100,101, 95,
- 98,115,100,102, 95,100,105,102,102,117,115,101, 40, 99,111,108,111,114, 44, 32, 48, 46, 48, 44, 32, 78, 44, 32,114,101,115,117,
-108,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,103,108, 97,115,115, 40,118,101, 99,
- 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 44, 32,102,108,111, 97,116, 32,
-105,111,114, 44, 32,118,101, 99, 51, 32, 78, 44, 32,118,101, 99, 51, 32, 73, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,
-115,117,108,116, 41, 10,123, 10, 9,110,111,100,101, 95, 98,115,100,102, 95,100,105,102,102,117,115,101, 40, 99,111,108,111,114,
- 44, 32, 48, 46, 48, 44, 32, 78, 44, 32,114,101,115,117,108,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95,
- 98,115,100,102, 95,116,114, 97,110,115,108,117, 99,101,110,116, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,118,101, 99,
- 51, 32, 78, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9,110,111,100,101, 95, 98,115,
+ 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9, 47, 42, 32, 97,109, 98,105,101,110,116, 32,
+108,105,103,104,116, 32, 42, 47, 10, 9,118,101, 99, 51, 32, 76, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 50, 41, 59, 10, 10, 9,
+ 47, 42, 32,100,105,114,101, 99,116,105,111,110, 97,108, 32,108,105,103,104,116,115, 32, 42, 47, 10, 9,102,111,114, 40,105,110,
+116, 32,105, 32, 61, 32, 48, 59, 32,105, 32, 60, 32, 78, 85, 77, 95, 76, 73, 71, 72, 84, 83, 59, 32,105, 43, 43, 41, 32,123, 10,
+ 9, 9,118,101, 99, 51, 32,108,105,103,104,116, 95,112,111,115,105,116,105,111,110, 32, 61, 32,103,108, 95, 76,105,103,104,116,
+ 83,111,117,114, 99,101, 91,105, 93, 46,112,111,115,105,116,105,111,110, 46,120,121,122, 59, 10, 9, 9,118,101, 99, 51, 32,108,
+105,103,104,116, 95,100,105,102,102,117,115,101, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93,
+ 46,100,105,102,102,117,115,101, 46,114,103, 98, 59, 10, 10, 9, 9,102,108,111, 97,116, 32, 98,115,100,102, 32, 61, 32,109, 97,
+120, 40,100,111,116, 40, 78, 44, 32,108,105,103,104,116, 95,112,111,115,105,116,105,111,110, 41, 44, 32, 48, 46, 48, 41, 59, 10,
+ 9, 9, 76, 32, 43, 61, 32,108,105,103,104,116, 95,100,105,102,102,117,115,101, 42, 98,115,100,102, 59, 10, 9,125, 10, 10, 9,
+114,101,115,117,108,116, 32, 61, 32,118,101, 99, 52, 40, 76, 42, 99,111,108,111,114, 46,114,103, 98, 44, 32, 49, 46, 48, 41, 59,
+ 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,103,108,111,115,115,121, 40,118,101, 99, 52, 32, 99,
+111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 44, 32,118,101, 99, 51, 32, 78, 44, 32,118,
+101, 99, 51, 32, 73, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9, 47, 42, 32, 97,109,
+ 98,105,101,110,116, 32,108,105,103,104,116, 32, 42, 47, 10, 9,118,101, 99, 51, 32, 76, 32, 61, 32,118,101, 99, 51, 40, 48, 46,
+ 50, 41, 59, 10, 10, 9, 47, 42, 32,100,105,114,101, 99,116,105,111,110, 97,108, 32,108,105,103,104,116,115, 32, 42, 47, 10, 9,
+102,111,114, 40,105,110,116, 32,105, 32, 61, 32, 48, 59, 32,105, 32, 60, 32, 78, 85, 77, 95, 76, 73, 71, 72, 84, 83, 59, 32,105,
+ 43, 43, 41, 32,123, 10, 9, 9,118,101, 99, 51, 32,108,105,103,104,116, 95,112,111,115,105,116,105,111,110, 32, 61, 32,103,108,
+ 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,112,111,115,105,116,105,111,110, 46,120,121,122, 59, 10, 9, 9,
+118,101, 99, 51, 32, 72, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,104, 97,108,102, 86,
+101, 99,116,111,114, 46,120,121,122, 59, 10, 9, 9,118,101, 99, 51, 32,108,105,103,104,116, 95,100,105,102,102,117,115,101, 32,
+ 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,100,105,102,102,117,115,101, 46,114,103, 98, 59,
+ 10, 9, 9,118,101, 99, 51, 32,108,105,103,104,116, 95,115,112,101, 99,117,108, 97,114, 32, 61, 32,103,108, 95, 76,105,103,104,
+116, 83,111,117,114, 99,101, 91,105, 93, 46,115,112,101, 99,117,108, 97,114, 46,114,103, 98, 59, 10, 10, 9, 9, 47, 42, 32,119,
+101, 32,109,105,120, 32,105,110, 32,115,111,109,101, 32,100,105,102,102,117,115,101, 32,115,111, 32,108,111,119, 32,114,111,117,
+103,104,110,101,115,115, 32,115,116,105,108,108, 32,115,104,111,119,115, 32,117,112, 32, 42, 47, 10, 9, 9,102,108,111, 97,116,
+ 32, 98,115,100,102, 32, 61, 32, 48, 46, 53, 42,112,111,119, 40,109, 97,120, 40,100,111,116, 40, 78, 44, 32, 72, 41, 44, 32, 48,
+ 46, 48, 41, 44, 32, 49, 46, 48, 47,114,111,117,103,104,110,101,115,115, 41, 59, 10, 9, 9, 98,115,100,102, 32, 43, 61, 32, 48,
+ 46, 53, 42,109, 97,120, 40,100,111,116, 40, 78, 44, 32,108,105,103,104,116, 95,112,111,115,105,116,105,111,110, 41, 44, 32, 48,
+ 46, 48, 41, 59, 10, 9, 9, 76, 32, 43, 61, 32,108,105,103,104,116, 95,115,112,101, 99,117,108, 97,114, 42, 98,115,100,102, 59,
+ 10, 9,125, 10, 10, 9,114,101,115,117,108,116, 32, 61, 32,118,101, 99, 52, 40, 76, 42, 99,111,108,111,114, 46,114,103, 98, 44,
+ 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95, 97,110,105,115,111,116,114,
+111,112,105, 99, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115,
+ 85, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 86, 44, 32,118,101, 99, 51, 32, 78, 44, 32,118,101, 99,
+ 51, 32, 73, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9,110,111,100,101, 95, 98,115,
100,102, 95,100,105,102,102,117,115,101, 40, 99,111,108,111,114, 44, 32, 48, 46, 48, 44, 32, 78, 44, 32,114,101,115,117,108,116,
- 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,116,114, 97,110,115,112, 97,114,101,110,116,
- 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10,
- 9, 47, 42, 32,116,104,105,115, 32,105,115,110, 39,116, 32,114,105,103,104,116, 32, 42, 47, 10, 9,114,101,115,117,108,116, 46,
-114, 32, 61, 32, 99,111,108,111,114, 46,114, 59, 10, 9,114,101,115,117,108,116, 46,103, 32, 61, 32, 99,111,108,111,114, 46,103,
- 59, 10, 9,114,101,115,117,108,116, 46, 98, 32, 61, 32, 99,111,108,111,114, 46, 98, 59, 10, 9,114,101,115,117,108,116, 46, 97,
- 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,118,101,108,118,101,116,
- 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,115,105,103,109, 97, 44, 32,118,101, 99, 51, 32, 78,
- 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9,110,111,100,101, 95, 98,115,100,102, 95,
-100,105,102,102,117,115,101, 40, 99,111,108,111,114, 44, 32, 48, 46, 48, 44, 32, 78, 44, 32,114,101,115,117,108,116, 41, 59, 10,
-125, 10, 10, 47, 42, 32,101,109,105,115,115,105,111,110, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95,101,109,105,
-115,115,105,111,110, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,115,116,114,101,110,103,116,104,
- 44, 32,118,101, 99, 51, 32, 78, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9,114,101,
-115,117,108,116, 32, 61, 32, 99,111,108,111,114, 42,115,116,114,101,110,103,116,104, 59, 10,125, 10, 10, 47, 42, 32, 99,108,111,
-115,117,114,101,115, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95,109,105,120, 95,115,104, 97,100,101,114, 40,102,
-108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32,115,104, 97,100,101,114, 49, 44, 32,118,101, 99, 52, 32,115,104, 97,
-100,101,114, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,115,104, 97,100,101,114, 41, 10,123, 10, 9,115,104, 97,100,101,114,
- 32, 61, 32,109,105,120, 40,115,104, 97,100,101,114, 49, 44, 32,115,104, 97,100,101,114, 50, 44, 32,102, 97, 99, 41, 59, 10,125,
- 10, 10,118,111,105,100, 32,110,111,100,101, 95, 97,100,100, 95,115,104, 97,100,101,114, 40,118,101, 99, 52, 32,115,104, 97,100,
-101,114, 49, 44, 32,118,101, 99, 52, 32,115,104, 97,100,101,114, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,115,104, 97,100,
-101,114, 41, 10,123, 10, 9,115,104, 97,100,101,114, 32, 61, 32,115,104, 97,100,101,114, 49, 32, 43, 32,115,104, 97,100,101,114,
- 50, 59, 10,125, 10, 10, 47, 42, 32,102,114,101,115,110,101,108, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95,102,
-114,101,115,110,101,108, 40,102,108,111, 97,116, 32,105,111,114, 44, 32,118,101, 99, 51, 32, 78, 44, 32,118,101, 99, 51, 32, 73,
- 44, 32,111,117,116, 32,102,108,111, 97,116, 32,114,101,115,117,108,116, 41, 10,123, 10, 9,102,108,111, 97,116, 32,101,116, 97,
- 32, 61, 32,109, 97,120, 40,105,111,114, 44, 32, 48, 46, 48, 48, 48, 48, 49, 41, 59, 10, 9,114,101,115,117,108,116, 32, 61, 32,
-102,114,101,115,110,101,108, 95,100,105,101,108,101, 99,116,114,105, 99, 40, 73, 44, 32, 78, 44, 32,101,116, 97, 41, 59, 32, 47,
- 47, 98, 97, 99,107,102, 97, 99,105,110,103, 40, 41, 63, 32, 49, 46, 48, 47,101,116, 97, 58, 32,101,116, 97, 41, 59, 10,125, 10,
- 10, 47, 42, 32,103,101,111,109,101,116,114,121, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95,103,101,111,109,101,
-116,114,121, 40,118,101, 99, 51, 32, 73, 44, 32,118,101, 99, 51, 32, 78, 44, 32,109, 97,116, 52, 32,116,111,119,111,114,108,100,
- 44, 10, 9,111,117,116, 32,118,101, 99, 51, 32,112,111,115,105,116,105,111,110, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,
-111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,116, 97,110,103,101,110,116, 44, 10, 9,111,117,116, 32,118,101,
- 99, 51, 32,116,114,117,101, 95,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,109,105,110,
-103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,112, 97,114, 97,109,101,116,114,105, 99, 44, 10, 9,111,117,116, 32,102,108,111,
- 97,116, 32, 98, 97, 99,107,102, 97, 99,105,110,103, 41, 10,123, 10, 9,112,111,115,105,116,105,111,110, 32, 61, 32, 40,116,111,
-119,111,114,108,100, 42,118,101, 99, 52, 40, 73, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,110,111,114,109, 97,108,
- 32, 61, 32, 78, 59, 10, 9,116, 97,110,103,101,110,116, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10, 9,116,114,117,
-101, 95,110,111,114,109, 97,108, 32, 61, 32, 78, 59, 10, 9,105,110, 99,111,109,105,110,103, 32, 61, 32, 73, 59, 10, 9,112, 97,
-114, 97,109,101,116,114,105, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10, 9, 98, 97, 99,107,102, 97, 99,105,110,
-103, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95,116,101,120, 95, 99,111,111,114,100, 40,
-118,101, 99, 51, 32, 73, 44, 32,118,101, 99, 51, 32, 78, 44, 32,109, 97,116, 52, 32,116,111,119,111,114,108,100, 44, 10, 9,118,
-101, 99, 51, 32, 97,116,116,114, 95,111,114, 99,111, 44, 32,118,101, 99, 51, 32, 97,116,116,114, 95,117,118, 44, 10, 9,111,117,
-116, 32,118,101, 99, 51, 32,103,101,110,101,114, 97,116,101,100, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,111,
-117,116, 32,118,101, 99, 51, 32,111, 98,106,101, 99,116, 44, 10, 9,111,117,116, 32,118,101, 99, 51, 32, 99, 97,109,101,114, 97,
- 44, 32,111,117,116, 32,118,101, 99, 51, 32,119,105,110,100,111,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,114,101,102,108,
-101, 99,116,105,111,110, 41, 10,123, 10, 9,103,101,110,101,114, 97,116,101,100, 32, 61, 32, 97,116,116,114, 95,111,114, 99,111,
+ 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,103,108, 97,115,115, 40,118,101, 99, 52, 32,
+ 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 44, 32,102,108,111, 97,116, 32,105,111,
+114, 44, 32,118,101, 99, 51, 32, 78, 44, 32,118,101, 99, 51, 32, 73, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,
+108,116, 41, 10,123, 10, 9,110,111,100,101, 95, 98,115,100,102, 95,100,105,102,102,117,115,101, 40, 99,111,108,111,114, 44, 32,
+ 48, 46, 48, 44, 32, 78, 44, 32,114,101,115,117,108,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,
+100,102, 95,116,114, 97,110,115,108,117, 99,101,110,116, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,118,101, 99, 51, 32,
+ 78, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9,110,111,100,101, 95, 98,115,100,102,
+ 95,100,105,102,102,117,115,101, 40, 99,111,108,111,114, 44, 32, 48, 46, 48, 44, 32, 78, 44, 32,114,101,115,117,108,116, 41, 59,
+ 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,116,114, 97,110,115,112, 97,114,101,110,116, 40,118,
+101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9, 47,
+ 42, 32,116,104,105,115, 32,105,115,110, 39,116, 32,114,105,103,104,116, 32, 42, 47, 10, 9,114,101,115,117,108,116, 46,114, 32,
+ 61, 32, 99,111,108,111,114, 46,114, 59, 10, 9,114,101,115,117,108,116, 46,103, 32, 61, 32, 99,111,108,111,114, 46,103, 59, 10,
+ 9,114,101,115,117,108,116, 46, 98, 32, 61, 32, 99,111,108,111,114, 46, 98, 59, 10, 9,114,101,115,117,108,116, 46, 97, 32, 61,
+ 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,118,101,108,118,101,116, 40,118,
+101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,115,105,103,109, 97, 44, 32,118,101, 99, 51, 32, 78, 44, 32,
+111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9,110,111,100,101, 95, 98,115,100,102, 95,100,105,
+102,102,117,115,101, 40, 99,111,108,111,114, 44, 32, 48, 46, 48, 44, 32, 78, 44, 32,114,101,115,117,108,116, 41, 59, 10,125, 10,
+ 10, 47, 42, 32,101,109,105,115,115,105,111,110, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95,101,109,105,115,115,
+105,111,110, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,115,116,114,101,110,103,116,104, 44, 32,
+118,101, 99, 51, 32, 78, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10, 9,114,101,115,117,
+108,116, 32, 61, 32, 99,111,108,111,114, 42,115,116,114,101,110,103,116,104, 59, 10,125, 10, 10, 47, 42, 32, 99,108,111,115,117,
+114,101,115, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95,109,105,120, 95,115,104, 97,100,101,114, 40,102,108,111,
+ 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32,115,104, 97,100,101,114, 49, 44, 32,118,101, 99, 52, 32,115,104, 97,100,101,
+114, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,115,104, 97,100,101,114, 41, 10,123, 10, 9,115,104, 97,100,101,114, 32, 61,
+ 32,109,105,120, 40,115,104, 97,100,101,114, 49, 44, 32,115,104, 97,100,101,114, 50, 44, 32,102, 97, 99, 41, 59, 10,125, 10, 10,
+118,111,105,100, 32,110,111,100,101, 95, 97,100,100, 95,115,104, 97,100,101,114, 40,118,101, 99, 52, 32,115,104, 97,100,101,114,
+ 49, 44, 32,118,101, 99, 52, 32,115,104, 97,100,101,114, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,115,104, 97,100,101,114,
+ 41, 10,123, 10, 9,115,104, 97,100,101,114, 32, 61, 32,115,104, 97,100,101,114, 49, 32, 43, 32,115,104, 97,100,101,114, 50, 59,
+ 10,125, 10, 10, 47, 42, 32,102,114,101,115,110,101,108, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95,102,114,101,
+115,110,101,108, 40,102,108,111, 97,116, 32,105,111,114, 44, 32,118,101, 99, 51, 32, 78, 44, 32,118,101, 99, 51, 32, 73, 44, 32,
+111,117,116, 32,102,108,111, 97,116, 32,114,101,115,117,108,116, 41, 10,123, 10, 9,102,108,111, 97,116, 32,101,116, 97, 32, 61,
+ 32,109, 97,120, 40,105,111,114, 44, 32, 48, 46, 48, 48, 48, 48, 49, 41, 59, 10, 9,114,101,115,117,108,116, 32, 61, 32,102,114,
+101,115,110,101,108, 95,100,105,101,108,101, 99,116,114,105, 99, 40, 73, 44, 32, 78, 44, 32,101,116, 97, 41, 59, 32, 47, 47, 98,
+ 97, 99,107,102, 97, 99,105,110,103, 40, 41, 63, 32, 49, 46, 48, 47,101,116, 97, 58, 32,101,116, 97, 41, 59, 10,125, 10, 10, 47,
+ 42, 32,103,101,111,109,101,116,114,121, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95,103,101,111,109,101,116,114,
+121, 40,118,101, 99, 51, 32, 73, 44, 32,118,101, 99, 51, 32, 78, 44, 32,109, 97,116, 52, 32,116,111,119,111,114,108,100, 44, 10,
+ 9,111,117,116, 32,118,101, 99, 51, 32,112,111,115,105,116,105,111,110, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,
+109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,116, 97,110,103,101,110,116, 44, 10, 9,111,117,116, 32,118,101, 99, 51,
+ 32,116,114,117,101, 95,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,109,105,110,103, 44,
+ 32,111,117,116, 32,118,101, 99, 51, 32,112, 97,114, 97,109,101,116,114,105, 99, 44, 10, 9,111,117,116, 32,102,108,111, 97,116,
+ 32, 98, 97, 99,107,102, 97, 99,105,110,103, 41, 10,123, 10, 9,112,111,115,105,116,105,111,110, 32, 61, 32, 40,116,111,119,111,
+114,108,100, 42,118,101, 99, 52, 40, 73, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,110,111,114,109, 97,108, 32, 61,
+ 32, 78, 59, 10, 9,116, 97,110,103,101,110,116, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10, 9,116,114,117,101, 95,
+110,111,114,109, 97,108, 32, 61, 32, 78, 59, 10, 9,105,110, 99,111,109,105,110,103, 32, 61, 32, 73, 59, 10, 9,112, 97,114, 97,
+109,101,116,114,105, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10, 9, 98, 97, 99,107,102, 97, 99,105,110,103, 32,
+ 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95,116,101,120, 95, 99,111,111,114,100, 40,118,101,
+ 99, 51, 32, 73, 44, 32,118,101, 99, 51, 32, 78, 44, 32,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,109,
+ 97,116, 52, 32,111, 98,105,110,118,109, 97,116, 44, 10, 9,118,101, 99, 51, 32, 97,116,116,114, 95,111,114, 99,111, 44, 32,118,
+101, 99, 51, 32, 97,116,116,114, 95,117,118, 44, 10, 9,111,117,116, 32,118,101, 99, 51, 32,103,101,110,101,114, 97,116,101,100,
+ 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,
+111,117,116, 32,118,101, 99, 51, 32,111, 98,106,101, 99,116, 44, 10, 9,111,117,116, 32,118,101, 99, 51, 32, 99, 97,109,101,114,
+ 97, 44, 32,111,117,116, 32,118,101, 99, 51, 32,119,105,110,100,111,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,114,101,102,
+108,101, 99,116,105,111,110, 41, 10,123, 10, 9,103,101,110,101,114, 97,116,101,100, 32, 61, 32, 97,116,116,114, 95,111,114, 99,
+111, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 40,111, 98,105,110,118,109, 97,116,
+ 42, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40, 78, 44, 32, 48, 46, 48, 41, 41, 41, 46,120,121,122, 41,
59, 10, 9,117,118, 32, 61, 32, 97,116,116,114, 95,117,118, 59, 10, 9,111, 98,106,101, 99,116, 32, 61, 32, 73, 59, 10, 9, 99,
97,109,101,114, 97, 32, 61, 32, 73, 59, 10, 9,119,105,110,100,111,119, 32, 61, 32,103,108, 95, 70,114, 97,103, 67,111,111,114,
100, 46,120,121,122, 59, 10, 9,114,101,102,108,101, 99,116,105,111,110, 32, 61, 32,114,101,102,108,101, 99,116, 40, 78, 44, 32,
diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c
index 8d4d01b7e97..08c5e24aca6 100644
--- a/source/blender/ikplugin/intern/iksolver_plugin.c
+++ b/source/blender/ikplugin/intern/iksolver_plugin.c
@@ -425,10 +425,10 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
goalpos[2]= fac*goalpos[2] + mfac*world_pose[3][2];
/* blend rotation */
- mat3_to_quat( q1,goalrot);
- mat4_to_quat( q2,world_pose);
+ mat3_to_quat(q1, goalrot);
+ mat4_to_quat(q2, world_pose);
interp_qt_qtqt(q, q1, q2, mfac);
- quat_to_mat3( goalrot,q);
+ quat_to_mat3(goalrot, q);
}
iktarget= iktree[target->tip];
diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp
index ccfe2eaa862..2e437c627a2 100644
--- a/source/blender/ikplugin/intern/itasc_plugin.cpp
+++ b/source/blender/ikplugin/intern/itasc_plugin.cpp
@@ -424,16 +424,16 @@ static IK_Data* get_ikdata(bPose *pose)
}
static double EulerAngleFromMatrix(const KDL::Rotation& R, int axis)
{
- double t = KDL::sqrt(R(0,0)*R(0,0) + R(0,1)*R(0,1));
+ double t = KDL::sqrt(R(0, 0)*R(0, 0) + R(0, 1)*R(0, 1));
if (t > 16.0*KDL::epsilon) {
- if (axis == 0) return -KDL::atan2(R(1,2), R(2,2));
- else if (axis == 1) return KDL::atan2(-R(0,2), t);
- else return -KDL::atan2(R(0,1), R(0,0));
+ if (axis == 0) return -KDL::atan2(R(1, 2), R(2, 2));
+ else if (axis == 1) return KDL::atan2(-R(0, 2), t);
+ else return -KDL::atan2(R(0, 1), R(0, 0));
}
else {
- if (axis == 0) return -KDL::atan2(-R(2,1), R(1,1));
- else if (axis == 1) return KDL::atan2(-R(0,2), t);
+ if (axis == 0) return -KDL::atan2(-R(2, 1), R(1, 1));
+ else if (axis == 1) return KDL::atan2(-R(0, 2), t);
else return 0.0f;
}
}
@@ -441,8 +441,8 @@ static double EulerAngleFromMatrix(const KDL::Rotation& R, int axis)
static double ComputeTwist(const KDL::Rotation& R)
{
// qy and qw are the y and w components of the quaternion from R
- double qy = R(0,2) - R(2,0);
- double qw = R(0,0) + R(1,1) + R(2,2) + 1;
+ double qy = R(0, 2) - R(2, 0);
+ double qw = R(0, 0) + R(1, 1) + R(2, 2) + 1;
double tau = 2*KDL::atan2(qy, qw);
@@ -471,39 +471,38 @@ static void RemoveEulerAngleFromMatrix(KDL::Rotation& R, double angle, int axis)
}
#if 0
-static void GetEulerXZY(const KDL::Rotation& R, double& X,double& Z,double& Y)
+static void GetEulerXZY(const KDL::Rotation& R, double& X, double& Z, double& Y)
{
- if (fabs(R(0,1)) > 1.0 - KDL::epsilon ) {
- X = -KDL::sign(R(0,1)) * KDL::atan2(R(1,2), R(1,0));
- Z = -KDL::sign(R(0,1)) * KDL::PI / 2;
+ if (fabs(R(0, 1)) > 1.0 - KDL::epsilon ) {
+ X = -KDL::sign(R(0, 1)) * KDL::atan2(R(1, 2), R(1, 0));
+ Z = -KDL::sign(R(0, 1)) * KDL::PI / 2;
Y = 0.0;
}
else {
- X = KDL::atan2(R(2,1), R(1,1));
- Z = KDL::atan2(-R(0,1), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,2))));
- Y = KDL::atan2(R(0,2), R(0,0));
+ X = KDL::atan2(R(2, 1), R(1, 1));
+ Z = KDL::atan2(-R(0, 1), KDL::sqrt( KDL::sqr(R(0, 0)) + KDL::sqr(R(0, 2))));
+ Y = KDL::atan2(R(0, 2), R(0, 0));
}
}
-static void GetEulerXYZ(const KDL::Rotation& R, double& X,double& Y,double& Z)
+static void GetEulerXYZ(const KDL::Rotation& R, double& X, double& Y, double& Z)
{
- if (fabs(R(0,2)) > 1.0 - KDL::epsilon ) {
- X = KDL::sign(R(0,2)) * KDL::atan2(-R(1,0), R(1,1));
- Y = KDL::sign(R(0,2)) * KDL::PI / 2;
+ if (fabs(R(0, 2)) > 1.0 - KDL::epsilon ) {
+ X = KDL::sign(R(0, 2)) * KDL::atan2(-R(1, 0), R(1, 1));
+ Y = KDL::sign(R(0, 2)) * KDL::PI / 2;
Z = 0.0;
}
else {
- X = KDL::atan2(-R(1,2), R(2,2));
- Y = KDL::atan2(R(0,2), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,1))));
- Z = KDL::atan2(-R(0,1), R(0,0));
+ X = KDL::atan2(-R(1, 2), R(2, 2));
+ Y = KDL::atan2(R(0, 2), KDL::sqrt( KDL::sqr(R(0, 0)) + KDL::sqr(R(0, 1))));
+ Z = KDL::atan2(-R(0, 1), R(0, 0));
}
}
#endif
static void GetJointRotation(KDL::Rotation& boneRot, int type, double* rot)
{
- switch (type & ~IK_TRANSY)
- {
+ switch (type & ~IK_TRANSY) {
default:
// fixed bone, no joint
break;
@@ -805,16 +804,16 @@ static bool joint_callback(const iTaSC::Timestamp& timestamp, iTaSC::ConstraintV
if (chan->rotmode > 0) {
/* euler rotations (will cause gimble lock, but this can be alleviated a bit with rotation orders) */
- eulO_to_mat3( rmat,chan->eul, chan->rotmode);
+ eulO_to_mat3( rmat, chan->eul, chan->rotmode);
}
else if (chan->rotmode == ROT_MODE_AXISANGLE) {
/* axis-angle - stored in quaternion data, but not really that great for 3D-changing orientations */
- axis_angle_to_mat3( rmat,&chan->quat[1], chan->quat[0]);
+ axis_angle_to_mat3( rmat, &chan->quat[1], chan->quat[0]);
}
else {
/* quats are normalised before use to eliminate scaling issues */
normalize_qt(chan->quat);
- quat_to_mat3( rmat,chan->quat);
+ quat_to_mat3(rmat, chan->quat);
}
KDL::Rotation jointRot(
rmat[0][0], rmat[1][0], rmat[2][0],
@@ -825,8 +824,7 @@ static bool joint_callback(const iTaSC::Timestamp& timestamp, iTaSC::ConstraintV
}
// determine which part of jointValue is used for this joint
// closely related to the way the joints are defined
- switch (ikchan->jointType & ~IK_TRANSY)
- {
+ switch (ikchan->jointType & ~IK_TRANSY) {
case IK_XDOF:
case IK_YDOF:
case IK_ZDOF:
@@ -881,15 +879,21 @@ static int convert_channels(IK_Scene *ikscene, PoseTree *tree)
/* set DoF flag */
flag = 0;
- if (!(pchan->ikflag & BONE_IK_NO_XDOF) && !(pchan->ikflag & BONE_IK_NO_XDOF_TEMP) &&
- (!(pchan->ikflag & BONE_IK_XLIMIT) || pchan->limitmin[0]<0.f || pchan->limitmax[0]>0.f))
+ if (!(pchan->ikflag & BONE_IK_NO_XDOF) && !(pchan->ikflag & BONE_IK_NO_XDOF_TEMP) &&
+ (!(pchan->ikflag & BONE_IK_XLIMIT) || pchan->limitmin[0]<0.f || pchan->limitmax[0]>0.f))
+ {
flag |= IK_XDOF;
+ }
if (!(pchan->ikflag & BONE_IK_NO_YDOF) && !(pchan->ikflag & BONE_IK_NO_YDOF_TEMP) &&
- (!(pchan->ikflag & BONE_IK_YLIMIT) || pchan->limitmin[1]<0.f || pchan->limitmax[1]>0.f))
+ (!(pchan->ikflag & BONE_IK_YLIMIT) || pchan->limitmin[1]<0.f || pchan->limitmax[1]>0.f))
+ {
flag |= IK_YDOF;
+ }
if (!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP) &&
- (!(pchan->ikflag & BONE_IK_ZLIMIT) || pchan->limitmin[2]<0.f || pchan->limitmax[2]>0.f))
+ (!(pchan->ikflag & BONE_IK_ZLIMIT) || pchan->limitmin[2]<0.f || pchan->limitmax[2]>0.f))
+ {
flag |= IK_ZDOF;
+ }
if (tree->stretch && (pchan->ikstretch > 0.0)) {
flag |= IK_TRANSY;
@@ -921,8 +925,7 @@ static int convert_channels(IK_Scene *ikscene, PoseTree *tree)
* bone length is computed from bone->length multiplied by the scaling factor of
* the armature. Non-uniform scaling will give bad result!
*/
- switch (flag & (IK_XDOF|IK_YDOF|IK_ZDOF))
- {
+ switch (flag & (IK_XDOF|IK_YDOF|IK_ZDOF)) {
default:
ikchan->jointType = 0;
ikchan->ndof = 0;
@@ -1165,8 +1168,7 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan)
weight[0] = (1.0-pchan->stiffness[0]);
weight[1] = (1.0-pchan->stiffness[1]);
weight[2] = (1.0-pchan->stiffness[2]);
- switch (ikchan->jointType & ~IK_TRANSY)
- {
+ switch (ikchan->jointType & ~IK_TRANSY) {
case 0:
// fixed bone
if (!(ikchan->jointType & IK_TRANSY)) {
@@ -1386,7 +1388,7 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan)
e_matrix& Wq = arm->getWq();
assert(Wq.cols() == (int)weights.size());
for (int q=0; q<Wq.cols(); q++)
- Wq(q,q)=weights[q];
+ Wq(q, q)=weights[q];
// get the inverse rest pose frame of the base to compute relative rest pose of end effectors
// this is needed to handle the enforce parameter
// ikscene->pchan[0] is the root channel of the tree
@@ -1512,7 +1514,7 @@ static void create_scene(Scene *scene, Object *ob)
ikdata->first = ikscene;
}
// delete the trees once we are done
- while(tree) {
+ while (tree) {
BLI_remlink(&pchan->iktree, tree);
BLI_freelistN(&tree->targets);
if (tree->pchan) MEM_freeN(tree->pchan);
@@ -1610,10 +1612,12 @@ static void execute_scene(Scene* blscene, IK_Scene* ikscene, bItasc* ikparam, fl
ikscene->scene->update(timestamp, timestep, numstep, false, !reiterate, simulation);
if (reiterate) {
// how many times do we reiterate?
- for (i=0; i<ikparam->numiter; i++) {
+ for (i = 0; i<ikparam->numiter; i++) {
if (ikscene->armature->getMaxJointChange() < ikparam->precision ||
- ikscene->armature->getMaxEndEffectorChange() < ikparam->precision)
+ ikscene->armature->getMaxEndEffectorChange() < ikparam->precision)
+ {
break;
+ }
ikscene->scene->update(timestamp, timestep, numstep, true, false, simulation);
}
if (simulation) {
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index 0c8f932db6a..9f3ed6797be 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -133,8 +133,8 @@ static void free_anim_movie(struct anim *UNUSED(anim)) { ; }
static int an_stringdec(const char *string, char* head, char *tail, unsigned short *numlen)
{
- unsigned short len,nume,nums=0;
- short i,found=FALSE;
+ unsigned short len, nume, nums=0;
+ short i, found=FALSE;
len=strlen(string);
nume = len;
@@ -156,7 +156,7 @@ static int an_stringdec(const char *string, char* head, char *tail, unsigned sho
}
}
if (found) {
- strcpy(tail ,&string[nume+1]);
+ strcpy(tail, &string[nume+1]);
strcpy(head, string);
head[nums]= '\0';
*numlen=nume-nums+1;
@@ -255,7 +255,7 @@ void IMB_close_anim_proxies(struct anim *anim)
IMB_free_indices(anim);
}
-struct anim * IMB_open_anim( const char * name, int ib_flags, int streamindex)
+struct anim * IMB_open_anim(const char * name, int ib_flags, int streamindex)
{
struct anim * anim;
@@ -285,7 +285,7 @@ static int startavi (struct anim *anim)
streamcount = anim->streamindex;
#endif
- anim->avi = MEM_callocN (sizeof(AviMovie),"animavi");
+ anim->avi = MEM_callocN (sizeof(AviMovie), "animavi");
if (anim->avi == NULL) {
printf("Can't open avi: %s\n", anim->name);
@@ -676,7 +676,7 @@ static void ffmpeg_postprocess(struct anim * anim)
uint8_t** dst = anim->pFrameRGB->data;
int dstStride2[4] = { dstStride[0], 0, 0, 0 };
uint8_t* dst2[4] = { dst[0], 0, 0, 0 };
- int x,y,h,w;
+ int x, y, h, w;
unsigned char* bottom;
unsigned char* top;
@@ -933,7 +933,7 @@ 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",
- (long long int)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) {
@@ -1040,7 +1040,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
anim->next_packet.stream_index = -1;
}
- /* memset(anim->pFrame,...) ?? */
+ /* memset(anim->pFrame, ...) ?? */
if (ret >= 0) {
ffmpeg_decode_video_frame_scan(anim, pts_to_search);
@@ -1271,7 +1271,7 @@ struct ImBuf * IMB_anim_absolute(struct anim * anim, int position,
}
}
- switch(anim->curtype) {
+ switch (anim->curtype) {
case ANIM_SEQUENCE:
pic = an_stringdec(anim->first, head, tail, &digits);
pic += position;
diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c
index 06e1d75c5d0..bce3c70fd93 100644
--- a/source/blender/imbuf/intern/bmp.c
+++ b/source/blender/imbuf/intern/bmp.c
@@ -192,18 +192,18 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags)
}
/* Couple of helper functions for writing our data */
-static int putIntLSB(unsigned int ui,FILE *ofile)
+static int putIntLSB(unsigned int ui, FILE *ofile)
{
- putc((ui>>0)&0xFF,ofile);
- putc((ui>>8)&0xFF,ofile);
- putc((ui>>16)&0xFF,ofile);
- return putc((ui>>24)&0xFF,ofile);
+ putc((ui>>0)&0xFF, ofile);
+ putc((ui>>8)&0xFF, ofile);
+ putc((ui>>16)&0xFF, ofile);
+ return putc((ui>>24)&0xFF, ofile);
}
-static int putShortLSB(unsigned short us,FILE *ofile)
+static int putShortLSB(unsigned short us, FILE *ofile)
{
- putc((us>>0)&0xFF,ofile);
- return putc((us>>8)&0xFF,ofile);
+ putc((us>>0)&0xFF, ofile);
+ return putc((us>>8)&0xFF, ofile);
}
/* Found write info at http://users.ece.gatech.edu/~slabaugh/personal/c/bitmapUnix.c */
@@ -220,37 +220,37 @@ int imb_savebmp(struct ImBuf *ibuf, const char *name, int flags)
bytesize = (ibuf->x * 3 + extrabytes) * ibuf->y;
data = (uchar *) ibuf->rect;
- ofile = BLI_fopen(name,"wb");
+ ofile = BLI_fopen(name, "wb");
if (!ofile) return 0;
- putShortLSB(19778,ofile); /* "BM" */
- putIntLSB(0,ofile); /* This can be 0 for BI_RGB bitmaps */
- putShortLSB(0,ofile); /* Res1 */
- putShortLSB(0,ofile); /* Res2 */
- putIntLSB(BMP_FILEHEADER_SIZE + sizeof(infoheader),ofile);
-
- putIntLSB(sizeof(infoheader),ofile);
- putIntLSB(ibuf->x,ofile);
- putIntLSB(ibuf->y,ofile);
- putShortLSB(1,ofile);
- putShortLSB(24,ofile);
- putIntLSB(0,ofile);
- putIntLSB(bytesize + BMP_FILEHEADER_SIZE + sizeof(infoheader),ofile);
- putIntLSB(0,ofile);
- putIntLSB(0,ofile);
- putIntLSB(0,ofile);
- putIntLSB(0,ofile);
+ putShortLSB(19778, ofile); /* "BM" */
+ putIntLSB(0, ofile); /* This can be 0 for BI_RGB bitmaps */
+ putShortLSB(0, ofile); /* Res1 */
+ putShortLSB(0, ofile); /* Res2 */
+ putIntLSB(BMP_FILEHEADER_SIZE + sizeof(infoheader), ofile);
+
+ putIntLSB(sizeof(infoheader), ofile);
+ putIntLSB(ibuf->x, ofile);
+ putIntLSB(ibuf->y, ofile);
+ putShortLSB(1, ofile);
+ putShortLSB(24, ofile);
+ putIntLSB(0, ofile);
+ putIntLSB(bytesize + BMP_FILEHEADER_SIZE + sizeof(infoheader), ofile);
+ putIntLSB(0, ofile);
+ putIntLSB(0, ofile);
+ putIntLSB(0, ofile);
+ putIntLSB(0, ofile);
/* Need to write out padded image data in bgr format */
for (y=0;y<ibuf->y;y++) {
for (x=0;x<ibuf->x;x++) {
ptr=(x + y * ibuf->x) * 4;
- if (putc(data[ptr+2],ofile) == EOF) return 0;
- if (putc(data[ptr+1],ofile) == EOF) return 0;
- if (putc(data[ptr],ofile) == EOF) return 0;
+ if (putc(data[ptr+2], ofile) == EOF) return 0;
+ if (putc(data[ptr+1], ofile) == EOF) return 0;
+ if (putc(data[ptr], ofile) == EOF) return 0;
}
/* add padding here */
- for (t=0;t<extrabytes;t++) if (putc(0,ofile) == EOF) return 0;
+ for (t=0;t<extrabytes;t++) if (putc(0, ofile) == EOF) return 0;
}
if (ofile) {
fflush(ofile);
diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp
index 42ef799cf3e..42bec5874ca 100644
--- a/source/blender/imbuf/intern/dds/ColorBlock.cpp
+++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp
@@ -93,12 +93,10 @@ void ColorBlock::init(uint w, uint h, const uint * data, uint x, uint y)
// @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :(
// @@ Ideally we should zero the weights of the pixels out of range.
- for (uint i = 0; i < 4; i++)
- {
+ for (uint i = 0; i < 4; i++) {
const int by = i % bh;
- for (uint e = 0; e < 4; e++)
- {
+ for (uint e = 0; e < 4; e++) {
const int bx = e % bw;
const uint idx = (y + by) * w + x + bx;
@@ -118,12 +116,10 @@ void ColorBlock::init(uint w, uint h, const float * data, uint x, uint y)
uint srcPlane = w * h;
- for (uint i = 0; i < 4; i++)
- {
+ for (uint i = 0; i < 4; i++) {
const uint by = i % bh;
- for (uint e = 0; e < 4; e++)
- {
+ for (uint e = 0; e < 4; e++) {
const uint bx = e % bw;
const uint idx = ((y + by) * w + x + bx);
@@ -148,8 +144,7 @@ static inline uint8 component(Color32 c, uint i)
void ColorBlock::swizzle(uint x, uint y, uint z, uint w)
{
- for (int i = 0; i < 16; i++)
- {
+ for (int i = 0; i < 16; i++) {
Color32 c = m_color[i];
m_color[i].r = component(c, x);
m_color[i].g = component(c, y);
@@ -164,10 +159,8 @@ bool ColorBlock::isSingleColor(Color32 mask/*= Color32(0xFF, 0xFF, 0xFF, 0x00)*/
{
uint u = m_color[0].u & mask.u;
- for (int i = 1; i < 16; i++)
- {
- if (u != (m_color[i].u & mask.u))
- {
+ for (int i = 1; i < 16; i++) {
+ if (u != (m_color[i].u & mask.u)) {
return false;
}
}
@@ -243,8 +236,7 @@ Color32 ColorBlock::averageColor() const
/// Return true if the block is not fully opaque.
bool ColorBlock::hasAlpha() const
{
- for (uint i = 0; i < 16; i++)
- {
+ for (uint i = 0; i < 16; i++) {
if (m_color[i].a != 255) return true;
}
return false;
diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
index e2874652f02..3966135ea32 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
@@ -308,7 +308,7 @@ static const uint DDPF_SRGB = 0x40000000U;
const char * getDxgiFormatString(DXGI_FORMAT dxgiFormat)
{
#define CASE(format) case DXGI_FORMAT_##format: return #format
- switch(dxgiFormat)
+ switch (dxgiFormat)
{
CASE(UNKNOWN);
@@ -431,7 +431,7 @@ static const uint DDPF_SRGB = 0x40000000U;
const char * getD3d10ResourceDimensionString(D3D10_RESOURCE_DIMENSION resourceDimension)
{
- switch(resourceDimension)
+ switch (resourceDimension)
{
default:
case D3D10_RESOURCE_DIMENSION_UNKNOWN: return "UNKNOWN";
@@ -1305,7 +1305,7 @@ void DirectDrawSurface::readBlock(ColorBlock * rgba)
uint DirectDrawSurface::blockSize() const
{
- switch(header.pf.fourcc)
+ switch (header.pf.fourcc)
{
case FOURCC_DXT1:
case FOURCC_ATI1:
@@ -1318,7 +1318,7 @@ uint DirectDrawSurface::blockSize() const
case FOURCC_ATI2:
return 16;
case FOURCC_DX10:
- switch(header.header10.dxgiFormat)
+ switch (header.header10.dxgiFormat)
{
case DXGI_FORMAT_BC1_TYPELESS:
case DXGI_FORMAT_BC1_UNORM:
diff --git a/source/blender/imbuf/intern/dds/PixelFormat.h b/source/blender/imbuf/intern/dds/PixelFormat.h
index 3c5cb34812c..308ea810f03 100644
--- a/source/blender/imbuf/intern/dds/PixelFormat.h
+++ b/source/blender/imbuf/intern/dds/PixelFormat.h
@@ -66,17 +66,14 @@
// Convert component \a c having \a inbits to the returned value having \a outbits.
inline uint convert(uint c, uint inbits, uint outbits)
{
- if (inbits == 0)
- {
+ if (inbits == 0) {
return 0;
}
- else if (inbits >= outbits)
- {
+ else if (inbits >= outbits) {
// truncate
return c >> (inbits - outbits);
}
- else
- {
+ else {
// bitexpand
return (c << (outbits - inbits)) | convert(c, inbits, outbits - inbits);
}
@@ -85,21 +82,20 @@
// Get pixel component shift and size given its mask.
inline void maskShiftAndSize(uint mask, uint * shift, uint * size)
{
- if (!mask)
- {
+ if (!mask) {
*shift = 0;
*size = 0;
return;
}
*shift = 0;
- while((mask & 1) == 0) {
+ while ((mask & 1) == 0) {
++(*shift);
mask >>= 1;
}
*size = 0;
- while((mask & 1) == 1) {
+ while ((mask & 1) == 1) {
++(*size);
mask >>= 1;
}
diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c
index 0e6567d2c6b..7b17334f3c9 100644
--- a/source/blender/imbuf/intern/filter.c
+++ b/source/blender/imbuf/intern/filter.c
@@ -52,7 +52,7 @@
static void filtrow(unsigned char *point, int x)
{
- unsigned int c1,c2,c3,error;
+ unsigned int c1, c2, c3, error;
if (x>1) {
c1 = c2 = *point;
@@ -72,7 +72,7 @@ static void filtrow(unsigned char *point, int x)
static void filtrowf(float *point, int x)
{
- float c1,c2,c3;
+ float c1, c2, c3;
if (x>1) {
c1 = c2 = *point;
@@ -92,7 +92,7 @@ static void filtrowf(float *point, int x)
static void filtcolum(unsigned char *point, int y, int skip)
{
- unsigned int c1,c2,c3,error;
+ unsigned int c1, c2, c3, error;
unsigned char *point2;
if (y>1) {
@@ -115,7 +115,7 @@ static void filtcolum(unsigned char *point, int y, int skip)
static void filtcolumf(float *point, int y, int skip)
{
- float c1,c2,c3, *point2;
+ float c1, c2, c3, *point2;
if (y>1) {
c1 = c2 = *point;
@@ -148,23 +148,23 @@ void IMB_filtery(struct ImBuf *ibuf)
for (;x>0;x--) {
if (point) {
- if (ibuf->planes > 24) filtcolum(point,y,skip);
+ if (ibuf->planes > 24) filtcolum(point, y, skip);
point++;
- filtcolum(point,y,skip);
+ filtcolum(point, y, skip);
point++;
- filtcolum(point,y,skip);
+ filtcolum(point, y, skip);
point++;
- filtcolum(point,y,skip);
+ filtcolum(point, y, skip);
point++;
}
if (pointf) {
- if (ibuf->planes > 24) filtcolumf(pointf,y,skip);
+ if (ibuf->planes > 24) filtcolumf(pointf, y, skip);
pointf++;
- filtcolumf(pointf,y,skip);
+ filtcolumf(pointf, y, skip);
pointf++;
- filtcolumf(pointf,y,skip);
+ filtcolumf(pointf, y, skip);
pointf++;
- filtcolumf(pointf,y,skip);
+ filtcolumf(pointf, y, skip);
pointf++;
}
}
@@ -186,23 +186,23 @@ void imb_filterx(struct ImBuf *ibuf)
for (;y>0;y--) {
if (point) {
- if (ibuf->planes > 24) filtrow(point,x);
+ if (ibuf->planes > 24) filtrow(point, x);
point++;
- filtrow(point,x);
+ filtrow(point, x);
point++;
- filtrow(point,x);
+ filtrow(point, x);
point++;
- filtrow(point,x);
+ filtrow(point, x);
point+=skip;
}
if (pointf) {
- if (ibuf->planes > 24) filtrowf(pointf,x);
+ if (ibuf->planes > 24) filtrowf(pointf, x);
pointf++;
- filtrowf(pointf,x);
+ filtrowf(pointf, x);
pointf++;
- filtrowf(pointf,x);
+ filtrowf(pointf, x);
pointf++;
- filtrowf(pointf,x);
+ filtrowf(pointf, x);
pointf+=skip;
}
}
@@ -304,7 +304,7 @@ void IMB_mask_filter_extend(char *mask, int width, int height)
void IMB_mask_clear(ImBuf *ibuf, char *mask, int val)
{
- int x,y;
+ int x, y;
if (ibuf->rect_float) {
for (x=0; x<ibuf->x; x++) {
for (y=0; y<ibuf->y; y++) {
@@ -399,7 +399,7 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
if (!check_pixel_assigned(srcbuf, srcmask, index, depth, is_float)) {
float tmp[4];
float wsum=0;
- float acc[4]={0,0,0,0};
+ float acc[4]={0, 0, 0, 0};
k = 0;
if (check_pixel_assigned(srcbuf, srcmask, filter_make_index(x-1, y, width, height), depth, is_float) ||
diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c
index ba165d51e96..2109891a3ce 100644
--- a/source/blender/imbuf/intern/imageprocess.c
+++ b/source/blender/imbuf/intern/imageprocess.c
@@ -50,7 +50,7 @@
/* This define should be relocated to a global header some where Kent Mein
* I stole it from util.h in the plugins api */
-#define MAX2(x,y) ( (x)>(y) ? (x) : (y) )
+#define MAX2(x, y) ( (x)>(y) ? (x) : (y) )
/* Only this one is used liberally here, and in imbuf */
void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf)
@@ -113,10 +113,10 @@ static void pixel_from_buffer(struct ImBuf *ibuf, unsigned char **outI, float **
static float P(float k)
{
float p1, p2, p3, p4;
- p1 = MAX2(k+2.0f,0);
- p2 = MAX2(k+1.0f,0);
- p3 = MAX2(k,0);
- p4 = MAX2(k-1.0f,0);
+ p1 = MAX2(k+2.0f, 0);
+ p2 = MAX2(k+1.0f, 0);
+ p3 = MAX2(k, 0);
+ p4 = MAX2(k-1.0f, 0);
return (float)(1.0f/6.0f)*( p1*p1*p1 - 4.0f * p2*p2*p2 + 6.0f * p3*p3*p3 - 4.0f * p4*p4*p4);
}
@@ -125,15 +125,15 @@ static float P(float k)
/* older, slower function, works the same as above */
static float P(float k)
{
- return (float)(1.0f/6.0f)*( pow( MAX2(k+2.0f,0) , 3.0f ) - 4.0f * pow( MAX2(k+1.0f,0) , 3.0f ) + 6.0f * pow( MAX2(k,0) , 3.0f ) - 4.0f * pow( MAX2(k-1.0f,0) , 3.0f));
+ return (float)(1.0f/6.0f)*( pow( MAX2(k+2.0f, 0), 3.0f ) - 4.0f * pow( MAX2(k+1.0f, 0), 3.0f ) + 6.0f * pow( MAX2(k, 0), 3.0f ) - 4.0f * pow( MAX2(k-1.0f, 0), 3.0f));
}
#endif
void bicubic_interpolation_color(struct ImBuf *in, unsigned char *outI, float *outF, float u, float v)
{
- int i,j,n,m,x1,y1;
+ int i, j, n, m, x1, y1;
unsigned char *dataI;
- float a,b,w,wx,wy[4], outR,outG,outB,outA,*dataF;
+ float a, b, w, wx, wy[4], outR, outG, outB, outA, *dataF;
/* sample area entirely outside image? */
if (ceil(u)<0 || floor(u)>in->x-1 || ceil(v)<0 || floor(v)>in->y-1)
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index b566d975f5b..c38599028f8 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -69,7 +69,7 @@ anim_index_builder * IMB_index_builder_create(const char * name)
{
anim_index_builder * rv
- = MEM_callocN( sizeof(struct anim_index_builder),
+ = MEM_callocN(sizeof(struct anim_index_builder),
"index builder");
fprintf(stderr, "Starting work on index: %s\n", name);
@@ -176,7 +176,7 @@ struct anim_index * IMB_indexer_open(const char * name)
return NULL;
}
- idx = MEM_callocN( sizeof(struct anim_index), "anim_index");
+ idx = MEM_callocN(sizeof(struct anim_index), "anim_index");
BLI_strncpy(idx->name, name, sizeof(idx->name));
@@ -191,7 +191,7 @@ struct anim_index * IMB_indexer_open(const char * name)
fseek(fp, 12, SEEK_SET);
- idx->entries = MEM_callocN( sizeof(struct anim_index_entry)
+ idx->entries = MEM_callocN(sizeof(struct anim_index_entry)
* idx->num_entries, "anim_index_entries");
for (i = 0; i < idx->num_entries; i++) {
diff --git a/source/blender/imbuf/intern/indexer_dv.c b/source/blender/imbuf/intern/indexer_dv.c
index f0c38f6db06..8dc03ae708d 100644
--- a/source/blender/imbuf/intern/indexer_dv.c
+++ b/source/blender/imbuf/intern/indexer_dv.c
@@ -171,7 +171,7 @@ static void parse_header_block(indexer_dv_context * This, unsigned char* target)
static void parse_subcode_blocks(
indexer_dv_context * This, unsigned char* target)
{
- int i,j;
+ int i, j;
for (j = 0; j < 2; j++) {
for (i = 3; i < 80; i += 5) {
@@ -185,7 +185,7 @@ static void parse_subcode_blocks(
static void parse_vaux_blocks(
indexer_dv_context * This, unsigned char* target)
{
- int i,j;
+ int i, j;
for (j = 0; j < 3; j++) {
for (i = 3; i < 80; i += 5) {
diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c
index e775d0f7bbd..430361dbb53 100644
--- a/source/blender/imbuf/intern/iris.c
+++ b/source/blender/imbuf/intern/iris.c
@@ -74,7 +74,7 @@ typedef struct {
#define GINTLUM (156)
#define BINTLUM (21)
-#define ILUM(r,g,b) ((int)(RINTLUM*(r)+GINTLUM*(g)+BINTLUM*(b))>>8)
+#define ILUM(r, g, b) ((int)(RINTLUM * (r) + GINTLUM * (g) + BINTLUM * (b)) >> 8)
#define OFFSET_R 0 /* this is byte order dependent */
#define OFFSET_G 1
@@ -149,7 +149,7 @@ static void putshort(FILE *outf, unsigned short val)
buf[0] = (val>>8);
buf[1] = (val>>0);
- fwrite(buf,2,1,outf);
+ fwrite(buf, 2, 1, outf);
}
static int putlong(FILE *outf, unsigned int val)
@@ -160,7 +160,7 @@ static int putlong(FILE *outf, unsigned int val)
buf[1] = (val>>16);
buf[2] = (val>>8);
buf[3] = (val>>0);
- return fwrite(buf,4,1,outf);
+ return fwrite(buf, 4, 1, outf);
}
static void readheader(FILE *inf, IMAGE *image)
@@ -178,18 +178,18 @@ static int writeheader(FILE *outf, IMAGE *image)
{
IMAGE t= {0};
- fwrite(&t,sizeof(IMAGE),1,outf);
- fseek(outf,0,SEEK_SET);
- putshort(outf,image->imagic);
- putshort(outf,image->type);
- putshort(outf,image->dim);
- putshort(outf,image->xsize);
- putshort(outf,image->ysize);
- putshort(outf,image->zsize);
- putlong(outf,image->min);
- putlong(outf,image->max);
- putlong(outf,0);
- return fwrite("no name",8,1,outf);
+ fwrite(&t, sizeof(IMAGE), 1, outf);
+ fseek(outf, 0, SEEK_SET);
+ putshort(outf, image->imagic);
+ putshort(outf, image->type);
+ putshort(outf, image->dim);
+ putshort(outf, image->xsize);
+ putshort(outf, image->ysize);
+ putshort(outf, image->zsize);
+ putlong(outf, image->min);
+ putlong(outf, image->max);
+ putlong(outf, 0);
+ return fwrite("no name", 8, 1, outf);
}
static int writetab(FILE *outf, unsigned int *tab, int len)
@@ -197,7 +197,7 @@ static int writetab(FILE *outf, unsigned int *tab, int len)
int r = 0;
while (len) {
- r = putlong(outf,*tab++);
+ r = putlong(outf, *tab++);
len -= 4;
}
return r;
@@ -271,14 +271,14 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
readheader(inf, &image);
if (image.imagic != IMAGIC) {
- fprintf(stderr,"longimagedata: bad magic number in image file\n");
+ fprintf(stderr, "longimagedata: bad magic number in image file\n");
return(NULL);
}
rle = ISRLE(image.type);
bpp = BPP(image.type);
if (bpp != 1 && bpp != 2) {
- fprintf(stderr,"longimagedata: image must have 1 or 2 byte per pix chan\n");
+ fprintf(stderr, "longimagedata: image must have 1 or 2 byte per pix chan\n");
return(NULL);
}
@@ -299,8 +299,8 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
lengthtab = (unsigned int *)MEM_mallocN(tablen, "iris endtab");
file_offset = 512;
- readtab(inf,starttab,tablen);
- readtab(inf,lengthtab,tablen);
+ readtab(inf, starttab, tablen);
+ readtab(inf, lengthtab, tablen);
/* check data order */
cur = 0;
@@ -710,27 +710,27 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons
image->zsize = zsize;
image->min = 0;
image->max = 255;
- goodwrite *= writeheader(outf,image);
- fseek(outf,512+2*tablen,SEEK_SET);
+ goodwrite *= writeheader(outf, image);
+ fseek(outf, 512+2*tablen, SEEK_SET);
pos = 512+2*tablen;
for (y = 0; y < ysize; y++) {
for (z = 0; z < zsize; z++) {
if (zsize == 1) {
- lumrow((uchar *)lptr,(uchar *)lumbuf,xsize);
- len = compressrow((uchar *)lumbuf,rlebuf,CHANOFFSET(z),xsize);
+ lumrow((uchar *)lptr, (uchar *)lumbuf, xsize);
+ len = compressrow((uchar *)lumbuf, rlebuf, CHANOFFSET(z), xsize);
}
else {
if (z<4) {
- len = compressrow((uchar *)lptr, rlebuf,CHANOFFSET(z),xsize);
+ len = compressrow((uchar *)lptr, rlebuf, CHANOFFSET(z), xsize);
}
else if (z<8 && zptr) {
- len = compressrow((uchar *)zptr, rlebuf,CHANOFFSET(z-4),xsize);
+ len = compressrow((uchar *)zptr, rlebuf, CHANOFFSET(z-4), xsize);
}
}
if (len>rlebuflen) {
- fprintf(stderr,"output_iris: rlebuf is too small - bad poop\n");
+ fprintf(stderr, "output_iris: rlebuf is too small - bad poop\n");
exit(1);
}
goodwrite *= fwrite(rlebuf, len, 1, outf);
@@ -742,9 +742,9 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons
if (zptr) zptr += xsize;
}
- fseek(outf,512,SEEK_SET);
- goodwrite *= writetab(outf,starttab,tablen);
- goodwrite *= writetab(outf,lengthtab,tablen);
+ fseek(outf, 512, SEEK_SET);
+ goodwrite *= writetab(outf, starttab, tablen);
+ goodwrite *= writetab(outf, lengthtab, tablen);
MEM_freeN(image);
MEM_freeN(starttab);
MEM_freeN(lengthtab);
@@ -754,7 +754,7 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons
if (goodwrite)
return 1;
else {
- fprintf(stderr,"output_iris: not enough space for image!!\n");
+ fprintf(stderr, "output_iris: not enough space for image!!\n");
return 0;
}
}
@@ -765,7 +765,7 @@ static void lumrow(unsigned char *rgbptr, unsigned char *lumptr, int n)
{
lumptr += CHANOFFSET(0);
while (n--) {
- *lumptr = ILUM(rgbptr[OFFSET_R],rgbptr[OFFSET_G],rgbptr[OFFSET_B]);
+ *lumptr = ILUM(rgbptr[OFFSET_R], rgbptr[OFFSET_G], rgbptr[OFFSET_B]);
lumptr += 4;
rgbptr += 4;
}
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c
index 6abfbdb4aa1..c71763b245d 100644
--- a/source/blender/imbuf/intern/jp2.c
+++ b/source/blender/imbuf/intern/jp2.c
@@ -158,7 +158,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
if ((image->numcomps * image->x1 * image->y1) == 0) {
- fprintf(stderr,"\nError: invalid raw image parameters\n");
+ fprintf(stderr, "\nError: invalid raw image parameters\n");
return NULL;
}
@@ -339,7 +339,7 @@ static void cinema_parameters(opj_cparameters_t *parameters)
parameters->tp_flag = 'C';
parameters->tp_on = 1;
- /*Tile and Image shall be at (0,0)*/
+ /*Tile and Image shall be at (0, 0)*/
parameters->cp_tx0 = 0;
parameters->cp_ty0 = 0;
parameters->image_offset_x0 = 0;
@@ -363,7 +363,7 @@ static void cinema_parameters(opj_cparameters_t *parameters)
}
-static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol)
+static void cinema_setup_encoder(opj_cparameters_t *parameters, opj_image_t *image, img_fol_t *img_fol)
{
int i;
float temp_rate;
@@ -375,9 +375,9 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag
parameters->numresolution = 6;
}
if (!((image->comps[0].w == 2048) || (image->comps[0].h == 1080))) {
- fprintf(stdout,"Image coordinates %d x %d is not 2K compliant.\nJPEG Digital Cinema Profile-3 "
+ fprintf(stdout, "Image coordinates %d x %d is not 2K compliant.\nJPEG Digital Cinema Profile-3 "
"(2K profile) compliance requires that at least one of coordinates match 2048 x 1080\n",
- image->comps[0].w,image->comps[0].h);
+ image->comps[0].w, image->comps[0].h);
parameters->cp_rsiz = STD_RSIZ;
}
break;
@@ -390,12 +390,12 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag
parameters->numresolution = 7;
}
if (!((image->comps[0].w == 4096) || (image->comps[0].h == 2160))) {
- fprintf(stdout,"Image coordinates %d x %d is not 4K compliant.\nJPEG Digital Cinema Profile-4"
+ fprintf(stdout, "Image coordinates %d x %d is not 4K compliant.\nJPEG Digital Cinema Profile-4"
"(4K profile) compliance requires that at least one of coordinates match 4096 x 2160\n",
- image->comps[0].w,image->comps[0].h);
+ image->comps[0].w, image->comps[0].h);
parameters->cp_rsiz = STD_RSIZ;
}
- parameters->numpocs = initialise_4K_poc(parameters->POC,parameters->numresolution);
+ parameters->numpocs = initialise_4K_poc(parameters->POC, parameters->numresolution);
break;
case OFF:
/* do nothing */
@@ -465,13 +465,13 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
int i, numcomps, w, h, prec;
- int x,y, y_row;
+ int x, y, y_row;
OPJ_COLOR_SPACE color_space;
opj_image_cmptparm_t cmptparm[4]; /* maximum of 4 components */
opj_image_t * image = NULL;
img_fol_t img_fol; /* only needed for cinema presets */
- memset(&img_fol,0,sizeof(img_fol_t));
+ memset(&img_fol, 0, sizeof(img_fol_t));
if (ibuf->ftype & JP2_CINE) {
@@ -552,7 +552,7 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
float rgb[3];
switch (prec) {
- case 8: /* Convert blenders float color channels to 8,12 or 16bit ints */
+ case 8: /* Convert blenders float color channels to 8, 12 or 16bit ints */
for (y=h-1; y>=0; y--) {
y_row = y*w;
for (x=0; x<w; x++, rect_float+=4) {
@@ -665,7 +665,7 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
parameters->tcp_mct = image->numcomps == 3 ? 1 : 0;
if (parameters->cp_cinema) {
- cinema_setup_encoder(parameters,image,&img_fol);
+ cinema_setup_encoder(parameters, image, &img_fol);
}
if (img_fol.rates)
@@ -748,7 +748,7 @@ int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags)
}
fwrite(cio->buffer, 1, codestream_length, f);
fclose(f);
- fprintf(stderr,"Generated outfile %s\n",name);
+ fprintf(stderr, "Generated outfile %s\n", name);
/* close and free the byte stream */
opj_cio_close(cio);
diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c
index 3f3ebc5872d..f3a382eaa56 100644
--- a/source/blender/imbuf/intern/jpeg.c
+++ b/source/blender/imbuf/intern/jpeg.c
@@ -230,7 +230,7 @@ static void memory_source(j_decompress_ptr cinfo, unsigned char *buffer, size_t
* If must suspend, take the specified action (typically "return FALSE").
*/
#define INPUT_BYTE(cinfo,V,action) \
- MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \
+ MAKESTMT(MAKE_BYTE_AVAIL(cinfo,action); \
bytes_in_buffer--; \
V = GETJOCTET(*next_input_byte++); )
@@ -238,7 +238,7 @@ static void memory_source(j_decompress_ptr cinfo, unsigned char *buffer, size_t
* V should be declared unsigned int or perhaps INT32.
*/
#define INPUT_2BYTES(cinfo,V,action) \
- MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \
+ MAKESTMT(MAKE_BYTE_AVAIL(cinfo,action); \
bytes_in_buffer--; \
V = ((unsigned int) GETJOCTET(*next_input_byte++)) << 8; \
MAKE_BYTE_AVAIL(cinfo,action); \
@@ -321,7 +321,7 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
rect = (uchar *) (ibuf->rect + y * ibuf->x);
buffer = row_pointer[0];
- switch(depth) {
+ switch (depth) {
case 1:
for (x=ibuf->x; x >0; x--) {
rect[3] = 255;
@@ -524,7 +524,7 @@ next_stamp_info:
rect = (uchar *) (ibuf->rect + y * ibuf->x);
buffer = row_pointer[0];
- switch(cinfo->in_color_space) {
+ switch (cinfo->in_color_space) {
case JCS_RGB:
for (x = 0; x < ibuf->x; x++) {
*buffer++ = rect[0];
@@ -577,7 +577,7 @@ static int init_jpeg(FILE * outfile, struct jpeg_compress_struct * cinfo, struct
if (ibuf->planes == 32) cinfo->in_color_space = JCS_UNKNOWN;
#endif
- switch(cinfo->in_color_space) {
+ switch (cinfo->in_color_space) {
case JCS_RGB:
cinfo->input_components = 3;
break;
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index ff3a816f478..50bc55da412 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -117,8 +117,7 @@ private:
bool Mem_IStream::read (char c[], int n)
{
- if (n + _exrpos <= _exrsize)
- {
+ if (n + _exrpos <= _exrsize) {
memcpy(c, (void *)(&_exrbuf[_exrpos]), n);
_exrpos += n;
return true;
@@ -162,8 +161,7 @@ int imb_is_a_openexr(unsigned char *mem)
static void openexr_header_compression(Header *header, int compression)
{
- switch(compression)
- {
+ switch (compression) {
case 0:
header->compression() = NO_COMPRESSION;
break;
@@ -236,12 +234,10 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags
if (ibuf->rect_float) {
float *from;
- for (int i = ibuf->y-1; i >= 0; i--)
- {
+ for (int i = ibuf->y-1; i >= 0; i--) {
from= ibuf->rect_float + channels*i*width;
- for (int j = ibuf->x; j > 0; j--)
- {
+ for (int j = ibuf->x; j > 0; j--) {
to->r = from[0];
to->g = from[1];
to->b = from[2];
@@ -254,12 +250,10 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags
unsigned char *from;
if (ibuf->profile == IB_PROFILE_LINEAR_RGB) {
- for (int i = ibuf->y-1; i >= 0; i--)
- {
+ for (int i = ibuf->y-1; i >= 0; i--) {
from= (unsigned char *)ibuf->rect + channels*i*width;
- for (int j = ibuf->x; j > 0; j--)
- {
+ for (int j = ibuf->x; j > 0; j--) {
to->r = (float)(from[0])/255.0;
to->g = (float)(from[1])/255.0;
to->b = (float)(from[2])/255.0;
@@ -269,12 +263,10 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags
}
}
else {
- for (int i = ibuf->y-1; i >= 0; i--)
- {
+ for (int i = ibuf->y-1; i >= 0; i--) {
from= (unsigned char *)ibuf->rect + channels*i*width;
- for (int j = ibuf->x; j > 0; j--)
- {
+ for (int j = ibuf->x; j > 0; j--) {
to->r = srgb_to_linearrgb((float)from[0] / 255.0);
to->g = srgb_to_linearrgb((float)from[1] / 255.0);
to->b = srgb_to_linearrgb((float)from[2] / 255.0);
@@ -364,8 +356,7 @@ static int imb_save_openexr_float(struct ImBuf *ibuf, const char *name, int flag
int imb_save_openexr(struct ImBuf *ibuf, const char *name, int flags)
{
- if (flags & IB_mem)
- {
+ if (flags & IB_mem) {
printf("OpenEXR-save: Create EXR in memory CURRENTLY NOT SUPPORTED !\n");
imb_addencodedbufferImBuf(ibuf);
ibuf->encodedsize = 0;
@@ -743,7 +734,7 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa
echan->chan_id= echan->name[len-1];
len-= 3;
- while(len>=0) {
+ while (len>=0) {
if (echan->name[len]=='.')
break;
len--;
@@ -913,8 +904,7 @@ static void exr_print_filecontents(InputFile *file)
{
const ChannelList &channels = file->header().channels();
- for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i)
- {
+ for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i) {
const Channel &channel = i.channel();
printf("OpenEXR-load: Found channel %s of type %d\n", i.name(), channel.type);
}
@@ -925,8 +915,7 @@ static const char *exr_rgba_channelname(InputFile *file, const char *chan)
{
const ChannelList &channels = file->header().channels();
- for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i)
- {
+ for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i) {
/* const Channel &channel = i.channel(); */ /* Not used yet */
const char *str= i.name();
int len= strlen(str);
@@ -986,8 +975,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
is_multi= exr_is_multilayer(file);
/* do not make an ibuf when */
- if (is_multi && !(flags & IB_test) && !(flags & IB_multilayer))
- {
+ if (is_multi && !(flags & IB_test) && !(flags & IB_multilayer)) {
printf("Error: can't process EXR multilayer file\n");
}
else {
@@ -998,10 +986,8 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
/* openEXR is linear as per EXR spec */
ibuf->profile = IB_PROFILE_LINEAR_RGB;
- if (!(flags & IB_test))
- {
- if (is_multi) /* only enters with IB_multilayer flag set */
- {
+ if (!(flags & IB_test)) {
+ if (is_multi) { /* only enters with IB_multilayer flag set */
/* constructs channels for reading, allocates memory in channels */
ExrHandle *handle= imb_exr_begin_read_mem(file, width, height);
if (handle) {
@@ -1032,14 +1018,13 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
frameBuffer.insert ( exr_rgba_channelname(file, "A"),
Slice (Imf::FLOAT, (char *) (first+3), xstride, ystride, 1, 1, 1.0f)); /* 1.0 is fill value */
- if (exr_has_zbuffer(file))
- {
+ if (exr_has_zbuffer(file)) {
float *firstz;
addzbuffloatImBuf(ibuf);
firstz= ibuf->zbuf_float - (dw.min.x - dw.min.y*width);
firstz+= (height-1)*width;
- frameBuffer.insert ("Z", Slice (Imf::FLOAT, (char *)firstz , sizeof(float), -width*sizeof(float)));
+ frameBuffer.insert("Z", Slice (Imf::FLOAT, (char *)firstz, sizeof(float), -width * sizeof(float)));
}
file->setFrameBuffer (frameBuffer);
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index 74e1a4084c2..0a19bf1280b 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -51,9 +51,9 @@ typedef struct PNGReadStruct {
unsigned int seek;
} PNGReadStruct;
-static void ReadData( png_structp png_ptr, png_bytep data, png_size_t length);
-static void WriteData( png_structp png_ptr, png_bytep data, png_size_t length);
-static void Flush( png_structp png_ptr);
+static void ReadData(png_structp png_ptr, png_bytep data, png_size_t length);
+static void WriteData(png_structp png_ptr, png_bytep data, png_size_t length);
+static void Flush(png_structp png_ptr);
int imb_is_a_png(unsigned char *mem)
{
@@ -68,7 +68,7 @@ static void Flush(png_structp png_ptr)
(void)png_ptr;
}
-static void WriteData( png_structp png_ptr, png_bytep data, png_size_t length)
+static void WriteData(png_structp png_ptr, png_bytep data, png_size_t length)
{
ImBuf *ibuf = (ImBuf *) png_get_io_ptr(png_ptr);
@@ -81,7 +81,7 @@ static void WriteData( png_structp png_ptr, png_bytep data, png_size_t length)
ibuf->encodedsize += length;
}
-static void ReadData( png_structp png_ptr, png_bytep data, png_size_t length)
+static void ReadData(png_structp png_ptr, png_bytep data, png_size_t length)
{
PNGReadStruct *rs= (PNGReadStruct *) png_get_io_ptr(png_ptr);
@@ -358,7 +358,7 @@ struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags)
bytesperpixel = png_get_channels(png_ptr, info_ptr);
- switch(color_type) {
+ switch (color_type) {
case PNG_COLOR_TYPE_RGB:
case PNG_COLOR_TYPE_RGB_ALPHA:
break;
diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c
index 524f96b72af..66acd952ac0 100644
--- a/source/blender/imbuf/intern/radiance_hdr.c
+++ b/source/blender/imbuf/intern/radiance_hdr.c
@@ -192,8 +192,11 @@ struct ImBuf *imb_loadhdr(unsigned char *mem, size_t size, int flags)
}
}
if (found && (x<(size + 2))) {
- if (sscanf((char *)&mem[x+1], "%79s %d %79s %d", (char*)&oriY, &height,
- (char*)&oriX, &width) != 4) return NULL;
+ if (sscanf((char *)&mem[x + 1], "%79s %d %79s %d", (char *)&oriY, &height,
+ (char*)&oriX, &width) != 4)
+ {
+ return NULL;
+ }
/* find end of this line, data right behind it */
ptr = (unsigned char *)strchr((char*)&mem[x+1], '\n');
diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c
index 61f90f7a97a..e9d549be8b9 100644
--- a/source/blender/imbuf/intern/readimage.c
+++ b/source/blender/imbuf/intern/readimage.c
@@ -152,7 +152,7 @@ ImBuf *IMB_testiffname(const char *filepath, int flags)
imb_cache_filename(filepath_tx, filepath, flags);
- file = BLI_open(filepath_tx,O_BINARY|O_RDONLY,0);
+ file = BLI_open(filepath_tx, O_BINARY|O_RDONLY, 0);
if (file < 0) return NULL;
ibuf=IMB_loadifffile(file, flags|IB_test|IB_multilayer, filepath_tx);
diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c
index 6ea84fd6717..9f025803c2e 100644
--- a/source/blender/imbuf/intern/rectop.c
+++ b/source/blender/imbuf/intern/rectop.c
@@ -359,13 +359,13 @@ void IMB_rectblend(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx,
/* copy */
for (;height > 0; height--) {
if (do_char) {
- memcpy(drect,srect, width * sizeof(int));
+ memcpy(drect, srect, width * sizeof(int));
drect += destskip;
srect += srcskip;
}
if (do_float) {
- memcpy(drectf,srectf, width * sizeof(float) * 4);
+ memcpy(drectf, srectf, width * sizeof(float) * 4);
drectf += destskip*4;
srectf += srcskip*4;
}
@@ -496,8 +496,8 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
CLAMP(y1, 0, height);
CLAMP(y2, 0, height);
- if (x1>x2) SWAP(int,x1,x2);
- if (y1>y2) SWAP(int,y1,y2);
+ if (x1>x2) SWAP(int, x1, x2);
+ if (y1>y2) SWAP(int, y1, y2);
if (x1==x2 || y1==y2) return;
a = col[3];
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index a7b994beef9..7f5430dad8a 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -53,10 +53,10 @@
struct ImBuf *IMB_half_x(struct ImBuf *ibuf1)
{
struct ImBuf *ibuf2;
- uchar *p1,*_p1,*dest;
- short a,r,g,b;
- int x,y;
- float af,rf,gf,bf, *p1f, *_p1f, *destf;
+ uchar *p1, *_p1, *dest;
+ short a, r, g, b;
+ int x, y;
+ float af, rf, gf, bf, *p1f, *_p1f, *destf;
int do_rect, do_float;
if (ibuf1==NULL) return (NULL);
@@ -119,7 +119,7 @@ struct ImBuf *IMB_half_x(struct ImBuf *ibuf1)
struct ImBuf *IMB_double_fast_x(struct ImBuf *ibuf1)
{
struct ImBuf *ibuf2;
- int *p1,*dest, i, col, do_rect, do_float;
+ int *p1, *dest, i, col, do_rect, do_float;
float *p1f, *destf;
if (ibuf1==NULL) return (NULL);
@@ -128,7 +128,7 @@ struct ImBuf *IMB_double_fast_x(struct ImBuf *ibuf1)
do_rect= (ibuf1->rect != NULL);
do_float= (ibuf1->rect_float != NULL);
- ibuf2 = IMB_allocImBuf(2 * ibuf1->x , ibuf1->y , ibuf1->planes, ibuf1->flags);
+ ibuf2 = IMB_allocImBuf(2 * ibuf1->x, ibuf1->y, ibuf1->planes, ibuf1->flags);
if (ibuf2==NULL) return (NULL);
p1 = (int *) ibuf1->rect;
@@ -172,11 +172,11 @@ struct ImBuf *IMB_double_x(struct ImBuf *ibuf1)
struct ImBuf *IMB_half_y(struct ImBuf *ibuf1)
{
struct ImBuf *ibuf2;
- uchar *p1,*p2,*_p1,*dest;
- short a,r,g,b;
- int x,y;
+ uchar *p1, *p2, *_p1, *dest;
+ short a, r, g, b;
+ int x, y;
int do_rect, do_float;
- float af,rf,gf,bf,*p1f,*p2f,*_p1f,*destf;
+ float af, rf, gf, bf, *p1f, *p2f, *_p1f, *destf;
p1= p2= NULL;
p1f= p2f= NULL;
@@ -187,7 +187,7 @@ struct ImBuf *IMB_half_y(struct ImBuf *ibuf1)
do_rect= (ibuf1->rect != NULL);
do_float= (ibuf1->rect_float != NULL);
- ibuf2 = IMB_allocImBuf(ibuf1->x , (ibuf1->y) / 2 , ibuf1->planes, ibuf1->flags);
+ ibuf2 = IMB_allocImBuf(ibuf1->x, (ibuf1->y) / 2, ibuf1->planes, ibuf1->flags);
if (ibuf2==NULL) return (NULL);
_p1 = (uchar *) ibuf1->rect;
@@ -246,7 +246,7 @@ struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1)
struct ImBuf *ibuf2;
int *p1, *dest1, *dest2;
float *p1f, *dest1f, *dest2f;
- int x,y;
+ int x, y;
int do_rect, do_float;
if (ibuf1==NULL) return (NULL);
@@ -255,7 +255,7 @@ struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1)
do_rect= (ibuf1->rect != NULL);
do_float= (ibuf1->rect_float != NULL);
- ibuf2 = IMB_allocImBuf(ibuf1->x , 2 * ibuf1->y , ibuf1->planes, ibuf1->flags);
+ ibuf2 = IMB_allocImBuf(ibuf1->x, 2 * ibuf1->y, ibuf1->planes, ibuf1->flags);
if (ibuf2==NULL) return (NULL);
p1 = (int *) ibuf1->rect;
@@ -297,7 +297,7 @@ void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1)
{
uchar *p1, *p2 = NULL, *dest;
float *p1f, *destf, *p2f = NULL;
- int x,y;
+ int x, y;
const short do_rect= (ibuf1->rect != NULL);
const short do_float= (ibuf1->rect_float != NULL) && (ibuf2->rect_float != NULL);
@@ -1093,18 +1093,18 @@ static struct ImBuf *scaledowny(struct ImBuf *ibuf, int newy)
static struct ImBuf *scaleupx(struct ImBuf *ibuf, int newx)
{
- uchar *rect,*_newrect=NULL,*newrect;
- float *rectf,*_newrectf=NULL,*newrectf;
- float sample,add;
- float val_a,nval_a,diff_a;
- float val_b,nval_b,diff_b;
- float val_g,nval_g,diff_g;
- float val_r,nval_r,diff_r;
- float val_af,nval_af,diff_af;
- float val_bf,nval_bf,diff_bf;
- float val_gf,nval_gf,diff_gf;
- float val_rf,nval_rf,diff_rf;
- int x,y, do_rect = 0, do_float = 0;
+ uchar *rect, *_newrect=NULL, *newrect;
+ float *rectf, *_newrectf=NULL, *newrectf;
+ float sample, add;
+ float val_a, nval_a, diff_a;
+ float val_b, nval_b, diff_b;
+ float val_g, nval_g, diff_g;
+ float val_r, nval_r, diff_r;
+ float val_af, nval_af, diff_af;
+ float val_bf, nval_bf, diff_bf;
+ float val_gf, nval_gf, diff_gf;
+ float val_rf, nval_rf, diff_rf;
+ int x, y, do_rect = 0, do_float = 0;
val_a = nval_a = diff_a = val_b = nval_b = diff_b = 0;
val_g = nval_g = diff_g = val_r = nval_r = diff_r = 0;
@@ -1260,18 +1260,18 @@ static struct ImBuf *scaleupx(struct ImBuf *ibuf, int newx)
static struct ImBuf *scaleupy(struct ImBuf *ibuf, int newy)
{
- uchar *rect,*_newrect=NULL,*newrect;
- float *rectf,*_newrectf=NULL,*newrectf;
- float sample,add;
- float val_a,nval_a,diff_a;
- float val_b,nval_b,diff_b;
- float val_g,nval_g,diff_g;
- float val_r,nval_r,diff_r;
- float val_af,nval_af,diff_af;
- float val_bf,nval_bf,diff_bf;
- float val_gf,nval_gf,diff_gf;
- float val_rf,nval_rf,diff_rf;
- int x,y, do_rect = 0, do_float = 0, skipx;
+ uchar *rect, *_newrect=NULL, *newrect;
+ float *rectf, *_newrectf=NULL, *newrectf;
+ float sample, add;
+ float val_a, nval_a, diff_a;
+ float val_b, nval_b, diff_b;
+ float val_g, nval_g, diff_g;
+ float val_r, nval_r, diff_r;
+ float val_af, nval_af, diff_af;
+ float val_bf, nval_bf, diff_bf;
+ float val_gf, nval_gf, diff_gf;
+ float val_rf, nval_rf, diff_rf;
+ int x, y, do_rect = 0, do_float = 0, skipx;
val_a = nval_a = diff_a = val_b = nval_b = diff_b = 0;
val_g = nval_g = diff_g = val_r = nval_r = diff_r = 0;
@@ -1484,10 +1484,10 @@ struct ImBuf *IMB_scaleImBuf(struct ImBuf * ibuf, unsigned int newx, unsigned in
return ibuf;
}
- if (newx < ibuf->x) if (newx) scaledownx(ibuf,newx);
- if (newy < ibuf->y) if (newy) scaledowny(ibuf,newy);
- if (newx > ibuf->x) if (newx) scaleupx(ibuf,newx);
- if (newy > ibuf->y) if (newy) scaleupy(ibuf,newy);
+ if (newx < ibuf->x) if (newx) scaledownx(ibuf, newx);
+ if (newy < ibuf->y) if (newy) scaledowny(ibuf, newy);
+ if (newx > ibuf->x) if (newx) scaleupx(ibuf, newx);
+ if (newy > ibuf->y) if (newy) scaleupy(ibuf, newy);
return(ibuf);
}
@@ -1498,10 +1498,10 @@ struct imbufRGBA {
struct ImBuf *IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy)
{
- unsigned int *rect,*_newrect,*newrect;
+ unsigned int *rect, *_newrect, *newrect;
struct imbufRGBA *rectf, *_newrectf, *newrectf;
- int x,y, do_float=0, do_rect=0;
- int ofsx,ofsy,stepx,stepy;
+ int x, y, do_float=0, do_rect=0;
+ int ofsx, ofsy, stepx, stepy;
rect = NULL; _newrect = NULL; newrect = NULL;
rectf = NULL; _newrectf = NULL; newrectf = NULL;
diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c
index 7aceb695d00..1a05dd93229 100644
--- a/source/blender/imbuf/intern/targa.c
+++ b/source/blender/imbuf/intern/targa.c
@@ -73,7 +73,7 @@ static int tga_out1(unsigned int data, FILE *file)
uchar *p;
p = (uchar *) & data;
- if (putc(p[0],file) == EOF) return(EOF);
+ if (putc(p[0], file) == EOF) return(EOF);
return (~EOF);
}
@@ -82,8 +82,8 @@ static int tga_out2(unsigned int data, FILE * file)
uchar *p;
p = (uchar *) & data;
- if (putc(p[0],file) == EOF) return(EOF);
- if (putc(p[1],file) == EOF) return(EOF);
+ if (putc(p[0], file) == EOF) return(EOF);
+ if (putc(p[1], file) == EOF) return(EOF);
return (~EOF);
}
@@ -93,9 +93,9 @@ static int tga_out3(unsigned int data, FILE * file)
uchar *p;
p = (uchar *) & data;
- if (putc(p[2],file) == EOF) return(EOF);
- if (putc(p[1],file) == EOF) return(EOF);
- if (putc(p[0],file) == EOF) return(EOF);
+ if (putc(p[2], file) == EOF) return(EOF);
+ if (putc(p[1], file) == EOF) return(EOF);
+ if (putc(p[0], file) == EOF) return(EOF);
return (~EOF);
}
@@ -106,16 +106,16 @@ static int tga_out4(unsigned int data, FILE * file)
p = (uchar *) & data;
/* order = bgra */
- if (putc(p[2],file) == EOF) return(EOF);
- if (putc(p[1],file) == EOF) return(EOF);
- if (putc(p[0],file) == EOF) return(EOF);
- if (putc(p[3],file) == EOF) return(EOF);
+ if (putc(p[2], file) == EOF) return(EOF);
+ if (putc(p[1], file) == EOF) return(EOF);
+ if (putc(p[0], file) == EOF) return(EOF);
+ if (putc(p[3], file) == EOF) return(EOF);
return (~EOF);
}
static short makebody_tga(ImBuf * ibuf, FILE * file, int (*out)(unsigned int, FILE*))
{
- register int last,this;
+ register int last, this;
register int copy, bytes;
register unsigned int *rect, *rectstart, *temp;
int y;
@@ -150,9 +150,9 @@ static short makebody_tga(ImBuf * ibuf, FILE * file, int (*out)(unsigned int, FI
last = copy;
if (copy>=128) last = 128;
copy -= last;
- if (fputc(last-1,file) == EOF) return(0);
+ if (fputc(last-1, file) == EOF) return(0);
do {
- if (out(*rect++,file) == EOF) return(0);
+ if (out(*rect++, file) == EOF) return(0);
} while (--last != 0);
}
rectstart = rect;
@@ -173,17 +173,17 @@ static short makebody_tga(ImBuf * ibuf, FILE * file, int (*out)(unsigned int, FI
while (copy) {
if (copy>128) {
- if (fputc(255,file) == EOF) return(0);
+ if (fputc(255, file) == EOF) return(0);
copy -= 128;
}
else {
if (copy == 1) {
- if (fputc(0,file) == EOF) return(0);
+ if (fputc(0, file) == EOF) return(0);
}
- else if (fputc(127 + copy,file) == EOF) return(0);
+ else if (fputc(127 + copy, file) == EOF) return(0);
copy = 0;
}
- if (out(last,file) == EOF) return(0);
+ if (out(last, file) == EOF) return(0);
}
copy=TRUE;
}
@@ -276,10 +276,10 @@ int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags)
if (ibuf->planes==32) {
buf[17] |= 0x08;
}
- fildes = BLI_fopen(name,"wb");
+ fildes = BLI_fopen(name, "wb");
if (!fildes) return 0;
- if (fwrite(buf, 1, 18,fildes) != 18) {
+ if (fwrite(buf, 1, 18, fildes) != 18) {
fclose(fildes);
return (0);
}
@@ -288,7 +288,7 @@ int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags)
ok = dumptarga(ibuf, fildes);
}
else {
- switch((ibuf->planes + 7) >> 3) {
+ switch ((ibuf->planes + 7) >> 3) {
case 1:
ok = makebody_tga(ibuf, fildes, tga_out1);
break;
@@ -485,10 +485,10 @@ partial_load:
complete_partial_load(ibuf, rect);
}
-static void ldtarga(struct ImBuf * ibuf,unsigned char * mem, size_t mem_size, int psize)
+static void ldtarga(struct ImBuf * ibuf, unsigned char * mem, size_t mem_size, int psize)
{
unsigned char *mem_end = mem+mem_size;
- int col,size;
+ int col, size;
unsigned int *rect;
uchar * cp = (uchar *) &col;
@@ -553,10 +553,10 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
unsigned int *rect, *cmap= NULL /*, mincol= 0*/, maxcol= 0;
uchar * cp = (uchar *) &col;
- if (checktarga(&tga,mem) == 0) return(NULL);
+ if (checktarga(&tga, mem) == 0) return(NULL);
- if (flags & IB_test) ibuf = IMB_allocImBuf(tga.xsize,tga.ysize,tga.pixsize, 0);
- else ibuf = IMB_allocImBuf(tga.xsize,tga.ysize,(tga.pixsize + 0x7) & ~0x7, IB_rect);
+ if (flags & IB_test) ibuf = IMB_allocImBuf(tga.xsize, tga.ysize, tga.pixsize, 0);
+ else ibuf = IMB_allocImBuf(tga.xsize, tga.ysize, (tga.pixsize + 0x7) & ~0x7, IB_rect);
if (ibuf == NULL) return(NULL);
ibuf->ftype = TGA;
@@ -617,22 +617,22 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
}
}
- switch(tga.imgtyp) {
+ switch (tga.imgtyp) {
case 1:
case 2:
case 3:
- if (tga.pixsize <= 8) ldtarga(ibuf,mem,mem_size,0);
- else if (tga.pixsize <= 16) ldtarga(ibuf,mem,mem_size,1);
- else if (tga.pixsize <= 24) ldtarga(ibuf,mem,mem_size,2);
- else if (tga.pixsize <= 32) ldtarga(ibuf,mem,mem_size,3);
+ if (tga.pixsize <= 8) ldtarga(ibuf, mem, mem_size, 0);
+ else if (tga.pixsize <= 16) ldtarga(ibuf, mem, mem_size, 1);
+ else if (tga.pixsize <= 24) ldtarga(ibuf, mem, mem_size, 2);
+ else if (tga.pixsize <= 32) ldtarga(ibuf, mem, mem_size, 3);
break;
case 9:
case 10:
case 11:
- if (tga.pixsize <= 8) decodetarga(ibuf,mem,mem_size,0);
- else if (tga.pixsize <= 16) decodetarga(ibuf,mem,mem_size,1);
- else if (tga.pixsize <= 24) decodetarga(ibuf,mem,mem_size,2);
- else if (tga.pixsize <= 32) decodetarga(ibuf,mem,mem_size,3);
+ if (tga.pixsize <= 8) decodetarga(ibuf, mem, mem_size, 0);
+ else if (tga.pixsize <= 16) decodetarga(ibuf, mem, mem_size, 1);
+ else if (tga.pixsize <= 24) decodetarga(ibuf, mem, mem_size, 2);
+ else if (tga.pixsize <= 32) decodetarga(ibuf, mem, mem_size, 3);
break;
}
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index 5d64e1b2aec..8507cb71543 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -69,13 +69,13 @@
#define URI_MAX FILE_MAX*3 + 8
-static int get_thumb_dir( char* dir , ThumbSize size)
+static int get_thumb_dir(char *dir, ThumbSize size)
{
#ifdef WIN32
wchar_t dir_16 [MAX_PATH];
/* yes, applications shouldn't store data there, but so does GIMP :)*/
SHGetSpecialFolderPathW(0, dir_16, CSIDL_PROFILE, 0);
- conv_utf_16_to_8(dir_16,dir,FILE_MAX);
+ conv_utf_16_to_8(dir_16, dir, FILE_MAX);
#else
@@ -83,7 +83,7 @@ static int get_thumb_dir( char* dir , ThumbSize size)
if (!home) return 0;
BLI_strncpy(dir, home, FILE_MAX);
#endif
- switch(size) {
+ switch (size) {
case THB_NORMAL:
strcat(dir, "/.thumbnails/normal/");
break;
@@ -132,7 +132,7 @@ static const char hex[17] = "0123456789abcdef";
/* Note: This escape function works on file: URIs, but if you want to
* escape something else, please read RFC-2396 */
-static void escape_uri_string (const char *string, char* escaped_string, int len,UnsafeCharacterSet mask)
+static void escape_uri_string (const char *string, char* escaped_string, int len, UnsafeCharacterSet mask)
{
#define ACCEPTABLE(a) ((a)>=32 && (a)<128 && (acceptable[(a)-32] & use_mask))
@@ -218,7 +218,7 @@ static void thumbname_from_uri(const char* uri, char* thumb, const int thumb_len
char hexdigest[33];
unsigned char digest[16];
- md5_buffer( uri, strlen(uri), digest);
+ md5_buffer(uri, strlen(uri), digest);
hexdigest[0] = '\0';
to_hex_char(hexdigest, digest, 16);
hexdigest[32] = '\0';
@@ -269,7 +269,7 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
float scaledx, scaledy;
struct stat info;
- switch(size) {
+ switch (size) {
case THB_NORMAL:
tsize = 128;
break;
@@ -302,7 +302,7 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
return NULL;
}
if (size == THB_FAIL) {
- img = IMB_allocImBuf(1,1,32, IB_rect | IB_metadata);
+ img = IMB_allocImBuf(1, 1, 32, IB_rect | IB_metadata);
if (!img) return NULL;
}
else {
@@ -398,7 +398,7 @@ ImBuf* IMB_thumb_read(const char* path, ThumbSize size)
char uri[FILE_MAX*3+8];
ImBuf *img = NULL;
- if (!uri_from_filename(path,uri)) {
+ if (!uri_from_filename(path, uri)) {
return NULL;
}
if (thumbpath_from_uri(uri, thumb, sizeof(thumb), size)) {
@@ -414,7 +414,7 @@ void IMB_thumb_delete(const char* path, ThumbSize size)
char thumb[FILE_MAX];
char uri[FILE_MAX*3+8];
- if (!uri_from_filename(path ,uri)) {
+ if (!uri_from_filename(path, uri)) {
return;
}
if (thumbpath_from_uri(uri, thumb, sizeof(thumb), size)) {
@@ -439,7 +439,7 @@ ImBuf* IMB_thumb_manage(const char* path, ThumbSize size, ThumbSource source)
if (stat(path, &st)) {
return NULL;
}
- if (!uri_from_filename(path,uri)) {
+ if (!uri_from_filename(path, uri)) {
return NULL;
}
if (thumbpath_from_uri(uri, thumb, sizeof(thumb), THB_FAIL)) {
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index b5fdb897d14..62cf206dfec 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -154,12 +154,12 @@ static int IMB_ispic_name(const char *name)
if (UTIL_DEBUG) printf("IMB_ispic_name: loading %s\n", name);
- if (stat(name,&st) == -1)
+ if (stat(name, &st) == -1)
return FALSE;
if (((st.st_mode) & S_IFMT) != S_IFREG)
return FALSE;
- if ((fp = BLI_open(name,O_BINARY|O_RDONLY, 0)) < 0)
+ if ((fp = BLI_open(name, O_BINARY|O_RDONLY, 0)) < 0)
return FALSE;
if (read(fp, buf, 32) != 32) {
@@ -250,7 +250,7 @@ static int isffmpeg (const char *filename)
do_init_ffmpeg();
- if ( BLI_testextensie(filename, ".swf") ||
+ if (BLI_testextensie(filename, ".swf") ||
BLI_testextensie(filename, ".jpg") ||
BLI_testextensie(filename, ".png") ||
BLI_testextensie(filename, ".dds") ||
@@ -258,7 +258,10 @@ static int isffmpeg (const char *filename)
BLI_testextensie(filename, ".bmp") ||
BLI_testextensie(filename, ".exr") ||
BLI_testextensie(filename, ".cin") ||
- BLI_testextensie(filename, ".wav")) return 0;
+ BLI_testextensie(filename, ".wav"))
+ {
+ return 0;
+ }
if (av_open_input_file(&pFormatCtx, filename, NULL, 0, NULL)!=0) {
if (UTIL_DEBUG) fprintf(stderr, "isffmpeg: av_open_input_file failed\n");
@@ -339,14 +342,14 @@ int imb_get_anim_type(const char * name)
/* stat test below fails on large files > 4GB */
if (isffmpeg(name)) return (ANIM_FFMPEG);
# endif
- if (stat(name,&st) == -1) return(0);
+ if (stat(name, &st) == -1) return(0);
if (((st.st_mode) & S_IFMT) != S_IFREG) return(0);
if (isavi(name)) return (ANIM_AVI);
if (ismovie(name)) return (ANIM_MOVIE);
#else
- if (stat(name,&st) == -1) return(0);
+ if (stat(name, &st) == -1) return(0);
if (((st.st_mode) & S_IFMT) != S_IFREG) return(0);
if (ismovie(name)) return (ANIM_MOVIE);
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 0d06b55f1d3..c531225775a 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -65,6 +65,7 @@ typedef struct Brush {
short blend; /* blend mode */
short ob_mode; /* & with ob->mode to see if the brush is compatible, use for display only. */
+ float weight; /* brush weight */
int size; /* brush diameter */
int flag; /* general purpose flag */
float jitter; /* jitter the position of the brush */
@@ -83,7 +84,7 @@ typedef struct Brush {
char sculpt_tool; /* active sculpt tool */
char vertexpaint_tool; /* active vertex/weight paint blend mode (poorly named) */
char imagepaint_tool; /* active image paint tool */
- char pad3[5];
+ char pad;
float autosmooth_factor;
diff --git a/source/blender/makesdna/DNA_listBase.h b/source/blender/makesdna/DNA_listBase.h
index d0e7a2f4433..35549aee3d2 100644
--- a/source/blender/makesdna/DNA_listBase.h
+++ b/source/blender/makesdna/DNA_listBase.h
@@ -43,7 +43,7 @@ extern "C" {
/* generic - all structs which are used in linked-lists used this */
typedef struct Link
{
- struct Link *next,*prev;
+ struct Link *next, *prev;
} Link;
diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h
index 89ed3ba055f..a0806481aea 100644
--- a/source/blender/makesdna/DNA_meshdata_types.h
+++ b/source/blender/makesdna/DNA_meshdata_types.h
@@ -95,7 +95,7 @@ typedef struct MLoop {
typedef struct MTexPoly {
struct Image *tpage;
char flag, transp;
- short mode,tile,unwrap;
+ short mode, tile, unwrap;
} MTexPoly;
/* can copy from/to MTexPoly/MTFace */
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 1abce525be2..01096b6459e 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -375,8 +375,8 @@ typedef struct NodeImageMultiFileSocket {
} NodeImageMultiFileSocket;
typedef struct NodeChroma {
- float t1,t2,t3;
- float fsize,fstrength,falpha;
+ float t1, t2, t3;
+ float fsize, fstrength, falpha;
float key[4];
short algorithm, channel;
} NodeChroma;
diff --git a/source/blender/makesdna/DNA_object_fluidsim.h b/source/blender/makesdna/DNA_object_fluidsim.h
index a55b7b17a22..24bd023af88 100644
--- a/source/blender/makesdna/DNA_object_fluidsim.h
+++ b/source/blender/makesdna/DNA_object_fluidsim.h
@@ -50,16 +50,16 @@ typedef struct FluidVertexVelocity {
typedef struct FluidsimSettings {
struct FluidsimModifierData *fmd; /* for fast RNA access */
- /* domain,fluid or obstacle */
+ /* domain, fluid or obstacle */
short type;
- /* display advanced options in fluid sim tab (on=1,off=0)*/
+ /* display advanced options in fluid sim tab (on=1, off=0)*/
short show_advancedoptions;
/* domain object settings */
/* resolutions */
short resolutionxyz;
short previewresxyz;
- /* size of the domain in real units (meters along largest resolution x,y,z extent) */
+ /* size of the domain in real units (meters along largest resolution x, y, z extent) */
float realsize;
/* show original meshes, preview or final sim */
short guiDisplayMode;
@@ -85,7 +85,7 @@ typedef struct FluidsimSettings {
/* fluid object type settings */
/* gravity strength */
- float iniVelx,iniVely,iniVelz;
+ float iniVelx, iniVely, iniVelz;
/* store pointer to original mesh (for replacing the current one) */
struct Mesh *orgMesh;
@@ -106,8 +106,8 @@ typedef struct FluidsimSettings {
/* additional flags depending on the type, lower short contains flags
* to check validity, higher short additional flags */
short typeFlags;
- /* switch off velocity genration, volume init type for fluid/obstacles (volume=1,shell=2,both=3) */
- char domainNovecgen,volumeInitType;
+ /* switch off velocity genration, volume init type for fluid/obstacles (volume=1, shell=2, both=3) */
+ char domainNovecgen, volumeInitType;
/* boundary "stickiness" for part slip values */
float partSlipValue;
diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h
index 6fefd2d672f..25c9ad70ea1 100644
--- a/source/blender/makesdna/DNA_object_force.h
+++ b/source/blender/makesdna/DNA_object_force.h
@@ -327,7 +327,7 @@ typedef struct SoftBody {
maxloops,
choke,
solver_ID,
- plastic,springpreload
+ plastic, springpreload
;
struct SBScratch *scratch; /* scratch pad/cache on live time not saved in file */
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 86a2bb60cc9..05a96ef2f35 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -319,8 +319,12 @@ typedef struct DupliObject {
#define OB_ARMATURE 25
/* check if the object type supports materials */
-#define OB_TYPE_SUPPORT_MATERIAL(_type) ((_type) >= OB_MESH && (_type) <= OB_MBALL)
-#define OB_TYPE_SUPPORT_VGROUP(_type) (ELEM(_type, OB_MESH, OB_LATTICE))
+#define OB_TYPE_SUPPORT_MATERIAL(_type) \
+ ((_type) >= OB_MESH && (_type) <= OB_MBALL)
+#define OB_TYPE_SUPPORT_VGROUP(_type) \
+ (ELEM(_type, OB_MESH, OB_LATTICE))
+#define OB_TYPE_SUPPORT_EDITMODE(_type) \
+ (ELEM7(_type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE))
/* partype: first 4 bits: type */
#define PARTYPE 15
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index d2df799bc94..81cc4f13372 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -176,14 +176,16 @@ typedef struct SceneRenderLayer {
struct Material *mat_override;
struct Group *light_override;
- unsigned int lay; /* scene->lay itself has priority over this */
- unsigned int lay_zmask; /* has to be after lay, this is for Z-masking */
+ unsigned int lay; /* scene->lay itself has priority over this */
+ unsigned int lay_zmask; /* has to be after lay, this is for Z-masking */
+ unsigned int lay_exclude; /* not used by internal, exclude */
int layflag;
- int pad;
-
int passflag; /* pass_xor has to be after passflag */
int pass_xor;
+
+ int samples;
+ int pad;
} SceneRenderLayer;
/* srl->layflag */
@@ -849,13 +851,18 @@ typedef struct UnifiedPaintSettings {
/* unified strength of brush */
float alpha;
+ /* unified brush weight, [0, 1] */
+ float weight;
+
/* user preferences for sculpt and paint */
int flag;
+ int pad;
} UnifiedPaintSettings;
typedef enum {
UNIFIED_PAINT_SIZE = (1<<0),
UNIFIED_PAINT_ALPHA = (1<<1),
+ UNIFIED_PAINT_WEIGHT = (1<<5),
/* only used if unified size is enabled, mirros the brush flags
* BRUSH_LOCK_SIZE and BRUSH_SIZE_PRESSURE */
@@ -876,7 +883,8 @@ typedef struct ToolSettings {
Sculpt *sculpt;
UvSculpt *uvsculpt; /* uv smooth */
- /* Vertex groups */
+ /* Vertex group weight - used only for editmode, not weight
+ paint */
float vgroup_weight;
/* Subdivide Settings */
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index 0a516c90aa1..cd73b692011 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -208,7 +208,7 @@ typedef struct Editing {
/* ************* Effect Variable Structs ********* */
typedef struct WipeVars {
- float edgeWidth,angle;
+ float edgeWidth, angle;
short forward, wipetype;
} WipeVars;
diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h
index 26b3a3e6c62..3e20b353856 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -56,6 +56,11 @@
#define SM_BORDER_VERTICAL 1
#define SM_BORDER_CLOSED 2
+/* collision types */
+#define SM_COLL_STATIC 0
+#define SM_COLL_RIGID 1
+#define SM_COLL_ANIMATED 2
+
typedef struct SmokeDomainSettings {
struct SmokeModifierData *smd; /* for fast RNA access */
struct FLUID_3D *fluid;
@@ -137,15 +142,16 @@ typedef struct SmokeFlowSettings {
typedef struct SmokeCollSettings {
struct SmokeModifierData *smd; /* for fast RNA access */
struct BVHTree *bvhtree; /* bounding volume hierarchy for this cloth object */
-
-// struct DerivedMesh *dm; // UNUSED, ifdef'd in code for now.
float *points;
float *points_old;
- float *vel;
+ float *vel; // UNUSED
+ int *tridivs;
float mat[4][4];
float mat_old[4][4];
int numpoints;
int numverts; // check if mesh changed
+ int numtris;
+ float dx; /* global domain cell length taken from (scale / resolution) */
short type; // static = 0, rigid = 1, dynamic = 2
short pad;
int pad2;
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 1938c63d474..2356c1945b9 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -904,6 +904,7 @@ enum {
#define SC_SHOW_GRAPH_TRACKS (1<<15)
/*#define SC_SHOW_PYRAMID_LEVELS (1<<16) */ /* UNUSED */
#define SC_LOCK_TIMECURSOR (1<<17)
+#define SC_SHOW_SECONDS (1<<18)
/* SpaceClip->mode */
#define SC_MODE_TRACKING 0
diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h
index 9c0f63028c1..2f099ed59f5 100644
--- a/source/blender/makesdna/DNA_tracking_types.h
+++ b/source/blender/makesdna/DNA_tracking_types.h
@@ -123,7 +123,7 @@ typedef struct MovieTrackingSettings {
short default_pattern_match; /* re-adjust every N frames */
short default_flag; /* default flags like color channels used by default */
- short pod;
+ short motion_flag; /* flags describes motion type */
/* ** common tracker settings ** */
short speed; /* speed of tracking */
@@ -131,8 +131,8 @@ typedef struct MovieTrackingSettings {
/* ** reconstruction settings ** */
int keyframe1, keyframe2; /* two keyframes for reconstrution initialization */
- /* ** which camera intrinsics to refine. uses on the REFINE_* flags */
- short refine_camera_intrinsics, pad23;
+ /* which camera intrinsics to refine. uses on the REFINE_* flags */
+ short refine_camera_intrinsics, pad2;
/* ** tool settings ** */
@@ -243,6 +243,11 @@ enum {
/* MovieTrackingSettings->flag */
#define TRACKING_SETTINGS_SHOW_DEFAULT_EXPANDED (1<<0)
+/* MovieTrackingSettings->motion_flag */
+#define TRACKING_MOTION_TRIPOD (1<<0)
+
+#define TRACKING_MOTION_MODAL (TRACKING_MOTION_TRIPOD)
+
/* MovieTrackingSettings->speed */
#define TRACKING_SPEED_FASTEST 0
#define TRACKING_SPEED_REALTIME 1
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 40c4a7fab9d..94c4d141a57 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -205,7 +205,7 @@ typedef struct ThemeSpace {
char grid[4];
char wire[4], select[4];
- char lamp[4], speaker[4], empty[4],camera[4], pad[8];
+ char lamp[4], speaker[4], empty[4], camera[4], pad[8];
char active[4], group[4], group_active[4], transform[4];
char vertex[4], vertex_select[4];
char edge[4], edge_select[4];
@@ -376,13 +376,13 @@ typedef struct UserDef {
short tb_leftmouse, tb_rightmouse;
struct SolidLight light[3];
short tw_hotspot, tw_flag, tw_handlesize, tw_size;
- short textimeout,texcollectrate;
+ short textimeout, texcollectrate;
short wmdrawmethod; /* removed wmpad */
short dragthreshold;
int memcachelimit;
int prefetchframes;
short frameserverport;
- short pad_rot_angle; /*control the rotation step of the view when PAD2,PAD4,PAD6&PAD8 is use*/
+ short pad_rot_angle; /*control the rotation step of the view when PAD2, PAD4, PAD6&PAD8 is use*/
short obcenter_dia;
short rvisize; /* rotating view icon size */
short rvibright; /* rotating view icon brightness */
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index ef7a2746d37..557c0393166 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -338,7 +338,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
else sdna->nr_names= *data;
data++;
- sdna->names= MEM_callocN( sizeof(void *)*sdna->nr_names, "sdnanames");
+ sdna->names= MEM_callocN(sizeof(void *)*sdna->nr_names, "sdnanames");
}
else {
printf("NAME error in SDNA file\n");
@@ -378,7 +378,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
else sdna->nr_types= *data;
data++;
- sdna->types= MEM_callocN( sizeof(void *)*sdna->nr_types, "sdnatypes");
+ sdna->types= MEM_callocN(sizeof(void *)*sdna->nr_types, "sdnatypes");
}
else {
printf("TYPE error in SDNA file\n");
@@ -442,7 +442,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
else sdna->nr_structs= *data;
data++;
- sdna->structs= MEM_callocN( sizeof(void *)*sdna->nr_structs, "sdnastrcs");
+ sdna->structs= MEM_callocN(sizeof(void *)*sdna->nr_structs, "sdnastrcs");
}
else {
printf("STRC error in SDNA file\n");
@@ -692,7 +692,7 @@ static void cast_elem(const char *ctype, const char *otype, const char *name, ch
curlen= DNA_elem_type_size(ctypenr);
while (arrlen>0) {
- switch(otypenr) {
+ switch (otypenr) {
case SDNA_TYPE_CHAR:
val= *olddata; break;
case SDNA_TYPE_UCHAR:
@@ -717,7 +717,7 @@ static void cast_elem(const char *ctype, const char *otype, const char *name, ch
val= *( (uint64_t *)olddata); break;
}
- switch(ctypenr) {
+ switch (ctypenr) {
case SDNA_TYPE_CHAR:
*curdata= val; break;
case SDNA_TYPE_UCHAR:
@@ -933,7 +933,7 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna,
spo= oldsdna->structs[oldSDNAnr];
elen= oldsdna->typelens[ spo[0] ];
- memcpy( cur, data, elen);
+ memcpy(cur, data, elen);
return;
}
@@ -1140,7 +1140,7 @@ void *DNA_struct_reconstruct(SDNA *newsdna, SDNA *oldsdna, char *compflags, int
return NULL;
}
- cur= MEM_callocN( blocks*curlen, "reconstruct");
+ cur= MEM_callocN(blocks*curlen, "reconstruct");
cpc= cur;
cpo= data;
for (a=0; a<blocks; a++) {
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index f67fff460f1..adcdf5df106 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -360,8 +360,8 @@ static int add_name(const char *str)
* */
buf[i] = 0;
if (debugSDNA > 3) printf("Name before chomping: %s\n", buf);
- if ((strncmp(buf,"(*headdraw", 10) == 0) ||
- (strncmp(buf,"(*windraw", 9) == 0) )
+ if ((strncmp(buf, "(*headdraw", 10) == 0) ||
+ (strncmp(buf, "(*windraw", 9) == 0) )
{
buf[i] = ')';
buf[i+1] = '(';
@@ -766,7 +766,7 @@ static int calculate_structlens(int firststruct)
}
if (alphalen % 8) {
- printf("Align pointer error in struct (alphalen8): %s %s\n", types[structtype],cp);
+ printf("Align pointer error in struct (alphalen8): %s %s\n", types[structtype], cp);
dna_error = 1;
}
@@ -792,7 +792,7 @@ static int calculate_structlens(int firststruct)
/* struct alignment */
if (type >= firststruct) {
if (sizeof(void *)==8 && (len % 8) ) {
- printf("Align struct error: %s %s\n", types[structtype],cp);
+ printf("Align struct error: %s %s\n", types[structtype], cp);
dna_error = 1;
}
}
@@ -889,9 +889,8 @@ void dna_write(FILE *file, void *pntr, int size)
data = (char *) pntr;
- for (i = 0 ; i < size ; i++)
- {
- fprintf(file, "%d,", data[i]);
+ for (i = 0 ; i < size ; i++) {
+ fprintf(file, "%d, ", data[i]);
linelength++;
if (linelength >= MAX_DNA_LINE_LENGTH) {
fprintf(file, "\n");
@@ -990,7 +989,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
/* FOR DEBUG */
if (debugSDNA > 1) {
- int a,b;
+ int a, b;
/* short *elem; */
short num_types;
@@ -1008,7 +1007,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
for (a=0; a<nr_structs; a++) {
sp= structs[a];
- printf(" struct %s elems: %d size: %d\n", types[sp[0]], sp[1],typelens[sp[0]]);
+ printf(" struct %s elems: %d size: %d\n", types[sp[0]], sp[1], typelens[sp[0]]);
num_types = sp[1];
sp+= 2;
/* ? num_types was elem? */
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index e083a690fba..62957ac5de8 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -281,7 +281,7 @@ static void rna_sortlist(ListBase *listbase, int(*cmp)(const void*, const void*)
static void rna_print_c_string(FILE *f, const char *str)
{
- static const char *escape[] = {"\''", "\"\"", "\??", "\\\\","\aa", "\bb", "\ff", "\nn", "\rr", "\tt", "\vv", NULL};
+ static const char *escape[] = {"\''", "\"\"", "\??", "\\\\", "\aa", "\bb", "\ff", "\nn", "\rr", "\tt", "\vv", NULL};
int i, j;
if (!str) {
@@ -1359,8 +1359,10 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
* array get/next function, we can be sure it is an actual array */
if (cprop->next && cprop->get)
if (strcmp((const char*)cprop->next, "rna_iterator_array_next") == 0 &&
- strcmp((const char*)cprop->get, "rna_iterator_array_get") == 0)
+ strcmp((const char*)cprop->get, "rna_iterator_array_get") == 0)
+ {
prop->flag |= PROP_RAW_ARRAY;
+ }
cprop->get = (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)cprop->get);
cprop->begin = (void*)rna_def_property_begin_func(f, srna, prop, dp, (const char*)cprop->begin);
@@ -3124,7 +3126,7 @@ int main(int argc, char **argv)
totblock = MEM_get_memory_blocks_in_use();
if (totblock != 0) {
- fprintf(stderr, "Error Totblock: %d\n",totblock);
+ fprintf(stderr, "Error Totblock: %d\n", totblock);
MEM_set_error_callback(mem_error_cb);
MEM_printmemlist();
}
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 3200b271718..18edcf1344f 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -615,7 +615,7 @@ PropertyRNA *RNA_struct_find_nested(PointerRNA *ptr, StructRNA *srna)
{
PropertyRNA *prop = NULL;
- RNA_STRUCT_BEGIN(ptr, iprop) {
+ RNA_STRUCT_BEGIN (ptr, iprop) {
/* This assumes that there can only be one user of this nested struct */
if (RNA_property_pointer_type(ptr, iprop) == srna) {
prop = iprop;
@@ -637,7 +637,7 @@ int RNA_struct_contains_property(PointerRNA *ptr, PropertyRNA *prop_test)
iterprop = RNA_struct_iterator_property(ptr->type);
- RNA_PROP_BEGIN(ptr, itemptr, iterprop) {
+ RNA_PROP_BEGIN (ptr, itemptr, iterprop) {
/* PropertyRNA *prop= itemptr.data; */
if (prop_test == (PropertyRNA *)itemptr.data) {
found = TRUE;
@@ -684,7 +684,7 @@ FunctionRNA *RNA_struct_find_function(PointerRNA *ptr, const char *identifier)
func = NULL;
- RNA_PROP_BEGIN(&tptr, funcptr, iterprop) {
+ RNA_PROP_BEGIN (&tptr, funcptr, iterprop) {
if (strcmp(identifier, RNA_function_identifier(funcptr.data)) == 0) {
func = funcptr.data;
break;
@@ -3122,12 +3122,13 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
if (((itemtype == PROP_BOOLEAN || itemtype == PROP_INT) && in.type == PROP_RAW_INT) ||
(itemtype == PROP_FLOAT && in.type == PROP_RAW_FLOAT))
+ {
/* avoid creating temporary buffer if the data type match */
needconv = 0;
-
+ }
/* no item property pointer, can still be id property, or
* property of a type derived from the collection pointer type */
- RNA_PROP_BEGIN(ptr, itemptr, prop) {
+ RNA_PROP_BEGIN (ptr, itemptr, prop) {
if (itemptr.data) {
if (itemprop) {
/* we got the property already */
@@ -4498,7 +4499,7 @@ char *RNA_pointer_as_string(bContext *C, PointerRNA *ptr)
BLI_dynstr_append(dynstr, "{");
- RNA_STRUCT_BEGIN(ptr, prop) {
+ RNA_STRUCT_BEGIN (ptr, prop) {
propname = RNA_property_identifier(prop);
if (strcmp(propname, "rna_type") == 0)
@@ -4541,7 +4542,7 @@ char *RNA_pointer_as_string_keywords_ex(bContext *C, PointerRNA *ptr, PointerRNA
PropertyRNA *prop_default;
char *buf_default;
- RNA_PROP_BEGIN(ptr, propptr, iterprop) {
+ RNA_PROP_BEGIN (ptr, propptr, iterprop) {
prop = propptr.data;
flag = RNA_property_flag(prop);
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 1159a1ba20e..20265f467d5 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -191,7 +191,7 @@ static void rna_Action_active_pose_marker_index_range(PointerRNA *ptr, int *min,
-static void rna_Action_frame_range_get(PointerRNA *ptr,float *values)
+static void rna_Action_frame_range_get(PointerRNA *ptr, float *values)
{ /* don't include modifiers because they too easily can have very large
* ranges: MINAFRAMEF to MAXFRAMEF. */
calc_action_range(ptr->id.data, values, values+1, FALSE);
@@ -617,9 +617,9 @@ static void rna_def_action(BlenderRNA *brna)
rna_def_action_pose_markers(brna, prop);
/* properties */
- prop = RNA_def_float_vector(srna, "frame_range" , 2 , NULL , 0, 0, "Frame Range" ,
- "The final frame range of all F-Curves within this action" , 0 , 0);
- RNA_def_property_float_funcs(prop, "rna_Action_frame_range_get" , NULL, NULL);
+ prop = RNA_def_float_vector(srna, "frame_range", 2, NULL, 0, 0, "Frame Range",
+ "The final frame range of all F-Curves within this action", 0, 0);
+ RNA_def_property_float_funcs(prop, "rna_Action_frame_range_get", NULL, NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
/* special "type" limiter - should not really be edited in general,
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index e564c03df14..3b89899702d 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -141,7 +141,7 @@ static void rna_ConstraintActuator_type_set(struct PointerRNA *ptr, int value)
switch (ca->type) {
case ACT_CONST_TYPE_ORI:
/* negative axis not supported in the orientation mode */
- if (ELEM3(ca->mode, ACT_CONST_DIRNX,ACT_CONST_DIRNY, ACT_CONST_DIRNZ))
+ if (ELEM3(ca->mode, ACT_CONST_DIRNX, ACT_CONST_DIRNY, ACT_CONST_DIRNZ))
ca->mode = ACT_CONST_NONE;
break;
@@ -1451,22 +1451,6 @@ static void rna_def_scene_actuator(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Scene", "Scene to be added/removed/paused/resumed");
RNA_def_property_update(prop, NC_LOGIC, NULL);
-
- /* XXX no need for those tooltips. to remove soon
- * Originally we had different 'scene' tooltips for different values of 'type'.
- * They were:
- * ACT_SCENE_RESTART ""
- * ACT_SCENE_CAMERA ""
- * ACT_SCENE_SET "Set this Scene"
- * ACT_SCENE_ADD_FRONT "Add an Overlay Scene"
- * ACT_SCENE_ADD_BACK "Add a Background Scene"
- * ACT_SCENE_REMOVE "Remove a Scene"
- * ACT_SCENE_SUSPEND "Pause a Scene"
- * ACT_SCENE_RESUME "Unpause a Scene"
- *
- * It can be done in the ui script if still needed.
- */
-
}
static void rna_def_random_actuator(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c
index ce9edc17999..2f27c7a1e84 100644
--- a/source/blender/makesrna/intern/rna_boid.c
+++ b/source/blender/makesrna/intern/rna_boid.c
@@ -407,7 +407,7 @@ static void rna_def_boidrule(BlenderRNA *brna)
/* data */
srna = RNA_def_struct(brna, "BoidRule", NULL);
- RNA_def_struct_ui_text(srna , "Boid Rule", "");
+ RNA_def_struct_ui_text(srna, "Boid Rule", "");
RNA_def_struct_refine_func(srna, "rna_BoidRule_refine");
RNA_def_struct_path_func(srna, "rna_BoidRule_path");
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 5093c1a6eee..bdff545df5c 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -52,7 +52,7 @@ EnumPropertyItem brush_sculpt_tool_items[] = {
{SCULPT_TOOL_BLOB, "BLOB", ICON_BRUSH_BLOB, "Blob", ""},
{SCULPT_TOOL_CLAY, "CLAY", ICON_BRUSH_CLAY, "Clay", ""},
{SCULPT_TOOL_CLAY_STRIPS, "CLAY_STRIPS", ICON_BRUSH_CLAY_STRIPS, "Clay Strips", ""},
- {SCULPT_TOOL_CREASE, "CREASE",ICON_BRUSH_CREASE, "Crease", ""},
+ {SCULPT_TOOL_CREASE, "CREASE", ICON_BRUSH_CREASE, "Crease", ""},
{SCULPT_TOOL_DRAW, "DRAW", ICON_BRUSH_SCULPT_DRAW, "Draw", ""},
{SCULPT_TOOL_FILL, "FILL", ICON_BRUSH_FILL, "Fill", ""},
{SCULPT_TOOL_FLATTEN, "FLATTEN", ICON_BRUSH_FLATTEN, "Flatten", ""},
@@ -572,7 +572,7 @@ static void rna_def_brush(BlenderRNA *brna)
prop = RNA_def_property(srna, "rate", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "rate");
- RNA_def_property_range(prop, 0.0001f , 10000.0f);
+ RNA_def_property_range(prop, 0.0001f, 10000.0f);
RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 3);
RNA_def_property_ui_text(prop, "Rate", "Interval between paints for Airbrush");
RNA_def_property_update(prop, 0, "rna_Brush_update");
@@ -583,6 +583,13 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Color", "");
RNA_def_property_update(prop, 0, "rna_Brush_update");
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
+ RNA_def_property_ui_text(prop, "Weight", "Vertex weight when brush is applied");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "alpha");
RNA_def_property_float_default(prop, 0.5f);
@@ -867,7 +874,7 @@ static void rna_def_brush(BlenderRNA *brna)
prop = RNA_def_property(srna, "clone_offset", PROP_FLOAT, PROP_XYZ);
RNA_def_property_float_sdna(prop, NULL, "clone.offset");
RNA_def_property_ui_text(prop, "Clone Offset", "");
- RNA_def_property_ui_range(prop, -1.0f , 1.0f, 10.0f, 3);
+ RNA_def_property_ui_range(prop, -1.0f, 1.0f, 10.0f, 3);
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_Brush_update");
/* brush capabilities (mode-dependent) */
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 6d67f0c00dd..e321e83dd61 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -68,7 +68,7 @@ EnumPropertyItem constraint_type_items[] = {
{CONSTRAINT_TYPE_LOCKTRACK, "LOCKED_TRACK", ICON_CONSTRAINT_DATA, "Locked Track",
"Tracking along a single axis"},
{CONSTRAINT_TYPE_SPLINEIK, "SPLINE_IK", ICON_CONSTRAINT_DATA, "Spline IK", ""},
- {CONSTRAINT_TYPE_STRETCHTO, "STRETCH_TO",ICON_CONSTRAINT_DATA, "Stretch To", ""},
+ {CONSTRAINT_TYPE_STRETCHTO, "STRETCH_TO", ICON_CONSTRAINT_DATA, "Stretch To", ""},
{CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", ICON_CONSTRAINT_DATA, "Track To",
"Legacy tracking constraint prone to twisting artifacts"},
{0, "", 0, N_("Relationship"), ""},
@@ -1020,7 +1020,7 @@ static void rna_def_constraint_minmax(BlenderRNA *brna)
srna = RNA_def_struct(brna, "FloorConstraint", "Constraint");
RNA_def_struct_ui_text(srna, "Floor Constraint", "Use the target object for location limitation");
- RNA_def_struct_sdna_from(srna, "bMinMaxConstraint","data");
+ RNA_def_struct_sdna_from(srna, "bMinMaxConstraint", "data");
prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "tar");
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index 97cf73ab998..cdfaa8aae1d 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -100,12 +100,12 @@ static const EnumPropertyItem curve2d_fill_mode_items[] = {
#include "MEM_guardedalloc.h"
-#include "ED_curve.h" /* for BKE_curve_nurbs */
+#include "ED_curve.h" /* for BKE_curve_nurbs_get */
/* highly irritating but from RNA we cant know this */
static Nurb *curve_nurb_from_point(Curve *cu, const void *point, int *nu_index, int *pt_index)
{
- ListBase *nurbs = BKE_curve_nurbs(cu);
+ ListBase *nurbs = BKE_curve_nurbs_get(cu);
Nurb *nu;
int i = 0;
@@ -139,7 +139,7 @@ static Nurb *curve_nurb_from_point(Curve *cu, const void *point, int *nu_index,
static StructRNA *rna_Curve_refine(PointerRNA *ptr)
{
Curve *cu = (Curve*)ptr->data;
- short obtype = curve_type(cu);
+ short obtype = BKE_curve_type_get(cu);
if (obtype == OB_FONT) return &RNA_TextCurve;
else if (obtype == OB_SURF) return &RNA_SurfaceCurve;
@@ -205,7 +205,7 @@ static void rna_Curve_texspace_set(Main *UNUSED(bmain), Scene *UNUSED(scene), Po
Curve *cu = (Curve*)ptr->data;
if (cu->texflag & CU_AUTOSPACE)
- tex_space_curve(cu);
+ BKE_curve_tex_space_calc(cu);
}
static int rna_Curve_texspace_editable(PointerRNA *ptr)
@@ -219,7 +219,7 @@ static void rna_Curve_texspace_loc_get(PointerRNA *ptr, float *values)
Curve *cu = (Curve *)ptr->data;
if (!cu->bb)
- tex_space_curve(cu);
+ BKE_curve_tex_space_calc(cu);
copy_v3_v3(values, cu->loc);
}
@@ -236,7 +236,7 @@ static void rna_Curve_texspace_size_get(PointerRNA *ptr, float *values)
Curve *cu = (Curve *)ptr->data;
if (!cu->bb)
- tex_space_curve(cu);
+ BKE_curve_tex_space_calc(cu);
copy_v3_v3(values, cu->size);
}
@@ -271,7 +271,7 @@ static void rna_Curve_dimension_set(PointerRNA *ptr, int value)
if (value == CU_3D) cu->flag |= CU_3D;
else cu->flag &= ~CU_3D;
- update_curve_dimension(cu);
+ BKE_curve_curve_dimension_update(cu);
}
static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr,
@@ -326,7 +326,7 @@ static void rna_Curve_update_points(Main *bmain, Scene *scene, PointerRNA *ptr)
Nurb *nu = curve_nurb_from_point(cu, ptr->data, NULL, NULL);
if (nu)
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
rna_Curve_update_data(bmain, scene, ptr);
}
@@ -404,7 +404,7 @@ static void rna_Curve_taperObject_set(PointerRNA *ptr, PointerRNA value)
static void rna_Curve_resolution_u_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Curve *cu = (Curve*)ptr->id.data;
- ListBase *nurbs = BKE_curve_nurbs(cu);
+ ListBase *nurbs = BKE_curve_nurbs_get(cu);
Nurb *nu = nurbs->first;
while (nu) {
@@ -418,7 +418,7 @@ static void rna_Curve_resolution_u_update_data(Main *bmain, Scene *scene, Pointe
static void rna_Curve_resolution_v_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Curve *cu = (Curve*)ptr->id.data;
- ListBase *nurbs = BKE_curve_nurbs(cu);
+ ListBase *nurbs = BKE_curve_nurbs_get(cu);
Nurb *nu = nurbs->first;
@@ -481,10 +481,10 @@ static void rna_Nurb_update_cyclic_u(Main *bmain, Scene *scene, PointerRNA *ptr)
Nurb *nu = (Nurb*)ptr->data;
if (nu->type == CU_BEZIER) {
- calchandlesNurb(nu);
+ BKE_nurb_handles_calc(nu);
}
else {
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
}
rna_Curve_update_data(bmain, scene, ptr);
@@ -494,7 +494,7 @@ static void rna_Nurb_update_cyclic_v(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Nurb *nu = (Nurb*)ptr->data;
- nurbs_knot_calc_v(nu);
+ BKE_nurb_knot_calc_v(nu);
rna_Curve_update_data(bmain, scene, ptr);
}
@@ -503,8 +503,8 @@ static void rna_Nurb_update_knot_u(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Nurb *nu = (Nurb*)ptr->data;
- clamp_nurb_order_u(nu);
- nurbs_knot_calc_u(nu);
+ BKE_nurb_order_clamp_u(nu);
+ BKE_nurb_knot_calc_u(nu);
rna_Curve_update_data(bmain, scene, ptr);
}
@@ -513,8 +513,8 @@ static void rna_Nurb_update_knot_v(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Nurb *nu = (Nurb*)ptr->data;
- clamp_nurb_order_v(nu);
- nurbs_knot_calc_v(nu);
+ BKE_nurb_order_clamp_v(nu);
+ BKE_nurb_knot_calc_v(nu);
rna_Curve_update_data(bmain, scene, ptr);
}
@@ -529,10 +529,10 @@ static void rna_Curve_spline_points_add(ID *id, Nurb *nu, ReportList *reports, i
}
else {
- addNurbPoints(nu, number);
+ BKE_nurb_points_add(nu, number);
/* update */
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
rna_Curve_update_data_id(NULL, NULL, id);
}
@@ -547,10 +547,10 @@ static void rna_Curve_spline_bezpoints_add(ID *id, Nurb *nu, ReportList *reports
/* do nothing */
}
else {
- addNurbPointsBezier(nu, number);
+ BKE_nurb_bezierPoints_add(nu, number);
/* update */
- nurbs_knot_calc_u(nu);
+ BKE_nurb_knot_calc_u(nu);
rna_Curve_update_data_id(NULL, NULL, id);
}
@@ -558,7 +558,7 @@ static void rna_Curve_spline_bezpoints_add(ID *id, Nurb *nu, ReportList *reports
static Nurb *rna_Curve_spline_new(Curve *cu, int type)
{
- Nurb *nu = (Nurb *) MEM_callocN( sizeof( Nurb ), "spline.new" );
+ Nurb *nu = (Nurb *) MEM_callocN(sizeof( Nurb ), "spline.new" );
if (type == CU_BEZIER) {
BezTriple *bezt = (BezTriple *)MEM_callocN(sizeof(BezTriple), "spline.new.bezt");
@@ -579,7 +579,7 @@ static Nurb *rna_Curve_spline_new(Curve *cu, int type)
nu->resolu = nu->resolv = 12;
nu->flag = CU_SMOOTH;
- BLI_addtail(BKE_curve_nurbs(cu), nu);
+ BLI_addtail(BKE_curve_nurbs_get(cu), nu);
return nu;
}
@@ -587,7 +587,7 @@ static Nurb *rna_Curve_spline_new(Curve *cu, int type)
static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, Nurb *nu)
{
int found = 0;
- ListBase *nurbs = BKE_curve_nurbs(cu);
+ ListBase *nurbs = BKE_curve_nurbs_get(cu);
found = BLI_remlink_safe(nurbs, nu);
@@ -596,7 +596,7 @@ static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, Nurb *nu)
return;
}
- freeNurb(nu);
+ BKE_nurb_free(nu);
/* invalidate pointer!, no can do */
DAG_id_tag_update(&cu->id, OB_RECALC_DATA);
@@ -605,9 +605,9 @@ static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, Nurb *nu)
static void rna_Curve_spline_clear(Curve *cu)
{
- ListBase *nurbs = BKE_curve_nurbs(cu);
+ ListBase *nurbs = BKE_curve_nurbs_get(cu);
- freeNurblist(nurbs);
+ BKE_nurbList_free(nurbs);
DAG_id_tag_update(&cu->id, OB_RECALC_DATA);
WM_main_add_notifier(NC_GEOM|ND_DATA, NULL);
@@ -617,7 +617,7 @@ static PointerRNA rna_Curve_active_spline_get(PointerRNA *ptr)
{
Curve *cu = (Curve*)ptr->data;
Nurb *nu;
- ListBase *nurbs = BKE_curve_nurbs(cu);
+ ListBase *nurbs = BKE_curve_nurbs_get(cu);
/* for curve outside editmode will set to -1, should be changed to be allowed outside of editmode. */
nu = BLI_findlink(nurbs, cu->actnu);
@@ -632,7 +632,7 @@ static void rna_Curve_active_spline_set(PointerRNA *ptr, PointerRNA value)
{
Curve *cu = (Curve*)ptr->data;
Nurb *nu = value.data;
- ListBase *nubase = BKE_curve_nurbs(cu);
+ ListBase *nubase = BKE_curve_nurbs_get(cu);
/* -1 is ok for an unset index */
if (nu == NULL)
@@ -644,7 +644,7 @@ static void rna_Curve_active_spline_set(PointerRNA *ptr, PointerRNA value)
static char *rna_Curve_spline_path(PointerRNA *ptr)
{
Curve *cu = (Curve*)ptr->id.data;
- ListBase *nubase = BKE_curve_nurbs(cu);
+ ListBase *nubase = BKE_curve_nurbs_get(cu);
Nurb *nu = ptr->data;
int index = BLI_findindex(nubase, nu);
@@ -693,7 +693,7 @@ static char *rna_TextBox_path(PointerRNA *ptr)
static void rna_Curve_splines_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
Curve *cu = (Curve*)ptr->id.data;
- rna_iterator_listbase_begin(iter, BKE_curve_nurbs(cu), NULL);
+ rna_iterator_listbase_begin(iter, BKE_curve_nurbs_get(cu), NULL);
}
#else
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index bf5f51374fa..122e42e29e7 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -482,12 +482,10 @@ static void rna_FModifier_active_update(Main *UNUSED(bmain), Scene *UNUSED(scene
FModifier *fm, *fmo = (FModifier*)ptr->data;
/* clear active state of other FModifiers in this list */
- for (fm = fmo->prev; fm; fm = fm->prev)
- {
+ for (fm = fmo->prev; fm; fm = fm->prev) {
fm->flag &= ~FMODIFIER_FLAG_ACTIVE;
}
- for (fm = fmo->next; fm; fm = fm->next)
- {
+ for (fm = fmo->next; fm; fm = fm->next) {
fm->flag &= ~FMODIFIER_FLAG_ACTIVE;
}
diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c
index a4aac6f345c..003b4ae4fbc 100644
--- a/source/blender/makesrna/intern/rna_fluidsim.c
+++ b/source/blender/makesrna/intern/rna_fluidsim.c
@@ -141,7 +141,7 @@ static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA
psys->pointcache = BKE_ptcache_add(&psys->ptcaches);
psys->flag |= PSYS_ENABLED;
BLI_strncpy(psys->name, "FluidParticles", sizeof(psys->name));
- BLI_addtail(&ob->particlesystem,psys);
+ BLI_addtail(&ob->particlesystem, psys);
/* add modifier */
psmd = (ParticleSystemModifierData*)modifier_new(eModifierType_ParticleSystem);
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index e5939296f5a..f7e7435598b 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -212,13 +212,13 @@ static int rna_Image_has_data_get(PointerRNA *ptr)
return 0;
}
-static void rna_Image_size_get(PointerRNA *ptr,int *values)
+static void rna_Image_size_get(PointerRNA *ptr, int *values)
{
Image *im = (Image*)ptr->data;
ImBuf *ibuf;
void *lock;
- ibuf = BKE_image_acquire_ibuf(im, NULL , &lock);
+ ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
if (ibuf) {
values[0] = ibuf->x;
values[1] = ibuf->y;
@@ -237,7 +237,7 @@ static void rna_Image_resolution_get(PointerRNA *ptr, float *values)
ImBuf *ibuf;
void *lock;
- ibuf = BKE_image_acquire_ibuf(im, NULL , &lock);
+ ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
if (ibuf) {
values[0] = ibuf->ppm[0];
values[1] = ibuf->ppm[1];
@@ -256,7 +256,7 @@ static void rna_Image_resolution_set(PointerRNA *ptr, const float *values)
ImBuf *ibuf;
void *lock;
- ibuf = BKE_image_acquire_ibuf(im, NULL , &lock);
+ ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
if (ibuf) {
ibuf->ppm[0] = values[0];
ibuf->ppm[1] = values[1];
@@ -616,13 +616,13 @@ static void rna_def_image(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Depth", "Image bit depth");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop = RNA_def_int_vector(srna, "size" , 2 , NULL , 0, 0, "Size" ,
- "Width and height in pixels, zero when image data cant be loaded" , 0 , 0);
- RNA_def_property_int_funcs(prop, "rna_Image_size_get" , NULL, NULL);
+ prop = RNA_def_int_vector(srna, "size", 2, NULL, 0, 0, "Size",
+ "Width and height in pixels, zero when image data cant be loaded", 0, 0);
+ RNA_def_property_int_funcs(prop, "rna_Image_size_get", NULL, NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop = RNA_def_float_vector(srna, "resolution" , 2 , NULL , 0, 0, "Resolution" , "X/Y pixels per meter" , 0 , 0);
- RNA_def_property_float_funcs(prop, "rna_Image_resolution_get" , "rna_Image_resolution_set", NULL);
+ prop = RNA_def_float_vector(srna, "resolution", 2, NULL, 0, 0, "Resolution", "X/Y pixels per meter", 0, 0);
+ RNA_def_property_float_funcs(prop, "rna_Image_resolution_get", "rna_Image_resolution_set", NULL);
prop = RNA_def_property(srna, "pixels", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(prop, PROP_DYNAMIC);
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c
index 671bee80523..dda287a164c 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_lamp.c
@@ -600,7 +600,7 @@ static void rna_def_spot_lamp(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem prop_shadbuftype_items[] = {
- {LA_SHADBUF_REGULAR , "REGULAR", 0, "Classical", "Classic shadow buffer"},
+ {LA_SHADBUF_REGULAR, "REGULAR", 0, "Classical", "Classic shadow buffer"},
{LA_SHADBUF_HALFWAY, "HALFWAY", 0, "Classic-Halfway",
"Regular buffer, averaging the closest and 2nd closest Z value to reducing "
"bias artifacts"},
@@ -612,7 +612,7 @@ static void rna_def_spot_lamp(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem prop_shadbuffiltertype_items[] = {
- {LA_SHADBUF_BOX , "BOX", 0, "Box", "Apply the Box filter to shadow buffer samples"},
+ {LA_SHADBUF_BOX, "BOX", 0, "Box", "Apply the Box filter to shadow buffer samples"},
{LA_SHADBUF_TENT, "TENT", 0, "Tent", "Apply the Tent Filter to shadow buffer samples"},
{LA_SHADBUF_GAUSS, "GAUSS", 0, "Gauss", "Apply the Gauss filter to shadow buffer samples"},
{0, NULL, 0, NULL, NULL}};
@@ -677,7 +677,7 @@ static void rna_def_spot_lamp(BlenderRNA *brna)
prop = RNA_def_property(srna, "spot_blend", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spotblend");
- RNA_def_property_range(prop, 0.0f ,1.0f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Spot Blend", "The softness of the spotlight edge");
RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index e616a632147..1a039295924 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -301,7 +301,7 @@ void RNA_def_main(BlenderRNA *brna)
RNA_def_main_window_managers},
{"images", "Image", "rna_Main_image_begin", "Images", "Image datablocks", RNA_def_main_images},
{"lattices", "Lattice", "rna_Main_latt_begin", "Lattices", "Lattice datablocks", RNA_def_main_lattices},
- {"curves", "Curve", "rna_Main_curve_begin", "Curves", "Curve datablocks", RNA_def_main_curves} ,
+ {"curves", "Curve", "rna_Main_curve_begin", "Curves", "Curve datablocks", RNA_def_main_curves},
{"metaballs", "MetaBall", "rna_Main_mball_begin", "Metaballs", "Metaball datablocks", RNA_def_main_metaballs},
{"fonts", "VectorFont", "rna_Main_font_begin", "Vector Fonts", "Vector font datablocks", RNA_def_main_fonts},
{"textures", "Texture", "rna_Main_tex_begin", "Textures", "Texture datablocks", RNA_def_main_textures},
@@ -347,8 +347,7 @@ void RNA_def_main(BlenderRNA *brna)
RNA_def_property_boolean_funcs(prop, "rna_Main_is_saved_get", NULL);
RNA_def_property_ui_text(prop, "File is Saved", "Has the current session been saved to disk as a .blend file");
- for (i = 0; lists[i].name; i++)
- {
+ for (i = 0; lists[i].name; i++) {
prop = RNA_def_property(srna, lists[i].identifier, PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, lists[i].type);
RNA_def_property_collection_funcs(prop, lists[i].iter_begin, "rna_iterator_listbase_next",
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 10a45fbb94d..63006af7c72 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -141,7 +141,7 @@ Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, const cha
type = OB_MESH;
break;
case ID_CU:
- type = curve_type((struct Curve *)data);
+ type = BKE_curve_type_get((struct Curve *)data);
break;
case ID_MB:
type = OB_MBALL;
@@ -314,7 +314,7 @@ void rna_Main_lattices_remove(Main *bmain, ReportList *reports, struct Lattice *
Curve *rna_Main_curves_new(Main *UNUSED(bmain), const char *name, int type)
{
- Curve *cu = add_curve(name, type);
+ Curve *cu = BKE_curve_add(name, type);
id_us_min(&cu->id);
return cu;
}
@@ -329,7 +329,7 @@ void rna_Main_curves_remove(Main *bmain, ReportList *reports, struct Curve *cu)
MetaBall *rna_Main_metaballs_new(Main *UNUSED(bmain), const char *name)
{
- MetaBall *mb = add_mball(name);
+ MetaBall *mb = BKE_metaball_add(name);
id_us_min(&mb->id);
return mb;
}
@@ -523,7 +523,7 @@ MovieClip *rna_Main_movieclip_load(Main *UNUSED(bmain), ReportList *reports, con
MovieClip *clip;
errno = 0;
- clip = BKE_add_movieclip_file(filepath);
+ clip = BKE_movieclip_file_add(filepath);
if (!clip)
BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath,
@@ -534,7 +534,7 @@ MovieClip *rna_Main_movieclip_load(Main *UNUSED(bmain), ReportList *reports, con
void rna_Main_movieclips_remove(Main *bmain, MovieClip *clip)
{
- unlink_movieclip(bmain, clip);
+ BKE_movieclip_unlink(bmain, clip);
free_libblock(&bmain->movieclip, clip);
/* XXX python now has invalid pointer? */
}
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 7802241a25b..8aabc515dcb 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -766,7 +766,7 @@ static void rna_def_material_gamesettings(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem prop_face_orientation_items[] = {
- {GEMAT_NORMAL,"NORMAL",0,"Normal","No tranformation"},
+ {GEMAT_NORMAL, "NORMAL", 0, "Normal", "No tranformation"},
{GEMAT_HALO, "HALO", 0, "Halo", "Screen aligned billboard"},
{GEMAT_BILLBOARD, "BILLBOARD", 0, "Billboard", "Billboard with Z-axis constraint"},
{GEMAT_SHADOW, "SHADOW", 0, "Shadow", "Faces are used for shadow"},
@@ -1244,7 +1244,7 @@ static void rna_def_material_volume(BlenderRNA *brna)
prop = RNA_def_property(srna, "scattering", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "scattering");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1 ,3);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
RNA_def_property_ui_text(prop, "Scattering",
"Amount of light that gets scattered out by the volume - "
"the more out-scattering, the shallower the light will penetrate");
@@ -1267,7 +1267,7 @@ static void rna_def_material_volume(BlenderRNA *brna)
prop = RNA_def_property(srna, "reflection", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "reflection");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1 ,3);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
RNA_def_property_ui_text(prop, "Reflection",
"Multiplier to make out-scattered light brighter or darker (non-physically correct)");
RNA_def_property_update(prop, 0, "rna_Material_update");
diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c
index e8ea19a5c5b..f7ef0c5c89a 100644
--- a/source/blender/makesrna/intern/rna_meta.c
+++ b/source/blender/makesrna/intern/rna_meta.c
@@ -99,7 +99,7 @@ static void rna_MetaBall_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
if (mb->id.us > 0) {
for (ob = bmain->object.first; ob; ob = ob->id.next)
if (ob->data == mb)
- copy_mball_properties(scene, ob);
+ BKE_metaball_properties_copy(scene, ob);
DAG_id_tag_update(&mb->id, 0);
WM_main_add_notifier(NC_GEOM|ND_DATA, mb);
@@ -115,7 +115,7 @@ static void rna_MetaBall_update_rotation(Main *bmain, Scene *scene, PointerRNA *
static MetaElem *rna_MetaBall_elements_new(MetaBall *mb, int type)
{
- MetaElem *ml = add_metaball_element(mb, type);
+ MetaElem *ml = BKE_metaball_element_add(mb, type);
/* cheating way for importers to avoid slow updates */
if (mb->id.us > 0) {
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index ca1b3a86087..8c000e522ba 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -1444,7 +1444,7 @@ static void rna_def_modifier_array(BlenderRNA *brna)
/* Offset parameters */
prop = RNA_def_property(srna, "use_constant_offset", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_CONST);
- RNA_def_property_ui_text(prop, "Constant Offset", "Add a constant offset");;
+ RNA_def_property_ui_text(prop, "Constant Offset", "Add a constant offset");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "constant_offset_displace", PROP_FLOAT, PROP_TRANSLATION);
@@ -3162,7 +3162,7 @@ void RNA_def_modifier(BlenderRNA *brna)
/* data */
srna = RNA_def_struct(brna, "Modifier", NULL);
- RNA_def_struct_ui_text(srna , "Modifier", "Modifier affecting the geometry data of an object");
+ RNA_def_struct_ui_text(srna, "Modifier", "Modifier affecting the geometry data of an object");
RNA_def_struct_refine_func(srna, "rna_Modifier_refine");
RNA_def_struct_path_func(srna, "rna_Modifier_path");
RNA_def_struct_sdna(srna, "ModifierData");
diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c
index ca06793cd49..96da24b3392 100644
--- a/source/blender/makesrna/intern/rna_movieclip.c
+++ b/source/blender/makesrna/intern/rna_movieclip.c
@@ -248,9 +248,9 @@ static void rna_def_movieclip(BlenderRNA *brna)
"Use a preview proxy and/or timecode index for this clip");
RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
- prop = RNA_def_int_vector(srna, "size" , 2 , NULL , 0, 0, "Size",
- "Width and height in pixels, zero when image data cant be loaded" , 0 , 0);
- RNA_def_property_int_funcs(prop, "rna_MovieClip_size_get" , NULL, NULL);
+ prop = RNA_def_int_vector(srna, "size", 2, NULL, 0, 0, "Size",
+ "Width and height in pixels, zero when image data cant be loaded", 0, 0);
+ RNA_def_property_int_funcs(prop, "rna_MovieClip_size_get", NULL, NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
prop = RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ);
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index a101bcaec12..58fd936819b 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -328,6 +328,39 @@ static void rna_Matte_t2_set(PointerRNA *ptr, float value)
chroma->t2 = value;
}
+static void rna_distance_matte_t1_set(PointerRNA *ptr, float value)
+{
+ bNode *node = (bNode*)ptr->data;
+ NodeChroma *chroma = node->storage;
+
+ chroma->t1 = value;
+}
+
+static void rna_distance_matte_t2_set(PointerRNA *ptr, float value)
+{
+ bNode *node = (bNode*)ptr->data;
+ NodeChroma *chroma = node->storage;
+
+ chroma->t2 = value;
+}
+
+static void rna_difference_matte_t1_set(PointerRNA *ptr, float value)
+{
+ bNode *node = (bNode*)ptr->data;
+ NodeChroma *chroma = node->storage;
+
+ chroma->t1 = value;
+}
+
+static void rna_difference_matte_t2_set(PointerRNA *ptr, float value)
+{
+ bNode *node = (bNode*)ptr->data;
+ NodeChroma *chroma = node->storage;
+
+ chroma->t2 = value;
+}
+
+
static void rna_Node_scene_set(PointerRNA *ptr, PointerRNA value)
{
bNode *node = (bNode*)ptr->data;
@@ -1891,14 +1924,14 @@ static void def_cmp_diff_matte(StructRNA *srna)
prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "t1");
- RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
+ RNA_def_property_float_funcs(prop, NULL, "rna_difference_matte_t1_set", NULL);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "t2");
- RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
+ RNA_def_property_float_funcs(prop, NULL, "rna_difference_matte_t2_set", NULL);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Falloff", "Color distances below this additional threshold are partially keyed");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
@@ -1933,18 +1966,30 @@ static void def_cmp_distance_matte(StructRNA *srna)
{
PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
+ static EnumPropertyItem color_space_items[] = {
+ {1, "RGB", 0, "RGB", "RGB color space"},
+ {2, "YCC", 0, "YCC", "YCbCr Suppression"},
+ {0, NULL, 0, NULL, NULL}};
+
+ RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
+
+ prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "channel");
+ RNA_def_property_enum_items(prop, color_space_items);
+ RNA_def_property_ui_text(prop, "Channel", "");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "t1");
- RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
+ RNA_def_property_float_funcs(prop, NULL, "rna_distance_matte_t1_set", NULL);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "t2");
- RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
+ RNA_def_property_float_funcs(prop, NULL, "rna_distance_matte_t2_set", NULL);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Falloff", "Color distances below this additional threshold are partially keyed");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
@@ -2071,7 +2116,7 @@ static void def_cmp_chroma_matte(StructRNA *srna)
prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "fstrength");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Gain", "Alpha gain");
+ RNA_def_property_ui_text(prop, "Falloff", "Alpha falloff");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "shadow_adjust", PROP_FLOAT, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index bd024ba90be..6a4809e54e5 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -353,7 +353,7 @@ static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
test_object_materials(id);
if (GS(id->name) == ID_CU)
- test_curve_type(ob);
+ BKE_curve_type_test(ob);
else if (ob->type == OB_ARMATURE)
armature_rebuild_pose(ob, ob->data);
}
@@ -1888,9 +1888,9 @@ static void rna_def_object(BlenderRNA *brna)
"Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"},
{0, NULL, 0, NULL, NULL}};
- static float default_quat[4] = {1,0,0,0}; /* default quaternion values */
- static float default_axisAngle[4] = {0,0,1,0}; /* default axis-angle rotation values */
- static float default_scale[3] = {1,1,1}; /* default scale values */
+ static float default_quat[4] = {1, 0, 0, 0}; /* default quaternion values */
+ static float default_axisAngle[4] = {0, 0, 1, 0}; /* default axis-angle rotation values */
+ static float default_scale[3] = {1, 1, 1}; /* default scale values */
static int boundbox_dimsize[] = {8, 3};
srna = RNA_def_struct(brna, "Object", "ID");
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index fb383b1256b..d09dedb4f4c 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -96,7 +96,7 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
object_free_modifiers(tmpobj);
/* copies the data */
- copycu = tmpobj->data = copy_curve( (Curve *) ob->data );
+ copycu = tmpobj->data = BKE_curve_copy((Curve *) ob->data );
/* temporarily set edit so we get updates from edit mode, but
* also because for text datablocks copying it while in edit
@@ -105,26 +105,26 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
copycu->editnurb = tmpcu->editnurb;
/* get updated display list, and convert to a mesh */
- makeDispListCurveTypes( sce, tmpobj, 0 );
+ makeDispListCurveTypes(sce, tmpobj, 0);
copycu->editfont = NULL;
copycu->editnurb = NULL;
- nurbs_to_mesh( tmpobj );
+ nurbs_to_mesh(tmpobj);
/* nurbs_to_mesh changes the type to a mesh, check it worked */
if (tmpobj->type != OB_MESH) {
- free_libblock_us( &(G.main->object), tmpobj );
+ free_libblock_us(&(G.main->object), tmpobj);
BKE_report(reports, RPT_ERROR, "cant convert curve to mesh. Does the curve have any segments?");
return NULL;
}
tmpmesh = tmpobj->data;
- free_libblock_us( &G.main->object, tmpobj );
+ free_libblock_us(&G.main->object, tmpobj);
break;
case OB_MBALL: {
/* metaballs don't have modifiers, so just convert to mesh */
- Object *basis_ob = find_basis_mball(sce, ob);
+ Object *basis_ob = BKE_metaball_basis_find(sce, ob);
/* todo, re-generatre for render-res */
/* metaball_polygonize(scene, ob) */
@@ -364,7 +364,7 @@ static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int
}
if (assignmode != WEIGHT_REPLACE && assignmode != WEIGHT_ADD && assignmode != WEIGHT_SUBTRACT) {
- BKE_report(reports, RPT_ERROR, "Bad assignment mode" );
+ BKE_report(reports, RPT_ERROR, "Bad assignment mode");
return;
}
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index c52b6251223..2e8e597ad35 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -187,7 +187,7 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P
for (pid = pidlist.first; pid; pid = pid->next) {
if (pid->cache == cache)
pid2 = pid;
- else if (cache->name[0] != '\0' && strcmp(cache->name,pid->cache->name) == 0) {
+ else if (cache->name[0] != '\0' && strcmp(cache->name, pid->cache->name) == 0) {
/*TODO: report "name exists" to user */
BLI_strncpy(cache->name, cache->prev_name, sizeof(cache->name));
new_name = 0;
@@ -513,7 +513,7 @@ static void rna_FieldSettings_shape_update(Main *bmain, Scene *scene, PointerRNA
/* add/remove modifier as needed */
if (!md) {
- if (pd && (pd->shape == PFIELD_SHAPE_SURFACE) && ELEM(pd->forcefield,PFIELD_GUIDE,PFIELD_TEXTURE) == 0)
+ if (pd && (pd->shape == PFIELD_SHAPE_SURFACE) && ELEM(pd->forcefield, PFIELD_GUIDE, PFIELD_TEXTURE) == 0)
if (ELEM4(ob->type, OB_MESH, OB_SURF, OB_FONT, OB_CURVE))
ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Surface);
}
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index dd591ea7343..52c41c869bb 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -1516,7 +1516,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
{PART_AVE_GLOBAL_X, "GLOBAL_X", 0, "Global X", ""},
{PART_AVE_GLOBAL_Y, "GLOBAL_Y", 0, "Global Y", ""},
{PART_AVE_GLOBAL_Z, "GLOBAL_Z", 0, "Global Z", ""},
- {PART_AVE_RAND, "RAND", 0, "Random", ""} ,
+ {PART_AVE_RAND, "RAND", 0, "Random", ""},
{0, NULL, 0, NULL, NULL}
};
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index b65924057cd..ceace424f35 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -736,9 +736,9 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro
static void rna_def_pose_channel(BlenderRNA *brna)
{
- static float default_quat[4] = {1,0,0,0}; /* default quaternion values */
- static float default_axisAngle[4] = {0,0,1,0}; /* default axis-angle rotation values */
- static float default_scale[3] = {1,1,1}; /* default scale values */
+ static float default_quat[4] = {1, 0, 0, 0}; /* default quaternion values */
+ static float default_axisAngle[4] = {0, 0, 1, 0}; /* default axis-angle rotation values */
+ static float default_scale[3] = {1, 1, 1}; /* default scale values */
const int matrix_dimsize[] = {4, 4};
@@ -1002,21 +1002,21 @@ static void rna_def_pose_channel(BlenderRNA *brna)
prop = RNA_def_property(srna, "ik_stretch", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "ikstretch");
- RNA_def_property_range(prop, 0.0f,1.0f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "IK Stretch", "Allow scaling of the bone for IK");
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
prop = RNA_def_property(srna, "ik_rotation_weight", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "ikrotweight");
- RNA_def_property_range(prop, 0.0f,1.0f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "IK Rot Weight", "Weight of rotation constraint for IK");
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
prop = RNA_def_property(srna, "ik_linear_weight", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "iklinweight");
- RNA_def_property_range(prop, 0.0f,1.0f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "IK Lin Weight", "Weight of scale constraint for IK");
RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
@@ -1133,13 +1133,13 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
prop = RNA_def_property(srna, "precision", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "precision");
- RNA_def_property_range(prop, 0.0f,0.1f);
+ RNA_def_property_range(prop, 0.0f, 0.1f);
RNA_def_property_ui_text(prop, "Precision", "Precision of convergence in case of reiteration");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "numiter");
- RNA_def_property_range(prop, 1.f,1000.f);
+ RNA_def_property_range(prop, 1.f, 1000.f);
RNA_def_property_ui_text(prop, "Iterations",
"Maximum number of iterations for convergence in case of reiteration");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
@@ -1173,19 +1173,19 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
prop = RNA_def_property(srna, "step_min", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "minstep");
- RNA_def_property_range(prop, 0.0f,0.1f);
+ RNA_def_property_range(prop, 0.0f, 0.1f);
RNA_def_property_ui_text(prop, "Min step", "Lower bound for timestep in second in case of automatic substeps");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
prop = RNA_def_property(srna, "step_max", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "maxstep");
- RNA_def_property_range(prop, 0.0f,1.0f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Max step", "Higher bound for timestep in second in case of automatic substeps");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
prop = RNA_def_property(srna, "feedback", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "feedback");
- RNA_def_property_range(prop, 0.0f,100.0f);
+ RNA_def_property_range(prop, 0.0f, 100.0f);
RNA_def_property_ui_text(prop, "Feedback",
"Feedback coefficient for error correction, average response time is 1/feedback "
"(default=20)");
@@ -1193,7 +1193,7 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "maxvel");
- RNA_def_property_range(prop, 0.0f,100.0f);
+ RNA_def_property_range(prop, 0.0f, 100.0f);
RNA_def_property_ui_text(prop, "Max Velocity", "Maximum joint velocity in rad/s (default=50)");
RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
@@ -1205,7 +1205,7 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
prop = RNA_def_property(srna, "damping_max", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "dampmax");
- RNA_def_property_range(prop, 0.0f,1.0f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Damp",
"Maximum damping coefficient when singular value is nearly 0 "
"(higher values=more stability, less reactivity - default=0.5)");
@@ -1213,7 +1213,7 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
prop = RNA_def_property(srna, "damping_epsilon", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "dampeps");
- RNA_def_property_range(prop, 0.0f,1.0f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Epsilon",
"Singular value under which damping is progressively applied "
"(higher values=more stability, less reactivity - default=0.1)");
diff --git a/source/blender/makesrna/intern/rna_property.c b/source/blender/makesrna/intern/rna_property.c
index 3eac129a195..637e21cf6c5 100644
--- a/source/blender/makesrna/intern/rna_property.c
+++ b/source/blender/makesrna/intern/rna_property.c
@@ -109,7 +109,7 @@ void RNA_def_gameproperty(BlenderRNA *brna)
/* Base Struct for GameProperty */
srna = RNA_def_struct(brna, "GameProperty", NULL);
- RNA_def_struct_ui_text(srna , "Game Property", "Game engine user defined object property");
+ RNA_def_struct_ui_text(srna, "Game Property", "Game engine user defined object property");
RNA_def_struct_sdna(srna, "bProperty");
RNA_def_struct_refine_func(srna, "rna_GameProperty_refine");
@@ -132,7 +132,7 @@ void RNA_def_gameproperty(BlenderRNA *brna)
/* GameBooleanProperty */
srna = RNA_def_struct(brna, "GameBooleanProperty", "GameProperty");
- RNA_def_struct_ui_text(srna , "Game Boolean Property", "Game engine user defined Boolean property");
+ RNA_def_struct_ui_text(srna, "Game Boolean Property", "Game engine user defined Boolean property");
RNA_def_struct_sdna(srna, "bProperty");
RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -143,7 +143,7 @@ void RNA_def_gameproperty(BlenderRNA *brna)
/* GameIntProperty */
srna = RNA_def_struct(brna, "GameIntProperty", "GameProperty");
- RNA_def_struct_ui_text(srna , "Game Integer Property", "Game engine user defined integer number property");
+ RNA_def_struct_ui_text(srna, "Game Integer Property", "Game engine user defined integer number property");
RNA_def_struct_sdna(srna, "bProperty");
prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index d2eef1cdd43..ba927a1c739 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -151,7 +151,7 @@ EnumPropertyItem snap_element_items[] = {
#ifdef WITH_CINEON
# define R_IMF_ENUM_CINEON {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", \
"Output image in Cineon format"},
-# define R_IMF_ENUM_DPX {R_IMF_IMTYPE_DPX, "DPX",ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
+# define R_IMF_ENUM_DPX {R_IMF_IMTYPE_DPX, "DPX", ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
#else
# define R_IMF_ENUM_CINEON
# define R_IMF_ENUM_DPX
@@ -1779,6 +1779,11 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Use Unified Strength",
"Instead of per-brush strength, the strength is shared across brushes");
+ prop = RNA_def_property(srna, "use_unified_weight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_WEIGHT);
+ RNA_def_property_ui_text(prop, "Use Unified Weight",
+ "Instead of per-brush weight, the weight is shared across brushes");
+
/* unified paint settings that override the equivalent settings
* from the active brush */
prop = RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
@@ -1800,6 +1805,13 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna)
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
RNA_def_property_ui_text(prop, "Strength", "How powerful the effect of the brush is when applied");
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "weight");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
+ RNA_def_property_ui_text(prop, "Weight", "Weight to assign in vertex groups");
+
prop = RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_SIZE_PRESSURE);
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
@@ -1905,6 +1917,19 @@ void rna_def_render_layer_common(StructRNA *srna, int scene)
if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "layers_exclude", PROP_BOOLEAN, PROP_LAYER);
+ RNA_def_property_boolean_sdna(prop, NULL, "lay_exclude", 1);
+ RNA_def_property_array(prop, 20);
+ RNA_def_property_ui_text(prop, "Exclude Layers", "Exclude scene layers from having any influence");
+ if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
+ else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ if(scene) {
+ prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(prop, "Samples", "Override number of render samples for this render layer, 0 will use the scene setting");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+ }
+
/* layer options */
prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "layflag", SCE_LAY_DISABLE);
@@ -2888,7 +2913,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
{CODEC_ID_FLV1, "FLASH", 0, "Flash Video", ""},
{CODEC_ID_FFV1, "FFV1", 0, "FFmpeg video codec #1", ""},
{CODEC_ID_QTRLE, "QTRLE", 0, "QTRLE", ""},
- /* {CODEC_ID_DNXHD, "DNXHD", 0, "DNxHD", ""},*/ /* disabled for after release */
+ /* {CODEC_ID_DNXHD, "DNXHD", 0, "DNxHD", ""}, */ /* disabled for after release */
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem ffmpeg_audio_codec_items[] = {
@@ -3791,14 +3816,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "stamp_foreground", PROP_FLOAT, PROP_COLOR);
RNA_def_property_float_sdna(prop, NULL, "fg_stamp");
RNA_def_property_array(prop, 4);
- RNA_def_property_range(prop,0.0,1.0);
+ RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_text(prop, "Text Color", "Color to use for stamp text");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "stamp_background", PROP_FLOAT, PROP_COLOR);
RNA_def_property_float_sdna(prop, NULL, "bg_stamp");
RNA_def_property_array(prop, 4);
- RNA_def_property_range(prop,0.0,1.0);
+ RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_text(prop, "Background", "Color to use behind stamp text");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c
index ff336ba6693..8bed95f88b2 100644
--- a/source/blender/makesrna/intern/rna_sensor.c
+++ b/source/blender/makesrna/intern/rna_sensor.c
@@ -369,7 +369,7 @@ static void rna_def_near_sensor(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "NearSensor", "Sensor");
- RNA_def_struct_ui_text(srna , "Near Sensor", "Sensor to detect nearby objects");
+ RNA_def_struct_ui_text(srna, "Near Sensor", "Sensor to detect nearby objects");
RNA_def_struct_sdna_from(srna, "bNearSensor", "data");
prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index c94d420da8a..775e943b9a2 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -414,8 +414,6 @@ static StructRNA* rna_Sequence_refine(struct PointerRNA *ptr)
return &RNA_MulticamSequence;
case SEQ_ADJUSTMENT:
return &RNA_AdjustmentSequence;
- case SEQ_PLUGIN:
- return &RNA_PluginSequence;
case SEQ_WIPE:
return &RNA_WipeSequence;
case SEQ_GLOW:
@@ -1048,7 +1046,7 @@ static void rna_def_sequence(BlenderRNA *brna)
RNA_def_property_range(prop, 1, MAXFRAME);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Length", "The length of the contents of this strip after the handles are applied");
- RNA_def_property_int_funcs(prop, "rna_Sequence_frame_length_get", "rna_Sequence_frame_length_set",NULL);
+ RNA_def_property_int_funcs(prop, "rna_Sequence_frame_length_get", "rna_Sequence_frame_length_set", NULL);
RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
@@ -1063,7 +1061,7 @@ static void rna_def_sequence(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "start");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Start Frame", "");
- RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_set",NULL); /* overlap tests and calc_seq_disp */
+ RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_set", NULL); /* overlap tests and calc_seq_disp */
RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
@@ -1118,7 +1116,7 @@ static void rna_def_sequence(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "machine");
RNA_def_property_range(prop, 0, MAXSEQ-1);
RNA_def_property_ui_text(prop, "Channel", "Y position of the sequence strip");
- RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_channel_set",NULL); /* overlap test */
+ RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_channel_set", NULL); /* overlap test */
RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
/* blending */
@@ -1588,25 +1586,6 @@ static void rna_def_adjustment(BlenderRNA *brna)
rna_def_input(srna);
}
-static void rna_def_plugin(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "PluginSequence", "EffectSequence");
- RNA_def_struct_ui_text(srna, "Plugin Sequence",
- "Sequence strip applying an effect, loaded from an external plugin");
- RNA_def_struct_sdna_from(srna, "PluginSeq", "plugin");
-
- prop = RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Filename", "");
- RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
-
- /* plugin properties need custom wrapping code like ID properties */
-}
-
static void rna_def_wipe(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1848,7 +1827,6 @@ void RNA_def_sequencer(BlenderRNA *brna)
rna_def_effect(brna);
rna_def_multicam(brna);
rna_def_adjustment(brna);
- rna_def_plugin(brna);
rna_def_wipe(brna);
rna_def_glow(brna);
rna_def_transform(brna);
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index 69d76c0e342..b1fed62f87b 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -16,6 +16,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Daniel Genrich
+ * Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -336,12 +337,25 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna)
static void rna_def_smoke_coll_settings(BlenderRNA *brna)
{
+ static EnumPropertyItem smoke_coll_type_items[] = {
+ {SM_COLL_STATIC, "COLLSTATIC", 0, "Static", "Non moving obstacle"},
+ {SM_COLL_RIGID, "COLLRIGID", 0, "Rigid", "Rigid obstacle"},
+ {SM_COLL_ANIMATED, "COLLANIMATED", 0, "Animated", "Animated obstacle"},
+ {0, NULL, 0, NULL, NULL}};
+
StructRNA *srna;
+ PropertyRNA *prop;
srna = RNA_def_struct(brna, "SmokeCollSettings", NULL);
RNA_def_struct_ui_text(srna, "Collision Settings", "Smoke collision settings");
RNA_def_struct_sdna(srna, "SmokeCollSettings");
RNA_def_struct_path_func(srna, "rna_SmokeCollSettings_path");
+
+ prop = RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, smoke_coll_type_items);
+ RNA_def_property_ui_text(prop, "Collision type", "Collision type");
+ RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
}
void RNA_def_smoke(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 8d4b5a32969..a418de2c92d 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2612,7 +2612,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_hidden", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FILE_HIDE_DOT);
RNA_def_property_ui_text(prop, "Show Hidden", "Show hidden dot files");
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS , NULL);
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
prop = RNA_def_property(srna, "sort_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "sort");
@@ -3104,6 +3104,12 @@ static void rna_def_space_clip(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "postproc_flag", MOVIECLIP_PREVIEW_GRAYSCALE);
RNA_def_property_ui_text(prop, "Grayscale", "Display frame in grayscale mode");
RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
+
+ /* timeline */
+ prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_SECONDS);
+ RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
}
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index fab80997d08..e8253f4b51c 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -92,7 +92,7 @@ EnumPropertyItem blend_type_items[] = {
{MTEX_BLEND_VAL, "VALUE", 0, "Value", ""},
{MTEX_BLEND_COLOR, "COLOR", 0, "Color", ""},
{MTEX_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""},
- {MTEX_LIN_LIGHT , "LINEAR_LIGHT", 0, "Linear Light", ""},
+ {MTEX_LIN_LIGHT, "LINEAR_LIGHT", 0, "Linear Light", ""},
{0, NULL, 0, NULL, NULL}};
#ifdef RNA_RUNTIME
@@ -134,8 +134,6 @@ static StructRNA *rna_Texture_refine(struct PointerRNA *ptr)
return &RNA_MusgraveTexture;
case TEX_NOISE:
return &RNA_NoiseTexture;
- case TEX_PLUGIN:
- return &RNA_PluginTexture;
case TEX_POINTDENSITY:
return &RNA_PointDensityTexture;
case TEX_STUCCI:
@@ -1302,17 +1300,6 @@ static void rna_def_texture_image(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Texture_update");
}
-static void rna_def_texture_plugin(BlenderRNA *brna)
-{
- StructRNA *srna;
-
- srna = RNA_def_struct(brna, "PluginTexture", "Texture");
- RNA_def_struct_ui_text(srna, "Plugin", "External plugin texture");
- RNA_def_struct_sdna(srna, "Tex");
-
- /* XXX: todo */
-}
-
static void rna_def_texture_environment_map(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1571,19 +1558,19 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna)
static EnumPropertyItem point_source_items[] = {
{TEX_PD_PSYS, "PARTICLE_SYSTEM", 0, "Particle System", "Generate point density from a particle system"},
{TEX_PD_OBJECT, "OBJECT", 0, "Object Vertices", "Generate point density from an object's vertices"},
- /*{TEX_PD_FILE, "FILE", 0 , "File", ""}, */
+ /*{TEX_PD_FILE, "FILE", 0, "File", ""}, */
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem particle_cache_items[] = {
{TEX_PD_OBJECTLOC, "OBJECT_LOCATION", 0, "Emit Object Location", ""},
{TEX_PD_OBJECTSPACE, "OBJECT_SPACE", 0, "Emit Object Space", ""},
- {TEX_PD_WORLDSPACE, "WORLD_SPACE", 0 , "Global Space", ""},
+ {TEX_PD_WORLDSPACE, "WORLD_SPACE", 0, "Global Space", ""},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem vertice_cache_items[] = {
{TEX_PD_OBJECTLOC, "OBJECT_LOCATION", 0, "Object Location", ""},
{TEX_PD_OBJECTSPACE, "OBJECT_SPACE", 0, "Object Space", ""},
- {TEX_PD_WORLDSPACE, "WORLD_SPACE", 0 , "Global Space", ""},
+ {TEX_PD_WORLDSPACE, "WORLD_SPACE", 0, "Global Space", ""},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem falloff_items[] = {
@@ -2013,7 +2000,6 @@ static void rna_def_texture(BlenderRNA *brna)
rna_def_texture_stucci(brna);
rna_def_texture_noise(brna);
rna_def_texture_image(brna);
- rna_def_texture_plugin(brna);
rna_def_texture_environment_map(brna);
rna_def_texture_musgrave(brna);
rna_def_texture_voronoi(brna);
diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c
index 034696b43c5..b801dbb4fed 100644
--- a/source/blender/makesrna/intern/rna_texture_api.c
+++ b/source/blender/makesrna/intern/rna_texture_api.c
@@ -103,18 +103,18 @@ void RNA_api_environment_map(StructRNA *srna)
FunctionRNA *func;
PropertyRNA *parm;
- static const float default_layout[] = { 0,0, 1,0, 2,0, 0,1, 1,1, 2,1 };
+ static const float default_layout[] = {0, 0, 1, 0, 2, 0, 0, 1, 1, 1, 2, 1};
func = RNA_def_function(srna, "clear", "clear_envmap");
RNA_def_function_ui_description(func, "Discard the environment map and free it from memory");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- func = RNA_def_function(srna,"save", "save_envmap");
+ func = RNA_def_function(srna, "save", "save_envmap");
RNA_def_function_ui_description(func, "Save the environment map to disc using the scene render settings");
RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
- parm = RNA_def_string_file_name(func,"filepath","",FILE_MAX,"File path","Location of the output file");
+ parm = RNA_def_string_file_name(func, "filepath", "", FILE_MAX, "File path", "Location of the output file");
RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_def_pointer(func, "scene", "Scene", "", "Overrides the scene from which image parameters are taken");
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index c3a46c39643..85adf524717 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -607,6 +607,12 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Show Expanded", "Show the expanded in the user interface");
RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
+ /* solver settings */
+ prop = RNA_def_property(srna, "use_tripod_solver", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "motion_flag", TRACKING_MOTION_TRIPOD);
+ RNA_def_property_ui_text(prop, "Tripod Motion", "Tracking footage is shooted by tripod camera and should use special sovler for this");
+
/* limit frames */
prop = RNA_def_property(srna, "default_frames_limit", PROP_INT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 635dfb48b27..44ece727912 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -723,7 +723,7 @@ static void rna_def_panel(BlenderRNA *brna)
prop = RNA_def_property(srna, "bl_context", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->context");
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); /* should this be optional? - Campbell */
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); /* Only used in Properties Editor and 3D View - Thomas */
RNA_def_property_ui_text(prop, "Context",
"The context in which the panel belongs to. (TODO: explain the "
"possible combinations bl_context/bl_region_type/bl_space_type)");
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index ae236da6952..798bf590624 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -155,7 +155,7 @@ static void rna_userdef_gl_use_16bit_textures(Main *bmain, Scene *scene, Pointer
rna_userdef_update(bmain, scene, ptr);
}
-static void rna_userdef_select_mouse_set(PointerRNA *ptr,int value)
+static void rna_userdef_select_mouse_set(PointerRNA *ptr, int value)
{
UserDef *userdef = (UserDef*)ptr->data;
@@ -178,7 +178,7 @@ static int rna_userdef_autokeymode_get(PointerRNA *ptr)
return retval;
}
-static void rna_userdef_autokeymode_set(PointerRNA *ptr,int value)
+static void rna_userdef_autokeymode_set(PointerRNA *ptr, int value)
{
UserDef *userdef = (UserDef*)ptr->data;
@@ -1769,12 +1769,6 @@ static void rna_def_userdef_theme_space_seq(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Effect Strip", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
- prop = RNA_def_property(srna, "plugin_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "plugin");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Plugin Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
prop = RNA_def_property(srna, "transition_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "transition");
RNA_def_property_array(prop, 3);
@@ -2860,7 +2854,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
/* locale according to http://www.roseindia.net/tutorials/I18N/locales-list.shtml */
/* if you edit here, please also edit the source/blender/blenfont/intern/blf_lang.c 's locales */
/* Note: As this list is in alphabetical order, and not defined order,
- * here is the highest define currently in use: 30 (turkish). */
+ * here is the highest define currently in use: 31 (Hungarian). */
static EnumPropertyItem language_items[] = {
{ 0, "", 0, N_("Nearly done"), ""},
{ 0, "DEFAULT", 0, "Default (Default)", ""},
@@ -2878,20 +2872,21 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{10, "CATALAN", 0, "Catalan (Català)", "ca_AD"},
{16, "CROATIAN", 0, "Croatian (Hrvatski)", "hr_HR"},
{11, "CZECH", 0, "Czech (Český)", "cs_CZ"},
-/* { 3, "DUTCH", 0, "Dutch (Nederlandse taal)", "nl_NL"},*/ /* XXX No po's yet. */
+/* { 3, "DUTCH", 0, "Dutch (Nederlandse taal)", "nl_NL"}, */ /* XXX No po's yet. */
{ 6, "FINNISH", 0, "Finnish (Suomi)", "fi_FI"},
{ 5, "GERMAN", 0, "German (Deutsch)", "de_DE"},
{23, "GREEK", 0, "Greek (Ελληνικά)", "el_GR"},
+ {31, "HUNGARIAN", 0, "Hungarian (magyar)", "hu_HU"},
{27, "INDONESIAN", 0, "Indonesian (Bahasa indonesia)", "id_ID"},
{ 2, "JAPANESE", 0, "Japanese (日本語)", "ja_JP"},
{29, "KYRGYZ", 0, "Kyrgyz (Кыргыз тили)", "ky_KG"},
-/* {24, "KOREAN", 0, "Korean (한국 언어)", "ko_KR"},*/ /* XXX No po's yet. */
+/* {24, "KOREAN", 0, "Korean (한국 언어)", "ko_KR"}, */ /* XXX No po's yet. */
{25, "NEPALI", 0, "Nepali (नेपाली)", "ne_NP"},
/* using the utf8 flipped form of Persian (فارسی) */
{26, "PERSIAN", 0, "Persian (ﯽﺳﺭﺎﻓ)", "fa_IR"},
{19, "POLISH", 0, "Polish (Polski)", "pl_PL"},
{12, "BRAZILIAN_PORTUGUESE", 0, "Portuguese (Português)", "pt"},
-/* {20, "ROMANIAN", 0, "Romanian (Român)", "ro_RO"},*/ /* XXX No po's yet. */
+/* {20, "ROMANIAN", 0, "Romanian (Român)", "ro_RO"}, */ /* XXX No po's yet. */
{17, "SERBIAN", 0, "Serbian (Српски)", "sr_RS"},
{28, "SERBIAN_LATIN", 0, "Serbian latin (Srpski latinica)", "sr_RS@latin"},
{ 7, "SWEDISH", 0, "Swedish (Svenska)", "sv_SE"},
@@ -3373,15 +3368,6 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
RNA_def_property_string_sdna(prop, NULL, "textudir");
RNA_def_property_ui_text(prop, "Textures Directory", "The default directory to search for textures");
- prop = RNA_def_property(srna, "texture_plugin_directory", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "plugtexdir");
- RNA_def_property_ui_text(prop, "Texture Plugin Directory", "The default directory to search for texture plugins");
-
- prop = RNA_def_property(srna, "sequence_plugin_directory", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "plugseqdir");
- RNA_def_property_ui_text(prop, "Sequence Plugin Directory",
- "The default directory to search for sequence plugins");
-
prop = RNA_def_property(srna, "render_output_directory", PROP_STRING, PROP_DIRPATH);
RNA_def_property_string_sdna(prop, NULL, "renderdir");
RNA_def_property_ui_text(prop, "Render Output Directory",
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 8c4b7917cb8..0eb4ef1c5c9 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -665,13 +665,15 @@ static int rna_KeyMapItem_any_getf(PointerRNA *ptr)
wmKeyMapItem *kmi = (wmKeyMapItem*)ptr->data;
if (kmi->shift == KM_ANY &&
- kmi->ctrl == KM_ANY &&
- kmi->alt == KM_ANY &&
- kmi->oskey == KM_ANY)
-
+ kmi->ctrl == KM_ANY &&
+ kmi->alt == KM_ANY &&
+ kmi->oskey == KM_ANY)
+ {
return 1;
- else
+ }
+ else {
return 0;
+ }
}
static void rna_KeyMapItem_any_setf(PointerRNA *ptr, int value)
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index e4e89db403d..c11d6fc50af 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -97,7 +97,7 @@ static DerivedMesh *get_quick_derivedMesh(DerivedMesh *derivedData, DerivedMesh
DerivedMesh *result = NULL;
if (derivedData->getNumPolys(derivedData) == 0 || dm->getNumPolys(dm) == 0) {
- switch(operation) {
+ switch (operation) {
case eBooleanModifierOp_Intersect:
result = CDDM_new(0, 0, 0, 0, 0);
break;
diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c
index 8341bc67107..711c7e6e4ff 100644
--- a/source/blender/modifiers/intern/MOD_boolean_util.c
+++ b/source/blender/modifiers/intern/MOD_boolean_util.c
@@ -129,7 +129,7 @@ static void VertexIt_Construct(CSG_VertexIteratorDescriptor *output, DerivedMesh
if (output == 0) return;
// allocate some memory for blender iterator
- it = (VertexIt *)(MEM_mallocN(sizeof(VertexIt),"Boolean_VIt"));
+ it = (VertexIt *)(MEM_mallocN(sizeof(VertexIt), "Boolean_VIt"));
if (it == 0) {
return;
}
@@ -223,7 +223,7 @@ static void FaceIt_Construct(
if (output == 0) return;
// allocate some memory for blender iterator
- it = (FaceIt *)(MEM_mallocN(sizeof(FaceIt),"Boolean_FIt"));
+ it = (FaceIt *)(MEM_mallocN(sizeof(FaceIt), "Boolean_FIt"));
if (it == 0) {
return;
}
@@ -333,7 +333,7 @@ static void InterpCSGFace(
else
copy_v3_v3(obco, co[j]);
- interp_weights_face_v3( w[j],orig_co[0], orig_co[1], orig_co[2], orig_co[3], obco);
+ interp_weights_face_v3(w[j], orig_co[0], orig_co[1], orig_co[2], orig_co[3], obco);
}
CustomData_interp(&orig_dm->faceData, &dm->faceData, &orig_index, NULL, (float*)w, 1, index);
@@ -496,8 +496,8 @@ static void BuildMeshDescriptors(
struct CSG_FaceIteratorDescriptor * face_it,
struct CSG_VertexIteratorDescriptor * vertex_it)
{
- VertexIt_Construct(vertex_it,dm, ob);
- FaceIt_Construct(face_it,dm,face_offset,ob);
+ VertexIt_Construct(vertex_it, dm, ob);
+ FaceIt_Construct(face_it, dm, face_offset, ob);
}
static void FreeMeshDescriptors(
@@ -551,7 +551,7 @@ static DerivedMesh *NewBooleanDerivedMesh_intern(
}
BuildMeshDescriptors(dm_select, ob_select, 0, &fd_1, &vd_1);
- BuildMeshDescriptors(dm, ob, dm_select->getNumTessFaces(dm_select) , &fd_2, &vd_2);
+ BuildMeshDescriptors(dm, ob, dm_select->getNumTessFaces(dm_select), &fd_2, &vd_2);
bool_op = CSG_NewBooleanFunction();
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index 15940112527..8ad5b72204b 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -423,8 +423,11 @@ static void cuboid_do(
if (has_radius) {
if (fabsf(tmp_co[0]) > cmd->radius ||
- fabsf(tmp_co[1]) > cmd->radius ||
- fabsf(tmp_co[2]) > cmd->radius) continue;
+ fabsf(tmp_co[1]) > cmd->radius ||
+ fabsf(tmp_co[2]) > cmd->radius)
+ {
+ continue;
+ }
}
for (j = 0; j < dvert[i].totweight; ++j) {
@@ -521,8 +524,11 @@ static void cuboid_do(
if (has_radius) {
if (fabsf(tmp_co[0]) > cmd->radius ||
- fabsf(tmp_co[1]) > cmd->radius ||
- fabsf(tmp_co[2]) > cmd->radius) continue;
+ fabsf(tmp_co[1]) > cmd->radius ||
+ fabsf(tmp_co[2]) > cmd->radius)
+ {
+ continue;
+ }
}
octant = 0;
diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c
index b3faf6c140a..83a366815de 100644
--- a/source/blender/modifiers/intern/MOD_collision.c
+++ b/source/blender/modifiers/intern/MOD_collision.c
@@ -71,8 +71,7 @@ static void freeData(ModifierData *md)
{
CollisionModifierData *collmd = (CollisionModifierData*) md;
- if (collmd)
- {
+ if (collmd) {
if (collmd->bvhtree)
BLI_bvhtree_free(collmd->bvhtree);
if (collmd->x)
@@ -120,14 +119,12 @@ static void deformVerts(ModifierData *md, Object *ob,
if (derivedData) dm = CDDM_copy(derivedData);
else if (ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, ob);
- if (!ob->pd)
- {
+ if (!ob->pd) {
printf("CollisionModifier deformVerts: Should not happen!\n");
return;
}
- if (dm)
- {
+ if (dm) {
float current_time = 0;
unsigned int numverts = 0;
@@ -139,24 +136,21 @@ static void deformVerts(ModifierData *md, Object *ob,
if (G.rt > 0)
printf("current_time %f, collmd->time_xnew %f\n", current_time, collmd->time_xnew);
- numverts = dm->getNumVerts ( dm );
+ numverts = dm->getNumVerts (dm);
- if ((current_time > collmd->time_xnew)|| (BKE_ptcache_get_continue_physics()))
- {
+ if ((current_time > collmd->time_xnew)|| (BKE_ptcache_get_continue_physics())) {
unsigned int i;
// check if mesh has changed
if (collmd->x && (numverts != collmd->numverts))
freeData((ModifierData *)collmd);
- if (collmd->time_xnew == -1000) // first time
- {
+ if (collmd->time_xnew == -1000) { /* first time */
collmd->x = dm->dupVertArray(dm); // frame start position
- for ( i = 0; i < numverts; i++ )
- {
+ for ( i = 0; i < numverts; i++ ) {
// we save global positions
- mul_m4_v3( ob->obmat, collmd->x[i].co );
+ mul_m4_v3(ob->obmat, collmd->x[i].co);
}
collmd->xnew = MEM_dupallocN(collmd->x); // frame end position
@@ -187,7 +181,7 @@ static void deformVerts(ModifierData *md, Object *ob,
for (i = 0; i < numverts; i++) {
// we save global positions
- mul_m4_v3( ob->obmat, collmd->xnew[i].co );
+ mul_m4_v3(ob->obmat, collmd->xnew[i].co);
}
memcpy(collmd->current_xnew, collmd->x, numverts*sizeof(MVert));
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 293a8a8c686..70294588fd4 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -208,7 +208,7 @@ static void displaceModifier_do(
delta *= strength;
CLAMP(delta, -10000, 10000);
- switch(dmd->direction) {
+ switch (dmd->direction) {
case MOD_DISP_DIR_X:
vertexCos[i][0] += delta;
break;
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c
index a1dc69918c2..14acf6a0cbd 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -35,6 +35,7 @@
#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
#include "BLI_kdtree.h"
#include "BLI_rand.h"
@@ -104,8 +105,8 @@ static void createFacepa(ExplodeModifierData *emd,
ParticleData *pa;
KDTree *tree;
float center[3], co[3];
- int *facepa=NULL,*vertpa=NULL,totvert=0,totface=0,totpart=0;
- int i,p,v1,v2,v3,v4=0;
+ int *facepa=NULL, *vertpa=NULL, totvert=0, totface=0, totpart=0;
+ int i, p, v1, v2, v3, v4=0;
mvert = dm->getVertArray(dm);
mface = dm->getTessFaceArray(dm);
@@ -145,24 +146,24 @@ static void createFacepa(ExplodeModifierData *emd,
/* make tree of emitter locations */
tree=BLI_kdtree_new(totpart);
- for (p=0,pa=psys->particles; p<totpart; p++,pa++) {
- psys_particle_on_emitter(psmd,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,NULL,NULL,NULL,NULL,NULL);
+ for (p=0, pa=psys->particles; p<totpart; p++, pa++) {
+ psys_particle_on_emitter(psmd, psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, NULL, NULL, NULL, NULL, NULL);
BLI_kdtree_insert(tree, p, co, NULL);
}
BLI_kdtree_balance(tree);
/* set face-particle-indexes to nearest particle to face center */
- for (i=0,fa=mface; i<totface; i++,fa++) {
- add_v3_v3v3(center,mvert[fa->v1].co,mvert[fa->v2].co);
+ for (i=0, fa=mface; i<totface; i++, fa++) {
+ add_v3_v3v3(center, mvert[fa->v1].co, mvert[fa->v2].co);
add_v3_v3(center, mvert[fa->v3].co);
if (fa->v4) {
add_v3_v3(center, mvert[fa->v4].co);
- mul_v3_fl(center,0.25);
+ mul_v3_fl(center, 0.25);
}
else
- mul_v3_fl(center,0.3333f);
+ mul_v3_fl(center, 0.3333f);
- p= BLI_kdtree_find_nearest(tree,center,NULL,NULL);
+ p= BLI_kdtree_find_nearest(tree, center, NULL, NULL);
v1=vertpa[fa->v1];
v2=vertpa[fa->v2];
@@ -545,7 +546,7 @@ static void remap_uvs_23(DerivedMesh *dm, DerivedMesh *split, int numlayer, int
static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
{
DerivedMesh *splitdm;
- MFace *mf=NULL,*df1=NULL;
+ MFace *mf=NULL, *df1=NULL;
MFace *mface=dm->getTessFaceArray(dm);
MVert *dupve, *mv;
EdgeHash *edgehash;
@@ -553,10 +554,10 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
int totvert=dm->getNumVerts(dm);
int totface=dm->getNumTessFaces(dm);
- int *facesplit = MEM_callocN(sizeof(int)*totface,"explode_facesplit");
- int *vertpa = MEM_callocN(sizeof(int)*totvert,"explode_vertpa2");
+ int *facesplit = MEM_callocN(sizeof(int)*totface, "explode_facesplit");
+ int *vertpa = MEM_callocN(sizeof(int)*totvert, "explode_vertpa2");
int *facepa = emd->facepa;
- int *fs, totesplit=0,totfsplit=0,curdupface=0;
+ int *fs, totesplit=0, totfsplit=0, curdupface=0;
int i, v1, v2, v3, v4, esplit,
v[4] = {0, 0, 0, 0}, /* To quite gcc barking... */
uv[4] = {0, 0, 0, 0}; /* To quite gcc barking... */
@@ -566,7 +567,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
edgehash= BLI_edgehash_new();
/* recreate vertpa from facepa calculation */
- for (i=0,mf=mface; i<totface; i++,mf++) {
+ for (i=0, mf=mface; i<totface; i++, mf++) {
vertpa[mf->v1]=facepa[i];
vertpa[mf->v2]=facepa[i];
vertpa[mf->v3]=facepa[i];
@@ -575,7 +576,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
}
/* mark edges for splitting and how to split faces */
- for (i=0,mf=mface,fs=facesplit; i<totface; i++,mf++,fs++) {
+ for (i=0, mf=mface, fs=facesplit; i<totface; i++, mf++, fs++) {
v1=vertpa[mf->v1];
v2=vertpa[mf->v2];
v3=vertpa[mf->v3];
@@ -627,7 +628,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
BLI_edgehashIterator_free(ehi);
/* count new faces due to splitting */
- for (i=0,fs=facesplit; i<totface; i++,fs++)
+ for (i=0, fs=facesplit; i<totface; i++, fs++)
totfsplit += add_faces[*fs];
splitdm= CDDM_from_template(dm, totesplit, 0, totface+totfsplit, 0, 0);
@@ -650,8 +651,8 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
* later interpreted as tri's, for this to work right I think we probably
* have to stop using tessface - campbell */
- facepa= MEM_callocN(sizeof(int)*(totface+(totfsplit * 2)),"explode_facepa");
- //memcpy(facepa,emd->facepa,totface*sizeof(int));
+ facepa= MEM_callocN(sizeof(int)*(totface+(totfsplit * 2)), "explode_facepa");
+ //memcpy(facepa, emd->facepa, totface*sizeof(int));
emd->facepa=facepa;
/* create new verts */
@@ -660,9 +661,9 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
BLI_edgehashIterator_getKey(ehi, &ed_v1, &ed_v2);
esplit= GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
mv=CDDM_get_vert(splitdm, ed_v2);
- dupve=CDDM_get_vert(splitdm,esplit);
+ dupve=CDDM_get_vert(splitdm, esplit);
- DM_copy_vert_data(splitdm,splitdm, ed_v2, esplit,1);
+ DM_copy_vert_data(splitdm, splitdm, ed_v2, esplit, 1);
*dupve=*mv;
@@ -676,10 +677,10 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
/* create new faces */
curdupface=0;//=totface;
//curdupin=totesplit;
- for (i=0,fs=facesplit; i<totface; i++,fs++) {
+ for (i=0, fs=facesplit; i<totface; i++, fs++) {
mf = dm->getTessFaceData(dm, i, CD_MFACE);
- switch(*fs) {
+ switch (*fs) {
case 3:
case 10:
case 11:
@@ -711,7 +712,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
break;
}
- switch(*fs) {
+ switch (*fs) {
case 3:
case 6:
case 9:
@@ -797,7 +798,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
float cfra;
/* float timestep; */
int *facepa=emd->facepa;
- int totdup=0,totvert=0,totface=0,totpart=0,delface=0;
+ int totdup=0, totvert=0, totface=0, totpart=0, delface=0;
int i, v, u;
unsigned int ed_v1, ed_v2, mindex=0;
MTFace *mtface = NULL, *mtf;
@@ -858,12 +859,12 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
BLI_edgehashIterator_free(ehi);
/* the final duplicated vertices */
- explode= CDDM_from_template(dm, totdup, 0,totface-delface, 0, 0);
+ explode= CDDM_from_template(dm, totdup, 0, totface-delface, 0, 0);
mtface = CustomData_get_layer_named(&explode->faceData, CD_MTFACE, emd->uvname);
/*dupvert= CDDM_get_verts(explode);*/
/* getting back to object space */
- invert_m4_m4(imat,ob->obmat);
+ invert_m4_m4(imat, ob->obmat);
psmd->psys->lattice = psys_get_lattice(&sim);
@@ -879,7 +880,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
v= GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
dm->getVert(dm, ed_v1, &source);
- dest = CDDM_get_vert(explode,v);
+ dest = CDDM_get_vert(explode, v);
DM_copy_vert_data(dm, explode, ed_v1, v, 1);
*dest = source;
@@ -893,8 +894,8 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
state.time=cfra;
psys_get_particle_state(&sim, ed_v2, &state, 1);
- vertco=CDDM_get_vert(explode,v)->co;
- mul_m4_v3(ob->obmat,vertco);
+ vertco=CDDM_get_vert(explode, v)->co;
+ mul_m4_v3(ob->obmat, vertco);
sub_v3_v3(vertco, birth.co);
@@ -903,7 +904,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
mul_qt_v3(rot, vertco);
if (emd->flag & eExplodeFlag_PaSize)
- mul_v3_fl(vertco,pa->size);
+ mul_v3_fl(vertco, pa->size);
add_v3_v3(vertco, state.co);
@@ -913,7 +914,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
BLI_edgehashIterator_free(ehi);
/*map new vertices to faces*/
- for (i=0,u=0; i<totface; i++) {
+ for (i=0, u=0; i<totface; i++) {
MFace source;
int orig_v4;
@@ -925,8 +926,8 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
if (pa->alive==PARS_DEAD && (emd->flag&eExplodeFlag_Dead)==0) continue;
}
- dm->getTessFace(dm,i,&source);
- mf=CDDM_get_tessface(explode,u);
+ dm->getTessFace(dm, i, &source);
+ mf=CDDM_get_tessface(explode, u);
orig_v4 = source.v4;
@@ -941,7 +942,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
if (source.v4)
source.v4 = edgecut_get(vertpahash, source.v4, mindex);
- DM_copy_tessface_data(dm,explode,i,u,1);
+ DM_copy_tessface_data(dm, explode, i, u, 1);
*mf = source;
@@ -995,7 +996,7 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
{
DerivedMesh *dm = derivedData;
ExplodeModifierData *emd= (ExplodeModifierData*) md;
- ParticleSystemModifierData *psmd=findPrecedingParticlesystem(ob,md);
+ ParticleSystemModifierData *psmd=findPrecedingParticlesystem(ob, md);
DM_ensure_tessface(dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
@@ -1018,13 +1019,13 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
if (emd->flag & eExplodeFlag_CalcFaces)
emd->flag &= ~eExplodeFlag_CalcFaces;
- createFacepa(emd,psmd,derivedData);
+ createFacepa(emd, psmd, derivedData);
}
/* 2. create new mesh */
if (emd->flag & eExplodeFlag_EdgeCut) {
int *facepa = emd->facepa;
- DerivedMesh *splitdm=cutEdges(emd,dm);
- DerivedMesh *explode=explodeMesh(emd, psmd, md->scene, ob, splitdm);
+ DerivedMesh *splitdm = cutEdges(emd, dm);
+ DerivedMesh *explode = explodeMesh(emd, psmd, md->scene, ob, splitdm);
MEM_freeN(emd->facepa);
emd->facepa=facepa;
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c
index fe0cb2e650f..80c48062635 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c
@@ -66,8 +66,7 @@
void fluidsim_init(FluidsimModifierData *fluidmd)
{
#ifdef WITH_MOD_FLUID
- if (fluidmd)
- {
+ if (fluidmd) {
FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings");
fluidmd->fss = fss;
@@ -166,7 +165,7 @@ void fluidsim_free(FluidsimModifierData *fluidmd)
/* read .bobj.gz file into a fluidsimDerivedMesh struct */
static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_example)
{
- int wri = 0,i;
+ int wri = 0, i;
int gotBytes;
gzFile gzf;
int numverts = 0, numfaces = 0;
@@ -184,8 +183,7 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
// get numverts + numfaces first
// ------------------------------------------------
gzf = BLI_gzopen(filename, "rb");
- if (!gzf)
- {
+ if (!gzf) {
return NULL;
}
@@ -216,15 +214,13 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
return NULL;
gzf = BLI_gzopen(filename, "rb");
- if (!gzf)
- {
+ if (!gzf) {
return NULL;
}
dm = CDDM_new(numverts, 0, 0, numfaces * 3, numfaces);
- if (!dm)
- {
+ if (!dm) {
gzclose(gzf);
return NULL;
}
@@ -240,8 +236,7 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
// should be the same as numverts
gotBytes = gzread(gzf, &wri, sizeof(wri));
- if (wri != numverts)
- {
+ if (wri != numverts) {
if (dm)
dm->release(dm);
gzclose(gzf);
@@ -249,8 +244,7 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
}
normals = MEM_callocN(sizeof(short) * numverts * 3, "fluid_tmp_normals" );
- if (!normals)
- {
+ if (!normals) {
if (dm)
dm->release(dm);
gzclose(gzf);
@@ -258,8 +252,7 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
}
// read normals from file (but don't save them yet)
- for (i=numverts, no_s= normals; i>0; i--, no_s += 3)
- {
+ for (i=numverts, no_s= normals; i>0; i--, no_s += 3) {
gotBytes = gzread(gzf, no, sizeof(float) * 3);
normal_float_to_short_v3(no_s, no);
}
@@ -279,8 +272,7 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam
// read triangles from file
mp = CDDM_get_polys(dm);
ml = CDDM_get_loops(dm);
- for (i=0; i < numfaces; i++, mp++, ml += 3)
- {
+ for (i=0; i < numfaces; i++, mp++, ml += 3) {
int face[3];
gotBytes = gzread(gzf, face, sizeof(int) * 3);
@@ -369,7 +361,7 @@ void fluid_estimate_memory(Object *ob, FluidsimSettings *fss, char *value)
mesh= ob->data;
fluid_get_bb(mesh->mvert, mesh->totvert, ob->obmat, fss->bbStart, fss->bbSize);
- elbeemEstimateMemreq(fss->resolutionxyz, fss->bbSize[0],fss->bbSize[1],fss->bbSize[2], fss->maxRefine, value);
+ elbeemEstimateMemreq(fss->resolutionxyz, fss->bbSize[0], fss->bbSize[1], fss->bbSize[2], fss->maxRefine, value);
}
}
@@ -390,8 +382,7 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *
if (fss->meshVelocities)
MEM_freeN(fss->meshVelocities);
- if (len<7)
- {
+ if (len < 7) {
return;
}
@@ -402,33 +393,29 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *
velarray = fss->meshVelocities;
- // .bobj.gz , correct filename
+ // .bobj.gz, correct filename
// 87654321
filename[len-6] = 'v';
filename[len-5] = 'e';
filename[len-4] = 'l';
gzf = BLI_gzopen(filename, "rb");
- if (!gzf)
- {
+ if (!gzf) {
MEM_freeN(fss->meshVelocities);
fss->meshVelocities = NULL;
return;
}
- gzread(gzf, &wri, sizeof( wri ));
- if (wri != totvert)
- {
+ gzread(gzf, &wri, sizeof(wri));
+ if (wri != totvert) {
MEM_freeN(fss->meshVelocities);
fss->meshVelocities = NULL;
return;
}
- for (i=0; i<totvert;i++)
- {
- for (j=0; j<3; j++)
- {
- gzread(gzf, &wrf, sizeof( wrf ));
+ for (i=0; i<totvert;i++) {
+ for (j=0; j<3; j++) {
+ gzread(gzf, &wrf, sizeof(wrf));
velarray[i].vel[j] = wrf;
}
}
@@ -483,8 +470,7 @@ static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, Fluidsim
dm = fluidsim_read_obj(targetFile, &mp_example);
- if (!dm)
- {
+ if (!dm) {
// switch, abort background rendering when fluidsim mesh is missing
const char *strEnvName2 = "BLENDER_ELBEEMBOBJABORT"; // from blendercall.cpp
@@ -492,7 +478,7 @@ static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, Fluidsim
if (getenv(strEnvName2)) {
int elevel = atoi(getenv(strEnvName2));
if (elevel>0) {
- printf("Env. var %s set, fluid sim mesh '%s' not found, aborting render...\n",strEnvName2, targetFile);
+ printf("Env. var %s set, fluid sim mesh '%s' not found, aborting render...\n", strEnvName2, targetFile);
exit(1);
}
}
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index d8fbb6f468f..b115e5bb244 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -128,7 +128,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
}
}
-static float hook_falloff(float *co_1, float *co_2, const float falloff_squared, float fac)
+static float hook_falloff(const float co_1[3], const float co_2[3], const float falloff_squared, float fac)
{
if (falloff_squared) {
float len_squared = len_squared_v3v3(co_1, co_2);
diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c
index da4a489838f..32376acc553 100644
--- a/source/blender/modifiers/intern/MOD_mask.c
+++ b/source/blender/modifiers/intern/MOD_mask.c
@@ -195,8 +195,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
vertHash= BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "mask vert gh");
/* add vertices which exist in vertexgroups into vertHash for filtering */
- for (i= 0, dv= dvert; i < maxVerts; i++, dv++)
- {
+ for (i= 0, dv= dvert; i < maxVerts; i++, dv++) {
MDeformWeight *dw= dv->dw;
int j;
@@ -229,8 +228,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
BLI_ghash_free(vgroupHash, NULL, NULL);
MEM_freeN(bone_select_array);
}
- else /* --- Using Nominated VertexGroup only --- */
- {
+ else { /* --- Using Nominated VertexGroup only --- */
int defgrp_index = defgroup_name_index(ob, mmd->vgroup);
/* get dverts */
@@ -245,8 +243,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
vertHash= BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "mask vert2 bh");
/* add vertices which exist in vertexgroup into ghash for filtering */
- for (i= 0, dv= dvert; i < maxVerts; i++, dv++)
- {
+ for (i= 0, dv= dvert; i < maxVerts; i++, dv++) {
const int weight_set= defvert_find_weight(dv, defgrp_index) != 0.0f;
/* check if include vert in vertHash */
@@ -277,21 +274,19 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* loop over edges and faces, and do the same thing to
* ensure that they only reference existing verts
*/
- for (i = 0; i < maxEdges; i++)
- {
+ for (i = 0; i < maxEdges; i++) {
MEdge me;
dm->getEdge(dm, i, &me);
/* only add if both verts will be in new mesh */
- if ( BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me.v1)) &&
- BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me.v2)) )
+ if (BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me.v1)) &&
+ BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me.v2)))
{
BLI_ghash_insert(edgeHash, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(numEdges));
numEdges++;
}
}
- for (i = 0; i < maxPolys; i++)
- {
+ for (i = 0; i < maxPolys; i++) {
MPoly *mp = &mpoly[i];
MLoop *ml = mloop + mp->loopstart;
int ok = TRUE;
@@ -325,10 +320,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
mvert_new = CDDM_get_verts(result);
/* using ghash-iterators, map data into new mesh */
- /* vertices */
- for ( hashIter = BLI_ghashIterator_new(vertHash);
- !BLI_ghashIterator_isDone(hashIter);
- BLI_ghashIterator_step(hashIter) )
+ /* vertices */
+ for (hashIter = BLI_ghashIterator_new(vertHash);
+ !BLI_ghashIterator_isDone(hashIter);
+ BLI_ghashIterator_step(hashIter) )
{
MVert source;
MVert *dest;
@@ -343,10 +338,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
BLI_ghashIterator_free(hashIter);
- /* edges */
- for ( hashIter = BLI_ghashIterator_new(edgeHash);
- !BLI_ghashIterator_isDone(hashIter);
- BLI_ghashIterator_step(hashIter) )
+ /* edges */
+ for (hashIter = BLI_ghashIterator_new(edgeHash);
+ !BLI_ghashIterator_isDone(hashIter);
+ BLI_ghashIterator_step(hashIter))
{
MEdge source;
MEdge *dest;
@@ -364,10 +359,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
BLI_ghashIterator_free(hashIter);
- /* faces */
- for ( hashIter = BLI_ghashIterator_new(polyHash);
- !BLI_ghashIterator_isDone(hashIter);
- BLI_ghashIterator_step(hashIter) )
+ /* faces */
+ for (hashIter = BLI_ghashIterator_new(polyHash);
+ !BLI_ghashIterator_isDone(hashIter);
+ BLI_ghashIterator_step(hashIter) )
{
int oldIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(hashIter));
int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(hashIter));
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index 628104295f7..3af1351cbdb 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -117,7 +117,7 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
ParticleData *pa= NULL, *pars= NULL;
MFace *mface, *orig_mface;
MVert *mvert, *orig_mvert;
- int i,totvert, totpart=0, totface, maxvert, maxface, first_particle=0;
+ int i, totvert, totpart=0, totface, maxvert, maxface, first_particle=0;
short track=ob->trackflag%3, trackneg, axis = pimd->axis;
float max_co=0.0, min_co=0.0, temp_co[3], cross[3];
float *size=NULL;
@@ -132,7 +132,7 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
}
if (pimd->ob) {
- psys = BLI_findlink(&pimd->ob->particlesystem,pimd->psys-1);
+ psys = BLI_findlink(&pimd->ob->particlesystem, pimd->psys-1);
if (psys==NULL || psys->totpart==0)
return derivedData;
}
@@ -192,7 +192,7 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
max_co=max_r[track];
}
- result = CDDM_from_template(dm, maxvert,dm->getNumEdges(dm)*totpart,maxface, 0, 0);
+ result = CDDM_from_template(dm, maxvert, dm->getNumEdges(dm)*totpart, maxface, 0, 0);
mvert=result->getVertArray(result);
orig_mvert=dm->getVertArray(dm);
@@ -231,7 +231,7 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
mv->co[axis] = 0.0;
}
- psys_get_particle_on_path(&sim, first_particle + i/totvert, &state,1);
+ psys_get_particle_on_path(&sim, first_particle + i/totvert, &state, 1);
normalize_v3(state.vel);
@@ -241,22 +241,22 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
state.rot[1] = state.rot[2] = state.rot[3] = 0.0f;
}
else {
- float temp[3] = {0.0f,0.0f,0.0f};
+ float temp[3] = {0.0f, 0.0f, 0.0f};
temp[axis] = 1.0f;
cross_v3_v3v3(cross, temp, state.vel);
/* state.vel[axis] is the only component surviving from a dot product with the axis */
- axis_angle_to_quat(state.rot,cross,saacos(state.vel[axis]));
+ axis_angle_to_quat(state.rot, cross, saacos(state.vel[axis]));
}
}
else {
state.time=-1.0;
- psys_get_particle_state(&sim, first_particle + i/totvert, &state,1);
+ psys_get_particle_state(&sim, first_particle + i/totvert, &state, 1);
}
- mul_qt_v3(state.rot,mv->co);
+ mul_qt_v3(state.rot, mv->co);
if (pimd->flag & eParticleInstanceFlag_UseSize)
mul_v3_fl(mv->co, size[i/totvert]);
add_v3_v3(mv->co, state.co);
diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c
index d408e5a3bee..56b6493eda6 100644
--- a/source/blender/modifiers/intern/MOD_remesh.c
+++ b/source/blender/modifiers/intern/MOD_remesh.c
@@ -103,8 +103,10 @@ static void *dualcon_alloc_output(int totvert, int totquad)
DualConOutput *output;
if (!(output = MEM_callocN(sizeof(DualConOutput),
- "DualConOutput")))
+ "DualConOutput")))
+ {
return NULL;
+ }
output->dm = CDDM_new(totvert, 0, 0, 4*totquad, totquad);
return output;
@@ -164,7 +166,7 @@ static DerivedMesh *applyModifier(ModifierData *md,
if (rmd->flag & MOD_REMESH_FLOOD_FILL)
flags |= DUALCON_FLOOD_FILL;
- switch(rmd->mode) {
+ switch (rmd->mode) {
case MOD_REMESH_CENTROID:
mode = DUALCON_CENTROID;
break;
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index ae21d3d66ad..60eed4abcb1 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -179,7 +179,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
if (!totvert)
return CDDM_from_template(dm, 0, 0, 0, 0, 0);
- switch(ltmd->axis) {
+ switch (ltmd->axis) {
case 0:
other_axis_1=1;
other_axis_2=2;
diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c
index 6c1325b0bde..5ac52a97315 100644
--- a/source/blender/modifiers/intern/MOD_simpledeform.c
+++ b/source/blender/modifiers/intern/MOD_simpledeform.c
@@ -185,8 +185,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object
float lower = FLT_MAX;
float upper = -FLT_MAX;
- for (i=0; i<numVerts; i++)
- {
+ for (i=0; i<numVerts; i++) {
float tmp[3];
copy_v3_v3(tmp, vertexCos[i]);
@@ -206,8 +205,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object
modifier_get_vgroup(ob, dm, smd->vgroup_name, &dvert, &vgroup);
- switch(smd->mode)
- {
+ switch (smd->mode) {
case MOD_SIMPLEDEFORM_MODE_TWIST: simpleDeform_callback = simpleDeform_twist; break;
case MOD_SIMPLEDEFORM_MODE_BEND: simpleDeform_callback = simpleDeform_bend; break;
case MOD_SIMPLEDEFORM_MODE_TAPER: simpleDeform_callback = simpleDeform_taper; break;
@@ -216,8 +214,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object
return; //No simpledeform mode?
}
- for (i=0; i<numVerts; i++)
- {
+ for (i=0; i<numVerts; i++) {
float weight = defvert_array_find_weight_safe(dvert, i, vgroup);
if (weight != 0.0f) {
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index e134ff9dcca..4e143bcb008 100644
--- a/source/blender/modifiers/intern/MOD_util.c
+++ b/source/blender/modifiers/intern/MOD_util.c
@@ -144,7 +144,7 @@ void get_texture_coords(MappingInfoModifierData *dmd, Object *ob,
}
for (i = 0; i < numVerts; ++i, ++co, ++texco) {
- switch(texmapping) {
+ switch (texmapping) {
case MOD_DISP_MAP_LOCAL:
copy_v3_v3(*texco, *co);
break;
@@ -209,7 +209,7 @@ DerivedMesh *get_dm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*
if (orco)
DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, get_mesh_orco_verts(ob));
}
- else if (ELEM3(ob->type,OB_FONT,OB_CURVE,OB_SURF)) {
+ else if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
dm= CDDM_from_curve(ob);
}
diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c
index 1b96c586cbf..80a3b70d8e3 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -224,12 +224,12 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
if (cam->type == CAM_PERSP) {
float perspmat[4][4];
- perspective_m4( perspmat,xmin, xmax, ymin, ymax, cam->clipsta, cam->clipend);
+ perspective_m4(perspmat, xmin, xmax, ymin, ymax, cam->clipsta, cam->clipend);
mult_m4_m4m4(tmpmat, perspmat, projectors[i].projmat);
}
else { /* if (cam->type == CAM_ORTHO) */
float orthomat[4][4];
- orthographic_m4( orthomat,xmin, xmax, ymin, ymax, cam->clipsta, cam->clipend);
+ orthographic_m4(orthomat, xmin, xmax, ymin, ymax, cam->clipsta, cam->clipend);
mult_m4_m4m4(tmpmat, orthomat, projectors[i].projmat);
}
}
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c
index dd89ad59abd..38a93091700 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -29,6 +29,9 @@
#include "MEM_guardedalloc.h"
+#include "DNA_object_types.h"
+#include "DNA_meshdata_types.h"
+
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_string.h"
@@ -39,9 +42,6 @@
#include "BKE_texture.h"
#include "BKE_colortools.h"
-#include "DNA_object_types.h"
-#include "DNA_meshdata_types.h"
-
#include "depsgraph_private.h"
#include "RE_shader_ext.h"
@@ -245,7 +245,7 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
/* closely match PROP_SMOOTH and similar */
- switch(wmd->falloff_type) {
+ switch (wmd->falloff_type) {
case eWarp_Falloff_None:
fac = 1.0f;
break;
diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c
index 78e76e27c02..5fa3090cd87 100644
--- a/source/blender/modifiers/intern/MOD_wave.c
+++ b/source/blender/modifiers/intern/MOD_wave.c
@@ -247,7 +247,7 @@ static void waveModifier_do(WaveModifierData *md,
}
}
- switch(wmd_axis) {
+ switch (wmd_axis) {
case MOD_WAVE_X|MOD_WAVE_Y:
amplit = sqrtf(x*x + y*y);
break;
@@ -270,7 +270,7 @@ static void waveModifier_do(WaveModifierData *md,
if (falloff != 0.0f) {
float dist = 0.0f;
- switch(wmd_axis) {
+ switch (wmd_axis) {
case MOD_WAVE_X|MOD_WAVE_Y:
dist = sqrtf(x*x + y*y);
break;
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index 5ce435a7ca5..1f886812ab7 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -69,7 +69,9 @@ void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cm
!ELEM7(falloff_type, MOD_WVG_MAPPING_CURVE, MOD_WVG_MAPPING_SHARP, MOD_WVG_MAPPING_SMOOTH,
MOD_WVG_MAPPING_ROOT, MOD_WVG_MAPPING_SPHERE, MOD_WVG_MAPPING_RANDOM,
MOD_WVG_MAPPING_STEP))
+ {
return;
+ }
/* Map each weight (vertex) to its new value, accordingly to the chosen mode. */
for (i = 0; i < num; ++i) {
@@ -77,7 +79,7 @@ void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cm
/* Code borrowed from the warp modifier. */
/* Closely matches PROP_SMOOTH and similar. */
- switch(falloff_type) {
+ switch (falloff_type) {
case MOD_WVG_MAPPING_CURVE:
fac = curvemapping_evaluateF(cmap, 0, fac);
break;
@@ -157,7 +159,7 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne
texres.nor = NULL;
get_texture_value(texture, tex_co[idx], &texres);
/* Get the good channel value... */
- switch(tex_use_channel) {
+ switch (tex_use_channel) {
case MOD_WVG_MASK_TEX_USE_INT:
org_w[i] = (new_w[i] * texres.tin * fact) + (org_w[i] * (1.0f - (texres.tin*fact)));
break;
diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c
index ab3a363e703..f26b5f44f99 100644
--- a/source/blender/nodes/composite/node_composite_util.c
+++ b/source/blender/nodes/composite/node_composite_util.c
@@ -643,37 +643,37 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf)
void do_rgba_to_yuva(bNode *UNUSED(node), float *out, float *in)
{
- rgb_to_yuv(in[0],in[1],in[2], &out[0], &out[1], &out[2]);
+ rgb_to_yuv(in[0], in[1], in[2], &out[0], &out[1], &out[2]);
out[3]=in[3];
}
void do_rgba_to_hsva(bNode *UNUSED(node), float *out, float *in)
{
- rgb_to_hsv(in[0],in[1],in[2], &out[0], &out[1], &out[2]);
+ rgb_to_hsv(in[0], in[1], in[2], &out[0], &out[1], &out[2]);
out[3]=in[3];
}
void do_rgba_to_ycca(bNode *UNUSED(node), float *out, float *in)
{
- rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
+ rgb_to_ycc(in[0], in[1], in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
out[3]=in[3];
}
void do_yuva_to_rgba(bNode *UNUSED(node), float *out, float *in)
{
- yuv_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]);
+ yuv_to_rgb(in[0], in[1], in[2], &out[0], &out[1], &out[2]);
out[3]=in[3];
}
void do_hsva_to_rgba(bNode *UNUSED(node), float *out, float *in)
{
- hsv_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]);
+ hsv_to_rgb(in[0], in[1], in[2], &out[0], &out[1], &out[2]);
out[3]=in[3];
}
void do_ycca_to_rgba(bNode *UNUSED(node), float *out, float *in)
{
- ycc_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
+ ycc_to_rgb(in[0], in[1], in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
out[3]=in[3];
}
@@ -884,8 +884,9 @@ static void FHT2D(fREAL *data, unsigned int Mx, unsigned int My,
#define PRED(k) (((k & Nym) << Mx) + (k >> My))
for (j=PRED(i); j>i; j=PRED(j));
if (j < i) continue;
- for (k=i, j=PRED(i); j!=i; k=j, j=PRED(j), stm--)
- { t=data[j], data[j]=data[k], data[k]=t; }
+ for (k=i, j=PRED(i); j!=i; k=j, j=PRED(j), stm--) {
+ t=data[j], data[j]=data[k], data[k]=t;
+ }
#undef PRED
stm--;
}
@@ -1108,7 +1109,7 @@ void qd_getPixel(CompBuf* src, int x, int y, float* col)
float bc[4];
src->rect_procedural(src, bc, (float)x/(float)src->xrad, (float)y/(float)src->yrad);
- switch(src->type) {
+ switch (src->type) {
/* these fallthrough to get all the channels */
case CB_RGBA: col[3]=bc[3];
case CB_VEC3: col[2]=bc[2];
@@ -1118,7 +1119,7 @@ void qd_getPixel(CompBuf* src, int x, int y, float* col)
}
else if ((x >= 0) && (x < src->x) && (y >= 0) && (y < src->y)) {
float* bc = &src->rect[(x + y*src->x)*src->type];
- switch(src->type) {
+ switch (src->type) {
/* these fallthrough to get all the channels */
case CB_RGBA: col[3]=bc[3];
case CB_VEC3: col[2]=bc[2];
@@ -1127,7 +1128,7 @@ void qd_getPixel(CompBuf* src, int x, int y, float* col)
}
}
else {
- switch(src->type) {
+ switch (src->type) {
/* these fallthrough to get all the channels */
case CB_RGBA: col[3]=0.0;
case CB_VEC3: col[2]=0.0;
@@ -1142,7 +1143,7 @@ void qd_setPixel(CompBuf* src, int x, int y, float* col)
{
if ((x >= 0) && (x < src->x) && (y >= 0) && (y < src->y)) {
float* bc = &src->rect[(x + y*src->x)*src->type];
- switch(src->type) {
+ switch (src->type) {
/* these fallthrough to get all the channels */
case CB_RGBA: bc[3]=col[3];
case CB_VEC3: bc[2]=col[2];
@@ -1199,7 +1200,7 @@ void qd_getPixelLerp(CompBuf* src, float u, float v, float* col)
const int x1 = (int)ufl, y1 = (int)vfl;
const int x2 = (int)ceil(u), y2 = (int)ceil(v);
if ((x2 >= 0) && (y2 >= 0) && (x1 < src->x) && (y1 < src->y)) {
- const float B[4] = {0,0,0,0};
+ const float B[4] = {0, 0, 0, 0};
const int ox1 = (x1 < 0), oy1 = (y1 < 0), ox2 = (x2 >= src->x), oy2 = (y2 >= src->y);
const float* c00 = (ox1 || oy1) ? B : &src->rect[(x1 + y1*src->x)*src->type];
const float* c10 = (ox2 || oy1) ? B : &src->rect[(x2 + y1*src->x)*src->type];
@@ -1225,7 +1226,7 @@ void qd_getPixelLerpChan(CompBuf* src, float u, float v, int chan, float* out)
const int x2 = (int)ceil(u), y2 = (int)ceil(v);
if (chan >= src->type) chan = 0;
if ((x2 >= 0) && (y2 >= 0) && (x1 < src->x) && (y1 < src->y)) {
- const float B[4] = {0,0,0,0};
+ const float B[4] = {0, 0, 0, 0};
const int ox1 = (x1 < 0), oy1 = (y1 < 0), ox2 = (x2 >= src->x), oy2 = (y2 >= src->y);
const float* c00 = (ox1 || oy1) ? B : &src->rect[(x1 + y1*src->x)*src->type + chan];
const float* c10 = (ox2 || oy1) ? B : &src->rect[(x2 + y1*src->x)*src->type + chan];
diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
index f42fd83c13d..5b26927b694 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
@@ -96,7 +96,7 @@ The main change is an optional image input */
static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
NodeBilateralBlurData *nbbd= node->storage;
- CompBuf *new, *source, *img= in[0]->data , *refimg= in[1]->data;
+ CompBuf *new, *source, *img= in[0]->data, *refimg= in[1]->data;
double mean0, w, i2sigma_color, i2sigma_space;
double mean1[4];
double weight_tab[8];
diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
index 132b1659fa5..9e3aa9ee13f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
@@ -35,20 +35,20 @@
/* ******************* Channel Matte Node ********************************* */
static bNodeSocketTemplate cmp_node_channel_matte_in[]={
- {SOCK_RGBA,1,"Image", 1.0f, 1.0f, 1.0f, 1.0f},
- {-1,0,""}
+ {SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f},
+ {-1, 0, ""}
};
static bNodeSocketTemplate cmp_node_channel_matte_out[]={
- {SOCK_RGBA,0,"Image"},
- {SOCK_FLOAT,0,"Matte"},
- {-1,0,""}
+ {SOCK_RGBA, 0, "Image"},
+ {SOCK_FLOAT, 0, "Matte"},
+ {-1, 0, ""}
};
static void do_normalized_rgba_to_ycca2(bNode *UNUSED(node), float *out, float *in)
{
/*normalize to the range 0.0 to 1.0) */
- rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
+ rgb_to_ycc(in[0], in[1], in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
out[0]=(out[0])/255.0f;
out[1]=(out[1])/255.0f;
out[2]=(out[2])/255.0f;
@@ -61,7 +61,7 @@ static void do_normalized_ycca_to_rgba2(bNode *UNUSED(node), float *out, float *
in[0]=in[0]*255.0f;
in[1]=in[1]*255.0f;
in[2]=in[2]*255.0f;
- ycc_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
+ ycc_to_rgb(in[0], in[1], in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
out[3]=in[3];
}
@@ -71,7 +71,7 @@ static void do_channel_matte(bNode *node, float *out, float *in)
NodeChroma *c=(NodeChroma *)node->storage;
float alpha=0.0;
- switch(c->algorithm) {
+ switch (c->algorithm) {
case 0: { /* Alpha=key_channel-limit channel */
int key_channel=node->custom2-1;
int limit_channel=c->channel-1;
@@ -79,17 +79,17 @@ static void do_channel_matte(bNode *node, float *out, float *in)
break;
}
case 1: { /* Alpha=G-MAX(R, B) */
- switch(node->custom2) {
+ switch (node->custom2) {
case 1: {
- alpha=in[0]-MAX2(in[1],in[2]);
+ alpha=in[0]-MAX2(in[1], in[2]);
break;
}
case 2: {
- alpha=in[1]-MAX2(in[0],in[2]);
+ alpha=in[1]-MAX2(in[0], in[2]);
break;
}
case 3: {
- alpha=in[2]-MAX2(in[0],in[1]);
+ alpha=in[2]-MAX2(in[0], in[1]);
break;
}
default:
@@ -139,7 +139,7 @@ static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack
outbuf=dupalloc_compbuf(cbuf);
/*convert to colorspace*/
- switch(node->custom1) {
+ switch (node->custom1) {
case CMP_NODE_CHANNEL_MATTE_CS_RGB:
break;
case CMP_NODE_CHANNEL_MATTE_CS_HSV: /*HSV*/
@@ -159,7 +159,7 @@ static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack
composit1_pixel_processor(node, outbuf, outbuf, in[1]->vec, do_channel_matte, CB_RGBA);
/*convert back to RGB colorspace in place*/
- switch(node->custom1) {
+ switch (node->custom1) {
case CMP_NODE_CHANNEL_MATTE_CS_RGB: /*RGB*/
break;
case CMP_NODE_CHANNEL_MATTE_CS_HSV: /*HSV*/
diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
index 2df8e1b6139..f366642149a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
@@ -1,53 +1,53 @@
/*
- * ***** 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): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
+* ***** 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): none yet.
+*
+* ***** END GPL LICENSE BLOCK *****
+*/
/** \file blender/nodes/composite/nodes/node_composite_chromaMatte.c
- * \ingroup cmpnodes
- */
+* \ingroup cmpnodes
+*/
#include "node_composite_util.h"
/* ******************* Chroma Key ********************************************************** */
static bNodeSocketTemplate cmp_node_chroma_in[]={
- {SOCK_RGBA,1,"Image", 1.0f, 1.0f, 1.0f, 1.0f},
- {SOCK_RGBA,1,"Key Color", 1.0f, 1.0f, 1.0f, 1.0f},
- {-1,0,""}
+ {SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f},
+ {SOCK_RGBA, 1, "Key Color", 1.0f, 1.0f, 1.0f, 1.0f},
+ {-1, 0, ""}
};
static bNodeSocketTemplate cmp_node_chroma_out[]={
- {SOCK_RGBA,0,"Image"},
- {SOCK_FLOAT,0,"Matte"},
- {-1,0,""}
+ {SOCK_RGBA, 0, "Image"},
+ {SOCK_FLOAT, 0, "Matte"},
+ {-1, 0, ""}
};
static void do_rgba_to_ycca_normalized(bNode *UNUSED(node), float *out, float *in)
{
- rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
+ rgb_to_ycc(in[0], in[1], in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
//normalize to 0..1.0
out[0]=out[0]/255.0f;
@@ -59,9 +59,9 @@ static void do_rgba_to_ycca_normalized(bNode *UNUSED(node), float *out, float *i
out[1]=(out[1]*2.0f)-1.0f;
out[2]=(out[2]*2.0f)-1.0f;
-// out[0]=((out[0])-16)/255.0;
-// out[1]=((out[1])-128)/255.0;
-// out[2]=((out[2])-128)/255.0;
+ // out[0]=((out[0])-16)/255.0;
+ // out[1]=((out[1])-128)/255.0;
+ // out[2]=((out[2])-128)/255.0;
out[3]=in[3];
}
@@ -77,9 +77,9 @@ static void do_ycca_to_rgba_normalized(bNode *UNUSED(node), float *out, float *i
in[2]=(in[2]*255.0f);
// in[0]=(in[0]*255.0)+16;
-// in[1]=(in[1]*255.0)+128;
-// in[2]=(in[2]*255.0)+128;
- ycc_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
+ // in[1]=(in[1]*255.0)+128;
+ // in[2]=(in[2]*255.0)+128;
+ ycc_to_rgb(in[0], in[1], in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
out[3]=in[3];
}
@@ -94,7 +94,7 @@ static void do_chroma_key(bNode *node, float *out, float *in)
/* Algorithm from book "Video Demistified," does not include the spill reduction part */
- /* find theta, the angle that the color space should be rotated based on key*/
+ /* find theta, the angle that the color space should be rotated based on key chroma values*/
theta=atan2(c->key[2], c->key[1]);
/*rotate the cb and cr into x/z space */
@@ -107,20 +107,19 @@ static void do_chroma_key(bNode *node, float *out, float *in)
/* if kfg is <0 then the pixel is outside of the key color */
kfg= x-(fabsf(z)/tanf(angle/2.0f));
- out[0]=in[0];
- out[1]=in[1];
- out[2]=in[2];
+ copy_v3_v3(out, in);
if (kfg>0.0f) { /* found a pixel that is within key color */
- alpha=(1.0f-kfg)*(c->fstrength);
-
- beta=atan2(z,x);
+ beta=atan2(z, x);
angle2=c->t2; /* t2 is radians. */
/* if beta is within the cutoff angle */
if (fabsf(beta) < (angle2/2.0f)) {
alpha=0.0;
}
+ else {
+ alpha=1.0f-(kfg/c->fstrength);
+ }
/* don't make something that was more transparent less transparent */
if (alpha<in[3]) {
@@ -130,11 +129,8 @@ static void do_chroma_key(bNode *node, float *out, float *in)
out[3]=in[3];
}
}
- else { /*pixel is outside key color */
- out[0]=in[0];
- out[1]=in[1];
- out[2]=in[2];
- out[3]=in[3]; /* make pixel just as transparent as it was before */
+ else { /* make pixel just as transparent as it was before */
+ out[3]=in[3];
}
}
@@ -143,32 +139,32 @@ static void node_composit_exec_chroma_matte(void *data, bNode *node, bNodeStack
CompBuf *cbuf;
CompBuf *chromabuf;
NodeChroma *c;
-
+
if (in[0]->hasinput==0) return;
if (in[0]->data==NULL) return;
if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
-
+
cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
-
+
chromabuf= dupalloc_compbuf(cbuf);
-
+
c=node->storage;
-
+
/*convert rgbbuf to normalized chroma space*/
composit1_pixel_processor(node, chromabuf, cbuf, in[0]->vec, do_rgba_to_ycca_normalized, CB_RGBA);
/*convert key to normalized chroma color space */
do_rgba_to_ycca_normalized(node, c->key, in[1]->vec);
-
+
/*per pixel chroma key*/
composit1_pixel_processor(node, chromabuf, chromabuf, in[0]->vec, do_chroma_key, CB_RGBA);
-
+
/*convert back*/
composit1_pixel_processor(node, chromabuf, chromabuf, in[0]->vec, do_ycca_to_rgba_normalized, CB_RGBA);
-
+
out[0]->data= chromabuf;
if (out[1]->hasoutput)
out[1]->data= valbuf_from_rgbabuf(chromabuf, CHAN_A);
-
+
generate_preview(data, node, chromabuf);
if (cbuf!=in[0]->data)
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
index 12b6e802555..aa74e5c71a0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
@@ -34,15 +34,15 @@
/* ******************* Color Key ********************************************************** */
static bNodeSocketTemplate cmp_node_color_in[]={
- {SOCK_RGBA,1,"Image", 1.0f, 1.0f, 1.0f, 1.0f},
- {SOCK_RGBA,1,"Key Color", 1.0f, 1.0f, 1.0f, 1.0f},
- {-1,0,""}
+ {SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f},
+ {SOCK_RGBA, 1, "Key Color", 1.0f, 1.0f, 1.0f, 1.0f},
+ {-1, 0, ""}
};
static bNodeSocketTemplate cmp_node_color_out[]={
- {SOCK_RGBA,0,"Image"},
- {SOCK_FLOAT,0,"Matte"},
- {-1,0,""}
+ {SOCK_RGBA, 0, "Image"},
+ {SOCK_FLOAT, 0, "Matte"},
+ {-1, 0, ""}
};
static void do_color_key(bNode *node, float *out, float *in)
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
index 46d7c620aa8..15c10d0242e 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
@@ -37,14 +37,14 @@
/* ******************* Color Spill Supression ********************************* */
static bNodeSocketTemplate cmp_node_color_spill_in[]={
- {SOCK_RGBA,1,"Image", 1.0f, 1.0f, 1.0f, 1.0f},
+ {SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f},
{SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
- {-1,0,""}
+ {-1, 0, ""}
};
static bNodeSocketTemplate cmp_node_color_spill_out[]={
- {SOCK_RGBA,0,"Image"},
- {-1,0,""}
+ {SOCK_RGBA, 0, "Image"},
+ {-1, 0, ""}
};
static void do_simple_spillmap_red(bNode *node, float* out, float *in)
@@ -206,12 +206,10 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
spillmap=alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1);
rgbbuf=dupalloc_compbuf(cbuf);
- switch(node->custom1)
- {
+ switch (node->custom1) {
case 1: /*red spill*/
{
- switch(node->custom2)
- {
+ switch (node->custom2) {
case 0: /* simple limit */
{
if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
@@ -243,8 +241,7 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
}
case 2: /*green spill*/
{
- switch(node->custom2)
- {
+ switch (node->custom2) {
case 0: /* simple limit */
{
if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
@@ -276,8 +273,7 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
}
case 3: /*blue spill*/
{
- switch(node->custom2)
- {
+ switch (node->custom2) {
case 0: /* simple limit */
{
if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
index f77e4cd9c4e..8dead1babdd 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
@@ -37,13 +37,13 @@
/* ******************* Color Balance ********************************* */
static bNodeSocketTemplate cmp_node_colorbalance_in[]={
{SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
- {SOCK_RGBA,1,"Image", 1.0f, 1.0f, 1.0f, 1.0f},
- {-1,0,""}
+ {SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f},
+ {-1, 0, ""}
};
static bNodeSocketTemplate cmp_node_colorbalance_out[]={
- {SOCK_RGBA,0,"Image"},
- {-1,0,""}
+ {SOCK_RGBA, 0, "Image"},
+ {-1, 0, ""}
};
/* this function implements ASC-CDL according to the spec at http://www.asctech.org/
diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
index 027786d8b22..5dea0e1c067 100644
--- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
@@ -1,33 +1,33 @@
/*
- * ***** 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): Bob Holcomb
- *
- * ***** END GPL LICENSE BLOCK *****
- */
+* ***** 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): Bob Holcomb
+*
+* ***** END GPL LICENSE BLOCK *****
+*/
/** \file blender/nodes/composite/nodes/node_composite_diffMatte.c
- * \ingroup cmpnodes
- */
+* \ingroup cmpnodes
+*/
#include "node_composite_util.h"
@@ -49,39 +49,42 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float *
{
NodeChroma *c= (NodeChroma *)node->storage;
float tolerence=c->t1;
- float falloff=c->t2;
+ float fper=c->t2;
+ /* get falloff amount over tolerence size */
+ float falloff=(1.0f-fper) * tolerence;
float difference;
float alpha;
+ float maxInputAlpha;
+ /* average together the distances */
difference= fabs(inColor2[0]-inColor1[0]) +
- fabs(inColor2[1]-inColor1[1]) +
- fabs(inColor2[2]-inColor1[2]);
-
- /*average together the distances*/
+ fabs(inColor2[1]-inColor1[1]) +
+ fabs(inColor2[2]-inColor1[2]);
difference=difference/3.0f;
copy_v3_v3(outColor, inColor1);
- /*make 100% transparent*/
- if (difference < tolerence) {
- outColor[3]=0.0;
- }
- /*in the falloff region, make partially transparent */
- else if (difference < falloff+tolerence) {
- difference=difference-tolerence;
- alpha=difference/falloff;
- /*only change if more transparent than before */
- if (alpha < inColor1[3]) {
+ if (difference <= tolerence) {
+ if(difference<=falloff) {
+ alpha=0.0f;
+ }
+ else{
+ /* alpha as percent (distance / tolerance), each modified by falloff amount (in pixels)*/
+ alpha=(difference-falloff)/(tolerence-falloff);
+ }
+
+ /*only change if more transparent than either image */
+ maxInputAlpha=maxf(inColor1[3], inColor2[3]);
+ if (alpha < maxInputAlpha) {
+ /*clamp*/
+ if(alpha<0.0f) alpha=0.0f;
+ if(alpha>1.0f) alpha=1.0f;
outColor[3]=alpha;
}
else { /* leave as before */
- outColor[3]=inColor1[3];
+ outColor[3]=maxInputAlpha;
}
}
- else {
- /*foreground object*/
- outColor[3]= inColor1[3];
- }
}
static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
index f65b3312bea..49690499569 100644
--- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
@@ -72,7 +72,7 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap,
const float cs= cosf(rot), ss= sinf(rot);
const float isc= 1.f / (1.f + sc);
unsigned int x, y;
- float col[4]= {0,0,0,0};
+ float col[4]= {0, 0, 0, 0};
for (y= 0; y < img->y; ++y) {
const float v= isc * (y - center_y_pix) + ty;
diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
index 7aaaa7ed9b4..74e058292d3 100644
--- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
@@ -1,33 +1,33 @@
/*
- * ***** 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): Bob Holcomb
- *
- * ***** END GPL LICENSE BLOCK *****
- */
+* ***** 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): Bob Holcomb
+*
+* ***** END GPL LICENSE BLOCK *****
+*/
/** \file blender/nodes/composite/nodes/node_composite_distanceMatte.c
- * \ingroup cmpnodes
- */
+* \ingroup cmpnodes
+*/
#include "node_composite_util.h"
@@ -51,34 +51,88 @@ static void do_distance_matte(bNode *node, float *out, float *in)
{
NodeChroma *c= (NodeChroma *)node->storage;
float tolerence=c->t1;
- float falloff=c->t2;
+ float fper=c->t2;
+ /* get falloff amount over tolerence size */
+ float falloff=(1.0f-fper) * tolerence;
float distance;
float alpha;
distance=sqrt((c->key[0]-in[0])*(c->key[0]-in[0]) +
- (c->key[1]-in[1])*(c->key[1]-in[1]) +
- (c->key[2]-in[2])*(c->key[2]-in[2]));
+ (c->key[1]-in[1])*(c->key[1]-in[1]) +
+ (c->key[2]-in[2])*(c->key[2]-in[2]));
copy_v3_v3(out, in);
- /*make 100% transparent */
- if (distance < tolerence) {
- out[3]=0.0;
- }
- /*in the falloff region, make partially transparent */
- else if (distance < falloff+tolerence) {
- distance=distance-tolerence;
- alpha=distance/falloff;
+ if (distance <= tolerence) {
+ if(distance<=falloff) {
+ alpha=0.0f;
+ }
+ else{
+ /* alpha as percent (distance / tolerance), each modified by falloff amount (in pixels)*/
+ alpha=(distance-falloff)/(tolerence-falloff);
+ }
+
/*only change if more transparent than before */
if (alpha < in[3]) {
+ /*clamp*/
+ if(alpha<0.0f) alpha=0.0f;
+ if(alpha>1.0f) alpha=1.0f;
out[3]=alpha;
}
else { /* leave as before */
out[3]=in[3];
}
}
- else {
- out[3]=in[3];
+}
+
+static void do_chroma_distance_matte(bNode *node, float *out, float *in)
+{
+ NodeChroma *c= (NodeChroma *)node->storage;
+ float tolerence=c->t1;
+ float fper=c->t2;
+ /* get falloff amount over tolerence size */
+ float falloff=(1.0f-fper) * tolerence;
+ float y_key, cb_key, cr_key;
+ float y_pix, cb_pix, cr_pix;
+ float distance;
+ float alpha;
+
+ /*convert key to chroma colorspace */
+ rgb_to_ycc(c->key[0], c->key[1], c->key[2], &y_key, &cb_key, &cr_key, BLI_YCC_JFIF_0_255);
+ /* normalize the values */
+ cb_key=cb_key/255.0f;
+ cr_key=cr_key/255.0f;
+
+ /*convert pixel to chroma colorspace */
+ rgb_to_ycc(in[0], in[1], in[2], &y_pix, &cb_pix, &cr_pix, BLI_YCC_JFIF_0_255);
+ /*normalize the values */
+ cb_pix=cb_pix/255.0f;
+ cr_pix=cr_pix/255.0f;
+
+ distance=sqrt((cb_key-cb_pix)*(cb_key-cb_pix) +
+ (cr_key-cr_pix)*(cr_key-cr_pix));
+
+ copy_v3_v3(out, in);
+
+ if (distance <= tolerence) {
+ if(distance<=falloff) {
+ alpha=0.0f;
+ }
+ else{
+ /* alpha as percent (distance / tolerance), each modified by falloff amount (in pixels)*/
+ alpha=(distance-falloff)/(tolerence-falloff);
+ }
+
+ /*only change if more transparent than before */
+ if (alpha < in[3]) {
+ /*clamp*/
+ if(alpha<0.0f) alpha=0.0f;
+ if(alpha>1.0f) alpha=1.0f;
+ out[3]=alpha;
+ }
+ else { /* leave as before */
+ out[3]=in[3];
+ }
}
}
@@ -91,26 +145,34 @@ static void node_composit_exec_distance_matte(void *data, bNode *node, bNodeStac
CompBuf *workbuf;
CompBuf *inbuf;
NodeChroma *c;
-
+
/*is anything connected?*/
if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
/*must have an image imput*/
if (in[0]->data==NULL) return;
-
+
inbuf=typecheck_compbuf(in[0]->data, CB_RGBA);
-
+
c=node->storage;
workbuf=dupalloc_compbuf(inbuf);
-
+
/*use the input color*/
c->key[0]= in[1]->vec[0];
c->key[1]= in[1]->vec[1];
c->key[2]= in[1]->vec[2];
-
- /* note, processor gets a keyvals array passed on as buffer constant */
- composit1_pixel_processor(node, workbuf, workbuf, in[0]->vec, do_distance_matte, CB_RGBA);
-
-
+
+ /* work in RGB color space */
+ if(c->channel==1) {
+ /* note, processor gets a keyvals array passed on as buffer constant */
+ composit1_pixel_processor(node, workbuf, workbuf, in[0]->vec, do_distance_matte, CB_RGBA);
+ }
+ /* work in YCbCr color space */
+ else {
+ composit1_pixel_processor(node, workbuf, workbuf, in[0]->vec, do_chroma_distance_matte, CB_RGBA);
+ }
+
+
+
out[0]->data=workbuf;
if (out[1]->hasoutput)
out[1]->data=valbuf_from_rgbabuf(workbuf, CHAN_A);
@@ -124,6 +186,7 @@ static void node_composit_init_distance_matte(bNodeTree *UNUSED(ntree), bNode* n
{
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
node->storage= c;
+ c->channel=1;
c->t1= 0.1f;
c->t2= 0.1f;
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
index 966d8f8a21a..6eb70636efa 100644
--- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
@@ -786,7 +786,7 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l
int pix_prevCol; // pix_prevCol = pixel one column behind the one we are testing in a loop
int pix_nextCol; // pix_nextCol = pixel one column in front of the one we are testing in a loop
/* Test all rows between the FIRST and LAST rows, excluding left and right edges */
- for (x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) {
+ for (x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw, dx-=rw) {
a=x-2;
pix_prevRow=a+rw;
pix_nextRow=a-rw;
@@ -848,7 +848,7 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i
int pix_prevCol; // pix_prevCol = pixel one column behind the one we are testing in a loop
int pix_nextCol; // pix_nextCol = pixel one column in front of the one we are testing in a loop
/* Test all rows between the FIRST and LAST rows, excluding left and right edges */
- for (x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) {
+ for (x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw, dx-=rw) {
a=x-2;
pix_prevRow=a+rw;
pix_nextRow=a-rw;
@@ -917,13 +917,13 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne
unsigned int outerAccum=0; // for looping outer edge pixel indexes, represents current position from offset
unsigned int gradientAccum=0; // for looping gradient pixel indexes, represents current position from offset
/*
- * Here we compute the size of buffer needed to hold (row,col) coordinates
+ * Here we compute the size of buffer needed to hold (row, col) coordinates
* for each pixel previously determined to be either gradient, inner edge,
* or outer edge.
*
* Allocation is done by requesting 4 bytes "sizeof(int)" per pixel, even
* though gbuf[] is declared as unsigned short* (2 bytes) because we don't
- * store the pixel indexes, we only store x,y location of pixel in buffer.
+ * store the pixel indexes, we only store x, y location of pixel in buffer.
*
* This does make the assumption that x and y can fit in 16 unsigned bits
* so if Blender starts doing renders greater than 65536 in either direction
@@ -961,7 +961,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne
* gradientFillOffset (0 pixels) innerEdgeOffset (18 pixels) outerEdgeOffset (22 pixels)
* / / /
* / / /
- * |X Y X Y X Y X Y > <X Y X Y > <X Y X Y X Y > <X Y X Y | <- (x,y)
+ * |X Y X Y X Y X Y > <X Y X Y > <X Y X Y X Y > <X Y X Y | <- (x, y)
* +--------------------------------> <----------------> <------------------------> <----------------+
* |0 2 4 6 8 10 12 14 > ... <68 70 72 74 > ... <80 82 84 86 88 90 > ... <152 154 156 158 | <- bytes
* +--------------------------------> <----------------> <------------------------> <----------------+
@@ -975,7 +975,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne
* Ultimately we do need the pixel's memory buffer index to set the output
* pixel color, but it's faster to reconstruct the memory buffer location
* each iteration of the final gradient calculation than it is to deconstruct
- * a memory location into x,y pairs each round.
+ * a memory location into x, y pairs each round.
*/
@@ -987,7 +987,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne
innerAccum = *innerEdgeOffset; // section's offset so when we start filling, each
outerAccum = *outerEdgeOffset; // section fills up it's allocated space in gbuf
//uses dmin=row, rsl=col
- for (x=0,dmin=0; x<t; x+=rw,dmin++) {
+ for (x=0, dmin=0; x<t; x+=rw, dmin++) {
for (rsl=0; rsl<rw; rsl++) {
a=x+rsl;
if (lres[a]==2) { // it is a gradient pixel flagged by 2
@@ -1222,29 +1222,29 @@ static void node_composit_exec_doubleedgemask(void *UNUSED(data), bNode *node, b
*/
if (node->custom2) { // if "adjacent only" inner edge mode is turned on
if (node->custom1) { // if "keep inside" buffer edge mode is turned on
- do_adjacentKeepBorders(t,rw,limask,lomask,lres,res,rsize);
+ do_adjacentKeepBorders(t, rw, limask, lomask, lres, res, rsize);
}
else { // "bleed out" buffer edge mode is turned on
- do_adjacentBleedBorders(t,rw,limask,lomask,lres,res,rsize);
+ do_adjacentBleedBorders(t, rw, limask, lomask, lres, res, rsize);
}
isz=rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass
osz=rsize[1];
gsz=rsize[2];
// detect edges in all non-border pixels in the buffer
- do_adjacentEdgeDetection(t,rw,limask,lomask,lres,res,rsize,isz,osz,gsz);
+ do_adjacentEdgeDetection(t, rw, limask, lomask, lres, res, rsize, isz, osz, gsz);
}
else { // "all" inner edge mode is turned on
if (node->custom1) { // if "keep inside" buffer edge mode is turned on
- do_allKeepBorders(t,rw,limask,lomask,lres,res,rsize);
+ do_allKeepBorders(t, rw, limask, lomask, lres, res, rsize);
}
else { // "bleed out" buffer edge mode is turned on
- do_allBleedBorders(t,rw,limask,lomask,lres,res,rsize);
+ do_allBleedBorders(t, rw, limask, lomask, lres, res, rsize);
}
isz=rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass
osz=rsize[1];
gsz=rsize[2];
// detect edges in all non-border pixels in the buffer
- do_allEdgeDetection(t,rw,limask,lomask,lres,res,rsize,isz,osz,gsz);
+ do_allEdgeDetection(t, rw, limask, lomask, lres, res, rsize, isz, osz, gsz);
}
isz=rsize[0]; // set edge and gradient buffer sizes once again...
@@ -1263,8 +1263,8 @@ static void node_composit_exec_doubleedgemask(void *UNUSED(data), bNode *node, b
fsz=gsz+isz+osz; // calculate size of pixel index buffer needed
gbuf= MEM_mallocN(fsz*sizeof(int), "grd buf"); // allocate edge/gradient pixel index buffer
- do_createEdgeLocationBuffer(t,rw,lres,res,gbuf,&innerEdgeOffset,&outerEdgeOffset,isz,gsz);
- do_fillGradientBuffer(rw,res,gbuf,isz,osz,gsz,innerEdgeOffset,outerEdgeOffset);
+ do_createEdgeLocationBuffer(t, rw, lres, res, gbuf, &innerEdgeOffset, &outerEdgeOffset, isz, gsz);
+ do_fillGradientBuffer(rw, res, gbuf, isz, osz, gsz, innerEdgeOffset, outerEdgeOffset);
MEM_freeN(gbuf); // free the gradient index buffer
out[0]->data= stackbuf; // point the node output buffer to our filled buffer
diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c
index 6d470467cb0..5adabecba08 100644
--- a/source/blender/nodes/composite/nodes/node_composite_filter.c
+++ b/source/blender/nodes/composite/nodes/node_composite_filter.c
@@ -168,12 +168,12 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
static void node_composit_exec_filter(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
static float soft[9]= {1/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 4/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 1/16.0f};
- float sharp[9]= {-1,-1,-1,-1,9,-1,-1,-1,-1};
+ float sharp[9]= {-1, -1, -1, -1, 9, -1, -1, -1, -1};
float laplace[9]= {-1/8.0f, -1/8.0f, -1/8.0f, -1/8.0f, 1.0f, -1/8.0f, -1/8.0f, -1/8.0f, -1/8.0f};
- float sobel[9]= {1,2,1,0,0,0,-1,-2,-1};
- float prewitt[9]= {1,1,1,0,0,0,-1,-1,-1};
- float kirsch[9]= {5,5,5,-3,-3,-3,-2,-2,-2};
- float shadow[9]= {1,2,1,0,1,0,-1,-2,-1};
+ float sobel[9]= {1, 2, 1, 0, 0, 0, -1, -2, -1};
+ float prewitt[9]= {1, 1, 1, 0, 0, 0, -1, -1, -1};
+ float kirsch[9]= {5, 5, 5, -3, -3, -3, -2, -2, -2};
+ float shadow[9]= {1, 2, 1, 0, 1, 0, -1, -2, -1};
if (out[0]->hasoutput==0) return;
@@ -189,7 +189,7 @@ static void node_composit_exec_filter(void *data, bNode *node, bNodeStack **in,
stackbuf->xof= cbuf->xof;
stackbuf->yof= cbuf->yof;
- switch(node->custom1) {
+ switch (node->custom1) {
case CMP_FILT_SOFT:
do_filter3(stackbuf, cbuf, soft, in[0]->vec[0]);
break;
diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.c b/source/blender/nodes/composite/nodes/node_composite_gamma.c
index ae793b44f2c..2ee94224e4b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_gamma.c
+++ b/source/blender/nodes/composite/nodes/node_composite_gamma.c
@@ -50,7 +50,7 @@ static void do_gamma(bNode *UNUSED(node), float *out, float *in, float *fac)
int i=0;
for (i=0; i<3; i++) {
/* check for negative to avoid nan's */
- out[i] = (in[i] > 0.0f)? powf(in[i],fac[0]): in[i];
+ out[i] = (in[i] > 0.0f)? powf(in[i], fac[0]): in[i];
}
out[3] = in[3];
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c
index 42760ddfc4e..7484ae266fc 100644
--- a/source/blender/nodes/composite/nodes/node_composite_glare.c
+++ b/source/blender/nodes/composite/nodes/node_composite_glare.c
@@ -124,7 +124,7 @@ static CompBuf* BTP(CompBuf* src, float threshold, int scaledown)
static void star4(NodeGlare* ndg, CompBuf* dst, CompBuf* src)
{
int x, y, i, xm, xp, ym, yp;
- float c[4] = {0,0,0,0}, tc[4] = {0,0,0,0};
+ float c[4] = {0, 0, 0, 0}, tc[4] = {0, 0, 0, 0};
CompBuf *tbuf1, *tbuf2, *tsrc;
const float f1 = 1.f - ndg->fade, f2 = (1.f - f1)*0.5f;
//const float t3 = ndg->threshold*3.f;
diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
index 7349d1dd4bf..7089983fdbc 100644
--- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
+++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
@@ -81,7 +81,7 @@ static void node_composit_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeSta
else {
/* make output size of input image */
CompBuf *cbuf= dupalloc_compbuf(in[1]->data);
- CompBuf *stackbuf=typecheck_compbuf(cbuf,CB_RGBA);
+ CompBuf *stackbuf=typecheck_compbuf(cbuf, CB_RGBA);
composit2_pixel_processor(node, stackbuf, stackbuf, in[1]->vec, in[0]->data, in[0]->vec, do_hue_sat_fac, CB_RGBA, CB_VAL);
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c
index 6a156c390a7..62179cfa471 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -442,11 +442,14 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE
/* preview policy: take first 'Combined' pass if available,
* otherwise just use the first layer.
*/
- if (!firstbuf)
+ if (!firstbuf) {
firstbuf = stackbuf;
+ }
if (!combinedbuf &&
- (strcmp(sock->name, "Combined")==0 || strcmp(sock->name, "Image")==0))
+ (strcmp(sock->name, "Combined") == 0 || strcmp(sock->name, "Image") == 0))
+ {
combinedbuf = stackbuf;
+ }
}
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c
index ec6d2006296..9888966c46a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_levels.c
+++ b/source/blender/nodes/composite/nodes/node_composite_levels.c
@@ -40,9 +40,9 @@ static bNodeSocketTemplate cmp_node_view_levels_in[]= {
};
static bNodeSocketTemplate cmp_node_view_levels_out[]={
- {SOCK_FLOAT, 0,"Mean"},
- {SOCK_FLOAT, 0,"Std Dev"},
- {-1,0,""}
+ {SOCK_FLOAT, 0, "Mean"},
+ {SOCK_FLOAT, 0, "Std Dev"},
+ {-1, 0, ""}
};
static void rgb_tobw(float r, float g, float b, float* out)
@@ -54,7 +54,7 @@ static void fill_bins(bNode* node, CompBuf* in, int* bins)
{
float value[4];
int ivalue=0;
- int x,y;
+ int x, y;
/*fill bins */
for (y=0; y<in->y; y++) {
@@ -64,9 +64,9 @@ static void fill_bins(bNode* node, CompBuf* in, int* bins)
qd_getPixel(in, x, y, value);
if (value[3] > 0.0f) { /* don't count transparent pixels */
- switch(node->custom1) {
+ switch (node->custom1) {
case 1: { /* all colors */
- rgb_tobw(value[0],value[1],value[2], &value[0]);
+ rgb_tobw(value[0], value[1], value[2], &value[0]);
value[0]=value[0]*255; /* scale to 0-255 range */
ivalue=(int)value[0];
break;
@@ -89,7 +89,7 @@ static void fill_bins(bNode* node, CompBuf* in, int* bins)
}
case 5: /* luminence */
{
- rgb_to_yuv(value[0],value[1],value[2], &value[0], &value[1], &value[2]);
+ rgb_to_yuv(value[0], value[1], value[2], &value[0], &value[1], &value[2]);
value[0]=value[0]*255; /* scale to 0-255 range */
ivalue=(int)value[0];
break;
@@ -111,7 +111,7 @@ static float brightness_mean(bNode* node, CompBuf* in)
{
float sum=0.0;
int numPixels=0.0;
- int x,y;
+ int x, y;
float value[4];
for (x=0; x< in->x; x++) {
@@ -122,11 +122,10 @@ static float brightness_mean(bNode* node, CompBuf* in)
if (value[3] > 0.0f) { /* don't count transparent pixels */
numPixels++;
- switch(node->custom1)
- {
+ switch (node->custom1) {
case 1:
{
- rgb_tobw(value[0],value[1],value[2], &value[0]);
+ rgb_tobw(value[0], value[1], value[2], &value[0]);
sum+=value[0];
break;
}
@@ -147,7 +146,7 @@ static float brightness_mean(bNode* node, CompBuf* in)
}
case 5:
{
- rgb_to_yuv(value[0],value[1],value[2], &value[0], &value[1], &value[2]);
+ rgb_to_yuv(value[0], value[1], value[2], &value[0], &value[1], &value[2]);
sum+=value[0];
break;
}
@@ -163,7 +162,7 @@ static float brightness_standard_deviation(bNode* node, CompBuf* in, float mean)
{
float sum=0.0;
int numPixels=0.0;
- int x,y;
+ int x, y;
float value[4];
for (x=0; x< in->x; x++) {
@@ -174,11 +173,10 @@ static float brightness_standard_deviation(bNode* node, CompBuf* in, float mean)
if (value[3] > 0.0f) { /* don't count transparent pixels */
numPixels++;
- switch(node->custom1)
- {
+ switch (node->custom1) {
case 1:
{
- rgb_tobw(value[0],value[1],value[2], &value[0]);
+ rgb_tobw(value[0], value[1], value[2], &value[0]);
sum+=(value[0]-mean)*(value[0]-mean);
break;
}
@@ -202,7 +200,7 @@ static float brightness_standard_deviation(bNode* node, CompBuf* in, float mean)
}
case 5:
{
- rgb_to_yuv(value[0],value[1],value[2], &value[0], &value[1], &value[2]);
+ rgb_to_yuv(value[0], value[1], value[2], &value[0], &value[1], &value[2]);
sum+=(value[0]-mean)*(value[0]-mean);
break;
}
@@ -217,7 +215,7 @@ static float brightness_standard_deviation(bNode* node, CompBuf* in, float mean)
static void draw_histogram(bNode *node, CompBuf *out, int* bins)
{
- int x,y;
+ int x, y;
float color[4];
float value;
int max;
diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
index 85c291fd9ec..1518284e015 100644
--- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
@@ -35,14 +35,14 @@
/* ******************* Luma Matte Node ********************************* */
static bNodeSocketTemplate cmp_node_luma_matte_in[]={
- {SOCK_RGBA,1,"Image", 1.0f, 1.0f, 1.0f, 1.0f},
- {-1,0,""}
+ {SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f},
+ {-1, 0, ""}
};
static bNodeSocketTemplate cmp_node_luma_matte_out[]={
- {SOCK_RGBA,0,"Image"},
- {SOCK_FLOAT,0,"Matte"},
- {-1,0,""}
+ {SOCK_RGBA, 0, "Image"},
+ {SOCK_FLOAT, 0, "Matte"},
+ {-1, 0, ""}
};
static void do_luma_matte(bNode *node, float *out, float *in)
diff --git a/source/blender/nodes/composite/nodes/node_composite_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c
index 8362df1b691..4c9d1a66fb0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_math.c
+++ b/source/blender/nodes/composite/nodes/node_composite_math.c
@@ -46,8 +46,7 @@ static bNodeSocketTemplate cmp_node_math_out[]= {
static void do_math(bNode *node, float *out, float *in, float *in2)
{
- switch(node->custom1)
- {
+ switch (node->custom1) {
case 0: /* Add */
out[0]= in[0] + in2[0];
break;
diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.c b/source/blender/nodes/composite/nodes/node_composite_movieclip.c
index dd2c169fe9a..2f017b52676 100644
--- a/source/blender/nodes/composite/nodes/node_composite_movieclip.c
+++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.c
@@ -33,7 +33,7 @@
#include "node_composite_util.h"
-static bNodeSocketTemplate cmp_node_movieclip_out[]= {
+static bNodeSocketTemplate cmp_node_movieclip_out[] = {
{ SOCK_RGBA, 0, "Image"},
{ SOCK_FLOAT, 1, "Offset X"},
{ SOCK_FLOAT, 1, "Offset Y"},
@@ -49,50 +49,50 @@ static CompBuf *node_composit_get_movieclip(RenderData *rd, MovieClip *clip, Mov
int type;
float *rect;
- int alloc= FALSE;
+ int alloc = FALSE;
- orig_ibuf= BKE_movieclip_get_ibuf(clip, user);
+ orig_ibuf = BKE_movieclip_get_ibuf(clip, user);
- if (orig_ibuf==NULL || (orig_ibuf->rect==NULL && orig_ibuf->rect_float==NULL)) {
+ if (orig_ibuf == NULL || (orig_ibuf->rect == NULL && orig_ibuf->rect_float == NULL)) {
IMB_freeImBuf(orig_ibuf);
return NULL;
}
- ibuf= IMB_dupImBuf(orig_ibuf);
+ ibuf = IMB_dupImBuf(orig_ibuf);
IMB_freeImBuf(orig_ibuf);
- if (ibuf->rect_float == NULL || ibuf->userflags&IB_RECT_INVALID) {
+ if (ibuf->rect_float == NULL || (ibuf->userflags & IB_RECT_INVALID)) {
IMB_float_from_rect(ibuf);
- ibuf->userflags&= ~IB_RECT_INVALID;
+ ibuf->userflags &= ~IB_RECT_INVALID;
}
/* now we need a float buffer from the image with matching color management */
if (ibuf->channels == 4) {
- rect= node_composit_get_float_buffer(rd, ibuf, &alloc);
+ rect = node_composit_get_float_buffer(rd, ibuf, &alloc);
}
else {
/* non-rgba passes can't use color profiles */
- rect= ibuf->rect_float;
+ rect = ibuf->rect_float;
}
/* done coercing into the correct color management */
if (!alloc) {
- rect= MEM_dupallocN(rect);
- alloc= 1;
+ rect = MEM_dupallocN(rect);
+ alloc = TRUE;
}
- type= ibuf->channels;
+ type = ibuf->channels;
if (rd->scemode & R_COMP_CROP) {
- stackbuf= get_cropped_compbuf(&rd->disprect, rect, ibuf->x, ibuf->y, type);
+ stackbuf = get_cropped_compbuf(&rd->disprect, rect, ibuf->x, ibuf->y, type);
if (alloc)
MEM_freeN(rect);
}
else {
/* we put imbuf copy on stack, cbuf knows rect is from other ibuf when freed! */
- stackbuf= alloc_compbuf(ibuf->x, ibuf->y, type, FALSE);
- stackbuf->rect= rect;
- stackbuf->malloc= alloc;
+ stackbuf = alloc_compbuf(ibuf->x, ibuf->y, type, FALSE);
+ stackbuf->rect = rect;
+ stackbuf->malloc = alloc;
}
IMB_freeImBuf(ibuf);
@@ -103,32 +103,32 @@ static CompBuf *node_composit_get_movieclip(RenderData *rd, MovieClip *clip, Mov
static void node_composit_exec_movieclip(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
if (node->id) {
- RenderData *rd= data;
- MovieClip *clip= (MovieClip *)node->id;
- MovieClipUser *user= (MovieClipUser *)node->storage;
- CompBuf *stackbuf= NULL;
+ RenderData *rd = data;
+ MovieClip *clip = (MovieClip *)node->id;
+ MovieClipUser *user = (MovieClipUser *)node->storage;
+ CompBuf *stackbuf = NULL;
BKE_movieclip_user_set_frame(user, rd->cfra);
- stackbuf= node_composit_get_movieclip(rd, clip, user);
+ stackbuf = node_composit_get_movieclip(rd, clip, user);
if (stackbuf) {
- MovieTrackingStabilization *stab= &clip->tracking.stabilization;
+ MovieTrackingStabilization *stab = &clip->tracking.stabilization;
/* put image on stack */
- out[0]->data= stackbuf;
+ out[0]->data = stackbuf;
- if (stab->flag&TRACKING_2D_STABILIZATION) {
+ if (stab->flag & TRACKING_2D_STABILIZATION) {
float loc[2], scale, angle;
BKE_tracking_stabilization_data(&clip->tracking, rd->cfra, stackbuf->x, stackbuf->y,
loc, &scale, &angle);
- out[1]->vec[0]= loc[0];
- out[2]->vec[0]= loc[1];
+ out[1]->vec[0] = loc[0];
+ out[2]->vec[0] = loc[1];
- out[3]->vec[0]= scale;
- out[4]->vec[0]= angle;
+ out[3]->vec[0] = scale;
+ out[4]->vec[0] = angle;
}
/* generate preview */
@@ -139,10 +139,10 @@ static void node_composit_exec_movieclip(void *data, bNode *node, bNodeStack **U
static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
- MovieClipUser *user= MEM_callocN(sizeof(MovieClipUser), "node movie clip user");
+ MovieClipUser *user = MEM_callocN(sizeof(MovieClipUser), "node movie clip user");
- node->storage= user;
- user->framenr= 1;
+ node->storage = user;
+ user->framenr = 1;
}
void register_node_type_cmp_movieclip(bNodeTreeType *ttype)
diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
index d9f0da9b8aa..f6ffc783b08 100644
--- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
+++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
@@ -4,7 +4,7 @@
* 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.
+ * 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
@@ -37,12 +37,12 @@
/* **************** Translate ******************** */
-static bNodeSocketTemplate cmp_node_moviedistortion_in[]= {
+static bNodeSocketTemplate cmp_node_moviedistortion_in[] = {
{ SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
-static bNodeSocketTemplate cmp_node_moviedistortion_out[]= {
+static bNodeSocketTemplate cmp_node_moviedistortion_out[] = {
{ SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
@@ -51,63 +51,63 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
if (in[0]->data) {
if (node->id) {
- MovieClip *clip= (MovieClip *)node->id;
- CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
- CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 0);
+ MovieClip *clip = (MovieClip *)node->id;
+ CompBuf *cbuf = typecheck_compbuf(in[0]->data, CB_RGBA);
+ CompBuf *stackbuf = alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 0);
ImBuf *ibuf;
- ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
+ ibuf = IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
if (ibuf) {
- RenderData *rd= data;
+ RenderData *rd = data;
ImBuf *obuf;
- MovieTracking *tracking= &clip->tracking;
+ MovieTracking *tracking = &clip->tracking;
int width, height;
- float overscan= 0.0f;
- MovieClipUser user= {0};
+ float overscan = 0.0f;
+ MovieClipUser user = {0};
BKE_movieclip_user_set_frame(&user, rd->cfra);
- ibuf->rect_float= cbuf->rect;
+ ibuf->rect_float = cbuf->rect;
BKE_movieclip_get_size(clip, &user, &width, &height);
if (!node->storage)
- node->storage= BKE_tracking_distortion_create();
+ node->storage = BKE_tracking_distortion_create();
- if (node->custom1==0)
+ if (node->custom1 == 0)
obuf= BKE_tracking_distortion_exec(node->storage, tracking, ibuf, width, height, overscan, 1);
else
obuf= BKE_tracking_distortion_exec(node->storage, tracking, ibuf, width, height, overscan, 0);
- stackbuf->rect= obuf->rect_float;
- stackbuf->malloc= 1;
+ stackbuf->rect = obuf->rect_float;
+ stackbuf->malloc = TRUE;
- obuf->mall&= ~IB_rectfloat;
- obuf->rect_float= NULL;
+ obuf->mall &= ~IB_rectfloat;
+ obuf->rect_float = NULL;
IMB_freeImBuf(ibuf);
IMB_freeImBuf(obuf);
}
/* pass on output and free */
- out[0]->data= stackbuf;
+ out[0]->data = stackbuf;
- if (cbuf!=in[0]->data)
+ if (cbuf != in[0]->data)
free_compbuf(cbuf);
}
else {
- CompBuf *cbuf= in[0]->data;
- CompBuf *stackbuf= pass_on_compbuf(cbuf);
+ CompBuf *cbuf = in[0]->data;
+ CompBuf *stackbuf = pass_on_compbuf(cbuf);
- out[0]->data= stackbuf;
+ out[0]->data = stackbuf;
}
}
}
static const char *label(bNode *node)
{
- if (node->custom1==0)
+ if (node->custom1 == 0)
return IFACE_("Undistortion");
else
return IFACE_("Distortion");
@@ -124,7 +124,7 @@ static void storage_free(bNode *node)
static void storage_copy(bNode *orig_node, bNode *new_node)
{
if (orig_node->storage)
- new_node->storage= BKE_tracking_distortion_copy(orig_node->storage);
+ new_node->storage = BKE_tracking_distortion_copy(orig_node->storage);
}
void register_node_type_cmp_moviedistortion(bNodeTreeType *ttype)
diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c
index 6952817248d..8268977658d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_rotate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c
@@ -87,7 +87,7 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac
v=-s*x + c*y + centy;
xo= x+(int)centx;
- switch(node->custom1) {
+ switch (node->custom1) {
case 0:
neareast_interpolation(ibuf, obuf, u, v, xo, yo);
break;
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
index 6dac2d16401..c0e11fe54e3 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
@@ -127,7 +127,7 @@ static bNodeSocketTemplate cmp_node_combhsva_out[]= {
static void do_comb_hsva(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
- float r,g,b;
+ float r, g, b;
hsv_to_rgb(in1[0], in2[0], in3[0], &r, &g, &b);
out[0] = r;
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
index b12f08bb13d..7f3b8a31a4b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
@@ -91,8 +91,7 @@ static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeSta
if (in[0]->data==NULL) {
float y, cb, cr;
- switch(node->custom1)
- {
+ switch (node->custom1) {
case 1:
rgb_to_ycc(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &y, &cb, &cr, BLI_YCC_ITU_BT709);
break;
@@ -117,8 +116,7 @@ static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeSta
CompBuf *cbuf2=typecheck_compbuf(cbuf, CB_RGBA);
/* convert the RGB stackbuf to an HSV representation */
- switch(node->custom1)
- {
+ switch (node->custom1) {
case 1:
composit1_pixel_processor(node, cbuf2, cbuf2, in[0]->vec, do_sepycca_709, CB_RGBA);
break;
@@ -177,7 +175,7 @@ static bNodeSocketTemplate cmp_node_combycca_out[]= {
static void do_comb_ycca_601(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
- float r,g,b;
+ float r, g, b;
float y, cb, cr;
/*need to un-normalize the data*/
@@ -185,7 +183,7 @@ static void do_comb_ycca_601(bNode *UNUSED(node), float *out, float *in1, float
cb=in2[0]*255;
cr=in3[0]*255;
- ycc_to_rgb(y,cb,cr, &r, &g, &b, BLI_YCC_ITU_BT601);
+ ycc_to_rgb(y, cb, cr, &r, &g, &b, BLI_YCC_ITU_BT601);
out[0] = r;
out[1] = g;
@@ -195,7 +193,7 @@ static void do_comb_ycca_601(bNode *UNUSED(node), float *out, float *in1, float
static void do_comb_ycca_709(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
- float r,g,b;
+ float r, g, b;
float y, cb, cr;
/*need to un-normalize the data*/
@@ -203,7 +201,7 @@ static void do_comb_ycca_709(bNode *UNUSED(node), float *out, float *in1, float
cb=in2[0]*255;
cr=in3[0]*255;
- ycc_to_rgb(y,cb,cr, &r, &g, &b, BLI_YCC_ITU_BT709);
+ ycc_to_rgb(y, cb, cr, &r, &g, &b, BLI_YCC_ITU_BT709);
out[0] = r;
out[1] = g;
@@ -213,7 +211,7 @@ static void do_comb_ycca_709(bNode *UNUSED(node), float *out, float *in1, float
static void do_comb_ycca_jfif(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
- float r,g,b;
+ float r, g, b;
float y, cb, cr;
/*need to un-normalize the data*/
@@ -221,7 +219,7 @@ static void do_comb_ycca_jfif(bNode *UNUSED(node), float *out, float *in1, float
cb=in2[0]*255;
cr=in3[0]*255;
- ycc_to_rgb(y,cb,cr, &r, &g, &b, BLI_YCC_JFIF_0_255);
+ ycc_to_rgb(y, cb, cr, &r, &g, &b, BLI_YCC_JFIF_0_255);
out[0] = r;
out[1] = g;
@@ -240,8 +238,7 @@ static void node_composit_exec_combycca(void *UNUSED(data), bNode *node, bNodeSt
float cb = in[1]->vec[0] * 255;
float cr = in[2]->vec[0] * 255;
- switch(node->custom1)
- {
+ switch (node->custom1) {
case 1:
ycc_to_rgb(y, cb, cr, &out[0]->vec[0], &out[0]->vec[1], &out[0]->vec[2], BLI_YCC_ITU_BT709);
break;
@@ -270,8 +267,7 @@ static void node_composit_exec_combycca(void *UNUSED(data), bNode *node, bNodeSt
stackbuf = alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */
- switch(node->custom1)
- {
+ switch (node->custom1) {
case 1:
composit4_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec,
in[2]->data, in[2]->vec, in[3]->data, in[3]->vec,
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
index 8dd551643f5..57fcf3af046 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
@@ -128,7 +128,7 @@ static bNodeSocketTemplate cmp_node_combyuva_out[]= {
static void do_comb_yuva(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
- float r,g,b;
+ float r, g, b;
yuv_to_rgb(in1[0], in2[0], in3[0], &r, &g, &b);
out[0] = r;
diff --git a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
index 0eac85c4030..e5d8fe16d51 100644
--- a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
+++ b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
@@ -48,20 +48,20 @@ static bNodeSocketTemplate cmp_node_stabilize2d_out[]= {
static void node_composit_exec_stabilize2d(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
if (in[0]->data && node->id) {
- RenderData *rd= data;
- MovieClip *clip= (MovieClip *)node->id;
- CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
+ RenderData *rd = data;
+ MovieClip *clip = (MovieClip *)node->id;
+ CompBuf *cbuf = typecheck_compbuf(in[0]->data, CB_RGBA);
CompBuf *stackbuf;
float loc[2], scale, angle;
BKE_tracking_stabilization_data(&clip->tracking, rd->cfra, cbuf->x, cbuf->y, loc, &scale, &angle);
- stackbuf= node_composit_transform(cbuf, loc[0], loc[1], angle, scale, node->custom1);
+ stackbuf = node_composit_transform(cbuf, loc[0], loc[1], angle, scale, node->custom1);
/* pass on output and free */
- out[0]->data= stackbuf;
+ out[0]->data = stackbuf;
- if (cbuf!=in[0]->data)
+ if (cbuf != in[0]->data)
free_compbuf(cbuf);
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_texture.c b/source/blender/nodes/composite/nodes/node_composite_texture.c
index 562e2b2737e..0b521fac3e1 100644
--- a/source/blender/nodes/composite/nodes/node_composite_texture.c
+++ b/source/blender/nodes/composite/nodes/node_composite_texture.c
@@ -40,7 +40,7 @@ static bNodeSocketTemplate cmp_node_texture_in[]= {
};
static bNodeSocketTemplate cmp_node_texture_out[]= {
{ SOCK_FLOAT, 0, "Value"},
- { SOCK_RGBA , 0, "Color"},
+ { SOCK_RGBA, 0, "Color"},
{ -1, 0, "" }
};
diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.c b/source/blender/nodes/composite/nodes/node_composite_tonemap.c
index 0696c2ba848..eae81a4bbd2 100644
--- a/source/blender/nodes/composite/nodes/node_composite_tonemap.c
+++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.c
@@ -94,7 +94,7 @@ static void tonemap(NodeTonemap* ntm, CompBuf* dst, CompBuf* src)
I_l = sp[x][1] + ic*(L - sp[x][1]);
I_g = Cav[1] + ic*(Lav - Cav[1]);
I_a = I_l + ia*(I_g - I_l);
- dp[x][1] /= (dp[x][1] + pow((double)f*I_a,(double)m));
+ dp[x][1] /= (dp[x][1] + pow((double)f*I_a, (double)m));
I_l = sp[x][2] + ic*(L - sp[x][2]);
I_g = Cav[2] + ic*(Lav - Cav[2]);
I_a = I_l + ia*(I_g - I_l);
diff --git a/source/blender/nodes/composite/nodes/node_composite_transform.c b/source/blender/nodes/composite/nodes/node_composite_transform.c
index a610d8a66c4..2c2a352017a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_transform.c
+++ b/source/blender/nodes/composite/nodes/node_composite_transform.c
@@ -4,7 +4,7 @@
* 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.
+ * 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
@@ -34,7 +34,7 @@
/* **************** Transform ******************** */
-static bNodeSocketTemplate cmp_node_transform_in[]= {
+static bNodeSocketTemplate cmp_node_transform_in[] = {
{ SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, "X", 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f},
{ SOCK_FLOAT, 1, "Y", 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f},
@@ -43,17 +43,17 @@ static bNodeSocketTemplate cmp_node_transform_in[]= {
{ -1, 0, "" }
};
-static bNodeSocketTemplate cmp_node_transform_out[]= {
+static bNodeSocketTemplate cmp_node_transform_out[] = {
{ SOCK_RGBA, 0, "Image"},
{ -1, 0, "" }
};
CompBuf* node_composit_transform(CompBuf *cbuf, float x, float y, float angle, float scale, int filter_type)
{
- CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1);
+ CompBuf *stackbuf = alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, TRUE);
ImBuf *ibuf, *obuf;
float mat[4][4], lmat[4][4], rmat[4][4], smat[4][4], cmat[4][4], icmat[4][4];
- float svec[3]= {scale, scale, scale}, loc[2]= {x, y};
+ float svec[3] = {scale, scale, scale}, loc[2] = {x, y};
unit_m4(rmat);
unit_m4(lmat);
@@ -61,8 +61,8 @@ CompBuf* node_composit_transform(CompBuf *cbuf, float x, float y, float angle, f
unit_m4(cmat);
/* image center as rotation center */
- cmat[3][0]= (float)cbuf->x/2.0f;
- cmat[3][1]= (float)cbuf->y/2.0f;
+ cmat[3][0] = (float)cbuf->x/2.0f;
+ cmat[3][1] = (float)cbuf->y/2.0f;
invert_m4_m4(icmat, cmat);
size_to_mat4(smat, svec); /* scale matrix */
@@ -74,22 +74,22 @@ CompBuf* node_composit_transform(CompBuf *cbuf, float x, float y, float angle, f
invert_m4(mat);
- ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
- obuf= IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0);
+ ibuf = IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
+ obuf = IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0);
if (ibuf && obuf) {
int i, j;
- ibuf->rect_float= cbuf->rect;
- obuf->rect_float= stackbuf->rect;
+ ibuf->rect_float = cbuf->rect;
+ obuf->rect_float = stackbuf->rect;
- for (j=0; j<cbuf->y; j++) {
- for (i=0; i<cbuf->x;i++) {
- float vec[3]= {i, j, 0};
+ for (j = 0; j < cbuf->y; j++) {
+ for (i = 0; i < cbuf->x; i++) {
+ float vec[3] = {i, j, 0};
mul_v3_m4v3(vec, mat, vec);
- switch(filter_type) {
+ switch (filter_type) {
case 0:
neareast_interpolation(ibuf, obuf, vec[0], vec[1], i, j);
break;
@@ -114,15 +114,15 @@ CompBuf* node_composit_transform(CompBuf *cbuf, float x, float y, float angle, f
static void node_composit_exec_transform(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if (in[0]->data) {
- CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
+ CompBuf *cbuf = typecheck_compbuf(in[0]->data, CB_RGBA);
CompBuf *stackbuf;
- stackbuf= node_composit_transform(cbuf, in[1]->vec[0], in[2]->vec[0], in[3]->vec[0], in[4]->vec[0], node->custom1);
+ stackbuf = node_composit_transform(cbuf, in[1]->vec[0], in[2]->vec[0], in[3]->vec[0], in[4]->vec[0], node->custom1);
/* pass on output and free */
- out[0]->data= stackbuf;
+ out[0]->data = stackbuf;
- if (cbuf!=in[0]->data)
+ if (cbuf != in[0]->data)
free_compbuf(cbuf);
}
}
diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c
index 362ed59a38e..13882d631d8 100644
--- a/source/blender/nodes/intern/node_common.c
+++ b/source/blender/nodes/intern/node_common.c
@@ -130,7 +130,7 @@ bNode *node_group_make_from_selected(bNodeTree *ntree)
/* no groups in groups */
if (node->type==NODE_GROUP)
return NULL;
- DO_MINMAX2( (&node->locx), min, max);
+ DO_MINMAX2((&node->locx), min, max);
totnode++;
}
node->done= 0;
diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c
index 94b9d364418..b5400244efe 100644
--- a/source/blender/nodes/intern/node_socket.c
+++ b/source/blender/nodes/intern/node_socket.c
@@ -59,7 +59,7 @@ static bNodeSocketType node_socket_type_float = {
/* ui_name */ "Float",
/* ui_description */ "Floating Point",
/* ui_icon */ 0,
- /* ui_color */ {160,160,160,255},
+ /* ui_color */ {160, 160, 160, 255},
/* value_structname */ "bNodeSocketValueFloat",
/* value_structsize */ sizeof(bNodeSocketValueFloat),
@@ -74,7 +74,7 @@ static bNodeSocketType node_socket_type_vector = {
/* ui_name */ "Vector",
/* ui_description */ "3-dimensional floating point vector",
/* ui_icon */ 0,
- /* ui_color */ {100,100,200,255},
+ /* ui_color */ {100, 100, 200, 255},
/* value_structname */ "bNodeSocketValueVector",
/* value_structsize */ sizeof(bNodeSocketValueVector),
@@ -89,7 +89,7 @@ static bNodeSocketType node_socket_type_rgba = {
/* ui_name */ "RGBA",
/* ui_description */ "RGBA color",
/* ui_icon */ 0,
- /* ui_color */ {200,200,40,255},
+ /* ui_color */ {200, 200, 40, 255},
/* value_structname */ "bNodeSocketValueRGBA",
/* value_structsize */ sizeof(bNodeSocketValueRGBA),
@@ -104,7 +104,7 @@ static bNodeSocketType node_socket_type_int = {
/* ui_name */ "Int",
/* ui_description */ "Integer",
/* ui_icon */ 0,
- /* ui_color */ {17,133,37,255},
+ /* ui_color */ {17, 133, 37, 255},
/* value_structname */ "bNodeSocketValueInt",
/* value_structsize */ sizeof(bNodeSocketValueInt),
@@ -119,7 +119,7 @@ static bNodeSocketType node_socket_type_boolean = {
/* ui_name */ "Boolean",
/* ui_description */ "Boolean",
/* ui_icon */ 0,
- /* ui_color */ {158,139,63,255},
+ /* ui_color */ {158, 139, 63, 255},
/* value_structname */ "bNodeSocketValueBoolean",
/* value_structsize */ sizeof(bNodeSocketValueBoolean),
@@ -134,7 +134,7 @@ static bNodeSocketType node_socket_type_shader = {
/* ui_name */ "Shader",
/* ui_description */ "Shader",
/* ui_icon */ 0,
- /* ui_color */ {100,200,100,255},
+ /* ui_color */ {100, 200, 100, 255},
/* value_structname */ NULL,
/* value_structsize */ 0,
@@ -149,7 +149,7 @@ static bNodeSocketType node_socket_type_mesh = {
/* ui_name */ "Mesh",
/* ui_description */ "Mesh geometry data",
/* ui_icon */ 0,
- /* ui_color */ {255,133,7,255},
+ /* ui_color */ {255, 133, 7, 255},
/* value_structname */ NULL,
/* value_structsize */ 0,
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index 90c62bc47ac..9a9a27603dc 100644
--- a/source/blender/nodes/shader/node_shader_util.c
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -101,7 +101,7 @@ void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mo
/* note; sockets always exist for the given type! */
for (a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
if (sock->flag & SOCK_IN_USE) {
- switch(a) {
+ switch (a) {
case GEOM_OUT_GLOB:
*texco |= TEXCO_GLOB|NEED_UV; break;
case GEOM_OUT_VIEW:
@@ -137,7 +137,7 @@ void nodeShaderSynchronizeID(bNode *node, int copyto)
for (a=0, sock= node->inputs.first; sock; sock= sock->next, a++) {
if (!nodeSocketIsHidden(sock)) {
if (copyto) {
- switch(a) {
+ switch (a) {
case MAT_IN_COLOR:
copy_v3_v3(&ma->r, ((bNodeSocketValueRGBA*)sock->default_value)->value); break;
case MAT_IN_SPEC:
@@ -161,7 +161,7 @@ void nodeShaderSynchronizeID(bNode *node, int copyto)
}
}
else {
- switch(a) {
+ switch (a) {
case MAT_IN_COLOR:
copy_v3_v3(((bNodeSocketValueRGBA*)sock->default_value)->value, &ma->r); break;
case MAT_IN_SPEC:
diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c
index 44df496f5d6..db2b57ab51b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_math.c
+++ b/source/blender/nodes/shader/nodes/node_shader_math.c
@@ -48,7 +48,7 @@ static bNodeSocketTemplate sh_node_math_out[]= {
static void node_shader_exec_math(void *UNUSED(data), bNode *node, bNodeStack **in,
bNodeStack **out)
{
- switch(node->custom1) {
+ switch (node->custom1) {
case 0: /* Add */
out[0]->vec[0]= in[0]->vec[0] + in[1]->vec[0];
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c
index 8f67fb585c9..aa8b7070cab 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.c
@@ -33,6 +33,7 @@
static bNodeSocketTemplate sh_node_tex_coord_out[]= {
{ SOCK_VECTOR, 0, "Generated", 0.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},
{ SOCK_VECTOR, 0, "UV", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_VECTOR, 0, "Object", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_VECTOR, 0, "Camera", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
@@ -48,7 +49,7 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat, bNode *UNUSED(node), GPUN
return GPU_stack_link(mat, "node_tex_coord", in, out,
GPU_builtin(GPU_VIEW_POSITION), GPU_builtin(GPU_VIEW_NORMAL),
- GPU_builtin(GPU_INVERSE_VIEW_MATRIX), orco, mtface);
+ GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_INVERSE_OBJECT_MATRIX), orco, mtface);
}
/* node type definition */
diff --git a/source/blender/nodes/shader/nodes/node_shader_texture.c b/source/blender/nodes/shader/nodes/node_shader_texture.c
index 8b6386fe2f6..7d3e532be0b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_texture.c
+++ b/source/blender/nodes/shader/nodes/node_shader_texture.c
@@ -41,7 +41,7 @@ static bNodeSocketTemplate sh_node_texture_in[]= {
};
static bNodeSocketTemplate sh_node_texture_out[]= {
{ SOCK_FLOAT, 0, "Value"},
- { SOCK_RGBA , 0, "Color"},
+ { SOCK_RGBA, 0, "Color"},
{ SOCK_VECTOR, 0, "Normal"},
{ -1, 0, "" }
};
diff --git a/source/blender/nodes/shader/nodes/node_shader_vectMath.c b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
index a0fe67d591d..73b0582490d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vectMath.c
+++ b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
@@ -73,7 +73,7 @@ static void node_shader_exec_vect_math(void *UNUSED(data), bNode *node, bNodeSta
out[0]->vec[1]= vec1[1] + vec2[1];
out[0]->vec[2]= vec1[2] + vec2[2];
- out[1]->vec[0] = normalize_v3( out[0]->vec );
+ out[1]->vec[0] = normalize_v3(out[0]->vec );
}
else if (node->custom1 == 3) { /* Dot product */
out[1]->vec[0]= (vec1[0] * vec2[0]) + (vec1[1] * vec2[1]) + (vec1[2] * vec2[2]);
@@ -83,7 +83,7 @@ static void node_shader_exec_vect_math(void *UNUSED(data), bNode *node, bNodeSta
out[0]->vec[1]= (vec1[2] * vec2[0]) - (vec1[0] * vec2[2]);
out[0]->vec[2]= (vec1[0] * vec2[1]) - (vec1[1] * vec2[0]);
- out[1]->vec[0] = normalize_v3( out[0]->vec );
+ out[1]->vec[0] = normalize_v3(out[0]->vec );
}
else if (node->custom1 == 5) { /* Normalize */
if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
@@ -97,7 +97,7 @@ static void node_shader_exec_vect_math(void *UNUSED(data), bNode *node, bNodeSta
out[0]->vec[2]= vec2[2];
}
- out[1]->vec[0] = normalize_v3( out[0]->vec );
+ out[1]->vec[0] = normalize_v3(out[0]->vec );
}
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_bricks.c b/source/blender/nodes/texture/nodes/node_texture_bricks.c
index ac8799762bd..fbf04715020 100644
--- a/source/blender/nodes/texture/nodes/node_texture_bricks.c
+++ b/source/blender/nodes/texture/nodes/node_texture_bricks.c
@@ -102,16 +102,17 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
ins_y = y - row_height*rownum;
tint = noise((rownum << 16) + (bricknum & 0xFFFF)) + bias;
- CLAMP(tint,0.0f,1.0f);
+ CLAMP(tint, 0.0f, 1.0f);
- if ( ins_x < mortar_thickness || ins_y < mortar_thickness ||
- ins_x > (brick_width - mortar_thickness) ||
- ins_y > (row_height - mortar_thickness) ) {
- copy_v4_v4( out, mortar );
+ if (ins_x < mortar_thickness || ins_y < mortar_thickness ||
+ ins_x > (brick_width - mortar_thickness) ||
+ ins_y > (row_height - mortar_thickness))
+ {
+ copy_v4_v4(out, mortar);
}
else {
- copy_v4_v4( out, bricks1 );
- ramp_blend( MA_RAMP_BLEND, out, tint, bricks2 );
+ copy_v4_v4(out, bricks1);
+ ramp_blend(MA_RAMP_BLEND, out, tint, bricks2);
}
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c
index d0bc30089e2..38d6db1fd08 100644
--- a/source/blender/nodes/texture/nodes/node_texture_image.c
+++ b/source/blender/nodes/texture/nodes/node_texture_image.c
@@ -76,7 +76,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(i
while ( py >= ibuf->y ) py -= ibuf->y;
result = ibuf->rect_float + py*ibuf->x*4 + px*4;
- copy_v4_v4( out, result );
+ copy_v4_v4(out, result);
}
}
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c
index 29d154df884..54c9645fac3 100644
--- a/source/blender/nodes/texture/nodes/node_texture_math.c
+++ b/source/blender/nodes/texture/nodes/node_texture_math.c
@@ -51,7 +51,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
float in0 = tex_input_value(in[0], p, thread);
float in1 = tex_input_value(in[1], p, thread);
- switch(node->custom1) {
+ switch (node->custom1) {
case 0: /* Add */
*out= in0 + in1;
diff --git a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
index 41115076ec1..c170d03a495 100644
--- a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
+++ b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
@@ -37,7 +37,7 @@
static bNodeSocketTemplate inputs[]= {
{ SOCK_FLOAT, 1, "Factor", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR },
{ SOCK_RGBA, 1, "Color1", 0.5f, 0.5f, 0.5f, 1.0f },
- { SOCK_RGBA , 1, "Color2", 0.5f, 0.5f, 0.5f, 1.0f },
+ { SOCK_RGBA, 1, "Color2", 0.5f, 0.5f, 0.5f, 1.0f },
{ -1, 0, "" }
};
static bNodeSocketTemplate outputs[]= {
diff --git a/source/blender/nodes/texture/nodes/node_texture_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c
index 2b899fde593..19ba0e88639 100644
--- a/source/blender/nodes/texture/nodes/node_texture_output.c
+++ b/source/blender/nodes/texture/nodes/node_texture_output.c
@@ -88,14 +88,14 @@ static void unique_name(bNode *node)
i = node;
while (i->prev) i = i->prev;
- for (; i; i=i->next) {
- if (
- i == node ||
- i->type != TEX_NODE_OUTPUT ||
- strcmp(name, ((TexNodeOutput*)(i->storage))->name)
- )
+ for ( ; i; i = i->next) {
+ if (i == node ||
+ i->type != TEX_NODE_OUTPUT ||
+ strcmp(name, ((TexNodeOutput*)(i->storage))->name))
+ {
continue;
-
+ }
+
if (!new_name) {
int len = strlen(name);
if (len >= 4 && sscanf(name + len - 4, ".%03d", &suffix) == 1) {
diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c
index bf93231c306..ecf47a900f9 100644
--- a/source/blender/nodes/texture/nodes/node_texture_texture.c
+++ b/source/blender/nodes/texture/nodes/node_texture_texture.c
@@ -49,8 +49,8 @@ static bNodeSocketTemplate outputs[]= {
static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
{
Tex *nodetex = (Tex *)node->id;
- static float red[] = {1,0,0,1};
- static float white[] = {1,1,1,1};
+ static float red[] = {1, 0, 0, 1};
+ static float white[] = {1, 1, 1, 1};
float co[3], dxt[3], dyt[3];
copy_v3_v3(co, p->co);
@@ -65,12 +65,12 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
if (node->custom2 || node->need_exec==0) {
/* this node refers to its own texture tree! */
- copy_v4_v4(out, (fabs(co[0] - co[1]) < .01) ? white : red );
+ copy_v4_v4(out, (fabs(co[0] - co[1]) < .01) ? white : red);
}
else if (nodetex) {
TexResult texres;
int textype;
- float nor[] = {0,0,0};
+ float nor[] = {0, 0, 0};
float col1[4], col2[4];
tex_input_rgba(col1, in[0], p, thread);
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index 9972ff288b2..39336abe944 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -34,6 +34,7 @@
#include "../mathutils/mathutils.h"
+#include "DNA_object_types.h"
#include "DNA_meshdata_types.h"
#include "BLI_utildefines.h"
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 7259ea8e2f5..7c8f28d0979 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1424,7 +1424,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha
totkw = kw ? PyDict_Size(kw) : 0;
- RNA_STRUCT_BEGIN(ptr, prop) {
+ RNA_STRUCT_BEGIN (ptr, prop) {
arg_name = RNA_property_identifier(prop);
if (strcmp(arg_name, "rna_type") == 0) continue;
@@ -2203,7 +2203,7 @@ int pyrna_prop_collection_subscript_str_lib_pair_ptr(BPy_PropertyRNA *self, PyOb
/* lib is either a valid poniter or NULL,
* either way can do direct comparison with id.lib */
- RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
+ RNA_PROP_BEGIN (&self->ptr, itemptr, self->prop) {
ID *id = itemptr.data; /* always an ID */
if (id->lib == lib && (strncmp(keyname, id->name + 2, sizeof(id->name) - 2) == 0)) {
found = TRUE;
@@ -3346,7 +3346,7 @@ static void pyrna_dir_members_rna(PyObject *list, PointerRNA *ptr)
RNA_pointer_create(NULL, &RNA_Struct, ptr->type, &tptr);
iterprop = RNA_struct_find_property(&tptr, "functions");
- RNA_PROP_BEGIN(&tptr, itemptr, iterprop) {
+ RNA_PROP_BEGIN (&tptr, itemptr, iterprop) {
idname = RNA_function_identifier(itemptr.data);
pystring = PyUnicode_FromString(idname);
@@ -3365,7 +3365,7 @@ static void pyrna_dir_members_rna(PyObject *list, PointerRNA *ptr)
iterprop = RNA_struct_iterator_property(ptr->type);
- RNA_PROP_BEGIN(ptr, itemptr, iterprop) {
+ RNA_PROP_BEGIN (ptr, itemptr, iterprop) {
nameptr = RNA_struct_name_get_alloc(&itemptr, name, sizeof(name), &namelen);
if (nameptr) {
@@ -3980,7 +3980,7 @@ static PyObject *pyrna_prop_collection_keys(BPy_PropertyRNA *self)
char name[256], *nameptr;
int namelen;
- RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
+ RNA_PROP_BEGIN (&self->ptr, itemptr, self->prop) {
nameptr = RNA_struct_name_get_alloc(&itemptr, name, sizeof(name), &namelen);
if (nameptr) {
@@ -4017,7 +4017,7 @@ static PyObject *pyrna_prop_collection_items(BPy_PropertyRNA *self)
int namelen;
int i = 0;
- RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
+ RNA_PROP_BEGIN (&self->ptr, itemptr, self->prop) {
if (itemptr.data) {
/* add to python list */
item = PyTuple_New(2);
@@ -4189,7 +4189,7 @@ static PyObject *pyrna_prop_collection_find(BPy_PropertyRNA *self, PyObject *key
PYRNA_PROP_CHECK_OBJ(self);
- RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
+ RNA_PROP_BEGIN (&self->ptr, itemptr, self->prop) {
nameptr = RNA_struct_name_get_alloc(&itemptr, name, sizeof(name), &namelen);
if (nameptr) {
@@ -4220,7 +4220,7 @@ static void foreach_attr_type(BPy_PropertyRNA *self, const char *attr,
*attr_signed = FALSE;
/* note: this is fail with zero length lists, so don't let this get caled in that case */
- RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
+ RNA_PROP_BEGIN (&self->ptr, itemptr, self->prop) {
prop = RNA_struct_find_property(&itemptr, attr);
*raw_type = RNA_property_raw_type(prop);
*attr_tot = RNA_property_array_length(&itemptr, prop);
@@ -6401,7 +6401,7 @@ static PyObject *pyrna_basetype_dir(BPy_BaseTypeRNA *self)
PyObject *ret = PyList_New(0);
PyObject *item;
- RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
+ RNA_PROP_BEGIN (&self->ptr, itemptr, self->prop) {
StructRNA *srna = itemptr.data;
StructRNA *srna_base = RNA_struct_base(itemptr.data);
/* skip own operators, these double up [#29666] */
@@ -7189,7 +7189,7 @@ void pyrna_alloc_types(void)
RNA_blender_rna_pointer_create(&ptr);
prop = RNA_struct_find_property(&ptr, "structs");
- RNA_PROP_BEGIN(&ptr, itemptr, prop) {
+ RNA_PROP_BEGIN (&ptr, itemptr, prop) {
PyObject *item = pyrna_struct_Subtype(&itemptr);
if (item == NULL) {
if (PyErr_Occurred()) {
@@ -7217,7 +7217,7 @@ void pyrna_free_types(void)
prop = RNA_struct_find_property(&ptr, "structs");
- RNA_PROP_BEGIN(&ptr, itemptr, prop) {
+ RNA_PROP_BEGIN (&ptr, itemptr, prop) {
StructRNA *srna = srna_from_ptr(&itemptr);
void *py_ptr = RNA_struct_py_type_get(srna);
@@ -7477,7 +7477,7 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
/* loop over all structs */
- RNA_PROP_BEGIN(&ptr_rna, itemptr, prop_rna) {
+ RNA_PROP_BEGIN (&ptr_rna, itemptr, prop_rna) {
srna_iter = itemptr.data;
if (pyrna_srna_contains_pointer_prop_srna(srna_iter, srna, &prop_identifier)) {
break;
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index b94c2e21139..543574e5136 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -1011,7 +1011,7 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject
coord_array = MEM_callocN(dims * (resolu) * sizeof(float), "interpolate_bezier");
for (i = 0; i < dims; i++) {
- forward_diff_bezier(k1[i], h1[i], h2[i], k2[i], coord_array + i, resolu - 1, sizeof(float) * dims);
+ BKE_curve_forward_diff_bezier(k1[i], h1[i], h2[i], k2[i], coord_array + i, resolu - 1, sizeof(float) * dims);
}
list = PyList_New(resolu);
diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c
index 599268b225a..cdf8d6d1860 100644
--- a/source/blender/quicktime/apple/quicktime_export.c
+++ b/source/blender/quicktime/apple/quicktime_export.c
@@ -144,7 +144,7 @@ static QuicktimeCodecTypeDesc qtVideoCodecList[] = {
{kMPEG4VisualCodecType, 10, "MPEG4"},
{kH263CodecType, 11, "H.263"},
{kH264CodecType, 12, "H.264"},
- {0,0,NULL}};
+ {0, 0, NULL}};
static int qtVideoCodecCount = 12;
@@ -263,7 +263,7 @@ static OSErr QT_GetCodecSettingsFromScene(RenderData *rd, ReportList *reports)
// if there is codecdata in the blendfile, convert it to a Quicktime handle
if (qcd) {
myHandle = NewHandle(qcd->cdSize);
- PtrToHand( qcd->cdParms, &myHandle, qcd->cdSize);
+ PtrToHand(qcd->cdParms, &myHandle, qcd->cdSize);
}
// restore codecsettings to the quicktime component
@@ -346,26 +346,26 @@ static void QT_CreateMyVideoTrack(int rectx, int recty, ReportList *reports)
trackFrame.bottom = recty;
trackFrame.right = rectx;
- qtexport->theTrack = NewMovieTrack (qtexport->theMovie,
- FixRatio(trackFrame.right,1),
- FixRatio(trackFrame.bottom,1),
- 0);
- CheckError( GetMoviesError(), "NewMovieTrack error", reports );
+ qtexport->theTrack = NewMovieTrack (qtexport->theMovie,
+ FixRatio(trackFrame.right, 1),
+ FixRatio(trackFrame.bottom, 1),
+ 0);
+ CheckError(GetMoviesError(), "NewMovieTrack error", reports);
-// SetIdentityMatrix(&myMatrix);
-// ScaleMatrix(&myMatrix, fixed1, Long2Fix(-1), 0, 0);
-// TranslateMatrix(&myMatrix, 0, Long2Fix(trackFrame.bottom));
-// SetMovieMatrix(qtexport->theMovie, &myMatrix);
+ // SetIdentityMatrix(&myMatrix);
+ // ScaleMatrix(&myMatrix, fixed1, Long2Fix(-1), 0, 0);
+ // TranslateMatrix(&myMatrix, 0, Long2Fix(trackFrame.bottom));
+ // SetMovieMatrix(qtexport->theMovie, &myMatrix);
qtexport->theMedia = NewTrackMedia (qtexport->theTrack,
- VideoMediaType,
- qtdata->kVideoTimeScale,
- nil,
- 0);
- CheckError( GetMoviesError(), "NewTrackMedia error", reports );
+ VideoMediaType,
+ qtdata->kVideoTimeScale,
+ nil,
+ 0);
+ CheckError(GetMoviesError(), "NewTrackMedia error", reports);
err = BeginMediaEdits (qtexport->theMedia);
- CheckError( err, "BeginMediaEdits error", reports );
+ CheckError(err, "BeginMediaEdits error", reports);
QT_StartAddVideoSamplesToMedia (&trackFrame, rectx, recty, reports);
}
@@ -378,14 +378,14 @@ static void QT_EndCreateMyVideoTrack(ReportList *reports)
QT_EndAddVideoSamplesToMedia ();
err = EndMediaEdits (qtexport->theMedia);
- CheckError( err, "EndMediaEdits error", reports );
+ CheckError(err, "EndMediaEdits error", reports);
err = InsertMediaIntoTrack (qtexport->theTrack,
- kTrackStart,/* track start time */
- kMediaStart,/* media start time */
- GetMediaDuration (qtexport->theMedia),
- fixed1);
- CheckError( err, "InsertMediaIntoTrack error", reports );
+ kTrackStart, /* track start time */
+ kMediaStart, /* media start time */
+ GetMediaDuration (qtexport->theMedia),
+ fixed1);
+ CheckError(err, "InsertMediaIntoTrack error", reports);
}
@@ -515,7 +515,7 @@ void filepath_qt(char *string, RenderData *rd)
BLI_make_existing_file(string);
if (BLI_strcasecmp(string + strlen(string) - 4, ".mov")) {
- sprintf(txt, "%04d-%04d.mov", (rd->sfra) , (rd->efra) );
+ sprintf(txt, "%04d-%04d.mov", (rd->sfra), (rd->efra));
strcat(string, txt);
}
}
@@ -684,7 +684,7 @@ static void check_renderbutton_framerate(RenderData *rd, ReportList *reports)
}
err = SCSetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
- CheckError( err, "SCSetInfo error", reports );
+ CheckError(err, "SCSetInfo error", reports);
if (qtdata->gTemporalSettings.frameRate == 1571553) { // 23.98 fps
qtdata->kVideoTimeScale = 24000;
diff --git a/source/blender/quicktime/apple/quicktime_import.c b/source/blender/quicktime/apple/quicktime_import.c
index a1f35935877..804f7b271de 100644
--- a/source/blender/quicktime/apple/quicktime_import.c
+++ b/source/blender/quicktime/apple/quicktime_import.c
@@ -176,7 +176,7 @@ char *get_valid_qtname(char *name)
#endif /* _WIN32 */
-int anim_is_quicktime (const char *name)
+int anim_is_quicktime(const char *name)
{
FSSpec theFSSpec;
char theFullPath[255];
@@ -195,16 +195,19 @@ int anim_is_quicktime (const char *name)
// don't let quicktime movie import handle these
if ( BLI_testextensie(name, ".swf") ||
- BLI_testextensie(name, ".txt") ||
- BLI_testextensie(name, ".mpg") ||
- BLI_testextensie(name, ".avi") || // wouldnt be appropriate ;)
- BLI_testextensie(name, ".tga") ||
- BLI_testextensie(name, ".png") ||
- BLI_testextensie(name, ".bmp") ||
- BLI_testextensie(name, ".jpg") ||
- BLI_testextensie(name, ".wav") ||
- BLI_testextensie(name, ".zip") ||
- BLI_testextensie(name, ".mp3")) return 0;
+ BLI_testextensie(name, ".txt") ||
+ BLI_testextensie(name, ".mpg") ||
+ BLI_testextensie(name, ".avi") || // wouldnt be appropriate ;)
+ BLI_testextensie(name, ".tga") ||
+ BLI_testextensie(name, ".png") ||
+ BLI_testextensie(name, ".bmp") ||
+ BLI_testextensie(name, ".jpg") ||
+ BLI_testextensie(name, ".wav") ||
+ BLI_testextensie(name, ".zip") ||
+ BLI_testextensie(name, ".mp3"))
+ {
+ return 0;
+ }
if (QTIME_DEBUG) printf("qt: checking as movie: %s\n", name);
@@ -252,7 +255,7 @@ int anim_is_quicktime (const char *name)
}
-void free_anim_quicktime (struct anim *anim)
+void free_anim_quicktime(struct anim *anim)
{
if (anim == NULL) return;
if (anim->qtime == NULL) return;
@@ -260,12 +263,12 @@ void free_anim_quicktime (struct anim *anim)
UnlockPixels(anim->qtime->offscreenPixMap);
if (anim->qtime->have_gw)
- DisposeGWorld( anim->qtime->offscreenGWorld );
+ DisposeGWorld(anim->qtime->offscreenGWorld);
if (anim->qtime->ibuf)
IMB_freeImBuf(anim->qtime->ibuf);
- DisposeMovie( anim->qtime->movie );
- CloseMovieFile( anim->qtime->movieRefNum );
+ DisposeMovie(anim->qtime->movie);
+ CloseMovieFile(anim->qtime->movieRefNum);
if (anim->qtime->frameIndex) MEM_freeN (anim->qtime->frameIndex);
if (anim->qtime) MEM_freeN (anim->qtime);
@@ -414,7 +417,7 @@ static int GetFirstVideoMedia(struct anim *anim)
anim->qtime->theMedia = GetTrackMedia(anim->qtime->theTrack);
if (anim->qtime->theMedia)
- GetMediaHandlerDescription(anim->qtime->theMedia,&mediaType, nil, nil);
+ GetMediaHandlerDescription(anim->qtime->theMedia, &mediaType, nil, nil);
if (mediaType == VideoMediaType) return 1;
}
@@ -437,7 +440,7 @@ static short GetFirstVideoTrackPixelDepth(struct anim *anim)
}
-int startquicktime (struct anim *anim)
+int startquicktime(struct anim *anim)
{
FSSpec theFSSpec;
@@ -451,7 +454,7 @@ int startquicktime (struct anim *anim)
#endif
short depth = 0;
- anim->qtime = MEM_callocN (sizeof(QuicktimeMovie),"animqt");
+ anim->qtime = MEM_callocN (sizeof(QuicktimeMovie), "animqt");
anim->qtime->have_gw = FALSE;
if (anim->qtime == NULL) {
@@ -582,13 +585,16 @@ int imb_is_a_quicktime (char *name)
if (QTIME_DEBUG) printf("qt: checking as image %s\n", name);
// don't let quicktime image import handle these
- if ( BLI_testextensie(name, ".swf") ||
- BLI_testextensie(name, ".txt") ||
- BLI_testextensie(name, ".mpg") ||
- BLI_testextensie(name, ".wav") ||
- BLI_testextensie(name, ".mov") || // not as image, doesn't work
- BLI_testextensie(name, ".avi") ||
- BLI_testextensie(name, ".mp3")) return 0;
+ if (BLI_testextensie(name, ".swf") ||
+ BLI_testextensie(name, ".txt") ||
+ BLI_testextensie(name, ".mpg") ||
+ BLI_testextensie(name, ".wav") ||
+ BLI_testextensie(name, ".mov") || // not as image, doesn't work
+ BLI_testextensie(name, ".avi") ||
+ BLI_testextensie(name, ".mp3"))
+ {
+ return 0;
+ }
sprintf(theFullPath, "%s", name);
#ifdef __APPLE__
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h
index 315995475e9..2a3c8e60638 100644
--- a/source/blender/render/extern/include/RE_pipeline.h
+++ b/source/blender/render/extern/include/RE_pipeline.h
@@ -82,7 +82,7 @@ typedef struct RenderLayer {
/* copy of RenderData */
char name[RE_MAXNAME];
- unsigned int lay, lay_zmask;
+ unsigned int lay, lay_zmask, lay_exclude;
int layflag, passflag, pass_xor;
struct Material *mat_override;
diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h
index 74255560025..f84b00451a6 100644
--- a/source/blender/render/intern/include/render_types.h
+++ b/source/blender/render/intern/include/render_types.h
@@ -525,13 +525,13 @@ typedef struct LampRen {
float shdwr, shdwg, shdwb;
float energy, haint;
int lay;
- float spotsi,spotbl;
+ float spotsi, spotbl;
float vec[3];
float xsp, ysp, distkw, inpr;
float halokw, halo;
short falloff_type;
- float ld1,ld2;
+ float ld1, ld2;
struct CurveMapping *curfalloff;
/* copied from Lamp, to decouple more rendering stuff */
diff --git a/source/blender/render/intern/include/sunsky.h b/source/blender/render/intern/include/sunsky.h
index 6a41517b113..0afd9246150 100644
--- a/source/blender/render/intern/include/sunsky.h
+++ b/source/blender/render/intern/include/sunsky.h
@@ -73,7 +73,7 @@ typedef struct SunSky
} SunSky;
void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_brightness,
- float spread,float sun_brightness, float sun_size, float back_scatter,
+ float spread, float sun_brightness, float sun_size, float back_scatter,
float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace);
void GetSkyXYZRadiance(struct SunSky *sunsky, float theta, float phi, float color_out[3]);
diff --git a/source/blender/render/intern/raytrace/bvh.h b/source/blender/render/intern/raytrace/bvh.h
index ac86a65ff0b..c38d9b1dcb4 100644
--- a/source/blender/render/intern/raytrace/bvh.h
+++ b/source/blender/render/intern/raytrace/bvh.h
@@ -88,9 +88,9 @@ static int rayobject_bb_intersect_test(const Isect *isec, const float *_bb)
RE_RC_COUNT(isec->raycounter->bb.test);
- if(t1x > t2y || t2x < t1y || t1x > t2z || t2x < t1z || t1y > t2z || t2y < t1z) return 0;
- if(t2x < 0.0 || t2y < 0.0 || t2z < 0.0) return 0;
- if(t1x > isec->dist || t1y > isec->dist || t1z > isec->dist) return 0;
+ if (t1x > t2y || t2x < t1y || t1x > t2z || t2x < t1z || t1y > t2z || t2y < t1z) return 0;
+ if (t2x < 0.0 || t2y < 0.0 || t2z < 0.0) return 0;
+ if (t1x > isec->dist || t1y > isec->dist || t1z > isec->dist) return 0;
RE_RC_COUNT(isec->raycounter->bb.hit);
return 1;
@@ -99,7 +99,7 @@ static int rayobject_bb_intersect_test(const Isect *isec, const float *_bb)
/* bvh tree generics */
template<class Tree> static void bvh_add(Tree *obj, RayObject *ob)
{
- rtbuild_add( obj->builder, ob );
+ rtbuild_add(obj->builder, ob);
}
template<class Node>
@@ -113,10 +113,10 @@ template<class Tree> static void bvh_done(Tree *obj);
template<class Tree>
static void bvh_free(Tree *obj)
{
- if(obj->builder)
+ if (obj->builder)
rtbuild_free(obj->builder);
- if(obj->node_arena)
+ if (obj->node_arena)
BLI_memarena_free(obj->node_arena);
MEM_freeN(obj);
@@ -125,7 +125,7 @@ static void bvh_free(Tree *obj)
template<class Tree>
static void bvh_bb(Tree *obj, float *min, float *max)
{
- if(obj->root)
+ if (obj->root)
bvh_node_merge_bb(obj->root, min, max);
}
@@ -149,13 +149,11 @@ template<class Node> static inline int bvh_node_hit_test(Node *node, Isect *isec
template<class Node>
static inline void bvh_node_merge_bb(Node *node, float *min, float *max)
{
- if(is_leaf(node))
- {
- RE_rayobject_merge_bb( (RayObject*)node, min, max);
+ if (is_leaf(node)) {
+ RE_rayobject_merge_bb((RayObject *)node, min, max);
}
- else
- {
- DO_MIN(node->bb , min);
+ else {
+ DO_MIN(node->bb, min);
DO_MAX(node->bb+3, max);
}
}
@@ -167,32 +165,28 @@ static inline void bvh_node_merge_bb(Node *node, float *min, float *max)
*/
template<class Node> static inline void bvh_node_push_childs(Node *node, Isect *isec, Node **stack, int &stack_pos);
-template<class Node,int MAX_STACK_SIZE,bool TEST_ROOT,bool SHADOW>
+template<class Node, int MAX_STACK_SIZE, bool TEST_ROOT, bool SHADOW>
static int bvh_node_stack_raycast(Node *root, Isect *isec)
{
Node *stack[MAX_STACK_SIZE];
int hit = 0, stack_pos = 0;
- if(!TEST_ROOT && !is_leaf(root))
+ if (!TEST_ROOT && !is_leaf(root))
bvh_node_push_childs(root, isec, stack, stack_pos);
else
stack[stack_pos++] = root;
- while(stack_pos)
- {
+ while (stack_pos) {
Node *node = stack[--stack_pos];
- if(!is_leaf(node))
- {
- if(bvh_node_hit_test(node,isec))
- {
+ if (!is_leaf(node)) {
+ if (bvh_node_hit_test(node, isec)) {
bvh_node_push_childs(node, isec, stack, stack_pos);
assert(stack_pos <= MAX_STACK_SIZE);
}
}
- else
- {
+ else {
hit |= RE_rayobject_intersect( (RayObject*)node, isec);
- if(SHADOW && hit) return hit;
+ if (SHADOW && hit) return hit;
}
}
return hit;
@@ -205,18 +199,16 @@ static int bvh_node_stack_raycast(Node *root, Isect *isec)
* this was created to be able to use any simd (with the cost of some memmoves)
* it can take advantage of any SIMD width and doens't needs any special tree care
*/
-template<class Node,int MAX_STACK_SIZE,bool TEST_ROOT>
+template<class Node, int MAX_STACK_SIZE, bool TEST_ROOT>
static int bvh_node_stack_raycast_simd(Node *root, Isect *isec)
{
Node *stack[MAX_STACK_SIZE];
int hit = 0, stack_pos = 0;
- if(!TEST_ROOT)
- {
- if(!is_leaf(root))
- {
- if(!is_leaf(root->child))
+ if (!TEST_ROOT) {
+ if (!is_leaf(root)) {
+ if (!is_leaf(root->child))
bvh_node_push_childs(root, isec, stack, stack_pos);
else
return RE_rayobject_intersect( (RayObject*)root->child, isec);
@@ -224,19 +216,16 @@ static int bvh_node_stack_raycast_simd(Node *root, Isect *isec)
else
return RE_rayobject_intersect( (RayObject*)root, isec);
}
- else
- {
- if(!is_leaf(root))
+ else {
+ if (!is_leaf(root))
stack[stack_pos++] = root;
else
return RE_rayobject_intersect( (RayObject*)root, isec);
}
- while(true)
- {
+ while (true) {
//Use SIMD 4
- if(stack_pos >= 4)
- {
+ if (stack_pos >= 4) {
__m128 t_bb[6];
Node * t_node[4];
@@ -253,20 +242,20 @@ static int bvh_node_stack_raycast_simd(Node *root, Isect *isec)
const float *bb2 = stack[stack_pos+2]->bb;
const float *bb3 = stack[stack_pos+3]->bb;
- const __m128 x0y0x1y1 = _mm_shuffle_ps( _mm_load_ps(bb0), _mm_load_ps(bb1), _MM_SHUFFLE(1,0,1,0) );
- const __m128 x2y2x3y3 = _mm_shuffle_ps( _mm_load_ps(bb2), _mm_load_ps(bb3), _MM_SHUFFLE(1,0,1,0) );
- t_bb[0] = _mm_shuffle_ps( x0y0x1y1, x2y2x3y3, _MM_SHUFFLE(2,0,2,0) );
- t_bb[1] = _mm_shuffle_ps( x0y0x1y1, x2y2x3y3, _MM_SHUFFLE(3,1,3,1) );
-
- const __m128 z0X0z1X1 = _mm_shuffle_ps( _mm_load_ps(bb0), _mm_load_ps(bb1), _MM_SHUFFLE(3,2,3,2) );
- const __m128 z2X2z3X3 = _mm_shuffle_ps( _mm_load_ps(bb2), _mm_load_ps(bb3), _MM_SHUFFLE(3,2,3,2) );
- t_bb[2] = _mm_shuffle_ps( z0X0z1X1, z2X2z3X3, _MM_SHUFFLE(2,0,2,0) );
- t_bb[3] = _mm_shuffle_ps( z0X0z1X1, z2X2z3X3, _MM_SHUFFLE(3,1,3,1) );
-
- const __m128 Y0Z0Y1Z1 = _mm_shuffle_ps( _mm_load_ps(bb0+4), _mm_load_ps(bb1+4), _MM_SHUFFLE(1,0,1,0) );
- const __m128 Y2Z2Y3Z3 = _mm_shuffle_ps( _mm_load_ps(bb2+4), _mm_load_ps(bb3+4), _MM_SHUFFLE(1,0,1,0) );
- t_bb[4] = _mm_shuffle_ps( Y0Z0Y1Z1, Y2Z2Y3Z3, _MM_SHUFFLE(2,0,2,0) );
- t_bb[5] = _mm_shuffle_ps( Y0Z0Y1Z1, Y2Z2Y3Z3, _MM_SHUFFLE(3,1,3,1) );
+ const __m128 x0y0x1y1 = _mm_shuffle_ps( _mm_load_ps(bb0), _mm_load_ps(bb1), _MM_SHUFFLE(1, 0, 1, 0) );
+ const __m128 x2y2x3y3 = _mm_shuffle_ps( _mm_load_ps(bb2), _mm_load_ps(bb3), _MM_SHUFFLE(1, 0, 1, 0) );
+ t_bb[0] = _mm_shuffle_ps( x0y0x1y1, x2y2x3y3, _MM_SHUFFLE(2, 0, 2, 0) );
+ t_bb[1] = _mm_shuffle_ps( x0y0x1y1, x2y2x3y3, _MM_SHUFFLE(3, 1, 3, 1) );
+
+ const __m128 z0X0z1X1 = _mm_shuffle_ps( _mm_load_ps(bb0), _mm_load_ps(bb1), _MM_SHUFFLE(3, 2, 3, 2) );
+ const __m128 z2X2z3X3 = _mm_shuffle_ps( _mm_load_ps(bb2), _mm_load_ps(bb3), _MM_SHUFFLE(3, 2, 3, 2) );
+ t_bb[2] = _mm_shuffle_ps( z0X0z1X1, z2X2z3X3, _MM_SHUFFLE(2, 0, 2, 0) );
+ t_bb[3] = _mm_shuffle_ps( z0X0z1X1, z2X2z3X3, _MM_SHUFFLE(3, 1, 3, 1) );
+
+ const __m128 Y0Z0Y1Z1 = _mm_shuffle_ps( _mm_load_ps(bb0+4), _mm_load_ps(bb1+4), _MM_SHUFFLE(1, 0, 1, 0) );
+ const __m128 Y2Z2Y3Z3 = _mm_shuffle_ps( _mm_load_ps(bb2+4), _mm_load_ps(bb3+4), _MM_SHUFFLE(1, 0, 1, 0) );
+ t_bb[4] = _mm_shuffle_ps( Y0Z0Y1Z1, Y2Z2Y3Z3, _MM_SHUFFLE(2, 0, 2, 0) );
+ t_bb[5] = _mm_shuffle_ps( Y0Z0Y1Z1, Y2Z2Y3Z3, _MM_SHUFFLE(3, 1, 3, 1) );
#if 0
for(int i=0; i<4; i++)
{
@@ -286,41 +275,33 @@ static int bvh_node_stack_raycast_simd(Node *root, Isect *isec)
RE_RC_COUNT(isec->raycounter->simd_bb.test);
int res = test_bb_group4( t_bb, isec );
- for(int i=0; i<4; i++)
- if(res & (1<<i))
- {
+ for (int i = 0; i < 4; i++)
+ if (res & (1 << i)) {
RE_RC_COUNT(isec->raycounter->simd_bb.hit);
- if(!is_leaf(t_node[i]))
- {
- for(Node *t=t_node[i]; t; t=t->sibling)
- {
+ if (!is_leaf(t_node[i])) {
+ for (Node *t = t_node[i]; t; t = t->sibling) {
assert(stack_pos < MAX_STACK_SIZE);
stack[stack_pos++] = t;
}
}
- else
- {
+ else {
hit |= RE_rayobject_intersect( (RayObject*)t_node[i], isec);
- if(hit && isec->mode == RE_RAY_SHADOW) return hit;
+ if (hit && isec->mode == RE_RAY_SHADOW) return hit;
}
}
}
- else if(stack_pos > 0)
- {
+ else if (stack_pos > 0) {
Node *node = stack[--stack_pos];
assert(!is_leaf(node));
- if(bvh_node_hit_test(node,isec))
- {
- if(!is_leaf(node->child))
- {
+ if (bvh_node_hit_test(node, isec)) {
+ if (!is_leaf(node->child)) {
bvh_node_push_childs(node, isec, stack, stack_pos);
assert(stack_pos <= MAX_STACK_SIZE);
}
- else
- {
+ else {
hit |= RE_rayobject_intersect( (RayObject*)node->child, isec);
- if(hit && isec->mode == RE_RAY_SHADOW) return hit;
+ if (hit && isec->mode == RE_RAY_SHADOW) return hit;
}
}
}
@@ -338,41 +319,41 @@ template<class Node>
static int bvh_node_raycast(Node *node, Isect *isec)
{
int hit = 0;
- if(bvh_test_node(node, isec))
+ if (bvh_test_node(node, isec))
{
- if(isec->idot_axis[node->split_axis] > 0.0f)
+ if (isec->idot_axis[node->split_axis] > 0.0f)
{
int i;
for(i=0; i<BVH_NCHILDS; i++)
- if(!is_leaf(node->child[i]))
+ if (!is_leaf(node->child[i]))
{
- if(node->child[i] == 0) break;
+ if (node->child[i] == 0) break;
hit |= bvh_node_raycast(node->child[i], isec);
- if(hit && isec->mode == RE_RAY_SHADOW) return hit;
+ if (hit && isec->mode == RE_RAY_SHADOW) return hit;
}
else
{
hit |= RE_rayobject_intersect( (RayObject*)node->child[i], isec);
- if(hit && isec->mode == RE_RAY_SHADOW) return hit;
+ if (hit && isec->mode == RE_RAY_SHADOW) return hit;
}
}
else
{
int i;
for(i=BVH_NCHILDS-1; i>=0; i--)
- if(!is_leaf(node->child[i]))
+ if (!is_leaf(node->child[i]))
{
- if(node->child[i])
+ if (node->child[i])
{
hit |= dfs_raycast(node->child[i], isec);
- if(hit && isec->mode == RE_RAY_SHADOW) return hit;
+ if (hit && isec->mode == RE_RAY_SHADOW) return hit;
}
}
else
{
hit |= RE_rayobject_intersect( (RayObject*)node->child[i], isec);
- if(hit && isec->mode == RE_RAY_SHADOW) return hit;
+ if (hit && isec->mode == RE_RAY_SHADOW) return hit;
}
}
}
@@ -380,33 +361,27 @@ static int bvh_node_raycast(Node *node, Isect *isec)
}
#endif
-template<class Node,class HintObject>
+template<class Node, class HintObject>
void bvh_dfs_make_hint(Node *node, LCTSHint *hint, int reserve_space, HintObject *hintObject)
{
- assert( hint->size + reserve_space + 1 <= RE_RAY_LCTS_MAX_SIZE );
+ assert(hint->size + reserve_space + 1 <= RE_RAY_LCTS_MAX_SIZE);
- if(is_leaf(node))
- {
+ if (is_leaf(node)) {
hint->stack[hint->size++] = (RayObject*)node;
}
- else
- {
+ else {
int childs = count_childs(node);
- if(hint->size + reserve_space + childs <= RE_RAY_LCTS_MAX_SIZE)
- {
+ if (hint->size + reserve_space + childs <= RE_RAY_LCTS_MAX_SIZE) {
int result = hint_test_bb(hintObject, node->bb, node->bb+3);
- if(result == HINT_RECURSE)
- {
+ if (result == HINT_RECURSE) {
/* We are 100% sure the ray will be pass inside this node */
bvh_dfs_make_hint_push_siblings(node->child, hint, reserve_space, hintObject);
}
- else if(result == HINT_ACCEPT)
- {
+ else if (result == HINT_ACCEPT) {
hint->stack[hint->size++] = (RayObject*)node;
}
}
- else
- {
+ else {
hint->stack[hint->size++] = (RayObject*)node;
}
}
@@ -421,7 +396,7 @@ template<class Tree, int DFS_STACK_SIZE>
static inline RayObject *bvh_create_tree(int size)
{
Tree *obj= (Tree*)MEM_callocN(sizeof(Tree), "BVHTree" );
- assert( RE_rayobject_isAligned(obj) ); /* RayObject API assumes real data to be 4-byte aligned */
+ assert(RE_rayobject_isAligned(obj)); /* RayObject API assumes real data to be 4-byte aligned */
obj->rayobj.api = bvh_get_api<Tree>(DFS_STACK_SIZE);
obj->root = NULL;
diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp
index b2f85e8429d..a2773ba218d 100644
--- a/source/blender/render/intern/raytrace/rayobject.cpp
+++ b/source/blender/render/intern/raytrace/rayobject.cpp
@@ -60,13 +60,11 @@ MALWAYS_INLINE RayObject* rayface_from_coords(RayFace *rayface, void *ob, void *
copy_v3_v3(rayface->v2, v2);
copy_v3_v3(rayface->v3, v3);
- if (v4)
- {
+ if (v4) {
copy_v3_v3(rayface->v4, v4);
rayface->quad = 1;
}
- else
- {
+ else {
rayface->quad = 0;
}
@@ -77,8 +75,7 @@ MALWAYS_INLINE void rayface_from_vlak(RayFace *rayface, ObjectInstanceRen *obi,
{
rayface_from_coords(rayface, obi, vlr, vlr->v1->co, vlr->v2->co, vlr->v3->co, vlr->v4 ? vlr->v4->co : NULL);
- if (obi->transform_primitives)
- {
+ if (obi->transform_primitives) {
mul_m4_v3(obi->mat, rayface->v1);
mul_m4_v3(obi->mat, rayface->v2);
mul_m4_v3(obi->mat, rayface->v3);
@@ -295,13 +292,11 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i
return 0;
/* check if we should intersect this face */
- if (is->check == RE_CHECK_VLR_RENDER)
- {
+ if (is->check == RE_CHECK_VLR_RENDER) {
if (vlr_check_intersect(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
return 0;
}
- else if (is->check == RE_CHECK_VLR_NON_SOLID_MATERIAL)
- {
+ else if (is->check == RE_CHECK_VLR_NON_SOLID_MATERIAL) {
if (vlr_check_intersect(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
return 0;
if (vlr_check_intersect_solid(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
@@ -322,27 +317,25 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i
/* when a shadow ray leaves a face, it can be little outside the edges
* of it, causing intersection to be detected in its neighbor face */
- if (is->skip & RE_SKIP_VLR_NEIGHBOUR)
- {
- if (dist < 0.1f && is->orig.ob == face->ob)
- {
+ if (is->skip & RE_SKIP_VLR_NEIGHBOUR) {
+ if (dist < 0.1f && is->orig.ob == face->ob) {
VlakRen * a = (VlakRen*)is->orig.face;
VlakRen * b = (VlakRen*)face->face;
/* so there's a shared edge or vertex, let's intersect ray with
* face itself, if that's true we can safely return 1, otherwise
* we assume the intersection is invalid, 0 */
- if (a->v1==b->v1 || a->v2==b->v1 || a->v3==b->v1 || a->v4==b->v1
- || a->v1==b->v2 || a->v2==b->v2 || a->v3==b->v2 || a->v4==b->v2
- || a->v1==b->v3 || a->v2==b->v3 || a->v3==b->v3 || a->v4==b->v3
- || (b->v4 && (a->v1==b->v4 || a->v2==b->v4 || a->v3==b->v4 || a->v4==b->v4))) {
+ if (a->v1==b->v1 || a->v2==b->v1 || a->v3==b->v1 || a->v4==b->v1 ||
+ a->v1==b->v2 || a->v2==b->v2 || a->v3==b->v2 || a->v4==b->v2 ||
+ a->v1==b->v3 || a->v2==b->v3 || a->v3==b->v3 || a->v4==b->v3 ||
+ (b->v4 && (a->v1==b->v4 || a->v2==b->v4 || a->v3==b->v4 || a->v4==b->v4)))
+ {
/* create RayFace from original face, transformed if necessary */
RayFace origface;
ObjectInstanceRen *ob= (ObjectInstanceRen*)is->orig.ob;
rayface_from_vlak(&origface, ob, (VlakRen*)is->orig.face);
- if (!isec_tri_quad_neighbour(is->start, is->dir, &origface))
- {
+ if (!isec_tri_quad_neighbour(is->start, is->dir, &origface)) {
return 0;
}
}
@@ -375,8 +368,7 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec)
RE_RC_COUNT(isec->raycounter->raycast.test);
/* setup vars used on raycast */
- for (i=0; i<3; i++)
- {
+ for (i=0; i<3; i++) {
isec->idot_axis[i] = 1.0f / isec->dir[i];
isec->bv_index[2*i] = isec->idot_axis[i] < 0.0 ? 1 : 0;
@@ -388,12 +380,10 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec)
#ifdef RT_USE_LAST_HIT
/* last hit heuristic */
- if (isec->mode==RE_RAY_SHADOW && isec->last_hit)
- {
+ if (isec->mode==RE_RAY_SHADOW && isec->last_hit) {
RE_RC_COUNT(isec->raycounter->rayshadow_last_hit.test);
- if (RE_rayobject_intersect(isec->last_hit, isec))
- {
+ if (RE_rayobject_intersect(isec->last_hit, isec)) {
RE_RC_COUNT(isec->raycounter->raycast.hit);
RE_RC_COUNT(isec->raycounter->rayshadow_last_hit.hit);
return 1;
@@ -405,8 +395,7 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec)
isec->hit_hint = 0;
#endif
- if (RE_rayobject_intersect(r, isec))
- {
+ if (RE_rayobject_intersect(r, isec)) {
RE_RC_COUNT(isec->raycounter->raycast.hit);
#ifdef RT_USE_HINT
@@ -420,12 +409,10 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec)
int RE_rayobject_intersect(RayObject *r, Isect *i)
{
- if (RE_rayobject_isRayFace(r))
- {
+ if (RE_rayobject_isRayFace(r)) {
return intersect_rayface(r, (RayFace*) RE_rayobject_align(r), i);
}
- else if (RE_rayobject_isVlakPrimitive(r))
- {
+ else if (RE_rayobject_isVlakPrimitive(r)) {
//TODO optimize (useless copy to RayFace to avoid duplicate code)
VlakPrimitive *face = (VlakPrimitive*) RE_rayobject_align(r);
RayFace nface;
@@ -433,8 +420,7 @@ int RE_rayobject_intersect(RayObject *r, Isect *i)
return intersect_rayface(r, &nface, i);
}
- else if (RE_rayobject_isRayAPI(r))
- {
+ else if (RE_rayobject_isRayAPI(r)) {
r = RE_rayobject_align(r);
return r->api->raycast(r, i);
}
@@ -466,12 +452,10 @@ void RE_rayobject_free(RayObject *r)
float RE_rayobject_cost(RayObject *r)
{
- if (RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r))
- {
+ if (RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r)) {
return 1.0f;
}
- else if (RE_rayobject_isRayAPI(r))
- {
+ else if (RE_rayobject_isRayAPI(r)) {
r = RE_rayobject_align(r);
return r->api->cost(r);
}
@@ -485,8 +469,7 @@ float RE_rayobject_cost(RayObject *r)
void RE_rayobject_merge_bb(RayObject *r, float *min, float *max)
{
- if (RE_rayobject_isRayFace(r))
- {
+ if (RE_rayobject_isRayFace(r)) {
RayFace *face = (RayFace*) RE_rayobject_align(r);
DO_MINMAX(face->v1, min, max);
@@ -494,8 +477,7 @@ void RE_rayobject_merge_bb(RayObject *r, float *min, float *max)
DO_MINMAX(face->v3, min, max);
if (RE_rayface_isQuad(face)) DO_MINMAX(face->v4, min, max);
}
- else if (RE_rayobject_isVlakPrimitive(r))
- {
+ else if (RE_rayobject_isVlakPrimitive(r)) {
VlakPrimitive *face = (VlakPrimitive*) RE_rayobject_align(r);
RayFace nface;
rayface_from_vlak(&nface, face->ob, face->face);
@@ -505,8 +487,7 @@ void RE_rayobject_merge_bb(RayObject *r, float *min, float *max)
DO_MINMAX(nface.v3, min, max);
if (RE_rayface_isQuad(&nface)) DO_MINMAX(nface.v4, min, max);
}
- else if (RE_rayobject_isRayAPI(r))
- {
+ else if (RE_rayobject_isRayAPI(r)) {
r = RE_rayobject_align(r);
r->api->bb(r, min, max);
}
@@ -518,12 +499,10 @@ void RE_rayobject_merge_bb(RayObject *r, float *min, float *max)
void RE_rayobject_hint_bb(RayObject *r, RayHint *hint, float *min, float *max)
{
- if (RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r))
- {
+ if (RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r)) {
return;
}
- else if (RE_rayobject_isRayAPI(r))
- {
+ else if (RE_rayobject_isRayAPI(r)) {
r = RE_rayobject_align(r);
return r->api->hint_bb(r, hint, min, max);
}
@@ -543,8 +522,7 @@ int RE_rayobjectcontrol_test_break(RayObjectControl *control)
void RE_rayobject_set_control(RayObject *r, void *data, RE_rayobjectcontrol_test_break_callback test_break)
{
- if (RE_rayobject_isRayAPI(r))
- {
+ if (RE_rayobject_isRayAPI(r)) {
r = RE_rayobject_align(r);
r->control.data = data;
r->control.test_break = test_break;
diff --git a/source/blender/render/intern/raytrace/rayobject_blibvh.cpp b/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
index 165b62cfbe4..8f1b730bf10 100644
--- a/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
@@ -102,8 +102,7 @@ static void bvh_callback(void *userdata, int index, const BVHTreeRay *UNUSED(ray
Isect *isec = data->isec;
RayObject *face = data->leafs[index];
- if (RE_rayobject_intersect(face,isec))
- {
+ if (RE_rayobject_intersect(face, isec)) {
hit->index = index;
if (isec->mode == RE_RAY_SHADOW)
@@ -137,8 +136,8 @@ static void RE_rayobject_blibvh_add(RayObject *o, RayObject *ob)
INIT_MINMAX(min_max, min_max+3);
RE_rayobject_merge_bb(ob, min_max, min_max+3);
- DO_MIN(min_max , obj->bb[0]);
- DO_MAX(min_max+3, obj->bb[1]);
+ DO_MIN(min_max, obj->bb[0]);
+ DO_MAX(min_max + 3, obj->bb[1]);
BLI_bvhtree_insert(obj->bvh, obj->next_leaf - obj->leafs, min_max, 2);
*(obj->next_leaf++) = ob;
diff --git a/source/blender/render/intern/raytrace/rayobject_hint.h b/source/blender/render/intern/raytrace/rayobject_hint.h
index 3689aa8ac17..37d9edb035d 100644
--- a/source/blender/render/intern/raytrace/rayobject_hint.h
+++ b/source/blender/render/intern/raytrace/rayobject_hint.h
@@ -44,7 +44,7 @@ struct HintBB
inline int hint_test_bb(HintBB *obj, float *Nmin, float *Nmax)
{
- if(bb_fits_inside( Nmin, Nmax, obj->bb, obj->bb+3 ) )
+ if (bb_fits_inside( Nmin, Nmax, obj->bb, obj->bb+3 ) )
return HINT_RECURSE;
else
return HINT_ACCEPT;
diff --git a/source/blender/render/intern/raytrace/rayobject_instance.cpp b/source/blender/render/intern/raytrace/rayobject_instance.cpp
index 2e803ce0fd3..ce88bac1587 100644
--- a/source/blender/render/intern/raytrace/rayobject_instance.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_instance.cpp
@@ -99,8 +99,7 @@ static int RE_rayobject_instance_intersect(RayObject *o, Isect *isec)
int changed = 0, i, res;
// TODO - this is disabling self intersection on instances
- if (isec->orig.ob == obj->ob && obj->ob)
- {
+ if (isec->orig.ob == obj->ob && obj->ob) {
changed = 1;
isec->orig.ob = obj->target_ob;
}
@@ -117,8 +116,7 @@ static int RE_rayobject_instance_intersect(RayObject *o, Isect *isec)
isec->dist *= normalize_v3(isec->dir);
// update idot_axis and bv_index
- for (i=0; i<3; i++)
- {
+ for (i=0; i<3; i++) {
isec->idot_axis[i] = 1.0f / isec->dir[i];
isec->bv_index[2*i] = isec->idot_axis[i] < 0.0 ? 1 : 0;
@@ -132,12 +130,10 @@ static int RE_rayobject_instance_intersect(RayObject *o, Isect *isec)
res = RE_rayobject_intersect(obj->target, isec);
// map dist into original coordinate space
- if (res == 0)
- {
+ if (res == 0) {
isec->dist = dist;
}
- else
- {
+ else {
// note we don't just multiply dist, because of possible
// non-uniform scaling in the transform matrix
float vec[3];
@@ -165,8 +161,7 @@ static int RE_rayobject_instance_intersect(RayObject *o, Isect *isec)
isec->orig.ob = obj->ob;
// restore bv_index
- for (i=0; i<3; i++)
- {
+ for (i=0; i<3; i++) {
isec->bv_index[2*i] = isec->idot_axis[i] < 0.0 ? 1 : 0;
isec->bv_index[2*i+1] = 1 - isec->bv_index[2*i];
@@ -202,8 +197,7 @@ static void RE_rayobject_instance_bb(RayObject *o, float *min, float *max)
RE_rayobject_merge_bb(obj->target, m, M);
//There must be a faster way than rotating all the 8 vertexs of the BB
- for (i=0; i<8; i++)
- {
+ for (i=0; i<8; i++) {
for (j=0; j<3; j++) t[j] = i&(1<<j) ? M[j] : m[j];
mul_m4_v3(obj->target2global, t);
DO_MINMAX(t, min, max);
diff --git a/source/blender/render/intern/raytrace/rayobject_octree.cpp b/source/blender/render/intern/raytrace/rayobject_octree.cpp
index ea1d5c2573c..dc7b6dd6e8d 100644
--- a/source/blender/render/intern/raytrace/rayobject_octree.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_octree.cpp
@@ -74,7 +74,7 @@ typedef struct Octree {
struct Branch **adrbranch;
struct Node **adrnode;
float ocsize; /* ocsize: mult factor, max size octree */
- float ocfacx,ocfacy,ocfacz;
+ float ocfacx, ocfacy, ocfacz;
float min[3], max[3];
int ocres;
int branchcount, nodecount;
@@ -216,7 +216,7 @@ static Node *addnode(Octree *oc)
index= oc->nodecount>>12;
if (oc->adrnode[index]==NULL)
- oc->adrnode[index]= (Node*)MEM_callocN(4096*sizeof(Node),"addnode");
+ oc->adrnode[index]= (Node*)MEM_callocN(4096*sizeof(Node), "addnode");
if (oc->nodecount> NODE_ARRAY*NODE_ARRAY) {
printf("error; octree nodes full\n");
@@ -233,7 +233,7 @@ static int face_in_node(RayFace *face, short x, short y, short z, float rtf[][3]
// init static vars
if (face) {
- normal_tri_v3( nor,rtf[0], rtf[1], rtf[2]);
+ normal_tri_v3(nor, rtf[0], rtf[1], rtf[2]);
d= -nor[0]*rtf[0][0] - nor[1]*rtf[0][1] - nor[2]*rtf[0][2];
return 0;
}
@@ -297,15 +297,15 @@ static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short
oc4= ((x & 8)+(y & 4)+(z & 2))>>1;
oc5= ((x & 4)+(y & 2)+(z & 1));
- br= addbranch(oc, br,oc0);
- br= addbranch(oc, br,oc1);
- br= addbranch(oc, br,oc2);
- br= addbranch(oc, br,oc3);
- br= addbranch(oc, br,oc4);
+ br= addbranch(oc, br, oc0);
+ br= addbranch(oc, br, oc1);
+ br= addbranch(oc, br, oc2);
+ br= addbranch(oc, br, oc3);
+ br= addbranch(oc, br, oc4);
no= (Node *)br->b[oc5];
if (no==NULL) br->b[oc5]= (Branch *)(no= addnode(oc));
- while(no->next) no= no->next;
+ while (no->next) no = no->next;
a= 0;
if (no->v[7]) { /* node full */
@@ -313,7 +313,7 @@ static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short
no= no->next;
}
else {
- while(no->v[a]!=NULL) a++;
+ while (no->v[a] != NULL) a++;
}
no->v[a]= (RayFace*) RE_rayobject_align(face);
@@ -326,10 +326,10 @@ static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short
static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocface, short rts[][3], float rtf[][3])
{
- int ocx1,ocx2,ocy1,ocy2;
- int x,y,dx=0,dy=0;
- float ox1,ox2,oy1,oy2;
- float labda,labdao,labdax,labday,ldx,ldy;
+ int ocx1, ocx2, ocy1, ocy2;
+ int x, y, dx=0, dy=0;
+ float ox1, ox2, oy1, oy2;
+ float labda, labdao, labdax, labday, ldx, ldy;
ocx1= rts[b1][c1];
ocy1= rts[b1][c2];
@@ -383,7 +383,7 @@ static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocfa
x=ocx1; y=ocy1;
labda= MIN2(labdax, labday);
- while(TRUE) {
+ while (TRUE) {
if (x<0 || y<0 || x>=oc->ocres || y>=oc->ocres);
else ocface[oc->ocres*x+y]= 1;
@@ -405,7 +405,7 @@ static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocfa
y+=dy;
}
}
- labda=MIN2(labdax,labday);
+ labda=MIN2(labdax, labday);
if (labda==labdao) break;
if (labda>=1.0f) break;
}
@@ -421,7 +421,7 @@ static void filltriangle(Octree *oc, short c1, short c2, char *ocface, short *oc
for (y=ocmin[c2];y<=ocmax[c2];y++) {
if (ocface[a+y]) {
y++;
- while(ocface[a+y] && y!=ocmax[c2]) y++;
+ while (ocface[a+y] && y!=ocmax[c2]) y++;
for (y1=ocmax[c2];y1>y;y1--) {
if (ocface[a+y1]) {
for (y2=y;y2<=y1;y2++) ocface[a+y2]=1;
@@ -449,7 +449,7 @@ static void RE_rayobject_octree_free(RayObject *tree)
if (oc->adrbranch) {
int a= 0;
- while(oc->adrbranch[a]) {
+ while (oc->adrbranch[a]) {
MEM_freeN(oc->adrbranch[a]);
oc->adrbranch[a]= NULL;
a++;
@@ -461,7 +461,7 @@ static void RE_rayobject_octree_free(RayObject *tree)
if (oc->adrnode) {
int a= 0;
- while(oc->adrnode[a]) {
+ while (oc->adrnode[a]) {
MEM_freeN(oc->adrnode[a]);
oc->adrnode[a]= NULL;
a++;
@@ -541,13 +541,13 @@ static void octree_fill_rayface(Octree *oc, RayFace *face)
oc2= rts[1][c];
oc3= rts[2][c];
if (!RE_rayface_isQuad(face)) {
- ocmin[c]= MIN3(oc1,oc2,oc3);
- ocmax[c]= MAX3(oc1,oc2,oc3);
+ ocmin[c]= MIN3(oc1, oc2, oc3);
+ ocmax[c]= MAX3(oc1, oc2, oc3);
}
else {
oc4= rts[3][c];
- ocmin[c]= MIN4(oc1,oc2,oc3,oc4);
- ocmax[c]= MAX4(oc1,oc2,oc3,oc4);
+ ocmin[c]= MIN4(oc1, oc2, oc3, oc4);
+ ocmax[c]= MAX4(oc1, oc2, oc3, oc4);
}
if (ocmax[c]>oc->ocres-1) ocmax[c]=oc->ocres-1;
if (ocmin[c]<0) ocmin[c]=0;
@@ -558,32 +558,32 @@ static void octree_fill_rayface(Octree *oc, RayFace *face)
}
else {
- d2dda(oc, 0,1,0,1,ocface+ocres2,rts,rtf);
- d2dda(oc, 0,1,0,2,ocface,rts,rtf);
- d2dda(oc, 0,1,1,2,ocface+2*ocres2,rts,rtf);
- d2dda(oc, 1,2,0,1,ocface+ocres2,rts,rtf);
- d2dda(oc, 1,2,0,2,ocface,rts,rtf);
- d2dda(oc, 1,2,1,2,ocface+2*ocres2,rts,rtf);
+ d2dda(oc, 0, 1, 0, 1, ocface+ocres2, rts, rtf);
+ d2dda(oc, 0, 1, 0, 2, ocface, rts, rtf);
+ d2dda(oc, 0, 1, 1, 2, ocface+2*ocres2, rts, rtf);
+ d2dda(oc, 1, 2, 0, 1, ocface+ocres2, rts, rtf);
+ d2dda(oc, 1, 2, 0, 2, ocface, rts, rtf);
+ d2dda(oc, 1, 2, 1, 2, ocface+2*ocres2, rts, rtf);
if (!RE_rayface_isQuad(face)) {
- d2dda(oc, 2,0,0,1,ocface+ocres2,rts,rtf);
- d2dda(oc, 2,0,0,2,ocface,rts,rtf);
- d2dda(oc, 2,0,1,2,ocface+2*ocres2,rts,rtf);
+ d2dda(oc, 2, 0, 0, 1, ocface+ocres2, rts, rtf);
+ d2dda(oc, 2, 0, 0, 2, ocface, rts, rtf);
+ d2dda(oc, 2, 0, 1, 2, ocface+2*ocres2, rts, rtf);
}
else {
- d2dda(oc, 2,3,0,1,ocface+ocres2,rts,rtf);
- d2dda(oc, 2,3,0,2,ocface,rts,rtf);
- d2dda(oc, 2,3,1,2,ocface+2*ocres2,rts,rtf);
- d2dda(oc, 3,0,0,1,ocface+ocres2,rts,rtf);
- d2dda(oc, 3,0,0,2,ocface,rts,rtf);
- d2dda(oc, 3,0,1,2,ocface+2*ocres2,rts,rtf);
+ d2dda(oc, 2, 3, 0, 1, ocface+ocres2, rts, rtf);
+ d2dda(oc, 2, 3, 0, 2, ocface, rts, rtf);
+ d2dda(oc, 2, 3, 1, 2, ocface+2*ocres2, rts, rtf);
+ d2dda(oc, 3, 0, 0, 1, ocface+ocres2, rts, rtf);
+ d2dda(oc, 3, 0, 0, 2, ocface, rts, rtf);
+ d2dda(oc, 3, 0, 1, 2, ocface+2*ocres2, rts, rtf);
}
/* nothing todo with triangle..., just fills :) */
- filltriangle(oc, 0,1,ocface+ocres2,ocmin,ocmax);
- filltriangle(oc, 0,2,ocface,ocmin,ocmax);
- filltriangle(oc, 1,2,ocface+2*ocres2,ocmin,ocmax);
+ filltriangle(oc, 0, 1, ocface+ocres2, ocmin, ocmax);
+ filltriangle(oc, 0, 2, ocface, ocmin, ocmax);
+ filltriangle(oc, 1, 2, ocface+2*ocres2, ocmin, ocmax);
/* init static vars here */
- face_in_node(face, 0,0,0, rtf);
+ face_in_node(face, 0, 0, 0, rtf);
for (x=ocmin[0];x<=ocmax[0];x++) {
a= oc->ocres*x;
@@ -593,7 +593,7 @@ static void octree_fill_rayface(Octree *oc, RayFace *face)
for (z=ocmin[2];z<=ocmax[2];z++) {
if (ocface[b+z] && ocface[a+z]) {
if (face_in_node(NULL, x, y, z, rtf))
- ocwrite(oc, face, RE_rayface_isQuad(face), x,y,z, rtf);
+ ocwrite(oc, face, RE_rayface_isQuad(face), x, y, z, rtf);
}
}
}
@@ -658,8 +658,7 @@ static void RE_rayobject_octree_done(RayObject *tree)
oc->ocsize= sqrt(t00*t00+t01*t01+t02*t02); /* global, max size octree */
- for (c=0; c<oc->ro_nodes_used; c++)
- {
+ for (c=0; c<oc->ro_nodes_used; c++) {
octree_fill_rayface(oc, oc->ro_nodes[c]);
}
@@ -683,42 +682,41 @@ static void RE_rayobject_octree_bb(RayObject *tree, float *min, float *max)
/* check all faces in this node */
static int testnode(Octree *UNUSED(oc), Isect *is, Node *no, OcVal ocval)
{
- short nr=0;
+ short nr = 0;
/* return on any first hit */
- if (is->mode==RE_RAY_SHADOW) {
+ if (is->mode == RE_RAY_SHADOW) {
- for (; no; no = no->next)
- for (nr=0; nr<8; nr++)
- {
- RayFace *face = no->v[nr];
- OcVal *ov = no->ov+nr;
-
- if (!face) break;
-
- if ( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) )
- {
- if ( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) )
- return 1;
+ for ( ; no; no = no->next) {
+ for (nr = 0; nr < 8; nr++) {
+ RayFace *face = no->v[nr];
+ OcVal *ov = no->ov + nr;
+
+ if (!face) break;
+
+ if ( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) ) {
+ if ( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face), is) )
+ return 1;
+ }
}
}
}
- else
- { /* else mirror or glass or shadowtra, return closest face */
+ else {
+ /* else mirror or glass or shadowtra, return closest face */
int found= 0;
- for (; no; no = no->next)
- for (nr=0; nr<8; nr++)
- {
- RayFace *face = no->v[nr];
- OcVal *ov = no->ov+nr;
-
- if (!face) break;
-
- if ( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) )
- {
- if ( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) )
- found= 1;
+ for ( ; no; no = no->next) {
+ for (nr = 0; nr < 8; nr++) {
+ RayFace *face = no->v[nr];
+ OcVal *ov = no->ov + nr;
+
+ if (!face) break;
+
+ if ( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) ) {
+ if ( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face), is) ) {
+ found = 1;
+ }
+ }
}
}
@@ -851,12 +849,12 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
Node *no;
OcVal ocval;
float vec1[3], vec2[3], start[3], end[3];
- float u1,u2,ox1,ox2,oy1,oy2,oz1,oz2;
- float labdao,labdax,ldx,labday,ldy,labdaz,ldz, ddalabda;
+ float u1, u2, ox1, ox2, oy1, oy2, oz1, oz2;
+ float labdao, labdax, ldx, labday, ldy, labdaz, ldz, ddalabda;
float olabda = 0;
- int dx,dy,dz;
- int xo,yo,zo,c1=0;
- int ocx1,ocx2,ocy1, ocy2,ocz1,ocz2;
+ int dx, dy, dz;
+ int xo, yo, zo, c1=0;
+ int ocx1, ocx2, ocy1, ocy2, ocz1, ocz2;
/* clip with octree */
if (oc->branchcount==0) return 0;
@@ -877,14 +875,14 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
u2= 1.0f;
/* clip with octree cube */
- if (cliptest(-ldx, start[0]-oc->min[0], &u1,&u2)) {
- if (cliptest(ldx, oc->max[0]-start[0], &u1,&u2)) {
+ if (cliptest(-ldx, start[0]-oc->min[0], &u1, &u2)) {
+ if (cliptest(ldx, oc->max[0]-start[0], &u1, &u2)) {
ldy= is->dir[1]*is->dist;
- if (cliptest(-ldy, start[1]-oc->min[1], &u1,&u2)) {
- if (cliptest(ldy, oc->max[1]-start[1], &u1,&u2)) {
+ if (cliptest(-ldy, start[1]-oc->min[1], &u1, &u2)) {
+ if (cliptest(ldy, oc->max[1]-start[1], &u1, &u2)) {
ldz = is->dir[2]*is->dist;
- if (cliptest(-ldz, start[2]-oc->min[2], &u1,&u2)) {
- if (cliptest(ldz, oc->max[2]-start[2], &u1,&u2)) {
+ if (cliptest(-ldz, start[2]-oc->min[2], &u1, &u2)) {
+ if (cliptest(ldz, oc->max[2]-start[2], &u1, &u2)) {
c1=1;
if (u2<1.0f) {
end[0] = start[0]+u2*ldx;
@@ -936,7 +934,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
}
else {
int found = 0;
- //static int coh_ocx1,coh_ocx2,coh_ocy1, coh_ocy2,coh_ocz1,coh_ocz2;
+ //static int coh_ocx1, coh_ocx2, coh_ocy1, coh_ocy2, coh_ocz1, coh_ocz2;
float dox, doy, doz;
int eqval;
@@ -994,7 +992,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
}
xo=ocx1; yo=ocy1; zo=ocz1;
- ddalabda= MIN3(labdax,labday,labdaz);
+ ddalabda= MIN3(labdax, labday, labdaz);
vec2[0]= ox1;
vec2[1]= oy1;
@@ -1003,14 +1001,14 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
/* this loop has been constructed to make sure the first and last node of ray
* are always included, even when ddalabda==1.0f or larger */
- while(TRUE) {
+ while (TRUE) {
no= ocread(oc, xo, yo, zo);
if (no) {
/* calculate ray intersection with octree node */
copy_v3_v3(vec1, vec2);
- // dox,y,z is negative
+ // dox, y, z is negative
vec2[0]= ox1-ddalabda*dox;
vec2[1]= oy1-ddalabda*doy;
vec2[2]= oz1-ddalabda*doz;
@@ -1084,7 +1082,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
}
- ddalabda=MIN3(labdax,labday,labdaz);
+ ddalabda=MIN3(labdax, labday, labdaz);
if (ddalabda==labdao) break;
/* to make sure the last node is always checked */
if (labdao>=1.0f) break;
diff --git a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
index 2edf1593e99..bfcfbee536f 100644
--- a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
@@ -71,15 +71,14 @@ void bvh_done<QBVHTree>(QBVHTree *obj)
//TODO do this in 1 pass (half memory usage during building)
VBVHNode *root = BuildBinaryVBVH<VBVHNode>(arena1, &obj->rayobj.control).transform(obj->builder);
- if (RE_rayobjectcontrol_test_break(&obj->rayobj.control))
- {
+ if (RE_rayobjectcontrol_test_break(&obj->rayobj.control)) {
BLI_memarena_free(arena1);
BLI_memarena_free(arena2);
return;
}
if (root) {
- pushup_simd<VBVHNode,4>(root);
+ pushup_simd<VBVHNode, 4>(root);
obj->root = Reorganize_SVBVH<VBVHNode>(arena2).transform(root);
}
else
@@ -101,9 +100,9 @@ int intersect(QBVHTree *obj, Isect* isec)
//TODO renable hint support
if (RE_rayobject_isAligned(obj->root)) {
if (isec->mode == RE_RAY_SHADOW)
- return svbvh_node_stack_raycast<StackSize,true>(obj->root, isec);
+ return svbvh_node_stack_raycast<StackSize, true>(obj->root, isec);
else
- return svbvh_node_stack_raycast<StackSize,false>(obj->root, isec);
+ return svbvh_node_stack_raycast<StackSize, false>(obj->root, isec);
}
else
return RE_rayobject_intersect((RayObject*)obj->root, isec);
@@ -124,13 +123,13 @@ RayObjectAPI make_api()
{
static RayObjectAPI api =
{
- (RE_rayobject_raycast_callback) ((int(*)(Tree*,Isect*)) &intersect<STACK_SIZE>),
- (RE_rayobject_add_callback) ((void(*)(Tree*,RayObject*)) &bvh_add<Tree>),
+ (RE_rayobject_raycast_callback) ((int(*)(Tree*, Isect*)) &intersect<STACK_SIZE>),
+ (RE_rayobject_add_callback) ((void(*)(Tree*, RayObject*)) &bvh_add<Tree>),
(RE_rayobject_done_callback) ((void(*)(Tree*)) &bvh_done<Tree>),
(RE_rayobject_free_callback) ((void(*)(Tree*)) &bvh_free<Tree>),
- (RE_rayobject_merge_bb_callback)((void(*)(Tree*,float*,float*)) &bvh_bb<Tree>),
+ (RE_rayobject_merge_bb_callback)((void(*)(Tree*, float*, float*)) &bvh_bb<Tree>),
(RE_rayobject_cost_callback) ((float(*)(Tree*)) &bvh_cost<Tree>),
- (RE_rayobject_hint_bb_callback) ((void(*)(Tree*,LCTSHint*,float*,float*)) &bvh_hint_bb<Tree>)
+ (RE_rayobject_hint_bb_callback) ((void(*)(Tree*, LCTSHint*, float*, float*)) &bvh_hint_bb<Tree>)
};
return api;
@@ -139,7 +138,7 @@ RayObjectAPI make_api()
template<class Tree>
RayObjectAPI* bvh_get_api(int maxstacksize)
{
- static RayObjectAPI bvh_api256 = make_api<Tree,1024>();
+ static RayObjectAPI bvh_api256 = make_api<Tree, 1024>();
if (maxstacksize <= 1024) return &bvh_api256;
assert(maxstacksize <= 256);
@@ -148,7 +147,7 @@ RayObjectAPI* bvh_get_api(int maxstacksize)
RayObject *RE_rayobject_qbvh_create(int size)
{
- return bvh_create_tree<QBVHTree,DFS_STACK_SIZE>(size);
+ return bvh_create_tree<QBVHTree, DFS_STACK_SIZE>(size);
}
#else
diff --git a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
index 54901db8bdd..eb3bdb37f9d 100644
--- a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
@@ -66,7 +66,7 @@ static void rtbuild_init(RTBuilder *b)
RTBuilder* rtbuild_create(int size)
{
RTBuilder *builder = (RTBuilder*) MEM_mallocN( sizeof(RTBuilder), "RTBuilder" );
- RTBuilder::Object *memblock= (RTBuilder::Object*)MEM_mallocN( sizeof(RTBuilder::Object)*size,"RTBuilder.objects");
+ RTBuilder::Object *memblock= (RTBuilder::Object*)MEM_mallocN( sizeof(RTBuilder::Object)*size, "RTBuilder.objects");
rtbuild_init(builder);
@@ -74,9 +74,8 @@ RTBuilder* rtbuild_create(int size)
builder->primitives.begin = builder->primitives.end = memblock;
builder->primitives.maxsize = size;
- for (int i=0; i<3; i++)
- {
- builder->sorted_begin[i] = (RTBuilder::Object**)MEM_mallocN( sizeof(RTBuilder::Object*)*size,"RTBuilder.sorted_objects");
+ for (int i=0; i<3; i++) {
+ builder->sorted_begin[i] = (RTBuilder::Object**)MEM_mallocN( sizeof(RTBuilder::Object*)*size, "RTBuilder.sorted_objects");
builder->sorted_end[i] = builder->sorted_begin[i];
}
@@ -124,8 +123,7 @@ void rtbuild_add(RTBuilder *b, RayObject *o)
b->primitives.end->obj = o;
b->primitives.end->cost = RE_rayobject_cost(o);
- for (int i=0; i<3; i++)
- {
+ for (int i=0; i<3; i++) {
*(b->sorted_end[i]) = b->primitives.end;
b->sorted_end[i]++;
}
@@ -138,7 +136,7 @@ int rtbuild_size(RTBuilder *b)
}
-template<class Obj,int Axis>
+template<class Obj, int Axis>
static bool obj_bb_compare(const Obj &a, const Obj &b)
{
if (a->bb[Axis] != b->bb[Axis])
@@ -149,17 +147,16 @@ static bool obj_bb_compare(const Obj &a, const Obj &b)
template<class Item>
static void object_sort(Item *begin, Item *end, int axis)
{
- if (axis == 0) return std::sort(begin, end, obj_bb_compare<Item,0> );
- if (axis == 1) return std::sort(begin, end, obj_bb_compare<Item,1> );
- if (axis == 2) return std::sort(begin, end, obj_bb_compare<Item,2> );
+ if (axis == 0) return std::sort(begin, end, obj_bb_compare<Item, 0> );
+ if (axis == 1) return std::sort(begin, end, obj_bb_compare<Item, 1> );
+ if (axis == 2) return std::sort(begin, end, obj_bb_compare<Item, 2> );
assert(false);
}
void rtbuild_done(RTBuilder *b, RayObjectControl* ctrl)
{
for (int i=0; i<3; i++)
- if (b->sorted_begin[i])
- {
+ if (b->sorted_begin[i]) {
if (RE_rayobjectcontrol_test_break(ctrl)) break;
object_sort( b->sorted_begin[i], b->sorted_end[i], i );
}
@@ -175,13 +172,11 @@ RTBuilder* rtbuild_get_child(RTBuilder *b, int child, RTBuilder *tmp)
rtbuild_init( tmp );
for (int i=0; i<3; i++)
- if (b->sorted_begin[i])
- {
+ if (b->sorted_begin[i]) {
tmp->sorted_begin[i] = b->sorted_begin[i] + b->child_offset[child ];
tmp->sorted_end [i] = b->sorted_begin[i] + b->child_offset[child+1];
}
- else
- {
+ else {
tmp->sorted_begin[i] = 0;
tmp->sorted_end [i] = 0;
}
@@ -191,10 +186,9 @@ RTBuilder* rtbuild_get_child(RTBuilder *b, int child, RTBuilder *tmp)
void rtbuild_calc_bb(RTBuilder *b)
{
- if (b->bb[0] == 1.0e30f)
- {
+ if (b->bb[0] == 1.0e30f) {
for (RTBuilder::Object **index = b->sorted_begin[0]; index != b->sorted_end[0]; index++)
- RE_rayobject_merge_bb( (*index)->obj , b->bb, b->bb+3);
+ RE_rayobject_merge_bb( (*index)->obj, b->bb, b->bb+3);
}
}
@@ -312,7 +306,7 @@ int rtbuild_median_split_largest_axis(RTBuilder *b, int nchilds)
rtbuild_calc_bb(b);
- la = bb_largest_axis(b->bb,b->bb+3);
+ la = bb_largest_axis(b->bb, b->bb+3);
for (i=1; i<nchilds; i++)
separators[i-1] = (b->bb[la+3]-b->bb[la])*i / nchilds;
@@ -337,30 +331,25 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
assert(size > 1);
int baxis = -1, boffset = 0;
- if (size > nchilds)
- {
+ if (size > nchilds) {
float bcost = FLT_MAX;
baxis = -1, boffset = size/2;
SweepCost *sweep = (SweepCost*)MEM_mallocN( sizeof(SweepCost)*size, "RTBuilder.HeuristicSweep" );
- for (int axis=0; axis<3; axis++)
- {
+ for (int axis=0; axis<3; axis++) {
SweepCost sweep_left;
RTBuilder::Object **obj = b->sorted_begin[axis];
// float right_cost = 0;
- for (int i=size-1; i>=0; i--)
- {
- if (i == size-1)
- {
+ for (int i=size-1; i>=0; i--) {
+ if (i == size-1) {
copy_v3_v3(sweep[i].bb, obj[i]->bb);
copy_v3_v3(sweep[i].bb+3, obj[i]->bb+3);
sweep[i].cost = obj[i]->cost;
}
- else
- {
+ else {
sweep[i].bb[0] = MIN2(obj[i]->bb[0], sweep[i+1].bb[0]);
sweep[i].bb[1] = MIN2(obj[i]->bb[1], sweep[i+1].bb[1]);
sweep[i].bb[2] = MIN2(obj[i]->bb[2], sweep[i+1].bb[2]);
@@ -382,8 +371,7 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
// right_cost -= obj[0]->cost; if (right_cost < 0) right_cost = 0;
- for (int i=1; i<size; i++)
- {
+ for (int i=1; i<size; i++) {
//Worst case heuristic (cost of each child is linear)
float hcost, left_side, right_side;
@@ -401,9 +389,8 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
if (left_side > bcost) break; //No way we can find a better heuristic in this axis
assert(hcost >= 0);
- if ( hcost < bcost
- || (hcost == bcost && axis < baxis)) //this makes sure the tree built is the same whatever is the order of the sorting axis
- {
+ // this makes sure the tree built is the same whatever is the order of the sorting axis
+ if ( hcost < bcost || (hcost == bcost && axis < baxis)) {
bcost = hcost;
baxis = axis;
boffset = i;
@@ -423,13 +410,11 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
MEM_freeN(sweep);
}
- else if (size == 2)
- {
+ else if (size == 2) {
baxis = 0;
boffset = 1;
}
- else if (size == 1)
- {
+ else if (size == 1) {
b->child_offset[0] = 0;
b->child_offset[1] = 1;
return 1;
@@ -464,9 +449,9 @@ static void split_leafs(RTBuilder *b, int *nth, int partitions, int split_axis)
{
assert(nth[i] < nth[i+1] && nth[i+1] < nth[partitions]);
- if (split_axis == 0) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,0>);
- if (split_axis == 1) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,1>);
- if (split_axis == 2) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,2>);
+ if (split_axis == 0) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object, 0>);
+ if (split_axis == 1) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object, 1>);
+ if (split_axis == 2) std::nth_element(b, nth[i], nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object, 2>);
}
}
#endif
@@ -500,15 +485,13 @@ int bb_largest_axis(float *min, float *max)
sub[0] = max[0]-min[0];
sub[1] = max[1]-min[1];
sub[2] = max[2]-min[2];
- if (sub[0] > sub[1])
- {
+ if (sub[0] > sub[1]) {
if (sub[0] > sub[2])
return 0;
else
return 2;
}
- else
- {
+ else {
if (sub[1] > sub[2])
return 1;
else
diff --git a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
index 4c2099eb1e3..3cf2b4b5d5f 100644
--- a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
@@ -79,12 +79,10 @@ void bvh_done<SVBVHTree>(SVBVHTree *obj)
BLI_memarena_use_align(arena2, 16);
//Build and optimize the tree
- if (0)
- {
+ if (0) {
VBVHNode *root = BuildBinaryVBVH<VBVHNode>(arena1, &obj->rayobj.control).transform(obj->builder);
- if (RE_rayobjectcontrol_test_break(&obj->rayobj.control))
- {
+ if (RE_rayobjectcontrol_test_break(&obj->rayobj.control)) {
BLI_memarena_free(arena1);
BLI_memarena_free(arena2);
return;
@@ -96,25 +94,23 @@ void bvh_done<SVBVHTree>(SVBVHTree *obj)
pushup(root);
pushdown(root);
- pushup_simd<VBVHNode,4>(root);
+ pushup_simd<VBVHNode, 4>(root);
obj->root = Reorganize_SVBVH<VBVHNode>(arena2).transform(root);
}
- else
- {
+ else {
//Finds the optimal packing of this tree using a given cost model
//TODO this uses quite a lot of memory, find ways to reduce memory usage during building
- OVBVHNode *root = BuildBinaryVBVH<OVBVHNode>(arena1,&obj->rayobj.control).transform(obj->builder);
+ OVBVHNode *root = BuildBinaryVBVH<OVBVHNode>(arena1, &obj->rayobj.control).transform(obj->builder);
- if (RE_rayobjectcontrol_test_break(&obj->rayobj.control))
- {
+ if (RE_rayobjectcontrol_test_break(&obj->rayobj.control)) {
BLI_memarena_free(arena1);
BLI_memarena_free(arena2);
return;
}
if (root) {
- VBVH_optimalPackSIMD<OVBVHNode,PackCost>(PackCost()).transform(root);
+ VBVH_optimalPackSIMD<OVBVHNode, PackCost>(PackCost()).transform(root);
obj->root = Reorganize_SVBVH<OVBVHNode>(arena2).transform(root);
}
else
@@ -137,9 +133,9 @@ int intersect(SVBVHTree *obj, Isect* isec)
//TODO renable hint support
if (RE_rayobject_isAligned(obj->root)) {
if (isec->mode == RE_RAY_SHADOW)
- return svbvh_node_stack_raycast<StackSize,true>(obj->root, isec);
+ return svbvh_node_stack_raycast<StackSize, true>(obj->root, isec);
else
- return svbvh_node_stack_raycast<StackSize,false>(obj->root, isec);
+ return svbvh_node_stack_raycast<StackSize, false>(obj->root, isec);
}
else
return RE_rayobject_intersect( (RayObject*) obj->root, isec );
@@ -160,13 +156,13 @@ RayObjectAPI make_api()
{
static RayObjectAPI api =
{
- (RE_rayobject_raycast_callback) ((int(*)(Tree*,Isect*)) &intersect<STACK_SIZE>),
- (RE_rayobject_add_callback) ((void(*)(Tree*,RayObject*)) &bvh_add<Tree>),
+ (RE_rayobject_raycast_callback) ((int(*)(Tree*, Isect*)) &intersect<STACK_SIZE>),
+ (RE_rayobject_add_callback) ((void(*)(Tree*, RayObject*)) &bvh_add<Tree>),
(RE_rayobject_done_callback) ((void(*)(Tree*)) &bvh_done<Tree>),
(RE_rayobject_free_callback) ((void(*)(Tree*)) &bvh_free<Tree>),
- (RE_rayobject_merge_bb_callback)((void(*)(Tree*,float*,float*)) &bvh_bb<Tree>),
+ (RE_rayobject_merge_bb_callback)((void(*)(Tree*, float*, float*)) &bvh_bb<Tree>),
(RE_rayobject_cost_callback) ((float(*)(Tree*)) &bvh_cost<Tree>),
- (RE_rayobject_hint_bb_callback) ((void(*)(Tree*,LCTSHint*,float*,float*)) &bvh_hint_bb<Tree>)
+ (RE_rayobject_hint_bb_callback) ((void(*)(Tree*, LCTSHint*, float*, float*)) &bvh_hint_bb<Tree>)
};
return api;
@@ -175,7 +171,7 @@ RayObjectAPI make_api()
template<class Tree>
RayObjectAPI* bvh_get_api(int maxstacksize)
{
- static RayObjectAPI bvh_api256 = make_api<Tree,1024>();
+ static RayObjectAPI bvh_api256 = make_api<Tree, 1024>();
if (maxstacksize <= 1024) return &bvh_api256;
assert(maxstacksize <= 256);
@@ -184,7 +180,7 @@ RayObjectAPI* bvh_get_api(int maxstacksize)
RayObject *RE_rayobject_svbvh_create(int size)
{
- return bvh_create_tree<SVBVHTree,DFS_STACK_SIZE>(size);
+ return bvh_create_tree<SVBVHTree, DFS_STACK_SIZE>(size);
}
#else
diff --git a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
index e82623f1da9..47e78b8912e 100644
--- a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
@@ -87,11 +87,9 @@ void bvh_done<VBVHTree>(VBVHTree *obj)
BLI_memarena_use_malloc(arena1);
//Build and optimize the tree
- if (1)
- {
- VBVHNode *root = BuildBinaryVBVH<VBVHNode>(arena1,&obj->rayobj.control).transform(obj->builder);
- if (RE_rayobjectcontrol_test_break(&obj->rayobj.control))
- {
+ if (1) {
+ VBVHNode *root = BuildBinaryVBVH<VBVHNode>(arena1, &obj->rayobj.control).transform(obj->builder);
+ if (RE_rayobjectcontrol_test_break(&obj->rayobj.control)) {
BLI_memarena_free(arena1);
return;
}
@@ -108,8 +106,7 @@ void bvh_done<VBVHTree>(VBVHTree *obj)
else
obj->root = NULL;
}
- else
- {
+ else {
/*
TODO
MemArena *arena2 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "vbvh arena2");
@@ -118,7 +115,7 @@ void bvh_done<VBVHTree>(VBVHTree *obj)
//Finds the optimal packing of this tree using a given cost model
//TODO this uses quite a lot of memory, find ways to reduce memory usage during building
OVBVHNode *root = BuildBinaryVBVH<OVBVHNode>(arena2).transform(obj->builder);
- VBVH_optimalPackSIMD<OVBVHNode,PackCost>(PackCost()).transform(root);
+ VBVH_optimalPackSIMD<OVBVHNode, PackCost>(PackCost()).transform(root);
obj->root = Reorganize_VBVH<OVBVHNode>(arena1).transform(root);
BLI_memarena_free(arena2);
@@ -139,9 +136,9 @@ int intersect(VBVHTree *obj, Isect* isec)
//TODO renable hint support
if (RE_rayobject_isAligned(obj->root)) {
if (isec->mode == RE_RAY_SHADOW)
- return bvh_node_stack_raycast<VBVHNode,StackSize,false,true>( obj->root, isec);
+ return bvh_node_stack_raycast<VBVHNode, StackSize, false, true>( obj->root, isec);
else
- return bvh_node_stack_raycast<VBVHNode,StackSize,false,false>( obj->root, isec);
+ return bvh_node_stack_raycast<VBVHNode, StackSize, false, false>( obj->root, isec);
}
else
return RE_rayobject_intersect( (RayObject*) obj->root, isec );
@@ -159,8 +156,7 @@ void bvh_hint_bb(Tree *tree, LCTSHint *hint, float *UNUSED(min), float *UNUSED(m
void bfree(VBVHTree *tree)
{
- if (tot_pushup + tot_pushdown + tot_hints + tot_moves)
- {
+ if (tot_pushup + tot_pushdown + tot_hints + tot_moves) {
if (G.debug & G_DEBUG) {
printf("tot pushups: %d\n", tot_pushup);
printf("tot pushdowns: %d\n", tot_pushdown);
@@ -182,13 +178,13 @@ RayObjectAPI make_api()
{
static RayObjectAPI api =
{
- (RE_rayobject_raycast_callback) ((int(*)(Tree*,Isect*)) &intersect<STACK_SIZE>),
- (RE_rayobject_add_callback) ((void(*)(Tree*,RayObject*)) &bvh_add<Tree>),
+ (RE_rayobject_raycast_callback) ((int(*)(Tree*, Isect*)) &intersect<STACK_SIZE>),
+ (RE_rayobject_add_callback) ((void(*)(Tree*, RayObject*)) &bvh_add<Tree>),
(RE_rayobject_done_callback) ((void(*)(Tree*)) &bvh_done<Tree>),
(RE_rayobject_free_callback) ((void(*)(Tree*)) &bvh_free<Tree>),
- (RE_rayobject_merge_bb_callback)((void(*)(Tree*,float*,float*)) &bvh_bb<Tree>),
+ (RE_rayobject_merge_bb_callback)((void(*)(Tree*, float*, float*)) &bvh_bb<Tree>),
(RE_rayobject_cost_callback) ((float(*)(Tree*)) &bvh_cost<Tree>),
- (RE_rayobject_hint_bb_callback) ((void(*)(Tree*,LCTSHint*,float*,float*)) &bvh_hint_bb<Tree>)
+ (RE_rayobject_hint_bb_callback) ((void(*)(Tree*, LCTSHint*, float*, float*)) &bvh_hint_bb<Tree>)
};
return api;
@@ -197,7 +193,7 @@ RayObjectAPI make_api()
template<class Tree>
RayObjectAPI* bvh_get_api(int maxstacksize)
{
- static RayObjectAPI bvh_api256 = make_api<Tree,1024>();
+ static RayObjectAPI bvh_api256 = make_api<Tree, 1024>();
if (maxstacksize <= 1024) return &bvh_api256;
assert(maxstacksize <= 256);
@@ -206,5 +202,5 @@ RayObjectAPI* bvh_get_api(int maxstacksize)
RayObject *RE_rayobject_vbvh_create(int size)
{
- return bvh_create_tree<VBVHTree,DFS_STACK_SIZE>(size);
+ return bvh_create_tree<VBVHTree, DFS_STACK_SIZE>(size);
}
diff --git a/source/blender/render/intern/raytrace/reorganize.h b/source/blender/render/intern/raytrace/reorganize.h
index 68b2b22ecdd..a47bd27d11b 100644
--- a/source/blender/render/intern/raytrace/reorganize.h
+++ b/source/blender/render/intern/raytrace/reorganize.h
@@ -61,22 +61,20 @@ bool node_fits_inside(Node *a, Node *b)
}
template<class Node>
-void reorganize_find_fittest_parent(Node *tree, Node *node, std::pair<float,Node*> &cost)
+void reorganize_find_fittest_parent(Node *tree, Node *node, std::pair<float, Node*> &cost)
{
std::queue<Node*> q;
q.push(tree);
- while(!q.empty())
- {
+ while (!q.empty()) {
Node *parent = q.front();
q.pop();
- if(parent == node) continue;
- if(node_fits_inside(node, parent) && RE_rayobject_isAligned(parent->child) )
- {
+ if (parent == node) continue;
+ if (node_fits_inside(node, parent) && RE_rayobject_isAligned(parent->child) ) {
float pcost = bb_area(parent->bb, parent->bb+3);
- cost = std::min( cost, std::make_pair(pcost,parent) );
- for(Node *child = parent->child; child; child = child->sibling)
+ cost = std::min( cost, std::make_pair(pcost, parent) );
+ for (Node *child = parent->child; child; child = child->sibling)
q.push(child);
}
}
@@ -89,28 +87,23 @@ void reorganize(Node *root)
std::queue<Node*> q;
q.push(root);
- while(!q.empty())
- {
+ while (!q.empty()) {
Node * node = q.front();
q.pop();
- if( RE_rayobject_isAligned(node->child) )
- {
- for(Node **prev = &node->child; *prev; )
- {
- assert( RE_rayobject_isAligned(*prev) );
+ if (RE_rayobject_isAligned(node->child)) {
+ for (Node **prev = &node->child; *prev; ) {
+ assert(RE_rayobject_isAligned(*prev));
q.push(*prev);
- std::pair<float,Node*> best(FLT_MAX, root);
- reorganize_find_fittest_parent( root, *prev, best );
+ std::pair<float, Node*> best(FLT_MAX, root);
+ reorganize_find_fittest_parent(root, *prev, best);
- if(best.second == node)
- {
+ if (best.second == node) {
//Already inside the fitnest BB
prev = &(*prev)->sibling;
}
- else
- {
+ else {
Node *tmp = *prev;
*prev = (*prev)->sibling;
@@ -123,8 +116,7 @@ void reorganize(Node *root)
}
}
- if(node != root)
- {
+ if (node != root) {
}
}
}
@@ -137,29 +129,24 @@ void reorganize(Node *root)
template<class Node>
void remove_useless(Node *node, Node **new_node)
{
- if( RE_rayobject_isAligned(node->child) )
- {
+ if ( RE_rayobject_isAligned(node->child) ) {
- for(Node **prev = &node->child; *prev; )
- {
+ for (Node **prev = &node->child; *prev; ) {
Node *next = (*prev)->sibling;
remove_useless(*prev, prev);
- if(*prev == NULL)
+ if (*prev == NULL)
*prev = next;
- else
- {
+ else {
(*prev)->sibling = next;
prev = &((*prev)->sibling);
}
}
}
- if(node->child)
- {
- if(RE_rayobject_isAligned(node->child) && node->child->sibling == 0)
+ if (node->child) {
+ if (RE_rayobject_isAligned(node->child) && node->child->sibling == 0)
*new_node = node->child;
}
- else if(node->child == NULL)
- {
+ else if (node->child == NULL) {
*new_node = NULL;
}
}
@@ -171,18 +158,16 @@ void remove_useless(Node *node, Node **new_node)
template<class Node>
void pushup(Node *parent)
{
- if(is_leaf(parent)) return;
+ if (is_leaf(parent)) return;
float p_area = bb_area(parent->bb, parent->bb+3);
Node **prev = &parent->child;
- for(Node *child = parent->child; RE_rayobject_isAligned(child) && child; )
- {
+ for (Node *child = parent->child; RE_rayobject_isAligned(child) && child; ) {
const float c_area = bb_area(child->bb, child->bb + 3);
const int nchilds = count_childs(child);
float original_cost = ((p_area != 0.0f)? (c_area / p_area)*nchilds: 1.0f) + 1;
float flatten_cost = nchilds;
- if(flatten_cost < original_cost && nchilds >= 2)
- {
+ if (flatten_cost < original_cost && nchilds >= 2) {
append_sibling(child, child->child);
child = child->sibling;
*prev = child;
@@ -192,15 +177,14 @@ void pushup(Node *parent)
// child = *prev;
tot_pushup++;
}
- else
- {
+ else {
*prev = child;
prev = &(*prev)->sibling;
child = *prev;
}
}
- for(Node *child = parent->child; RE_rayobject_isAligned(child) && child; child = child->sibling)
+ for (Node *child = parent->child; RE_rayobject_isAligned(child) && child; child = child->sibling)
pushup(child);
}
@@ -210,31 +194,28 @@ void pushup(Node *parent)
template<class Node, int SSize>
void pushup_simd(Node *parent)
{
- if(is_leaf(parent)) return;
+ if (is_leaf(parent)) return;
int n = count_childs(parent);
Node **prev = &parent->child;
- for(Node *child = parent->child; RE_rayobject_isAligned(child) && child; )
- {
+ for (Node *child = parent->child; RE_rayobject_isAligned(child) && child; ) {
int cn = count_childs(child);
- if(cn-1 <= (SSize - (n%SSize) ) % SSize && RE_rayobject_isAligned(child->child) )
- {
+ if (cn-1 <= (SSize - (n%SSize) ) % SSize && RE_rayobject_isAligned(child->child) ) {
n += (cn - 1);
append_sibling(child, child->child);
child = child->sibling;
*prev = child;
}
- else
- {
+ else {
*prev = child;
prev = &(*prev)->sibling;
child = *prev;
}
}
- for(Node *child = parent->child; RE_rayobject_isAligned(child) && child; child = child->sibling)
- pushup_simd<Node,SSize>(child);
+ for (Node *child = parent->child; RE_rayobject_isAligned(child) && child; child = child->sibling)
+ pushup_simd<Node, SSize>(child);
}
@@ -248,19 +229,17 @@ void pushdown(Node *parent)
Node **s_child = &parent->child;
Node * child = parent->child;
- while(child && RE_rayobject_isAligned(child))
- {
+ while (child && RE_rayobject_isAligned(child)) {
Node *next = child->sibling;
Node **next_s_child = &child->sibling;
//assert(bb_fits_inside(parent->bb, parent->bb+3, child->bb, child->bb+3));
- for(Node *i = parent->child; RE_rayobject_isAligned(i) && i; i = i->sibling)
- if(child != i && bb_fits_inside(i->bb, i->bb+3, child->bb, child->bb+3) && RE_rayobject_isAligned(i->child))
- {
+ for (Node *i = parent->child; RE_rayobject_isAligned(i) && i; i = i->sibling)
+ if (child != i && bb_fits_inside(i->bb, i->bb+3, child->bb, child->bb+3) && RE_rayobject_isAligned(i->child)) {
// todo optimize (should the one with the smallest area?)
// float ia = bb_area(i->bb, i->bb+3)
-// if(child->i)
+// if (child->i)
*s_child = child->sibling;
child->sibling = i->child;
i->child = child;
@@ -286,18 +265,17 @@ void pushdown(Node *parent)
template<class Node>
float bvh_refit(Node *node)
{
- if(is_leaf(node)) return 0;
- if(is_leaf(node->child)) return 0;
+ if (is_leaf(node)) return 0;
+ if (is_leaf(node->child)) return 0;
float total = 0;
- for(Node *child = node->child; child; child = child->sibling)
+ for (Node *child = node->child; child; child = child->sibling)
total += bvh_refit(child);
float old_area = bb_area(node->bb, node->bb+3);
INIT_MINMAX(node->bb, node->bb+3);
- for(Node *child = node->child; child; child = child->sibling)
- {
+ for (Node *child = node->child; child; child = child->sibling) {
DO_MIN(child->bb, node->bb);
DO_MAX(child->bb+3, node->bb+3);
}
@@ -347,41 +325,36 @@ struct OVBVHNode
int best_cutsize;
void set_cut(int cutsize, OVBVHNode ***cut)
{
- if(cutsize == 1)
- {
+ if (cutsize == 1) {
**cut = this;
*cut = &(**cut)->sibling;
}
- else
- {
- if(cutsize > MAX_CUT_SIZE)
- {
- for(OVBVHNode *child = this->child; child && RE_rayobject_isAligned(child); child = child->sibling)
- {
+ else {
+ if (cutsize > MAX_CUT_SIZE) {
+ for (OVBVHNode *child = this->child; child && RE_rayobject_isAligned(child); child = child->sibling) {
child->set_cut( 1, cut );
cutsize--;
}
assert(cutsize == 0);
}
else
- for(OVBVHNode *child = this->child; child && RE_rayobject_isAligned(child); child = child->sibling)
+ for (OVBVHNode *child = this->child; child && RE_rayobject_isAligned(child); child = child->sibling)
child->set_cut( child->get_cut_size( cutsize ), cut );
}
}
void optimize()
{
- if(RE_rayobject_isAligned(this->child))
- {
+ if (RE_rayobject_isAligned(this->child)) {
//Calc new childs
{
OVBVHNode **cut = &(this->child);
- set_cut( best_cutsize, &cut );
+ set_cut(best_cutsize, &cut);
*cut = NULL;
}
//Optimize new childs
- for(OVBVHNode *child = this->child; child && RE_rayobject_isAligned(child); child = child->sibling)
+ for (OVBVHNode *child = this->child; child && RE_rayobject_isAligned(child); child = child->sibling)
child->optimize();
}
}
@@ -415,8 +388,7 @@ struct VBVH_optimalPackSIMD
//Fetch childs and needed data
{
float parent_area = bb_area(node->bb, node->bb+3);
- for(Node *child = node->child; child && RE_rayobject_isAligned(child); child = child->sibling)
- {
+ for (Node *child = node->child; child && RE_rayobject_isAligned(child); child = child->sibling) {
this->child[nchilds] = child;
this->child_hit_prob[nchilds] = (parent_area != 0.0f)? bb_area(child->bb, child->bb+3) / parent_area: 1.0f;
nchilds++;
@@ -427,36 +399,35 @@ struct VBVH_optimalPackSIMD
//Build DP table to find minimum cost to represent this node with a given cutsize
- int bt [MAX_OPTIMIZE_CHILDS+1][MAX_CUT_SIZE+1]; //backtrace table
- float cost[MAX_OPTIMIZE_CHILDS+1][MAX_CUT_SIZE+1]; //cost table (can be reduced to float[2][MAX_CUT_COST])
+ int bt [MAX_OPTIMIZE_CHILDS + 1][MAX_CUT_SIZE + 1]; //backtrace table
+ float cost[MAX_OPTIMIZE_CHILDS + 1][MAX_CUT_SIZE + 1]; //cost table (can be reduced to float[2][MAX_CUT_COST])
- for(int i=0; i<=nchilds; i++)
- for(int j=0; j<=MAX_CUT_SIZE; j++)
- cost[i][j] = INFINITY;
+ for (int i = 0; i <= nchilds; i++) {
+ for (int j = 0; j <= MAX_CUT_SIZE; j++) {
+ cost[i][j] = INFINITY;
+ }
+ }
cost[0][0] = 0;
- for(int i=1; i<=nchilds; i++)
- for(int size=i-1; size/*+(nchilds-i)*/<=MAX_CUT_SIZE; size++)
- for(int cut=1; cut+size/*+(nchilds-i)*/<=MAX_CUT_SIZE; cut++)
- {
- float new_cost = cost[i-1][size] + child_hit_prob[i-1]*child[i-1]->get_cost(cut);
- if(new_cost < cost[i][size+cut])
- {
- cost[i][size+cut] = new_cost;
- bt[i][size+cut] = cut;
+ for (int i = 1; i<=nchilds; i++) {
+ for (int size = i - 1; size/*+(nchilds-i)*/<=MAX_CUT_SIZE; size++) {
+ for (int cut = 1; cut+size/*+(nchilds-i)*/<=MAX_CUT_SIZE; cut++) {
+ float new_cost = cost[i - 1][size] + child_hit_prob[i - 1] * child[i - 1]->get_cost(cut);
+ if (new_cost < cost[i][size+cut]) {
+ cost[i][size+cut] = new_cost;
+ bt[i][size+cut] = cut;
+ }
+ }
}
}
//Save the ways to archieve the minimum cost with a given cutsize
- for(int i = nchilds; i <= MAX_CUT_SIZE; i++)
- {
+ for (int i = nchilds; i <= MAX_CUT_SIZE; i++) {
node->cut_cost[i-1] = cost[nchilds][i];
- if(cost[nchilds][i] < INFINITY)
- {
+ if (cost[nchilds][i] < INFINITY) {
int current_size = i;
- for(int j=nchilds; j>0; j--)
- {
+ for (int j=nchilds; j>0; j--) {
child[j-1]->cut_size[i-1] = bt[j][current_size];
current_size -= bt[j][current_size];
}
@@ -468,26 +439,22 @@ struct VBVH_optimalPackSIMD
void calc_costs(Node *node)
{
- if( RE_rayobject_isAligned(node->child) )
- {
+ if ( RE_rayobject_isAligned(node->child) ) {
int nchilds = 0;
- for(Node *child = node->child; child && RE_rayobject_isAligned(child); child = child->sibling)
- {
+ for (Node *child = node->child; child && RE_rayobject_isAligned(child); child = child->sibling) {
calc_costs(child);
nchilds++;
}
- for(int i=0; i<MAX_CUT_SIZE; i++)
+ for (int i=0; i<MAX_CUT_SIZE; i++)
node->cut_cost[i] = INFINITY;
//We are not allowed to look on nodes with with so many childs
- if(nchilds > MAX_CUT_SIZE)
- {
+ if (nchilds > MAX_CUT_SIZE) {
float cost = 0;
float parent_area = bb_area(node->bb, node->bb+3);
- for(Node *child = node->child; child && RE_rayobject_isAligned(child); child = child->sibling)
- {
+ for (Node *child = node->child; child && RE_rayobject_isAligned(child); child = child->sibling) {
cost += ((parent_area != 0.0f)? ( bb_area(child->bb, child->bb+3) / parent_area ): 1.0f) * child->get_cost(1);
}
@@ -495,16 +462,13 @@ struct VBVH_optimalPackSIMD
node->cut_cost[0] = cost;
node->best_cutsize = nchilds;
}
- else
- {
+ else {
calc_best calc(node);
//calc expected cost if we optimaly pack this node
- for(int cutsize=nchilds; cutsize<=MAX_CUT_SIZE; cutsize++)
- {
+ for (int cutsize=nchilds; cutsize<=MAX_CUT_SIZE; cutsize++) {
float m = node->get_cost(cutsize) + testcost(cutsize);
- if(m < node->cut_cost[0])
- {
+ if (m < node->cut_cost[0]) {
node->cut_cost[0] = m;
node->best_cutsize = cutsize;
}
@@ -512,24 +476,22 @@ struct VBVH_optimalPackSIMD
}
assert(node->cut_cost[0] != INFINITY);
}
- else
- {
+ else {
node->cut_cost[0] = 1.0f;
- for(int i=1; i<MAX_CUT_SIZE; i++)
+ for (int i = 1; i < MAX_CUT_SIZE; i++)
node->cut_cost[i] = INFINITY;
}
}
Node *transform(Node *node)
{
- if(RE_rayobject_isAligned(node->child))
- {
+ if (RE_rayobject_isAligned(node->child)) {
static int num = 0;
bool first = false;
- if(num == 0) { num++; first = true; }
+ if (num == 0) { num++; first = true; }
calc_costs(node);
- if((G.debug & G_DEBUG) && first) printf("expected cost = %f (%d)\n", node->cut_cost[0], node->best_cutsize );
+ if ((G.debug & G_DEBUG) && first) printf("expected cost = %f (%d)\n", node->cut_cost[0], node->best_cutsize );
node->optimize();
}
return node;
diff --git a/source/blender/render/intern/raytrace/svbvh.h b/source/blender/render/intern/raytrace/svbvh.h
index e0e96781f36..a4044db8208 100644
--- a/source/blender/render/intern/raytrace/svbvh.h
+++ b/source/blender/render/intern/raytrace/svbvh.h
@@ -94,9 +94,9 @@ static int svbvh_bb_intersect_test(const Isect *isec, const float *_bb)
RE_RC_COUNT(isec->raycounter->bb.test);
- if(t1x > t2y || t2x < t1y || t1x > t2z || t2x < t1z || t1y > t2z || t2y < t1z) return 0;
- if(t2x < 0.0 || t2y < 0.0 || t2z < 0.0) return 0;
- if(t1x > isec->dist || t1y > isec->dist || t1z > isec->dist) return 0;
+ if (t1x > t2y || t2x < t1y || t1x > t2z || t2x < t1z || t1y > t2z || t2y < t1z) return 0;
+ if (t2x < 0.0 || t2y < 0.0 || t2z < 0.0) return 0;
+ if (t1x > isec->dist || t1y > isec->dist || t1z > isec->dist) return 0;
RE_RC_COUNT(isec->raycounter->bb.hit);
@@ -116,40 +116,39 @@ static int svbvh_node_stack_raycast(SVBVHNode *root, Isect *isec)
stack[stack_pos++] = root;
- while(stack_pos)
- {
+ while (stack_pos) {
node = stack[--stack_pos];
- if(!svbvh_node_is_leaf(node))
- {
+ if (!svbvh_node_is_leaf(node)) {
int nchilds= node->nchilds;
- if(nchilds == 4) {
+ if (nchilds == 4) {
float *child_bb= node->child_bb;
int res = svbvh_bb_intersect_test_simd4(isec, ((__m128*) (child_bb)));
SVBVHNode **child= node->child;
RE_RC_COUNT(isec->raycounter->simd_bb.test);
- if(res & 1) { stack[stack_pos++] = child[0]; RE_RC_COUNT(isec->raycounter->simd_bb.hit); }
- if(res & 2) { stack[stack_pos++] = child[1]; RE_RC_COUNT(isec->raycounter->simd_bb.hit); }
- if(res & 4) { stack[stack_pos++] = child[2]; RE_RC_COUNT(isec->raycounter->simd_bb.hit); }
- if(res & 8) { stack[stack_pos++] = child[3]; RE_RC_COUNT(isec->raycounter->simd_bb.hit); }
+ if (res & 1) { stack[stack_pos++] = child[0]; RE_RC_COUNT(isec->raycounter->simd_bb.hit); }
+ if (res & 2) { stack[stack_pos++] = child[1]; RE_RC_COUNT(isec->raycounter->simd_bb.hit); }
+ if (res & 4) { stack[stack_pos++] = child[2]; RE_RC_COUNT(isec->raycounter->simd_bb.hit); }
+ if (res & 8) { stack[stack_pos++] = child[3]; RE_RC_COUNT(isec->raycounter->simd_bb.hit); }
}
else {
float *child_bb= node->child_bb;
SVBVHNode **child= node->child;
int i;
- for(i=0; i<nchilds; i++)
- if(svbvh_bb_intersect_test(isec, (float*)child_bb+6*i))
+ for (i = 0; i < nchilds; i++) {
+ if (svbvh_bb_intersect_test(isec, (float *)child_bb + 6 * i)) {
stack[stack_pos++] = child[i];
+ }
+ }
}
}
- else
- {
+ else {
hit |= RE_rayobject_intersect((RayObject*)node, isec);
- if(SHADOW && hit) break;
+ if (SHADOW && hit) break;
}
}
@@ -160,25 +159,20 @@ static int svbvh_node_stack_raycast(SVBVHNode *root, Isect *isec)
template<>
inline void bvh_node_merge_bb<SVBVHNode>(SVBVHNode *node, float *min, float *max)
{
- if(is_leaf(node))
- {
+ if (is_leaf(node)) {
RE_rayobject_merge_bb((RayObject*)node, min, max);
}
- else
- {
+ else {
int i=0;
- while(i+4 <= node->nchilds)
- {
+ while (i+4 <= node->nchilds) {
float *res = node->child_bb + 6*i;
- for(int j=0; j<3; j++)
- {
+ for (int j = 0; j < 3; j++) {
min[j] = MIN2(min[j], res[4*j+0]);
min[j] = MIN2(min[j], res[4*j+1]);
min[j] = MIN2(min[j], res[4*j+2]);
min[j] = MIN2(min[j], res[4*j+3]);
}
- for(int j=0; j<3; j++)
- {
+ for (int j = 0; j < 3; j++) {
max[j] = MAX2(max[j], res[4*(j+3)+0]);
max[j] = MAX2(max[j], res[4*(j+3)+1]);
max[j] = MAX2(max[j], res[4*(j+3)+2]);
@@ -188,10 +182,9 @@ inline void bvh_node_merge_bb<SVBVHNode>(SVBVHNode *node, float *min, float *max
i += 4;
}
- for(; i<node->nchilds; i++)
- {
- DO_MIN(node->child_bb+6*i , min);
- DO_MAX(node->child_bb+3+6*i, max);
+ for ( ; i < node->nchilds; i++) {
+ DO_MIN(node->child_bb + 6 * i, min);
+ DO_MAX(node->child_bb + 3 + 6 * i, max);
}
}
}
@@ -218,17 +211,19 @@ struct Reorganize_SVBVH
childs_per_node = 0;
useless_bb = 0;
- for(int i=0; i<16; i++)
+ for (int i = 0; i < 16; i++) {
nodes_with_childs[i] = 0;
+ }
}
~Reorganize_SVBVH()
{
- if(G.debug & G_DEBUG) {
+ if (G.debug & G_DEBUG) {
printf("%f childs per node\n", childs_per_node / nodes);
printf("%d childs BB are useless\n", useless_bb);
- for(int i=0; i<16; i++)
+ for (int i = 0; i < 16; i++) {
printf("%i childs per node: %d/%d = %f\n", i, nodes_with_childs[i], nodes, nodes_with_childs[i]/float(nodes));
+ }
}
}
@@ -248,14 +243,12 @@ struct Reorganize_SVBVH
void prepare_for_simd(SVBVHNode *node)
{
int i=0;
- while(i+4 <= node->nchilds)
- {
+ while (i + 4 <= node->nchilds) {
float vec_tmp[4*6];
float *res = node->child_bb+6*i;
std::copy(res, res+6*4, vec_tmp);
- for(int j=0; j<6; j++)
- {
+ for (int j=0; j<6; j++) {
res[4*j+0] = vec_tmp[6*0+j];
res[4*j+1] = vec_tmp[6*1+j];
res[4*j+2] = vec_tmp[6*2+j];
@@ -274,26 +267,25 @@ struct Reorganize_SVBVH
SVBVHNode *transform(OldNode *old)
{
- if(is_leaf(old))
+ if (is_leaf(old))
return (SVBVHNode*)old;
- if(is_leaf(old->child))
+ if (is_leaf(old->child))
return (SVBVHNode*)old->child;
int nchilds = count_childs(old);
int alloc_childs = nchilds;
- if(nchilds % 4 > 2)
+ if (nchilds % 4 > 2)
alloc_childs = padup(nchilds, 4);
SVBVHNode *node = create_node(alloc_childs);
childs_per_node += nchilds;
nodes++;
- if(nchilds < 16)
+ if (nchilds < 16)
nodes_with_childs[nchilds]++;
useless_bb += alloc_childs-nchilds;
- while(alloc_childs > nchilds)
- {
+ while (alloc_childs > nchilds) {
const static float def_bb[6] = { FLT_MAX, FLT_MAX, FLT_MAX, FLT_MIN, FLT_MIN, FLT_MIN };
alloc_childs--;
node->child[alloc_childs] = NULL;
@@ -301,20 +293,17 @@ struct Reorganize_SVBVH
}
int i=nchilds;
- for(OldNode *o_child = old->child; o_child; o_child = o_child->sibling)
- {
+ for (OldNode *o_child = old->child; o_child; o_child = o_child->sibling) {
i--;
node->child[i] = transform(o_child);
- if(is_leaf(o_child))
- {
+ if (is_leaf(o_child)) {
float bb[6];
INIT_MINMAX(bb, bb+3);
RE_rayobject_merge_bb((RayObject*)o_child, bb, bb+3);
copy_bb(node->child_bb+i*6, bb);
break;
}
- else
- {
+ else {
copy_bb(node->child_bb+i*6, o_child->bb);
}
}
diff --git a/source/blender/render/intern/raytrace/vbvh.h b/source/blender/render/intern/raytrace/vbvh.h
index 1c84cd23510..d8ff9000a3f 100644
--- a/source/blender/render/intern/raytrace/vbvh.h
+++ b/source/blender/render/intern/raytrace/vbvh.h
@@ -57,17 +57,14 @@ inline static void bvh_node_push_childs(Node *node, Isect *UNUSED(isec), Node **
{
Node *child = node->child;
- if(is_leaf(child))
- {
+ if (is_leaf(child)) {
stack[stack_pos++] = child;
}
- else
- {
- while(child)
- {
+ else {
+ while (child) {
/* Skips BB tests on primitives */
#if 0
- if(is_leaf(child->child)) {
+ if (is_leaf(child->child)) {
stack[stack_pos++] = child->child;
}
else
@@ -86,10 +83,9 @@ template<class Node>
int count_childs(Node *parent)
{
int n = 0;
- for(Node *i = parent->child; i; i = i->sibling)
- {
+ for (Node *i = parent->child; i; i = i->sibling) {
n++;
- if(is_leaf(i))
+ if (is_leaf(i))
break;
}
@@ -100,7 +96,7 @@ int count_childs(Node *parent)
template<class Node>
void append_sibling(Node *node, Node *sibling)
{
- while(node->sibling)
+ while (node->sibling)
node = node->sibling;
node->sibling = sibling;
@@ -118,7 +114,7 @@ struct BuildBinaryVBVH
void test_break()
{
- if(RE_rayobjectcontrol_test_break(control))
+ if (RE_rayobjectcontrol_test_break(control))
throw "Stop";
}
@@ -131,7 +127,7 @@ struct BuildBinaryVBVH
Node *create_node()
{
Node *node = (Node*)BLI_memarena_alloc( arena, sizeof(Node) );
- assert( RE_rayobject_isAligned(node) );
+ assert(RE_rayobject_isAligned(node));
node->sibling = NULL;
node->child = NULL;
@@ -160,19 +156,17 @@ struct BuildBinaryVBVH
{
int size = rtbuild_size(builder);
- if(size == 0) {
+ if (size == 0) {
return NULL;
}
- else if(size == 1)
- {
+ else if (size == 1) {
Node *node = create_node();
INIT_MINMAX(node->bb, node->bb+3);
rtbuild_merge_bb(builder, node->bb, node->bb+3);
node->child = (Node *) rtbuild_get_primitive(builder, 0);
return node;
}
- else
- {
+ else {
test_break();
Node *node = create_node();
@@ -183,8 +177,7 @@ struct BuildBinaryVBVH
INIT_MINMAX(node->bb, node->bb+3);
assert(nc == 2);
- for(int i=0; i<nc; i++)
- {
+ for (int i = 0; i < nc; i++) {
RTBuilder tmp;
rtbuild_get_child(builder, i, &tmp);
@@ -224,7 +217,7 @@ struct Reorganize_VBVH
VBVHNode *transform(OldNode *old)
{
- if(is_leaf(old))
+ if (is_leaf(old))
return (VBVHNode*)old;
VBVHNode *node = create_node();
@@ -237,7 +230,7 @@ struct Reorganize_VBVH
{
VBVHNode *n_child = transform(o_child);
*child_ptr = n_child;
- if(is_leaf(n_child)) return node;
+ if (is_leaf(n_child)) return node;
child_ptr = &n_child->sibling;
}
*child_ptr = 0;
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 66ed0bd85a9..22629764cbe 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -469,11 +469,11 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr
}
else if (v1->orco) {
uv1= uv[0]; uv2= uv[1]; uv3= uv[2]; uv4= uv[3];
- map_to_sphere( &uv[0][0], &uv[0][1],v1->orco[0], v1->orco[1], v1->orco[2]);
- map_to_sphere( &uv[1][0], &uv[1][1],v2->orco[0], v2->orco[1], v2->orco[2]);
- map_to_sphere( &uv[2][0], &uv[2][1],v3->orco[0], v3->orco[1], v3->orco[2]);
+ map_to_sphere(&uv[0][0], &uv[0][1], v1->orco[0], v1->orco[1], v1->orco[2]);
+ map_to_sphere(&uv[1][0], &uv[1][1], v2->orco[0], v2->orco[1], v2->orco[2]);
+ map_to_sphere(&uv[2][0], &uv[2][1], v3->orco[0], v3->orco[1], v3->orco[2]);
if (v4)
- map_to_sphere( &uv[3][0], &uv[3][1],v4->orco[0], v4->orco[1], v4->orco[2]);
+ map_to_sphere(&uv[3][0], &uv[3][1], v4->orco[0], v4->orco[1], v4->orco[2]);
}
else return;
@@ -886,9 +886,9 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[][4], int d
/* skip wire faces */
if (vlr->v2 != vlr->v3) {
if (vlr->v4)
- normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
+ normal_quad_v3(vlr->n, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
else
- normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
+ normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
}
}
}
@@ -908,10 +908,10 @@ static float *get_object_orco(Render *re, Object *ob)
if (!orco) {
if (ELEM(ob->type, OB_CURVE, OB_FONT)) {
- orco = make_orco_curve(re->scene, ob);
+ orco = BKE_curve_make_orco(re->scene, ob);
}
else if (ob->type==OB_SURF) {
- orco = make_orco_surf(ob);
+ orco = BKE_curve_surf_make_orco(ob);
}
if (orco)
@@ -1061,7 +1061,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
width= w;
/*cross is the radius of the strand so we want it to be half of full width */
- mul_v3_fl(cross,0.5f/crosslen);
+ mul_v3_fl(cross, 0.5f/crosslen);
}
else
width/=w;
@@ -1111,7 +1111,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
vlr->v3->orco= sd->orco;
vlr->v3->accum= vlr->v4->accum;
- normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
+ normal_quad_v3(vlr->n, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
vlr->mat= ma;
vlr->ec= ME_V2V3;
@@ -1124,7 +1124,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
if (sd->uvco) {
for (i=0; i<sd->totuv; i++) {
MTFace *mtf;
- mtf=RE_vlakren_get_tface(obr,vlr,i,NULL,1);
+ mtf=RE_vlakren_get_tface(obr, vlr, i, NULL, 1);
mtf->uv[0][0]=mtf->uv[1][0]=
mtf->uv[2][0]=mtf->uv[3][0]=(sd->uvco+2*i)[0];
mtf->uv[0][1]=mtf->uv[1][1]=
@@ -1132,7 +1132,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
}
if (sd->override_uv>=0) {
MTFace *mtf;
- mtf=RE_vlakren_get_tface(obr,vlr,sd->override_uv,NULL,0);
+ mtf=RE_vlakren_get_tface(obr, vlr, sd->override_uv, NULL, 0);
mtf->uv[0][0]=mtf->uv[3][0]=0.0f;
mtf->uv[1][0]=mtf->uv[2][0]=1.0f;
@@ -1144,7 +1144,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
if (sd->mcol) {
for (i=0; i<sd->totcol; i++) {
MCol *mc;
- mc=RE_vlakren_get_mcol(obr,vlr,i,NULL,1);
+ mc=RE_vlakren_get_mcol(obr, vlr, i, NULL, 1);
mc[0]=mc[1]=mc[2]=mc[3]=sd->mcol[i];
mc[0]=mc[1]=mc[2]=mc[3]=sd->mcol[i];
}
@@ -1189,22 +1189,22 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
if (sd->adapt) {
second=0;
- copy_v3_v3(anor,nor);
- copy_v3_v3(avec,vec);
+ copy_v3_v3(anor, nor);
+ copy_v3_v3(avec, vec);
}
}
else if (sd->adapt) {
- float dvec[3],pvec[3];
- sub_v3_v3v3(dvec,avec,vec);
- project_v3_v3v3(pvec,dvec,vec);
- sub_v3_v3v3(dvec,dvec,pvec);
+ float dvec[3], pvec[3];
+ sub_v3_v3v3(dvec, avec, vec);
+ project_v3_v3v3(pvec, dvec, vec);
+ sub_v3_v3v3(dvec, dvec, pvec);
w= vec[2]*re->winmat[2][3] + re->winmat[3][3];
dx= re->winx*dvec[0]*re->winmat[0][0]/w;
dy= re->winy*dvec[1]*re->winmat[1][1]/w;
w= sqrt(dx*dx + dy*dy);
- if (dot_v3v3(anor,nor)<sd->adapt_angle && w>sd->adapt_pix) {
+ if (dot_v3v3(anor, nor)<sd->adapt_angle && w>sd->adapt_pix) {
vlr= RE_findOrAddVlak(obr, obr->totvlak++);
vlr->flag= flag;
vlr->v1= v1;
@@ -1215,8 +1215,8 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
v1= vlr->v4; // cycle
v2= vlr->v3; // cycle
- copy_v3_v3(anor,nor);
- copy_v3_v3(avec,vec);
+ copy_v3_v3(anor, nor);
+ copy_v3_v3(avec, vec);
}
else {
vlr= RE_findOrAddVlak(obr, obr->totvlak-1);
@@ -1235,7 +1235,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
vlr->v3->orco= sd->orco;
vlr->v3->accum= vlr->v4->accum;
- normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
+ normal_quad_v3(vlr->n, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
vlr->mat= ma;
vlr->ec= ME_V2V3;
@@ -1248,7 +1248,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
if (sd->uvco) {
for (i=0; i<sd->totuv; i++) {
MTFace *mtf;
- mtf=RE_vlakren_get_tface(obr,vlr,i,NULL,1);
+ mtf=RE_vlakren_get_tface(obr, vlr, i, NULL, 1);
mtf->uv[0][0]=mtf->uv[1][0]=
mtf->uv[2][0]=mtf->uv[3][0]=(sd->uvco+2*i)[0];
mtf->uv[0][1]=mtf->uv[1][1]=
@@ -1256,7 +1256,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
}
if (sd->override_uv>=0) {
MTFace *mtf;
- mtf=RE_vlakren_get_tface(obr,vlr,sd->override_uv,NULL,0);
+ mtf=RE_vlakren_get_tface(obr, vlr, sd->override_uv, NULL, 0);
mtf->uv[0][0]=mtf->uv[3][0]=0.0f;
mtf->uv[1][0]=mtf->uv[2][0]=1.0f;
@@ -1268,7 +1268,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
if (sd->mcol) {
for (i=0; i<sd->totcol; i++) {
MCol *mc;
- mc=RE_vlakren_get_mcol(obr,vlr,i,NULL,1);
+ mc=RE_vlakren_get_mcol(obr, vlr, i, NULL, 1);
mc[0]=mc[1]=mc[2]=mc[3]=sd->mcol[i];
mc[0]=mc[1]=mc[2]=mc[3]=sd->mcol[i];
}
@@ -1372,11 +1372,11 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
sub_v3_v3(vlr->v4->co, yvec);
mul_m4_v3(re->viewmat, vlr->v4->co);
- normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
- copy_v3_v3(vlr->v1->n,vlr->n);
- copy_v3_v3(vlr->v2->n,vlr->n);
- copy_v3_v3(vlr->v3->n,vlr->n);
- copy_v3_v3(vlr->v4->n,vlr->n);
+ normal_quad_v3(vlr->n, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
+ copy_v3_v3(vlr->v1->n, vlr->n);
+ copy_v3_v3(vlr->v2->n, vlr->n);
+ copy_v3_v3(vlr->v3->n, vlr->n);
+ copy_v3_v3(vlr->v4->n, vlr->n);
vlr->mat= ma;
vlr->ec= ME_V2V3;
@@ -1395,8 +1395,8 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
time = (float)fmod((bb->tilt + 1.0f) / 2.0f, 1.0);
}
else {
- float axis1[3] = {0.0f,0.0f,0.0f};
- float axis2[3] = {0.0f,0.0f,0.0f};
+ float axis1[3] = {0.0f, 0.0f, 0.0f};
+ float axis2[3] = {0.0f, 0.0f, 0.0f};
axis1[(bb->align + 1) % 3] = 1.0f;
axis2[(bb->align + 2) % 3] = 1.0f;
@@ -1472,7 +1472,7 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re
if (ren_as != PART_DRAW_BB)
mul_m4_v3(re->viewmat, loc);
- switch(ren_as) {
+ switch (ren_as) {
case PART_DRAW_LINE:
sd->line = 1;
sd->time = 0.0f;
@@ -1518,7 +1518,7 @@ static void get_particle_uvco_mcol(short from, DerivedMesh *dm, float *fuv, int
int i;
/* get uvco */
- if (sd->uvco && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
+ if (sd->uvco && ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME)) {
for (i=0; i<sd->totuv; i++) {
if (num != DMCACHE_NOTFOUND) {
MFace *mface = dm->getTessFaceData(dm, num, CD_MFACE);
@@ -1535,7 +1535,7 @@ static void get_particle_uvco_mcol(short from, DerivedMesh *dm, float *fuv, int
}
/* get mcol */
- if (sd->mcol && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
+ if (sd->mcol && ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME)) {
for (i=0; i<sd->totcol; i++) {
if (num != DMCACHE_NOTFOUND) {
MFace *mface = dm->getTessFaceData(dm, num, CD_MFACE);
@@ -1557,7 +1557,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
ParticleSystemModifierData *psmd;
ParticleSystem *tpsys=0;
ParticleSettings *part, *tpart=0;
- ParticleData *pars, *pa=0,*tpa=0;
+ ParticleData *pars, *pa=0, *tpa=0;
ParticleKey *states=0;
ParticleKey state;
ParticleCacheKey *cache=0;
@@ -1569,7 +1569,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
StrandBound *sbound= 0;
StrandRen *strand=0;
RNG *rng= 0;
- float loc[3],loc1[3],loc0[3],mat[4][4],nmat[3][3],co[3],nor[3],duplimat[4][4];
+ float loc[3], loc1[3], loc0[3], mat[4][4], nmat[3][3], co[3], nor[3], duplimat[4][4];
float strandlen=0.0f, curlen=0.0f;
float hasize, pa_size, r_tilt, r_length;
float pa_time, pa_birthtime, pa_dietime;
@@ -1597,7 +1597,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
/* 2. start initializing things */
/* last possibility to bail out! */
- psmd = psys_get_modifier(ob,psys);
+ psmd = psys_get_modifier(ob, psys);
if (!(psmd->modifier.mode & eModifierMode_Render))
return 0;
@@ -1702,7 +1702,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
/* 2.6 setup strand rendering */
if (part->ren_as == PART_DRAW_PATH && psys->pathcache) {
- path_nbr=(int)pow(2.0,(double) part->ren_step);
+ path_nbr=(int)pow(2.0, (double) part->ren_step);
if (path_nbr) {
if (!ELEM(ma->material_type, MA_TYPE_HALO, MA_TYPE_WIRE)) {
@@ -1770,7 +1770,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
psys->lattice = psys_get_lattice(&sim);
/* 3. start creating renderable things */
- for (a=0,pa=pars; a<totpart+totchild; a++, pa++, seed++) {
+ for (a=0, pa=pars; a<totpart+totchild; a++, pa++, seed++) {
random = rng_getFloat(rng);
/* setup per particle individual stuff */
if (a<totpart) {
@@ -1786,10 +1786,10 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
/* get orco */
if (tpsys && part->phystype == PART_PHYS_NO) {
tpa = tpsys->particles + pa->num;
- psys_particle_on_emitter(psmd,tpart->from,tpa->num,pa->num_dmcache,tpa->fuv,tpa->foffset,co,nor,0,0,sd.orco,0);
+ psys_particle_on_emitter(psmd, tpart->from, tpa->num, pa->num_dmcache, tpa->fuv, tpa->foffset, co, nor, 0, 0, sd.orco, 0);
}
else
- psys_particle_on_emitter(psmd,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,nor,0,0,sd.orco,0);
+ psys_particle_on_emitter(psmd, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, nor, 0, 0, sd.orco, 0);
/* get uvco & mcol */
num= pa->num_dmcache;
@@ -1835,14 +1835,14 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
/* get orco */
if (part->childtype == PART_CHILD_FACES) {
psys_particle_on_emitter(psmd,
- PART_FROM_FACE, cpa->num,DMCACHE_ISCHILD,
- cpa->fuv,cpa->foffset,co,nor,0,0,sd.orco,0);
+ PART_FROM_FACE, cpa->num, DMCACHE_ISCHILD,
+ cpa->fuv, cpa->foffset, co, nor, 0, 0, sd.orco, 0);
}
else {
ParticleData *par = psys->particles + cpa->parent;
psys_particle_on_emitter(psmd, part->from,
- par->num,DMCACHE_ISCHILD,par->fuv,
- par->foffset,co,nor,0,0,sd.orco,0);
+ par->num, DMCACHE_ISCHILD, par->fuv,
+ par->foffset, co, nor, 0, 0, sd.orco, 0);
}
/* get uvco & mcol */
@@ -1943,8 +1943,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
float time;
if (k<=max_k) {
- copy_v3_v3(state.co,(cache+k)->co);
- copy_v3_v3(state.vel,(cache+k)->vel);
+ copy_v3_v3(state.co, (cache+k)->co);
+ copy_v3_v3(state.vel, (cache+k)->vel);
}
else
continue;
@@ -1953,8 +1953,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
curlen += len_v3v3((cache+k-1)->co, (cache+k)->co);
time= curlen/strandlen;
- copy_v3_v3(loc,state.co);
- mul_m4_v3(re->viewmat,loc);
+ copy_v3_v3(loc, state.co);
+ mul_m4_v3(re->viewmat, loc);
if (strandbuf) {
copy_v3_v3(svert->co, loc);
@@ -1968,8 +1968,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
if (k==1) {
sd.first = 1;
sd.time = 0.0f;
- sub_v3_v3v3(loc0,loc1,loc);
- add_v3_v3v3(loc0,loc1,loc0);
+ sub_v3_v3v3(loc0, loc1, loc);
+ add_v3_v3v3(loc0, loc1, loc0);
particle_curve(re, obr, psmd->dm, ma, &sd, loc1, loc0, seed, pa_co);
}
@@ -1980,7 +1980,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
if (k)
particle_curve(re, obr, psmd->dm, ma, &sd, loc, loc1, seed, pa_co);
- copy_v3_v3(loc1,loc);
+ copy_v3_v3(loc1, loc);
}
}
@@ -2005,7 +2005,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
continue;
state.time = (part->draw & PART_ABS_PATH_TIME) ? -ct : ct;
- psys_get_particle_on_path(&sim,a,&state,1);
+ psys_get_particle_on_path(&sim, a, &state, 1);
if (psys->parent)
mul_m4_v3(psys->parent->obmat, state.co);
@@ -2042,7 +2042,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
}
else {
state.time=cfra;
- if (psys_get_particle_state(&sim,a,&state,0)==0)
+ if (psys_get_particle_state(&sim, a, &state, 0)==0)
continue;
if (psys->parent)
@@ -2363,7 +2363,7 @@ static void displace_render_face(Render *re, ObjectRen *obr, VlakRen *vlr, float
/* Displace the verts, flag is set when done */
if (!vlr->v1->flag)
- displace_render_vert(re, obr, &shi, vlr->v1,0, scale, mat, imat);
+ displace_render_vert(re, obr, &shi, vlr->v1, 0, scale, mat, imat);
if (!vlr->v2->flag)
displace_render_vert(re, obr, &shi, vlr->v2, 1, scale, mat, imat);
@@ -2383,10 +2383,10 @@ static void displace_render_face(Render *re, ObjectRen *obr, VlakRen *vlr, float
/* Recalculate the face normal - if flipped before, flip now */
if (vlr->v4) {
- normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
+ normal_quad_v3(vlr->n, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
}
else {
- normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
+ normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
}
}
@@ -2437,7 +2437,7 @@ static void init_render_mball(Render *re, ObjectRen *obr)
int a, need_orco, vlakindex, *index, negative_scale;
ListBase dispbase= {NULL, NULL};
- if (ob!=find_basis_mball(re->scene, ob))
+ if (ob!=BKE_metaball_basis_find(re->scene, ob))
return;
mult_m4_m4m4(mat, re->viewmat, ob->obmat);
@@ -2463,7 +2463,7 @@ static void init_render_mball(Render *re, ObjectRen *obr)
if (!orco) {
/* orco hasn't been found in cache - create new one and add to cache */
- orco= make_orco_mball(ob, &dispbase);
+ orco= BKE_metaball_make_orco(ob, &dispbase);
set_object_orco(re, ob, orco);
}
}
@@ -2502,9 +2502,9 @@ static void init_render_mball(Render *re, ObjectRen *obr)
vlr->v4= 0;
if (negative_scale)
- normal_tri_v3( vlr->n,vlr->v1->co, vlr->v2->co, vlr->v3->co);
+ normal_tri_v3(vlr->n, vlr->v1->co, vlr->v2->co, vlr->v3->co);
else
- normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
+ normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
vlr->mat= ma;
vlr->flag= ME_SMOOTH;
@@ -2519,9 +2519,9 @@ static void init_render_mball(Render *re, ObjectRen *obr)
vlr1->v2= vlr1->v3;
vlr1->v3= RE_findOrAddVert(obr, index[3]);
if (negative_scale)
- normal_tri_v3( vlr1->n,vlr1->v1->co, vlr1->v2->co, vlr1->v3->co);
+ normal_tri_v3(vlr1->n, vlr1->v1->co, vlr1->v2->co, vlr1->v3->co);
else
- normal_tri_v3( vlr1->n,vlr1->v3->co, vlr1->v2->co, vlr1->v1->co);
+ normal_tri_v3(vlr1->n, vlr1->v3->co, vlr1->v2->co, vlr1->v1->co);
}
}
@@ -2610,7 +2610,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
vlr= RE_findOrAddVlak(obr, obr->totvlak++);
vlr->v1= v1; vlr->v2= v2; vlr->v3= v3; vlr->v4= v4;
- normal_quad_v3( n1,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
+ normal_quad_v3(n1, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
copy_v3_v3(vlr->n, n1);
@@ -2630,8 +2630,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
sizeu--; sizev--; /* dec size for face array */
if (dl->flag & DL_CYCL_V) {
- for (v = 0; v < sizev; v++)
- {
+ for (v = 0; v < sizev; v++) {
/* optimize! :*/
vlr= RE_findOrAddVlak(obr, UVTOINDEX(sizeu - 1, v));
vlr1= RE_findOrAddVlak(obr, UVTOINDEX(0, v));
@@ -2643,8 +2642,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
}
if (dl->flag & DL_CYCL_U) {
- for (u = 0; u < sizeu; u++)
- {
+ for (u = 0; u < sizeu; u++) {
/* optimize! :*/
vlr= RE_findOrAddVlak(obr, UVTOINDEX(u, 0));
vlr1= RE_findOrAddVlak(obr, UVTOINDEX(u, sizev-1));
@@ -2673,12 +2671,12 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
*/
if ((dl->flag & DL_CYCL_V) && (dl->flag & DL_CYCL_U)) {
- vlr= RE_findOrAddVlak(obr, UVTOINDEX(sizeu - 1, sizev - 1)); /* (m,n) */
- vlr1= RE_findOrAddVlak(obr, UVTOINDEX(0,0)); /* (0,0) */
+ vlr= RE_findOrAddVlak(obr, UVTOINDEX(sizeu - 1, sizev - 1)); /* (m, n) */
+ vlr1= RE_findOrAddVlak(obr, UVTOINDEX(0, 0)); /* (0, 0) */
add_v3_v3v3(n1, vlr->n, vlr1->n);
- vlr2= RE_findOrAddVlak(obr, UVTOINDEX(0, sizev-1)); /* (0,n) */
+ vlr2= RE_findOrAddVlak(obr, UVTOINDEX(0, sizev-1)); /* (0, n) */
add_v3_v3(n1, vlr2->n);
- vlr3= RE_findOrAddVlak(obr, UVTOINDEX(sizeu-1, 0)); /* (m,0) */
+ vlr3= RE_findOrAddVlak(obr, UVTOINDEX(sizeu-1, 0)); /* (m, 0) */
add_v3_v3(n1, vlr3->n);
copy_v3_v3(vlr->v3->n, n1);
copy_v3_v3(vlr1->v1->n, n1);
@@ -2756,9 +2754,9 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr,
/* render normals are inverted in render */
if (vlr->v4)
- len= normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
+ len= normal_quad_v3(vlr->n, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
else
- len= normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
+ len= normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
vlr->mat= ma;
vlr->flag= flag;
@@ -2983,7 +2981,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
orco+= 3*dl_surf_to_renderdata(obr, dl, matar, orco, mat);
}
else {
- int p1,p2,p3,p4;
+ int p1, p2, p3, p4;
fp= dl->verts;
startvert= obr->totvert;
@@ -3439,15 +3437,15 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
MVert *mv= me->mvert;
if (vlr->v4)
- len= normal_quad_v3( vlr->n, mv[mf->v4].co, mv[mf->v3].co, mv[mf->v2].co, mv[mf->v1].co);
+ len= normal_quad_v3(vlr->n, mv[mf->v4].co, mv[mf->v3].co, mv[mf->v2].co, mv[mf->v1].co);
else
- len= normal_tri_v3( vlr->n,mv[mf->v3].co, mv[mf->v2].co, mv[mf->v1].co);
+ len= normal_tri_v3(vlr->n, mv[mf->v3].co, mv[mf->v2].co, mv[mf->v1].co);
}
else {
if (vlr->v4)
- len= normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
+ len= normal_quad_v3(vlr->n, vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
else
- len= normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
+ len= normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
}
vlr->mat= ma;
@@ -3486,8 +3484,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
if (need_nmap_tangent != 0) {
const float * tangent = (const float *) layer->data;
float * ftang = RE_vlakren_get_nmap_tangent(obr, vlr, 1);
- for (vindex=0; vindex<nr_verts; vindex++)
- {
+ for (vindex=0; vindex<nr_verts; vindex++) {
copy_v4_v4(ftang+vindex*4, tangent+a*16+rev_tab[vindex]*4);
mul_mat3_m4_v3(mat, ftang+vindex*4);
normalize_v3(ftang+vindex*4);
@@ -3587,7 +3584,7 @@ static void initshadowbuf(Render *re, LampRen *lar, float mat[][4])
/* if (la->spsi<16) return; */
/* memory alloc */
- shb= (struct ShadBuf *)MEM_callocN( sizeof(struct ShadBuf),"initshadbuf");
+ shb= (struct ShadBuf *)MEM_callocN(sizeof(struct ShadBuf), "initshadbuf");
lar->shb= shb;
if (shb==NULL) return;
@@ -3686,7 +3683,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
BLI_addtail(&re->lights, go);
go->ob= ob;
/* lamprens are in own list, for freeing */
- lar= (LampRen *)MEM_callocN(sizeof(LampRen),"lampren");
+ lar= (LampRen *)MEM_callocN(sizeof(LampRen), "lampren");
BLI_addtail(&re->lampren, lar);
go->lampren= lar;
@@ -3763,7 +3760,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
lar->area_sizey= lar->area_size;
}
else if (lar->type==LA_AREA) {
- switch(lar->area_shape) {
+ switch (lar->area_shape) {
case LA_AREA_SQUARE:
lar->ray_totsamp= lar->ray_samp*lar->ray_samp;
lar->ray_sampy= lar->ray_samp;
@@ -3797,7 +3794,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
lar->sunsky = (struct SunSky*)MEM_callocN(sizeof(struct SunSky), "sunskyren");
lar->sunsky->effect_type = la->sun_effect_type;
- copy_v3_v3(vec,ob->obmat[2]);
+ copy_v3_v3(vec, ob->obmat[2]);
normalize_v3(vec);
InitSunSky(lar->sunsky, la->atm_turbidity, vec, la->horizon_brightness,
@@ -3847,7 +3844,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
if (la->haint>0.0f) {
re->flag |= R_LAMPHALO;
- /* camera position (0,0,0) rotate around lamp */
+ /* camera position (0, 0, 0) rotate around lamp */
lar->sh_invcampos[0]= -lar->co[0];
lar->sh_invcampos[1]= -lar->co[1];
lar->sh_invcampos[2]= -lar->co[2];
@@ -4136,7 +4133,7 @@ static void set_fullsample_trace_flag(Render *re, ObjectRen *obr)
}
/* split quads for predictable baking
- * dir 1 == (0,1,2) (0,2,3), 2 == (1,3,0) (1,2,3)
+ * dir 1 == (0, 1, 2) (0, 2, 3), 2 == (1, 3, 0) (1, 2, 3)
*/
static void split_quads(ObjectRen *obr, int dir)
{
@@ -4177,8 +4174,8 @@ static void split_quads(ObjectRen *obr, int dir)
vlr->v4 = vlr1->v4 = NULL;
/* new normals */
- normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
- normal_tri_v3( vlr1->n,vlr1->v3->co, vlr1->v2->co, vlr1->v1->co);
+ normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
+ normal_tri_v3(vlr1->n, vlr1->v3->co, vlr1->v2->co, vlr1->v1->co);
}
/* clear the flag when not divided */
else vlr->flag &= ~R_DIVIDE_24;
@@ -4242,8 +4239,8 @@ static void check_non_flat_quads(ObjectRen *obr)
/* 1---2 1---2 0 = orig face, 1 = new face */
/* render normals are inverted in render! we calculate normal of single tria here */
- flen= normal_tri_v3( nor,vlr->v4->co, vlr->v3->co, vlr->v1->co);
- if (flen==0.0f) normal_tri_v3( nor,vlr->v4->co, vlr->v2->co, vlr->v1->co);
+ flen= normal_tri_v3(nor, vlr->v4->co, vlr->v3->co, vlr->v1->co);
+ if (flen==0.0f) normal_tri_v3(nor, vlr->v4->co, vlr->v2->co, vlr->v1->co);
xn = dot_v3v3(nor, vlr->n);
@@ -4255,10 +4252,10 @@ static void check_non_flat_quads(ObjectRen *obr)
vlr1->flag |= R_FACE_SPLIT;
/* split direction based on vnorms */
- normal_tri_v3( nor,vlr->v1->co, vlr->v2->co, vlr->v3->co);
+ normal_tri_v3(nor, vlr->v1->co, vlr->v2->co, vlr->v3->co);
d1 = dot_v3v3(nor, vlr->v1->n);
- normal_tri_v3( nor,vlr->v2->co, vlr->v3->co, vlr->v4->co);
+ normal_tri_v3(nor, vlr->v2->co, vlr->v3->co, vlr->v4->co);
d2 = dot_v3v3(nor, vlr->v2->n);
if ( fabs(d1) < fabs(d2) ) vlr->flag |= R_DIVIDE_24;
@@ -4284,8 +4281,8 @@ static void check_non_flat_quads(ObjectRen *obr)
vlr->v4 = vlr1->v4 = NULL;
/* new normals */
- normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
- normal_tri_v3( vlr1->n,vlr1->v3->co, vlr1->v2->co, vlr1->v1->co);
+ normal_tri_v3(vlr->n, vlr->v3->co, vlr->v2->co, vlr->v1->co);
+ normal_tri_v3(vlr1->n, vlr1->v3->co, vlr1->v2->co, vlr1->v1->co);
}
/* clear the flag when not divided */
else vlr->flag &= ~R_DIVIDE_24;
@@ -4728,7 +4725,7 @@ static int allow_render_object(Render *re, Object *ob, int nolamps, int onlysele
return 0;
/* don't add non-basic meta objects, ends up having renderobjects with no geometry */
- if (ob->type == OB_MBALL && ob!=find_basis_mball(re->scene, ob))
+ if (ob->type == OB_MBALL && ob!=BKE_metaball_basis_find(re->scene, ob))
return 0;
if (nolamps && (ob->type==OB_LAMP))
@@ -5263,7 +5260,7 @@ static void speedvector_project(Render *re, float zco[2], const float co[3], con
/* use cylinder projection */
if (pano) {
float vec[3], ang;
- /* angle between (0,0,-1) and (co) */
+ /* angle between (0, 0, -1) and (co) */
copy_v3_v3(vec, co);
ang= saacos(-vec[2]/sqrtf(vec[0]*vec[0] + vec[2]*vec[2]));
@@ -5401,7 +5398,7 @@ static void calculate_speedvectors(Render *re, ObjectInstanceRen *obi, float *ve
co3= mesh->co[face[2]];
co4= (face[3])? mesh->co[face[3]]: NULL;
- interp_weights_face_v3( w,co1, co2, co3, co4, strand->vert->co);
+ interp_weights_face_v3(w, co1, co2, co3, co4, strand->vert->co);
zero_v4(speed);
madd_v4_v4fl(speed, winspeed[face[0]], w[0]);
@@ -5652,7 +5649,7 @@ void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce, unsigned
// NT check for fluidsim special treatment
fluidmd = (FluidsimModifierData *)modifiers_findByType(obi->ob, eModifierType_Fluidsim);
if (fluidmd && fluidmd->fss && (fluidmd->fss->type & OB_FLUIDSIM_DOMAIN)) {
- // use preloaded per vertex simulation data , only does calculation for step=1
+ // use preloaded per vertex simulation data, only does calculation for step=1
// NOTE/FIXME - velocities and meshes loaded unnecessarily often during the database_fromscene_vectors calls...
load_fluidsimspeedvectors(re, obi, oldobi->vectors, step);
}
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c
index fa7b9cb7ea1..f8ada97e493 100644
--- a/source/blender/render/intern/source/envmap.c
+++ b/source/blender/render/intern/source/envmap.c
@@ -239,10 +239,10 @@ static void envmap_transmatrix(float mat[][4], int part)
}
copy_m4_m4(tmat, mat);
- eul_to_mat4( rotmat,eul);
+ eul_to_mat4(rotmat, eul);
mul_serie_m4(mat, tmat, rotmat,
- NULL, NULL, NULL,
- NULL, NULL, NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
}
/* ------------------------------------------------------------------------- */
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 260a2de4858..2bcc71d1d48 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -1482,10 +1482,10 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
/* pixel coordinates */
- minx= MIN3(dxt[0],dyt[0],dxt[0]+dyt[0] );
- maxx= MAX3(dxt[0],dyt[0],dxt[0]+dyt[0] );
- miny= MIN3(dxt[1],dyt[1],dxt[1]+dyt[1] );
- maxy= MAX3(dxt[1],dyt[1],dxt[1]+dyt[1] );
+ minx = MIN3(dxt[0], dyt[0], dxt[0] + dyt[0]);
+ maxx = MAX3(dxt[0], dyt[0], dxt[0] + dyt[0]);
+ miny = MIN3(dxt[1], dyt[1], dxt[1] + dyt[1]);
+ maxy = MAX3(dxt[1], dyt[1], dxt[1] + dyt[1]);
/* tex_sharper has been removed */
minx= (maxx-minx)/2.0f;
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index f7f592c9407..3e82bec7e52 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -167,7 +167,7 @@ float RE_filter_value(int type, float x)
x= ABS(x);
- switch(type) {
+ switch (type) {
case R_FILTER_BOX:
if (x>1.0f) return 0.0f;
return 1.0f;
@@ -208,7 +208,7 @@ static float calc_weight(Render *re, float *weight, int i, int j)
weight[a]= 0.0;
/* Weighting choices */
- switch(re->r.filtertype) {
+ switch (re->r.filtertype) {
case R_FILTER_BOX:
if (i==0 && j==0) weight[a]= 1.0;
break;
diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c
index 436eaefd155..f5c2b70a290 100644
--- a/source/blender/render/intern/source/occlusion.c
+++ b/source/blender/render/intern/source/occlusion.c
@@ -1627,11 +1627,11 @@ static void *exec_strandsurface_sample(void *data)
co4= mesh->co[face[3]];
mid_v3_v3v3(co, co1, co3);
- normal_quad_v3( n,co1, co2, co3, co4);
+ normal_quad_v3(n, co1, co2, co3, co4);
}
else {
cent_tri_v3(co, co1, co2, co3);
- normal_tri_v3( n,co1, co2, co3);
+ normal_tri_v3(n, co1, co2, co3);
}
negate_v3(n);
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index a4a244daf43..ff45f991dc0 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -541,7 +541,9 @@ void RE_SetWindow(Render *re, rctf *viewplane, float clipsta, float clipend)
re->clipend= clipend;
re->r.mode &= ~R_ORTHO;
- perspective_m4( re->winmat,re->viewplane.xmin, re->viewplane.xmax, re->viewplane.ymin, re->viewplane.ymax, re->clipsta, re->clipend);
+ perspective_m4(re->winmat,
+ re->viewplane.xmin, re->viewplane.xmax,
+ re->viewplane.ymin, re->viewplane.ymax, re->clipsta, re->clipend);
}
@@ -554,7 +556,9 @@ void RE_SetOrtho(Render *re, rctf *viewplane, float clipsta, float clipend)
re->clipend= clipend;
re->r.mode |= R_ORTHO;
- orthographic_m4( re->winmat,re->viewplane.xmin, re->viewplane.xmax, re->viewplane.ymin, re->viewplane.ymax, re->clipsta, re->clipend);
+ orthographic_m4(re->winmat,
+ re->viewplane.xmin, re->viewplane.xmax,
+ re->viewplane.ymin, re->viewplane.ymax, re->clipsta, re->clipend);
}
void RE_SetView(Render *re, float mat[][4])
@@ -2375,7 +2379,7 @@ void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, const char
ibuf_clip = IMB_allocImBuf(layer->rectx, layer->recty, 32, IB_rectfloat);
if (ibuf_clip) {
- IMB_rectcpy(ibuf_clip, ibuf, 0,0, x,y, layer->rectx, layer->recty);
+ IMB_rectcpy(ibuf_clip, ibuf, 0, 0, x, y, layer->rectx, layer->recty);
memcpy(layer->rectf, ibuf_clip->rect_float, sizeof(float)*4*layer->rectx*layer->recty);
IMB_freeImBuf(ibuf_clip);
@@ -2404,7 +2408,7 @@ void RE_result_load_from_file(RenderResult *result, ReportList *reports, const c
}
}
-const float default_envmap_layout[] = { 0,0, 1,0, 2,0, 0,1, 1,1, 2,1 };
+const float default_envmap_layout[] = { 0, 0, 1, 0, 2, 0, 0, 1, 1, 1, 2, 1 };
int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env, const char *relpath, const char imtype, float layout[12])
{
@@ -2412,7 +2416,7 @@ int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env,
ImBuf *ibuf=NULL;
int ok;
int dx;
- int maxX=0,maxY=0,i=0;
+ int maxX=0, maxY=0, i=0;
char filepath[FILE_MAX];
if (env->cube[1]==NULL) {
@@ -2427,8 +2431,8 @@ int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env,
if (env->type == ENV_CUBE) {
for (i=0; i < 12; i+=2) {
- maxX = MAX2(maxX,layout[i] + 1);
- maxY = MAX2(maxY,layout[i+1] + 1);
+ maxX = MAX2(maxX, layout[i] + 1);
+ maxY = MAX2(maxY, layout[i+1] + 1);
}
ibuf = IMB_allocImBuf(maxX*dx, maxY*dx, 24, IB_rectfloat);
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index 826a31e17a8..ac48a5f41f2 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -351,7 +351,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz,
rc= hashvectf + (ofs % 768);
- fac= fabsf( rc[1]*(har->rad*fabsf(rc[0]) - radist) );
+ fac = fabsf(rc[1] * (har->rad * fabsf(rc[0]) - radist));
if (fac< 1.0f) {
ringf+= (1.0f-fac);
@@ -360,7 +360,7 @@ int shadeHaloFloat(HaloRen *har, float *col, int zz,
}
if (har->type & HA_VECT) {
- dist= fabsf( har->cos*(yn) - har->sin*(xn) )/har->rad;
+ dist= fabsf(har->cos * (yn) - har->sin * (xn)) / har->rad;
if (dist>1.0f) dist= 1.0f;
if (har->tex) {
zn= har->sin*xn - har->cos*yn;
diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c
index 5d4f9db9a02..8bbb16739f7 100644
--- a/source/blender/render/intern/source/pointdensity.c
+++ b/source/blender/render/intern/source/pointdensity.c
@@ -121,7 +121,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
/* Just to create a valid rendering context for particles */
psys_render_set(ob, psys, re->viewmat, re->winmat, re->winx, re->winy, 0);
- dm = mesh_create_derived_render(re->scene, ob,CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
+ dm = mesh_create_derived_render(re->scene, ob, CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
if ( !psys_check_enabled(ob, psys)) {
psys_render_restore(ob, psys);
@@ -221,7 +221,7 @@ static void pointdensity_cache_object(Render *re, PointDensity *pd, Object *ob)
copy_v3_v3(co, mvert->co);
- switch(pd->ob_cache_space) {
+ switch (pd->ob_cache_space) {
case TEX_PD_OBJECTSPACE:
break;
case TEX_PD_OBJECTLOC:
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index 0c735c18c57..c68fb578d4c 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -87,9 +87,8 @@ static int test_break(void *data)
static void RE_rayobject_config_control(RayObject *r, Render *re)
{
- if (RE_rayobject_isRayAPI(r))
- {
- r = RE_rayobject_align( r );
+ if (RE_rayobject_isRayAPI(r)) {
+ r = RE_rayobject_align(r);
r->control.data = re;
r->control.test_break = test_break;
}
@@ -99,8 +98,7 @@ static RayObject* RE_rayobject_create(Render *re, int type, int size)
{
RayObject * res = NULL;
- if (type == R_RAYSTRUCTURE_AUTO)
- {
+ if (type == R_RAYSTRUCTURE_AUTO) {
//TODO
//if (detect_simd())
#ifdef __SSE__
@@ -111,8 +109,7 @@ static RayObject* RE_rayobject_create(Render *re, int type, int size)
}
#ifndef __SSE__
- if (type == R_RAYSTRUCTURE_SIMD_SVBVH || type == R_RAYSTRUCTURE_SIMD_QBVH)
- {
+ if (type == R_RAYSTRUCTURE_SIMD_SVBVH || type == R_RAYSTRUCTURE_SIMD_QBVH) {
puts("Warning: Using VBVH (SSE was disabled at compile time)");
type = R_RAYSTRUCTURE_VBVH;
}
@@ -148,37 +145,30 @@ void freeraytree(Render *re)
{
ObjectInstanceRen *obi;
- if (re->raytree)
- {
+ if (re->raytree) {
RE_rayobject_free(re->raytree);
re->raytree = NULL;
}
- if (re->rayfaces)
- {
+ if (re->rayfaces) {
MEM_freeN(re->rayfaces);
re->rayfaces = NULL;
}
- if (re->rayprimitives)
- {
+ if (re->rayprimitives) {
MEM_freeN(re->rayprimitives);
re->rayprimitives = NULL;
}
- for (obi=re->instancetable.first; obi; obi=obi->next)
- {
+ for (obi=re->instancetable.first; obi; obi=obi->next) {
ObjectRen *obr = obi->obr;
- if (obr->raytree)
- {
+ if (obr->raytree) {
RE_rayobject_free(obr->raytree);
obr->raytree = NULL;
}
- if (obr->rayfaces)
- {
+ if (obr->rayfaces) {
MEM_freeN(obr->rayfaces);
obr->rayfaces = NULL;
}
- if (obi->raytree)
- {
+ if (obi->raytree) {
RE_rayobject_free(obi->raytree);
obi->raytree = NULL;
}
@@ -187,7 +177,7 @@ void freeraytree(Render *re)
#ifdef RE_RAYCOUNTER
{
RayCounter sum;
- memset( &sum, 0, sizeof(sum) );
+ memset(&sum, 0, sizeof(sum));
int i;
for (i=0; i<BLENDER_MAX_THREADS; i++)
RE_RC_MERGE(&sum, re_rc_counter+i);
@@ -232,8 +222,7 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi)
// update render stats
ObjectRen *obr = obi->obr;
- if (obr->raytree == NULL)
- {
+ if (obr->raytree == NULL) {
RayObject *raytree;
RayFace *face = NULL;
VlakPrimitive *vlakprimitive = NULL;
@@ -241,8 +230,7 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi)
//Count faces
int faces = 0;
- for (v=0;v<obr->totvlak;v++)
- {
+ for (v=0;v<obr->totvlak;v++) {
VlakRen *vlr = obr->vlaknodes[v>>8].vlak + (v&255);
if (is_raytraceable_vlr(re, vlr))
faces++;
@@ -260,23 +248,21 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi)
obr->rayobi = obi;
- for (v=0;v<obr->totvlak;v++)
- {
+ for (v=0;v<obr->totvlak;v++) {
VlakRen *vlr = obr->vlaknodes[v>>8].vlak + (v&255);
- if (is_raytraceable_vlr(re, vlr))
- {
+ if (is_raytraceable_vlr(re, vlr)) {
if ((re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS)) {
- RE_rayobject_add( raytree, RE_vlakprimitive_from_vlak( vlakprimitive, obi, vlr ) );
+ RE_rayobject_add(raytree, RE_vlakprimitive_from_vlak(vlakprimitive, obi, vlr));
vlakprimitive++;
}
else {
RE_rayface_from_vlak(face, obi, vlr);
- RE_rayobject_add( raytree, RE_rayobject_unalignRayFace(face) );
+ RE_rayobject_add(raytree, RE_rayobject_unalignRayFace(face));
face++;
}
}
}
- RE_rayobject_done( raytree );
+ RE_rayobject_done(raytree);
/* in case of cancel during build, raytree is not usable */
if (test_break(re))
@@ -286,8 +272,7 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi)
}
if (obr->raytree) {
- if ((obi->flag & R_TRANSFORMED) && obi->raytree == NULL)
- {
+ if ((obi->flag & R_TRANSFORMED) && obi->raytree == NULL) {
obi->transform_primitives = 0;
obi->raytree = RE_rayobject_instance_create( obr->raytree, obi->mat, obi, obi->obr->rayobi );
}
@@ -299,16 +284,13 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi)
static int has_special_rayobject(Render *re, ObjectInstanceRen *obi)
{
- if ( (obi->flag & R_TRANSFORMED) && (re->r.raytrace_options & R_RAYTRACE_USE_INSTANCES) )
- {
+ if ( (obi->flag & R_TRANSFORMED) && (re->r.raytrace_options & R_RAYTRACE_USE_INSTANCES) ) {
ObjectRen *obr = obi->obr;
int v, faces = 0;
- for (v=0;v<obr->totvlak;v++)
- {
+ for (v=0;v<obr->totvlak;v++) {
VlakRen *vlr = obr->vlaknodes[v>>8].vlak + (v&255);
- if (is_raytraceable_vlr(re, vlr))
- {
+ if (is_raytraceable_vlr(re, vlr)) {
faces++;
if (faces > 4)
return 1;
@@ -329,8 +311,7 @@ static void makeraytree_single(Render *re)
int faces = 0, obs = 0, special = 0;
for (obi=re->instancetable.first; obi; obi=obi->next)
- if (is_raytraceable(re, obi))
- {
+ if (is_raytraceable(re, obi)) {
ObjectRen *obr = obi->obr;
obs++;
@@ -339,8 +320,7 @@ static void makeraytree_single(Render *re)
}
else {
int v;
- for (v=0;v<obr->totvlak;v++)
- {
+ for (v=0;v<obr->totvlak;v++) {
VlakRen *vlr = obr->vlaknodes[v>>8].vlak + (v&255);
if (is_raytraceable_vlr(re, vlr))
faces++;
@@ -348,8 +328,7 @@ static void makeraytree_single(Render *re)
}
}
- if (faces + special == 0)
- {
+ if (faces + special == 0) {
re->raytree = RE_rayobject_empty_create();
return;
}
@@ -357,8 +336,7 @@ static void makeraytree_single(Render *re)
//Create raytree
raytree = re->raytree = RE_rayobject_create( re, re->r.raytrace_structure, faces+special );
- if ( (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) )
- {
+ if ( (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) ) {
vlakprimitive = re->rayprimitives = (VlakPrimitive*)MEM_callocN(faces*sizeof(VlakPrimitive), "Raytrace vlak-primitives");
}
else {
@@ -366,8 +344,7 @@ static void makeraytree_single(Render *re)
}
for (obi=re->instancetable.first; obi; obi=obi->next)
- if (is_raytraceable(re, obi))
- {
+ if (is_raytraceable(re, obi)) {
if (test_break(re))
break;
@@ -378,30 +355,27 @@ static void makeraytree_single(Render *re)
break;
if (obj)
- RE_rayobject_add( re->raytree, obj );
+ RE_rayobject_add(re->raytree, obj);
}
else {
int v;
ObjectRen *obr = obi->obr;
- if (obi->flag & R_TRANSFORMED)
- {
+ if (obi->flag & R_TRANSFORMED) {
obi->transform_primitives = 1;
}
- for (v=0;v<obr->totvlak;v++)
- {
+ for (v=0;v<obr->totvlak;v++) {
VlakRen *vlr = obr->vlaknodes[v>>8].vlak + (v&255);
if (is_raytraceable_vlr(re, vlr)) {
if ((re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS)) {
RayObject *obj = RE_vlakprimitive_from_vlak( vlakprimitive, obi, vlr );
- RE_rayobject_add( raytree, obj );
+ RE_rayobject_add(raytree, obj);
vlakprimitive++;
}
else {
RE_rayface_from_vlak(face, obi, vlr);
- if ((obi->flag & R_TRANSFORMED))
- {
+ if ((obi->flag & R_TRANSFORMED)) {
mul_m4_v3(obi->mat, face->v1);
mul_m4_v3(obi->mat, face->v2);
mul_m4_v3(obi->mat, face->v3);
@@ -409,7 +383,7 @@ static void makeraytree_single(Render *re)
mul_m4_v3(obi->mat, face->v4);
}
- RE_rayobject_add( raytree, RE_rayobject_unalignRayFace(face) );
+ RE_rayobject_add(raytree, RE_rayobject_unalignRayFace(face));
face++;
}
}
@@ -417,12 +391,11 @@ static void makeraytree_single(Render *re)
}
}
- if (!test_break(re))
- {
+ if (!test_break(re)) {
re->i.infostr= "Raytree.. building";
re->stats_draw(re->sdh, &re->i);
- RE_rayobject_done( raytree );
+ RE_rayobject_done(raytree);
}
}
@@ -451,9 +424,8 @@ void makeraytree(Render *re)
//Calculate raytree max_size
//This is ONLY needed to kept a bogus behavior of SUN and HEMI lights
INIT_MINMAX(min, max);
- RE_rayobject_merge_bb( re->raytree, min, max );
- for (i=0; i<3; i++)
- {
+ RE_rayobject_merge_bb(re->raytree, min, max);
+ for (i=0; i<3; i++) {
min[i] += 0.01f;
max[i] += 0.01f;
sub[i] = max[i]-min[i];
@@ -467,7 +439,7 @@ void makeraytree(Render *re)
}
#ifdef RE_RAYCOUNTER
- memset( re_rc_counter, 0, sizeof(re_rc_counter) );
+ memset(re_rc_counter, 0, sizeof(re_rc_counter));
#endif
}
@@ -720,7 +692,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
float dist_mir = origshi->mat->dist_mir;
copy_v3_v3(isec.start, start);
- copy_v3_v3(isec.dir, dir );
+ copy_v3_v3(isec.dir, dir);
isec.dist = dist_mir > 0 ? dist_mir : RE_RAYTRACE_MAXDIST;
isec.mode= RE_RAY_MIRROR;
isec.check = RE_CHECK_VLR_RENDER;
@@ -1006,12 +978,10 @@ static void halton_sample(double *ht_invprimes, double *ht_nums, double *v)
// "Instant Radiosity", Keller A.
unsigned int i;
- for (i = 0; i < 2; i++)
- {
+ for (i = 0; i < 2; i++) {
double r = fabs((1.0 - ht_nums[i]) - 1e-10);
- if (ht_invprimes[i] >= r)
- {
+ if (ht_invprimes[i] >= r) {
double lasth;
double h = ht_invprimes[i];
@@ -1065,8 +1035,7 @@ static struct QMCSampler *QMC_initSampler(int type, int tot)
static void QMC_initPixel(QMCSampler *qsa, int thread)
{
- if (qsa->type==SAMP_TYPE_HAMMERSLEY)
- {
+ if (qsa->type==SAMP_TYPE_HAMMERSLEY) {
/* hammersley sequence is fixed, already created in QMCSampler init.
* per pixel, gets a random offset. We create separate offsets per thread, for write-safety */
qsa->offs[thread][0] = 0.5f * BLI_thread_frand(thread);
@@ -1270,7 +1239,7 @@ static int adaptive_sample_contrast_val(int samples, float prev, float val, floa
/* if the last sample's contribution to the total value was below a small threshold
* (i.e. the samples taken are very similar), then taking more samples that are probably
* going to be the same is wasting effort */
- if (fabsf( prev/(float)(samples-1) - val/(float)samples ) < thresh) {
+ if (fabsf(prev / (float)(samples - 1) - val / (float)samples ) < thresh) {
return 1;
}
else
@@ -1345,7 +1314,7 @@ static void trace_refract(float col[4], ShadeInput *shi, ShadeResult *shr)
/* get a quasi-random vector from a phong-weighted disc */
QMC_samplePhong(samp3d, qsa, shi->thread, samples, blur);
- ortho_basis_v3v3_v3( orthx, orthy,v_refract);
+ ortho_basis_v3v3_v3(orthx, orthy, v_refract);
mul_v3_fl(orthx, samp3d[0]);
mul_v3_fl(orthy, samp3d[1]);
@@ -1377,8 +1346,7 @@ static void trace_refract(float col[4], ShadeInput *shi, ShadeResult *shr)
samples++;
/* adaptive sampling */
- if (adapt_thresh < 1.0f && samples > max_samples/2)
- {
+ if (adapt_thresh < 1.0f && samples > max_samples/2) {
if (adaptive_sample_variance(samples, col, colsq, adapt_thresh))
break;
@@ -1442,7 +1410,7 @@ static void trace_reflect(float col[3], ShadeInput *shi, ShadeResult *shr, float
mul_v3_fl(orthy, samp3d[1]*aniso);
}
else {
- ortho_basis_v3v3_v3( orthx, orthy,shi->vn);
+ ortho_basis_v3v3_v3(orthx, orthy, shi->vn);
mul_v3_fl(orthx, samp3d[0]);
mul_v3_fl(orthy, samp3d[1]);
}
@@ -1479,8 +1447,7 @@ static void trace_reflect(float col[3], ShadeInput *shi, ShadeResult *shr, float
samples++;
/* adaptive sampling */
- if (adapt_thresh > 0.0f && samples > max_samples/3)
- {
+ if (adapt_thresh > 0.0f && samples > max_samples/3) {
if (adaptive_sample_variance(samples, col, colsq, adapt_thresh))
break;
@@ -1712,7 +1679,7 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult *
vec[2]-= vec[2];
}
- copy_v3_v3(isec.dir, vec );
+ copy_v3_v3(isec.dir, vec);
isec.dist = RE_RAYTRACE_MAXDIST;
if (RE_rayobject_raycast(R.raytree, &isec)) {
@@ -1922,7 +1889,7 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
isec.lay= -1;
copy_v3_v3(isec.start, shi->co);
- RE_rayobject_hint_bb( R.raytree, &point_hint, isec.start, isec.start );
+ RE_rayobject_hint_bb(R.raytree, &point_hint, isec.start, isec.start);
isec.hint = &point_hint;
zero_v3(ao);
@@ -1946,7 +1913,7 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
copy_v3_v3(nrm, shi->facenor);
}
- ortho_basis_v3v3_v3( up, side,nrm);
+ ortho_basis_v3v3_v3(up, side, nrm);
/* sampling init */
if (R.wrld.ao_samp_method==WO_AOSAMP_HALTON) {
@@ -2062,7 +2029,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float ao[3], float env[3])
isec.lay= -1;
copy_v3_v3(isec.start, shi->co);
- RE_rayobject_hint_bb( R.raytree, &point_hint, isec.start, isec.start );
+ RE_rayobject_hint_bb(R.raytree, &point_hint, isec.start, isec.start);
isec.hint = &point_hint;
zero_v3(ao);
@@ -2267,11 +2234,10 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
QMC_initPixel(qsa, shi->thread);
INIT_MINMAX(min, max);
- for (i=0; i<totjitco; i++)
- {
+ for (i=0; i<totjitco; i++) {
DO_MINMAX(jitco[i], min, max);
}
- RE_rayobject_hint_bb( R.raytree, &bb_hint, min, max);
+ RE_rayobject_hint_bb(R.raytree, &bb_hint, min, max);
isec->hint = &bb_hint;
isec->check = RE_CHECK_VLR_RENDER;
@@ -2296,10 +2262,10 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
/* calc tangent plane vectors */
sub_v3_v3v3(v, co, lampco);
normalize_v3(v);
- ortho_basis_v3v3_v3( ru, rv,v);
+ ortho_basis_v3v3_v3(ru, rv, v);
/* sampling, returns quasi-random vector in area_size disc */
- QMC_sampleDisc(samp3d, qsa, shi->thread, samples,lar->area_size);
+ QMC_sampleDisc(samp3d, qsa, shi->thread, samples, lar->area_size);
/* distribute disc samples across the tangent plane */
s[0] = samp3d[0]*ru[0] + samp3d[1]*rv[0];
@@ -2420,7 +2386,7 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[
copy_v3_v3(isec->start, shi->co);
isec->orig.ob = shi->obi;
isec->orig.face = shi->vlr;
- RE_rayobject_hint_bb( R.raytree, &point_hint, isec->start, isec->start );
+ RE_rayobject_hint_bb(R.raytree, &point_hint, isec->start, isec->start);
isec->hint = &point_hint;
while (a--) {
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c
index 37d6479e7bc..162fc160915 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -458,6 +458,7 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
BLI_strncpy(rl->name, srl->name, sizeof(rl->name));
rl->lay= srl->lay;
rl->lay_zmask= srl->lay_zmask;
+ rl->lay_exclude= srl->lay_exclude;
rl->layflag= srl->layflag;
rl->passflag= srl->passflag; // for debugging: srl->passflag|SCE_PASS_RAYHITS;
rl->pass_xor= srl->pass_xor;
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index fedbce89058..521b295fb0b 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -227,7 +227,7 @@ static int blend(Tex *tex, float *texvec, TexResult *texres)
texres->tin= (2.0f+x+y)/4.0f;
}
else if (tex->stype==TEX_RAD) { /* radial */
- texres->tin= (atan2(y,x) / (2*M_PI) + 0.5);
+ texres->tin= (atan2(y, x) / (2*M_PI) + 0.5);
}
else { /* sphere TEX_SPHERE */
texres->tin= 1.0-sqrt(x*x+ y*y+texvec[2]*texvec[2]);
@@ -870,7 +870,7 @@ static int cubemap(MTex *mtex, VlakRen *vlr, float *n, float x, float y, float z
/* test for v1, vlr can be faked for baking */
if (vlr->v1 && vlr->v1->orco) {
float nor[3];
- normal_tri_v3( nor,vlr->v1->orco, vlr->v2->orco, vlr->v3->orco);
+ normal_tri_v3(nor, vlr->v1->orco, vlr->v2->orco, vlr->v3->orco);
if ( fabs(nor[0])<fabs(nor[2]) && fabs(nor[1])<fabs(nor[2]) ) vlr->puno |= ME_PROJXY;
else if ( fabs(nor[0])<fabs(nor[1]) && fabs(nor[2])<fabs(nor[1]) ) vlr->puno |= ME_PROJXZ;
@@ -969,8 +969,8 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
fx = (t[0] + 1.0f) / 2.0f;
fy = (t[1] + 1.0f) / 2.0f;
}
- else if (wrap==MTEX_TUBE) map_to_tube( &fx, &fy,t[0], t[1], t[2]);
- else if (wrap==MTEX_SPHERE) map_to_sphere( &fx, &fy,t[0], t[1], t[2]);
+ else if (wrap==MTEX_TUBE) map_to_tube( &fx, &fy, t[0], t[1], t[2]);
+ else if (wrap==MTEX_SPHERE) map_to_sphere(&fx, &fy, t[0], t[1], t[2]);
else {
if (texco==TEXCO_OBJECT) cubemap_ob(ob, n, t[0], t[1], t[2], &fx, &fy);
else if (texco==TEXCO_GLOB) cubemap_glob(n, t[0], t[1], t[2], &fx, &fy);
@@ -1041,20 +1041,20 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
}
if (ok) {
if (wrap==MTEX_TUBE) {
- map_to_tube( area, area+1,t[0], t[1], t[2]);
- map_to_tube( area+2, area+3,t[0]+dxt[0], t[1]+dxt[1], t[2]+dxt[2]);
- map_to_tube( area+4, area+5,t[0]+dyt[0], t[1]+dyt[1], t[2]+dyt[2]);
+ map_to_tube(area, area+1, t[0], t[1], t[2]);
+ map_to_tube(area + 2, area + 3, t[0] + dxt[0], t[1] + dxt[1], t[2] + dxt[2]);
+ map_to_tube(area + 4, area + 5, t[0] + dyt[0], t[1] + dyt[1], t[2] + dyt[2]);
}
else {
- map_to_sphere(area,area+1,t[0], t[1], t[2]);
- map_to_sphere( area+2, area+3,t[0]+dxt[0], t[1]+dxt[1], t[2]+dxt[2]);
- map_to_sphere( area+4, area+5,t[0]+dyt[0], t[1]+dyt[1], t[2]+dyt[2]);
+ map_to_sphere(area, area+1, t[0], t[1], t[2]);
+ map_to_sphere(area + 2, area + 3, t[0] + dxt[0], t[1] + dxt[1], t[2] + dxt[2]);
+ map_to_sphere(area + 4, area + 5, t[0] + dyt[0], t[1] + dyt[1], t[2] + dyt[2]);
}
areaflag= 1;
}
else {
- if (wrap==MTEX_TUBE) map_to_tube( &fx, &fy,t[0], t[1], t[2]);
- else map_to_sphere( &fx, &fy,t[0], t[1], t[2]);
+ if (wrap==MTEX_TUBE) map_to_tube( &fx, &fy, t[0], t[1], t[2]);
+ else map_to_sphere(&fx, &fy, t[0], t[1], t[2]);
dxt[0]/= 2.0f;
dxt[1]/= 2.0f;
dyt[0]/= 2.0f;
@@ -1185,7 +1185,7 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex,
tex, which_output, R.r.cfra, (R.r.scemode & R_TEXNODE_PREVIEW) != 0, NULL, NULL);
}
else
- switch(tex->type) {
+ switch (tex->type) {
case 0:
texres->tin= 0.0f;
@@ -1231,7 +1231,7 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex,
copy_v3_v3(tmpvec, texvec);
mul_v3_fl(tmpvec, 1.0f/tex->noisesize);
- switch(tex->stype) {
+ switch (tex->stype) {
case TEX_MFRACTAL:
case TEX_FBM:
retval= mg_mFractalOrfBmTex(tex, tmpvec, texres);
@@ -1389,7 +1389,7 @@ void texture_rgb_blend(float in[3], const float tex[3], const float out[3], floa
{
float facm, col;
- switch(blendtype) {
+ switch (blendtype) {
case MTEX_BLEND:
fact*= facg;
facm= 1.0f-fact;
@@ -1530,7 +1530,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen
facm= 1.0f-fact;
if (flip) SWAP(float, fact, facm);
- switch(blendtype) {
+ switch (blendtype) {
case MTEX_BLEND:
in= fact*tex + facm*out;
break;
@@ -2102,9 +2102,9 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
// generate the surface derivatives in object space
mul_m3_v3(view2obj, dPdx);
- mul_m3_v3( view2obj, dPdy );
+ mul_m3_v3(view2obj, dPdy);
// generate the unit normal in object space
- mul_transposed_m3_v3( obj2view, vN );
+ mul_transposed_m3_v3(obj2view, vN);
normalize_v3(vN);
}
@@ -2126,9 +2126,9 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
fMagnitude = abs_fDet;
if ( mtex->texflag & MTEX_BUMP_OBJECTSPACE ) {
// pre do transform of texres->nor by the inverse transposed of obj2view
- mul_transposed_m3_v3( view2obj, vN );
- mul_transposed_m3_v3( view2obj, ntap_bump->vR1 );
- mul_transposed_m3_v3( view2obj, ntap_bump->vR2 );
+ mul_transposed_m3_v3(view2obj, vN);
+ mul_transposed_m3_v3(view2obj, ntap_bump->vR1);
+ mul_transposed_m3_v3(view2obj, ntap_bump->vR2);
fMagnitude *= len_v3(vN);
}
@@ -3054,7 +3054,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
}
/* Grab the mapping settings for this texture */
- switch(mtex->texco) {
+ switch (mtex->texco) {
case TEXCO_ANGMAP:
/* only works with texture being "real" */
/* use saacos(), fixes bug [#22398], float precision caused lo[2] to be slightly less then -1.0 */
@@ -3077,8 +3077,8 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
case TEXCO_H_SPHEREMAP:
case TEXCO_H_TUBEMAP:
if (skyflag & WO_ZENUP) {
- if (mtex->texco==TEXCO_H_TUBEMAP) map_to_tube( tempvec, tempvec+1,lo[0], lo[2], lo[1]);
- else map_to_sphere( tempvec, tempvec+1,lo[0], lo[2], lo[1]);
+ if (mtex->texco==TEXCO_H_TUBEMAP) map_to_tube( tempvec, tempvec+1, lo[0], lo[2], lo[1]);
+ else map_to_sphere(tempvec, tempvec+1, lo[0], lo[2], lo[1]);
/* tube/spheremap maps for outside view, not inside */
tempvec[0]= 1.0f-tempvec[0];
/* only top half */
@@ -3683,7 +3683,7 @@ void RE_sample_material_color(Material *mat, float color[3], float *alpha, const
if (!mvert || !mface || !mat) return;
v1=mface[face_index].v1, v2=mface[face_index].v2, v3=mface[face_index].v3;
if (hit_quad) {v2=mface[face_index].v3; v3=mface[face_index].v4;}
- normal_tri_v3( normal, mvert[v1].co, mvert[v2].co, mvert[v3].co);
+ normal_tri_v3(normal, mvert[v1].co, mvert[v2].co, mvert[v3].co);
/* generate shadeinput with data required */
shi.mat = mat;
@@ -3737,7 +3737,7 @@ void RE_sample_material_color(Material *mat, float color[3], float *alpha, const
}
}
/* active uv map */
- shi.actuv = CustomData_get_active_layer_index(&orcoDm->faceData,CD_MTFACE) - layer_index;
+ shi.actuv = CustomData_get_active_layer_index(&orcoDm->faceData, CD_MTFACE) - layer_index;
shi.totuv = layers;
}
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index f5e36125299..04e1bee4376 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -457,7 +457,7 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset,
float *fp, *col= NULL;
int pixsize= 3;
- switch(rpass->passtype) {
+ switch (rpass->passtype) {
case SCE_PASS_Z:
fp= rpass->rect + offset;
*fp= shr->z;
@@ -569,7 +569,7 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
float *col= NULL, uvcol[3];
int a, pixsize= 3;
- switch(rpass->passtype) {
+ switch (rpass->passtype) {
case SCE_PASS_Z:
fp= rpass->rect + offset;
*fp= shr->z;
@@ -889,10 +889,10 @@ static PixStrMain *addpsmain(ListBase *lb)
{
PixStrMain *psm;
- psm= (PixStrMain *)MEM_mallocN(sizeof(PixStrMain),"pixstrMain");
+ psm= (PixStrMain *)MEM_mallocN(sizeof(PixStrMain), "pixstrMain");
BLI_addtail(lb, psm);
- psm->ps= (PixStr *)MEM_mallocN(4096*sizeof(PixStr),"pixstr");
+ psm->ps= (PixStr *)MEM_mallocN(4096*sizeof(PixStr), "pixstr");
psm->counter= 0;
return psm;
diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c
index 6a0c8e3526f..4a9e4be7f86 100644
--- a/source/blender/render/intern/source/renderdatabase.c
+++ b/source/blender/render/intern/source/renderdatabase.c
@@ -254,7 +254,7 @@ VertRen *RE_findOrAddVert(ObjectRen *obr, int nr)
int a;
if (nr<0) {
- printf("error in findOrAddVert: %d\n",nr);
+ printf("error in findOrAddVert: %d\n", nr);
return NULL;
}
a= nr>>8;
@@ -262,7 +262,7 @@ VertRen *RE_findOrAddVert(ObjectRen *obr, int nr)
if (a>=obr->vertnodeslen-1) { /* Need to allocate more columns..., and keep last element NULL for free loop */
temp= obr->vertnodes;
- obr->vertnodes= MEM_mallocN(sizeof(VertTableNode)*(obr->vertnodeslen+TABLEINITSIZE) , "vertnodes");
+ obr->vertnodes= MEM_mallocN(sizeof(VertTableNode)*(obr->vertnodeslen+TABLEINITSIZE), "vertnodes");
if (temp) memcpy(obr->vertnodes, temp, obr->vertnodeslen*sizeof(VertTableNode));
memset(obr->vertnodes+obr->vertnodeslen, 0, TABLEINITSIZE*sizeof(VertTableNode));
@@ -274,7 +274,7 @@ VertRen *RE_findOrAddVert(ObjectRen *obr, int nr)
if (v==NULL) {
int i;
- v= (VertRen *)MEM_callocN(256*sizeof(VertRen),"findOrAddVert");
+ v= (VertRen *)MEM_callocN(256*sizeof(VertRen), "findOrAddVert");
obr->vertnodes[a].vert= v;
for (i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++) {
@@ -497,7 +497,7 @@ VlakRen *RE_findOrAddVlak(ObjectRen *obr, int nr)
int a;
if (nr<0) {
- printf("error in findOrAddVlak: %d\n",nr);
+ printf("error in findOrAddVlak: %d\n", nr);
return obr->vlaknodes[0].vlak;
}
a= nr>>8;
@@ -505,7 +505,7 @@ VlakRen *RE_findOrAddVlak(ObjectRen *obr, int nr)
if (a>=obr->vlaknodeslen-1) { /* Need to allocate more columns..., and keep last element NULL for free loop */
temp= obr->vlaknodes;
- obr->vlaknodes= MEM_mallocN(sizeof(VlakTableNode)*(obr->vlaknodeslen+TABLEINITSIZE) , "vlaknodes");
+ obr->vlaknodes= MEM_mallocN(sizeof(VlakTableNode)*(obr->vlaknodeslen+TABLEINITSIZE), "vlaknodes");
if (temp) memcpy(obr->vlaknodes, temp, obr->vlaknodeslen*sizeof(VlakTableNode));
memset(obr->vlaknodes+obr->vlaknodeslen, 0, TABLEINITSIZE*sizeof(VlakTableNode));
@@ -518,7 +518,7 @@ VlakRen *RE_findOrAddVlak(ObjectRen *obr, int nr)
if (v==NULL) {
int i;
- v= (VlakRen *)MEM_callocN(256*sizeof(VlakRen),"findOrAddVlak");
+ v= (VlakRen *)MEM_callocN(256*sizeof(VlakRen), "findOrAddVlak");
obr->vlaknodes[a].vlak= v;
for (i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++)
@@ -668,7 +668,7 @@ StrandRen *RE_findOrAddStrand(ObjectRen *obr, int nr)
int a;
if (nr<0) {
- printf("error in findOrAddStrand: %d\n",nr);
+ printf("error in findOrAddStrand: %d\n", nr);
return obr->strandnodes[0].strand;
}
a= nr>>8;
@@ -676,7 +676,7 @@ StrandRen *RE_findOrAddStrand(ObjectRen *obr, int nr)
if (a>=obr->strandnodeslen-1) { /* Need to allocate more columns..., and keep last element NULL for free loop */
temp= obr->strandnodes;
- obr->strandnodes= MEM_mallocN(sizeof(StrandTableNode)*(obr->strandnodeslen+TABLEINITSIZE) , "strandnodes");
+ obr->strandnodes= MEM_mallocN(sizeof(StrandTableNode)*(obr->strandnodeslen+TABLEINITSIZE), "strandnodes");
if (temp) memcpy(obr->strandnodes, temp, obr->strandnodeslen*sizeof(StrandTableNode));
memset(obr->strandnodes+obr->strandnodeslen, 0, TABLEINITSIZE*sizeof(StrandTableNode));
@@ -689,7 +689,7 @@ StrandRen *RE_findOrAddStrand(ObjectRen *obr, int nr)
if (v==NULL) {
int i;
- v= (StrandRen *)MEM_callocN(256*sizeof(StrandRen),"findOrAddStrand");
+ v= (StrandRen *)MEM_callocN(256*sizeof(StrandRen), "findOrAddStrand");
obr->strandnodes[a].strand= v;
for (i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++)
@@ -871,8 +871,7 @@ void free_renderdata_tables(Render *re)
}
if (re->objectinstance) {
- for (obi=re->instancetable.first; obi; obi=obi->next)
- {
+ for (obi=re->instancetable.first; obi; obi=obi->next) {
if (obi->vectors)
MEM_freeN(obi->vectors);
@@ -904,7 +903,7 @@ HaloRen *RE_findOrAddHalo(ObjectRen *obr, int nr)
int a;
if (nr<0) {
- printf("error in findOrAddHalo: %d\n",nr);
+ printf("error in findOrAddHalo: %d\n", nr);
return NULL;
}
a= nr>>8;
@@ -914,7 +913,7 @@ HaloRen *RE_findOrAddHalo(ObjectRen *obr, int nr)
// TABLEINITSIZE, obr->blohalen+TABLEINITSIZE );
temp=obr->bloha;
- obr->bloha=(HaloRen**)MEM_callocN(sizeof(void*)*(obr->blohalen+TABLEINITSIZE) , "Bloha");
+ obr->bloha=(HaloRen**)MEM_callocN(sizeof(void*)*(obr->blohalen+TABLEINITSIZE), "Bloha");
if (temp) memcpy(obr->bloha, temp, obr->blohalen*sizeof(void*));
memset(&(obr->bloha[obr->blohalen]), 0, TABLEINITSIZE*sizeof(void*));
obr->blohalen+=TABLEINITSIZE; /*Does this really need to be power of 2?*/
@@ -923,7 +922,7 @@ HaloRen *RE_findOrAddHalo(ObjectRen *obr, int nr)
h= obr->bloha[a];
if (h==NULL) {
- h= (HaloRen *)MEM_callocN(256*sizeof(HaloRen),"findOrAdHalo");
+ h= (HaloRen *)MEM_callocN(256*sizeof(HaloRen), "findOrAdHalo");
obr->bloha[a]= h;
}
h+= (nr & 255);
@@ -1051,7 +1050,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
HaloRen *har;
MTex *mtex;
float tin, tr, tg, tb, ta;
- float xn, yn, zn, texvec[3], hoco[4], hoco1[4], in[3],tex[3],out[3];
+ float xn, yn, zn, texvec[3], hoco[4], hoco1[4], in[3], tex[3], out[3];
int i, hasrgb;
if (hasize==0.0f) return NULL;
@@ -1125,24 +1124,24 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
}
else if (mtex->texco & TEXCO_OBJECT) {
if (mtex->object)
- mul_m4_v3(mtex->object->imat_ren,texvec);
+ mul_m4_v3(mtex->object->imat_ren, texvec);
}
else if (mtex->texco & TEXCO_GLOB) {
- copy_v3_v3(texvec,vec);
+ copy_v3_v3(texvec, vec);
}
else if (mtex->texco & TEXCO_UV && uvco) {
- int uv_index=CustomData_get_named_layer_index(&dm->faceData,CD_MTFACE,mtex->uvname);
+ int uv_index=CustomData_get_named_layer_index(&dm->faceData, CD_MTFACE, mtex->uvname);
if (uv_index<0)
- uv_index=CustomData_get_active_layer_index(&dm->faceData,CD_MTFACE);
+ uv_index=CustomData_get_active_layer_index(&dm->faceData, CD_MTFACE);
- uv_index-=CustomData_get_layer_index(&dm->faceData,CD_MTFACE);
+ uv_index-=CustomData_get_layer_index(&dm->faceData, CD_MTFACE);
texvec[0]=2.0f*uvco[2*uv_index]-1.0f;
texvec[1]=2.0f*uvco[2*uv_index+1]-1.0f;
texvec[2]=0.0f;
}
else if (mtex->texco & TEXCO_PARTICLE) {
- /* particle coordinates in range [0,1] */
+ /* particle coordinates in range [0, 1] */
texvec[0] = 2.f * pa_co[0] - 1.f;
texvec[1] = 2.f * pa_co[1] - 1.f;
texvec[2] = pa_co[2];
@@ -1163,7 +1162,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
out[1]=har->g;
out[2]=har->b;
- texture_rgb_blend(in,tex,out,tin,mtex->colfac,mtex->blendtype);
+ texture_rgb_blend(in, tex, out, tin, mtex->colfac, mtex->blendtype);
// zn= 1.0-yn;
//har->r= (yn*tr+ zn*ma->r);
//har->g= (yn*tg+ zn*ma->g);
@@ -1178,13 +1177,13 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
tin = ta;
if (mtex->mapto & MAP_ALPHA)
- har->alfa = texture_value_blend(mtex->def_var,har->alfa,tin,mtex->alphafac,mtex->blendtype);
+ har->alfa = texture_value_blend(mtex->def_var, har->alfa, tin, mtex->alphafac, mtex->blendtype);
if (mtex->mapto & MAP_HAR)
- har->hard = 1.0f+126.0f*texture_value_blend(mtex->def_var,((float)har->hard)/127.0f,tin,mtex->hardfac,mtex->blendtype);
+ har->hard = 1.0f+126.0f*texture_value_blend(mtex->def_var, ((float)har->hard)/127.0f, tin, mtex->hardfac, mtex->blendtype);
if (mtex->mapto & MAP_RAYMIRR)
- har->hasize = 100.0f*texture_value_blend(mtex->def_var,har->hasize/100.0f,tin,mtex->raymirrfac,mtex->blendtype);
+ har->hasize = 100.0f*texture_value_blend(mtex->def_var, har->hasize/100.0f, tin, mtex->raymirrfac, mtex->blendtype);
if (mtex->mapto & MAP_TRANSLU) {
- float add = texture_value_blend(mtex->def_var,(float)har->add/255.0f,tin,mtex->translfac,mtex->blendtype);
+ float add = texture_value_blend(mtex->def_var, (float)har->add/255.0f, tin, mtex->translfac, mtex->blendtype);
CLAMP(add, 0.f, 1.f);
har->add = 255.0f*add;
}
@@ -1274,8 +1273,7 @@ void project_renderdata(Render *re, void (*projectfunc)(const float *, float mat
else if (hoco[3]<0.0f) {
har->miny= har->maxy= -10000; /* render clips it */
}
- else /* do the projection...*/
- {
+ else { /* do the projection...*/
/* bring back hocos */
hoco[0]*= 2.0f;
hoco[1]*= 2.0f;
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index 7b17c782590..1c572524a70 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -108,7 +108,7 @@ static void copy_to_ztile(int *rectz, int size, int x1, int y1, int tile, char *
#if 0
static int sizeoflampbuf(ShadBuf *shb)
{
- int num,count=0;
+ int num, count=0;
char *cp;
cp= shb->cbuf;
@@ -193,7 +193,7 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
#if 0
if (print) {
for (a=0, ds=dsample; a<tot; a++, ds++)
- printf("%lf,%f ", ds->z/(double)0x7FFFFFFF, ds->v);
+ printf("%lf, %f ", ds->z/(double)0x7FFFFFFF, ds->v);
printf("\n");
}
#endif
@@ -278,7 +278,7 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
#if 0
if (print) {
for (a=0, ds=dsample; a<newtot; a++, ds++)
- printf("%lf,%f ", ds->z/(double)0x7FFFFFFF, ds->v);
+ printf("%lf, %f ", ds->z/(double)0x7FFFFFFF, ds->v);
printf("\n");
}
#endif
@@ -319,7 +319,7 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
int a, b, c, tot, minz, found, prevtot, newtot;
int sampletot[RE_MAX_OSA], totsample = 0, totsamplec = 0;
- shsample= MEM_callocN( sizeof(ShadSampleBuf), "shad sample buf");
+ shsample= MEM_callocN(sizeof(ShadSampleBuf), "shad sample buf");
BLI_addtail(&shb->buffers, shsample);
shsample->totbuf= MEM_callocN(sizeof(int)*size*size, "deeptotbuf");
@@ -511,11 +511,11 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
int a, x, y, minx, miny, byt1, byt2;
char *rc, *rcline, *ctile, *zt;
- shsample= MEM_callocN( sizeof(ShadSampleBuf), "shad sample buf");
+ shsample= MEM_callocN(sizeof(ShadSampleBuf), "shad sample buf");
BLI_addtail(&shb->buffers, shsample);
- shsample->zbuf= MEM_mallocN( sizeof(uintptr_t)*(size*size)/256, "initshadbuf2");
- shsample->cbuf= MEM_callocN( (size*size)/256, "initshadbuf3");
+ shsample->zbuf= MEM_mallocN(sizeof(uintptr_t)*(size*size)/256, "initshadbuf2");
+ shsample->cbuf= MEM_callocN((size*size)/256, "initshadbuf3");
ztile= (uintptr_t *)shsample->zbuf;
ctile= shsample->cbuf;
@@ -546,7 +546,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
verg= (*rz1 & 0xFFFFFF00);
- for (a=0;a<256;a++,rz1++) {
+ for (a=0;a<256;a++, rz1++) {
if ( (*rz1 & 0xFFFFFF00) !=verg) break;
}
}
@@ -564,7 +564,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
verg1= rc[BCOMP];
rc+= 4;
byt1= 1; byt2= 1;
- for (a=1;a<256;a++,rc+=4) {
+ for (a=1;a<256;a++, rc+=4) {
byt1 &= (verg==rc[ACOMP]);
byt2 &= (verg1==rc[BCOMP]);
@@ -582,7 +582,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
}
else if (byt1) { /* only store short */
*ctile= 2;
- *ztile= (uintptr_t)MEM_mallocN(2*256+4,"Tile2");
+ *ztile= (uintptr_t)MEM_mallocN(2*256+4, "Tile2");
rz= (int *)*ztile;
*rz= *rz1;
@@ -595,7 +595,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
}
else { /* store triple */
*ctile= 3;
- *ztile= (uintptr_t)MEM_mallocN(3*256,"Tile3");
+ *ztile= (uintptr_t)MEM_mallocN(3*256, "Tile3");
zt= (char *)*ztile;
rc= rcline;
@@ -779,7 +779,7 @@ void makeshadowbuf(Render *re, LampRen *lar)
shb->pixsize= (shb->d)/temp;
wsize= shb->pixsize*(shb->size/2.0f);
- perspective_m4( shb->winmat,-wsize, wsize, -wsize, wsize, shb->d, shb->clipend);
+ perspective_m4(shb->winmat, -wsize, wsize, -wsize, wsize, shb->d, shb->clipend);
mult_m4_m4m4(shb->persmat, shb->winmat, shb->viewmat);
if (ELEM3(lar->buftype, LA_SHADBUF_REGULAR, LA_SHADBUF_HALFWAY, LA_SHADBUF_DEEP)) {
@@ -1192,7 +1192,7 @@ float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxc
if (firstreadshadbuf(shb, shsample, &rz, (int)(xs1+xres), (int)ys1, 1)) {
if (firstreadshadbuf(shb, shsample, &rz, (int)xs1, (int)(ys1+yres), 1)) {
if (firstreadshadbuf(shb, shsample, &rz, (int)(xs1+xres), (int)(ys1+yres), 1)) {
- return readshadowbuf(shb, shsample, bias,(int)xs1, (int)ys1, zs);
+ return readshadowbuf(shb, shsample, bias, (int)xs1, (int)ys1, zs);
}
}
}
@@ -2074,7 +2074,7 @@ static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *v
dface = dot_v3v3(v1, nor);
hoco[3]= 1.0f;
- /* ortho viewplane cannot intersect using view vector originating in (0,0,0) */
+ /* ortho viewplane cannot intersect using view vector originating in (0, 0, 0) */
if (R.r.mode & R_ORTHO) {
/* x and y 3d coordinate can be derived from pixel coord and winmat */
float fx= 2.0f/(R.winx*R.winmat[0][0]);
@@ -2160,8 +2160,8 @@ static int isb_add_samples(RenderPart *pa, ISBBranch *root, MemArena *memarena,
int sample, bsp_err= 0;
/* bsp split doesn't like to handle regular sequences */
- xcos= MEM_mallocN( pa->rectx*sizeof(int), "xcos");
- ycos= MEM_mallocN( pa->recty*sizeof(int), "ycos");
+ xcos= MEM_mallocN(pa->rectx*sizeof(int), "xcos");
+ ycos= MEM_mallocN(pa->recty*sizeof(int), "ycos");
for (xi=0; xi<pa->rectx; xi++)
xcos[xi]= xi;
for (yi=0; yi<pa->recty; yi++)
@@ -2364,8 +2364,8 @@ static int isb_add_samples_transp(RenderPart *pa, ISBBranch *root, MemArena *mem
int sample, bsp_err= 0;
/* bsp split doesn't like to handle regular sequences */
- xcos= MEM_mallocN( pa->rectx*sizeof(int), "xcos");
- ycos= MEM_mallocN( pa->recty*sizeof(int), "ycos");
+ xcos= MEM_mallocN(pa->rectx*sizeof(int), "xcos");
+ ycos= MEM_mallocN(pa->recty*sizeof(int), "ycos");
for (xi=0; xi<pa->rectx; xi++)
xcos[xi]= xi;
for (yi=0; yi<pa->recty; yi++)
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index cf688982eda..53d06893a3f 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -550,7 +550,7 @@ static float spec(float inp, int hard)
return inp;
}
-static float Phong_Spec( float *n, float *l, float *v, int hard, int tangent )
+static float Phong_Spec(float *n, float *l, float *v, int hard, int tangent )
{
float h[3];
float rslt;
@@ -638,7 +638,7 @@ static float Blinn_Spec(float *n, float *l, float *v, float refrac, float spec_p
else if ( b < a && b < c ) g = b;
else if ( c < a && c < b ) g = c;
- p = sqrt( (double)((refrac * refrac)+(vh*vh)-1.0f) );
+ p = sqrt((double)((refrac * refrac)+(vh * vh) - 1.0f));
f = (((p-vh)*(p-vh))/((p+vh)*(p+vh)))*(1+((((vh*(p+vh))-1.0f)*((vh*(p+vh))-1.0f))/(((vh*(p-vh))+1.0f)*((vh*(p-vh))+1.0f))));
ang = saacos(nh);
@@ -649,7 +649,7 @@ static float Blinn_Spec(float *n, float *l, float *v, float refrac, float spec_p
}
/* cartoon render spec */
-static float Toon_Spec( float *n, float *l, float *v, float size, float smooth, int tangent)
+static float Toon_Spec(float *n, float *l, float *v, float size, float smooth, int tangent)
{
float h[3];
float ang;
@@ -673,7 +673,7 @@ static float Toon_Spec( float *n, float *l, float *v, float size, float smooth,
}
/* Ward isotropic gaussian spec */
-static float WardIso_Spec( float *n, float *l, float *v, float rms, int tangent)
+static float WardIso_Spec(float *n, float *l, float *v, float rms, int tangent)
{
float i, nh, nv, nl, h[3], angle, alpha;
@@ -705,7 +705,7 @@ static float WardIso_Spec( float *n, float *l, float *v, float rms, int tangent)
}
/* cartoon render diffuse */
-static float Toon_Diff( float *n, float *l, float *UNUSED(v), float size, float smooth )
+static float Toon_Diff(float *n, float *l, float *UNUSED(v), float size, float smooth)
{
float rslt, ang;
@@ -754,12 +754,12 @@ static float OrenNayar_Diff(float nl, float *n, float *l, float *v, float rough
Lit_B[0] = l[0] - (realnl * n[0]);
Lit_B[1] = l[1] - (realnl * n[1]);
Lit_B[2] = l[2] - (realnl * n[2]);
- normalize_v3( Lit_B );
+ normalize_v3(Lit_B);
View_B[0] = v[0] - (nv * n[0]);
View_B[1] = v[1] - (nv * n[1]);
View_B[2] = v[2] - (nv * n[2]);
- normalize_v3( View_B );
+ normalize_v3(View_B);
t = Lit_B[0]*View_B[0] + Lit_B[1]*View_B[1] + Lit_B[2]*View_B[2];
if ( t < 0 ) t = 0;
@@ -931,7 +931,7 @@ static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, floa
float fac;
/* input */
- switch(ma->rampin_col) {
+ switch (ma->rampin_col) {
case MA_RAMP_IN_ENERGY:
/* should use 'rgb_to_grayscale' but we only have a vector version */
fac= 0.3f*r + 0.58f*g + 0.12f*b;
@@ -1003,7 +1003,7 @@ static void do_specular_ramp(ShadeInput *shi, float is, float t, float spec[3])
float col[4];
/* input */
- switch(ma->rampin_spec) {
+ switch (ma->rampin_spec) {
case MA_RAMP_IN_ENERGY:
fac= t;
break;
@@ -1158,8 +1158,7 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d
// visifac= 0.0f;
}
else {
- switch(lar->falloff_type)
- {
+ switch (lar->falloff_type) {
case LA_FALLOFF_CONSTANT:
visifac = 1.0f;
break;
diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c
index b6eccc3e10f..1dcac84271a 100644
--- a/source/blender/render/intern/source/sss.c
+++ b/source/blender/render/intern/source/sss.c
@@ -176,7 +176,7 @@ static float compute_reduced_albedo(ScatterSettings *ss)
{
const float tolerance= 1e-8;
const int max_iteration_count= 20;
- float d, fsub, xn_1= 0.0f , xn= 1.0f, fxn, fxn_1;
+ float d, fsub, xn_1= 0.0f, xn= 1.0f, fxn, fxn_1;
int i;
/* use secant method to compute reduced albedo using Rd function inverse
diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c
index ea6b099996d..b68525c7150 100644
--- a/source/blender/render/intern/source/strand.c
+++ b/source/blender/render/intern/source/strand.c
@@ -485,7 +485,7 @@ static APixstrand *addpsmainAstrand(ListBase *lb)
psm= MEM_mallocN(sizeof(APixstrMain), "addpsmainA");
BLI_addtail(lb, psm);
- psm->ps= MEM_callocN(4096*sizeof(APixstrand),"pixstr");
+ psm->ps = MEM_callocN(4096 * sizeof(APixstrand), "pixstr");
return psm->ps;
}
diff --git a/source/blender/render/intern/source/sunsky.c b/source/blender/render/intern/source/sunsky.c
index 8097628e575..5d0e7c1d4c8 100644
--- a/source/blender/render/intern/source/sunsky.c
+++ b/source/blender/render/intern/source/sunsky.c
@@ -71,7 +71,7 @@
/**
* ClipColor:
- * clip a color to range [0,1];
+ * clip a color to range [0, 1];
* */
void ClipColor(float c[3])
{
@@ -146,7 +146,7 @@ static float PerezFunction(struct SunSky *sunsky, const float *lam, float theta,
* back_scatter, controls back scatter light
* */
void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_brightness,
- float spread,float sun_brightness, float sun_size, float back_scatter,
+ float spread, float sun_brightness, float sun_size, float back_scatter,
float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace)
{
float theta2;
@@ -251,7 +251,7 @@ void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_b
void GetSkyXYZRadiance(struct SunSky* sunsky, float theta, float phi, float color_out[3])
{
float gamma;
- float x,y,Y,X,Z;
+ float x, y, Y, X, Z;
float hfade=1, nfade=1;
@@ -336,12 +336,11 @@ static void ComputeAttenuatedSunlight(float theta, int turbidity, float fTau[3])
fAlpha = 1.3f;
fBeta = 0.04608365822050f * turbidity - 0.04586025928522f;
- m = 1.0f/(cosf(theta) + 0.15f*powf(93.885f-theta/(float)M_PI*180.0f,-1.253f));
+ m = 1.0f/(cosf(theta) + 0.15f*powf(93.885f-theta/(float)M_PI*180.0f, -1.253f));
- for (i = 0; i < 3; i++)
- {
+ for (i = 0; i < 3; i++) {
// Rayleigh Scattering
- fTauR = expf( -m * 0.008735f * powf(fLambda[i], (float)(-4.08f)));
+ fTauR = expf(-m * 0.008735f * powf(fLambda[i], (float)(-4.08f)));
// Aerosal (water + dust) attenuation
fTauA = exp(-m * fBeta * powf(fLambda[i], -fAlpha));
@@ -375,7 +374,7 @@ void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float r
float K[3] = {0.685f, 0.679f, 0.670f};
float vBetaMieTemp[3];
- float fLambda[3],fLambda2[3], fLambda4[3];
+ float fLambda[3], fLambda2[3], fLambda4[3];
float vLambda2[3];
float vLambda4[3];
@@ -393,8 +392,7 @@ void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float r
fLambda[0] = 1/650e-9f;
fLambda[1] = 1/570e-9f;
fLambda[2] = 1/475e-9f;
- for (i=0; i < 3; i++)
- {
+ for (i=0; i < 3; i++) {
fLambda2[i] = fLambda[i]*fLambda[i];
fLambda4[i] = fLambda2[i]*fLambda2[i];
}
@@ -413,7 +411,7 @@ void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float r
VEC3OPF(sunSky->atm_BetaRay, vLambda4, *, fBeta);
fBetaDash = fTemp/2;
- VEC3OPF(sunSky->atm_BetaDashRay, vLambda4,*, fBetaDash);
+ VEC3OPF(sunSky->atm_BetaDashRay, vLambda4, *, fBetaDash);
// Mie scattering constants.
@@ -423,7 +421,7 @@ void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float r
fTemp3 = 0.434f*c*pi*(2*pi)*(2*pi);
VEC3OPV(vBetaMieTemp, K, *, fLambda);
- VEC3OPF(sunSky->atm_BetaMie, vBetaMieTemp,*, fTemp3);
+ VEC3OPF(sunSky->atm_BetaMie, vBetaMieTemp, *, fTemp3);
}
@@ -436,7 +434,7 @@ void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float r
* s, is distance
* rgb, contains rendered color value for a pixle
* */
-void AtmospherePixleShader( struct SunSky* sunSky, float view[3], float s, float rgb[3])
+void AtmospherePixleShader(struct SunSky* sunSky, float view[3], float s, float rgb[3])
{
float costheta;
float Phase_1;
diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c
index 8b059d4a564..69aa6082950 100644
--- a/source/blender/render/intern/source/volume_precache.c
+++ b/source/blender/render/intern/source/volume_precache.c
@@ -95,7 +95,7 @@ static int intersect_outside_volume(RayObject *tree, Isect *isect, float *offset
static int point_inside_obi(RayObject *tree, ObjectInstanceRen *UNUSED(obi), float *co)
{
Isect isect= {{0}};
- float dir[3] = {0.0f,0.0f,1.0f};
+ float dir[3] = {0.0f, 0.0f, 1.0f};
int final_depth=0, depth=0, limit=20;
/* set up the isect */
@@ -313,7 +313,7 @@ static float total_ms_energy(Render *re, int do_test_break, float *sr, float *sg
for (z=1;z<=res[2];z++) {
for (y=1;y<=res[1];y++) {
for (x=1;x<=res[0];x++) {
- const int i = ms_I(x,y,z,res);
+ const int i = ms_I(x, y, z, res);
if (sr[i] > 0.f) energy += sr[i];
if (sg[i] > 0.f) energy += sg[i];
@@ -334,16 +334,12 @@ static void ms_diffuse(Render *re, int do_test_break, float *x0, float *x, float
size_t size = n[0]*n[1]*n[2];
const float a = dt*diff*size;
- for (l=0; l<20; l++)
- {
- for (k=1; k<=n[2]; k++)
- {
- for (j=1; j<=n[1]; j++)
- {
- for (i=1; i<=n[0]; i++)
- {
- x[v_I_pad(i,j,k,n)] = (x0[v_I_pad(i,j,k,n)]) + a*( x0[v_I_pad(i-1,j,k,n)]+ x0[v_I_pad(i+1,j,k,n)]+ x0[v_I_pad(i,j-1,k,n)]+
- x0[v_I_pad(i,j+1,k,n)]+ x0[v_I_pad(i,j,k-1,n)]+x0[v_I_pad(i,j,k+1,n)]
+ for (l=0; l<20; l++) {
+ for (k=1; k<=n[2]; k++) {
+ for (j=1; j<=n[1]; j++) {
+ for (i=1; i<=n[0]; i++) {
+ x[v_I_pad(i, j, k, n)] = (x0[v_I_pad(i, j, k, n)]) + a*( x0[v_I_pad(i-1, j, k, n)]+ x0[v_I_pad(i+1, j, k, n)]+ x0[v_I_pad(i, j-1, k, n)]+
+ x0[v_I_pad(i, j+1, k, n)]+ x0[v_I_pad(i, j, k-1, n)]+x0[v_I_pad(i, j, k+1, n)]
) / (1+6*a);
}
}
@@ -384,16 +380,12 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi
energy_ss = total_ss_energy(re, do_test_break, vp);
/* Scattering as diffusion pass */
- for (m=0; m<simframes; m++)
- {
+ for (m=0; m<simframes; m++) {
/* add sources */
- for (z=1; z<=n[2]; z++)
- {
- for (y=1; y<=n[1]; y++)
- {
- for (x=1; x<=n[0]; x++)
- {
- const int i = lc_to_ms_I(x, y ,z, n); //lc index
+ for (z=1; z<=n[2]; z++) {
+ for (y=1; y<=n[1]; y++) {
+ for (x=1; x<=n[0]; x++) {
+ const int i = lc_to_ms_I(x, y, z, n); //lc index
const int j = ms_I(x, y, z, n); //ms index
time= PIL_check_seconds_timer();
@@ -422,9 +414,9 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi
if (re->test_break(re->tbh)) break;
- SWAP(float *,sr,sr0);
- SWAP(float *,sg,sg0);
- SWAP(float *,sb,sb0);
+ SWAP(float *, sr, sr0);
+ SWAP(float *, sg, sg0);
+ SWAP(float *, sb, sb0);
/* main diffusion simulation */
ms_diffuse(re, do_test_break, sr0, sr, diff, n);
@@ -448,13 +440,10 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi
origf = 0.0f;
}
- for (z=1;z<=n[2];z++)
- {
- for (y=1;y<=n[1];y++)
- {
- for (x=1;x<=n[0];x++)
- {
- const int i = lc_to_ms_I(x, y ,z, n); //lc index
+ for (z=1;z<=n[2];z++) {
+ for (y=1;y<=n[1];y++) {
+ for (x=1;x<=n[0];x++) {
+ const int i = lc_to_ms_I(x, y, z, n); //lc index
const int j = ms_I(x, y, z, n); //ms index
vp->data_r[i] = origf * vp->data_r[i] + fac * sr[j];
diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c
index fa0326e2c97..c51cb2af842 100644
--- a/source/blender/render/intern/source/volumetric.c
+++ b/source/blender/render/intern/source/volumetric.c
@@ -97,7 +97,7 @@ static float vol_get_shadow(ShadeInput *shi, LampRen *lar, const float co[3])
}
else {
sub_v3_v3v3(is.dir, lar->co, is.start);
- is.dist = normalize_v3( is.dir );
+ is.dist = normalize_v3(is.dir );
}
is.mode = RE_RAY_MIRROR;
@@ -113,7 +113,7 @@ static float vol_get_shadow(ShadeInput *shi, LampRen *lar, const float co[3])
is.orig.face = NULL;
is.last_hit = lar->last_hit[shi->thread];
- if (RE_rayobject_raycast(R.raytree,&is)) {
+ if (RE_rayobject_raycast(R.raytree, &is)) {
visibility = 0.f;
}
@@ -258,7 +258,7 @@ static float metadensity(Object* ob, const float co[3])
/* element rotation transform */
float tp[3] = {ml->x - tco[0], ml->y - tco[1], ml->z - tco[2]};
- quat_to_mat3( bmat,ml->quat);
+ quat_to_mat3(bmat, ml->quat);
transpose_m3(bmat); // rot.only, so inverse == transpose
mul_m3_v3(bmat, tp);
@@ -471,7 +471,7 @@ static void vol_get_transmittance(ShadeInput *shi, float tr[3], const float co[3
static void vol_shade_one_lamp(struct ShadeInput *shi, const float co[3], const float view[3], LampRen *lar, float lacol[3])
{
float visifac, lv[3], lampdist;
- float tr[3]={1.0,1.0,1.0};
+ float tr[3]={1.0, 1.0, 1.0};
float hitco[3], *atten_co;
float p, ref_col[3];
@@ -559,8 +559,7 @@ void vol_get_scattering(ShadeInput *shi, float scatter_col[3], const float co[3]
zero_v3(scatter_col);
lights= get_lights(shi);
- for (go=lights->first; go; go= go->next)
- {
+ for (go=lights->first; go; go= go->next) {
float lacol[3] = {0.f, 0.f, 0.f};
lar= go->lampren;
@@ -654,7 +653,7 @@ static void volumeintegrate(struct ShadeInput *shi, float col[4], const float co
/* the main entry point for volume shading */
static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int inside_volume)
{
- float hitco[3], col[4] = {0.f,0.f,0.f,0.f};
+ float hitco[3], col[4] = {0.f, 0.f, 0.f, 0.f};
float *startco, *endco;
int trace_behind = 1;
const int ztransp= ((shi->depth==0) && (shi->mat->mode & MA_TRANSP) && (shi->mat->mode & MA_ZTRANSP));
@@ -749,7 +748,7 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in
void shade_volume_shadow(struct ShadeInput *shi, struct ShadeResult *shr, struct Isect *last_is)
{
float hitco[3];
- float tr[3] = {1.0,1.0,1.0};
+ float tr[3] = {1.0, 1.0, 1.0};
Isect is= {{0}};
float *startco, *endco;
diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c
index 1f49b654ef8..940f718d4ad 100644
--- a/source/blender/render/intern/source/voxeldata.c
+++ b/source/blender/render/intern/source/voxeldata.c
@@ -117,7 +117,7 @@ static int load_frame_raw8(VoxelData *vd, FILE *fp, int frame)
return 0;
}
- if (fseek(fp,(frame-1)*size*sizeof(char),0) == -1) {
+ if (fseek(fp, (frame-1)*size*sizeof(char), 0) == -1) {
MEM_freeN(data_c);
MEM_freeN(vd->dataset);
vd->dataset= NULL;
@@ -171,8 +171,7 @@ static void load_frame_image_sequence(VoxelData *vd, Tex *tex)
vd->resol[2] = iuser.frames;
vd->dataset = MEM_mapallocN(sizeof(float)*vd_resol_size(vd), "voxel dataset");
- for (z=0; z < iuser.frames; z++)
- {
+ for (z=0; z < iuser.frames; z++) {
/* get a new ibuf for each frame */
if (z > 0) {
iuser.framenr++;
@@ -182,10 +181,8 @@ static void load_frame_image_sequence(VoxelData *vd, Tex *tex)
}
rf = ibuf->rect_float;
- for (y=0; y < ibuf->y; y++)
- {
- for (x=0; x < ibuf->x; x++)
- {
+ for (y=0; y < ibuf->y; y++) {
+ for (x=0; x < ibuf->x; x++) {
/* currently averaged to monchrome */
vd->dataset[ V_I(x, y, z, vd->resol) ] = (rf[0] + rf[1] + rf[2])*0.333f;
rf +=4;
@@ -204,7 +201,7 @@ static int read_voxeldata_header(FILE *fp, struct VoxelData *vd)
VoxelDataHeader *h=(VoxelDataHeader *)MEM_mallocN(sizeof(VoxelDataHeader), "voxel data header");
rewind(fp);
- if (fread(h,sizeof(VoxelDataHeader),1,fp) != 1) {
+ if (fread(h, sizeof(VoxelDataHeader), 1, fp) != 1) {
MEM_freeN(h);
return 0;
}
@@ -249,8 +246,7 @@ static void init_frame_smoke(VoxelData *vd, float cfra)
heat = smoke_get_heat(smd->domain->fluid);
- for (i=0; i<totRes; i++)
- {
+ for (i=0; i<totRes; i++) {
vd->dataset[i] = (heat[i]+2.0f)/4.0f;
}
@@ -271,8 +267,7 @@ static void init_frame_smoke(VoxelData *vd, float cfra)
yvel = smoke_get_velocity_y(smd->domain->fluid);
zvel = smoke_get_velocity_z(smd->domain->fluid);
- for (i=0; i<totRes; i++)
- {
+ for (i=0; i<totRes; i++) {
vd->dataset[i] = sqrt(xvel[i]*xvel[i] + yvel[i]*yvel[i] + zvel[i]*zvel[i])*3.0f;
}
@@ -333,7 +328,7 @@ void cache_voxeldata(Tex *tex, int scene_frame)
BLI_strncpy(path, vd->source_path, sizeof(path));
- switch(vd->file_format) {
+ switch (vd->file_format) {
case TEX_VD_IMAGE_SEQUENCE:
load_frame_image_sequence(vd, tex);
return;
@@ -343,7 +338,7 @@ void cache_voxeldata(Tex *tex, int scene_frame)
case TEX_VD_BLENDERVOXEL:
BLI_path_abs(path, G.main->name);
if (!BLI_exists(path)) return;
- fp = BLI_fopen(path,"rb");
+ fp = BLI_fopen(path, "rb");
if (!fp) return;
if (read_voxeldata_header(fp, vd))
@@ -354,7 +349,7 @@ void cache_voxeldata(Tex *tex, int scene_frame)
case TEX_VD_RAW_8BIT:
BLI_path_abs(path, G.main->name);
if (!BLI_exists(path)) return;
- fp = BLI_fopen(path,"rb");
+ fp = BLI_fopen(path, "rb");
if (!fp) return;
load_frame_raw8(vd, fp, curframe);
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index 74c4bf19faf..50fb9211995 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -149,7 +149,7 @@ static void zbuf_add_to_span(ZSpan *zspan, float *v1, float *v2)
}
else {
dx0= 0.0f;
- xs0= MIN2(minv[0],maxv[0]);
+ xs0= MIN2(minv[0], maxv[0]);
}
/* empty span */
@@ -270,7 +270,7 @@ static APixstr *addpsmainA(ListBase *lb)
psm= MEM_mallocN(sizeof(APixstrMain), "addpsmainA");
BLI_addtail(lb, psm);
- psm->ps= MEM_callocN(4096*sizeof(APixstr),"pixstr");
+ psm->ps= MEM_callocN(4096*sizeof(APixstr), "pixstr");
return psm->ps;
}
@@ -305,8 +305,8 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
{
APixstr *ap, *apofs, *apn;
double zxd, zyd, zy0, zverg;
- float x0,y0,z0;
- float x1,y1,z1,x2,y2,z2,xx1;
+ float x0, y0, z0;
+ float x1, y1, z1, x2, y2, z2, xx1;
float *span1, *span2;
int *rz, *rm, x, y;
int sn1, sn2, rectx, *rectzofs, *rectmaskofs, my0, my2, mask;
@@ -844,7 +844,7 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), flo
static int clipline(float v1[4], float v2[4]) /* return 0: do not draw */
{
- float dz,dw, u1=0.0, u2=1.0;
+ float dz, dw, u1=0.0, u2=1.0;
float dx, dy, v13;
dz= v2[2]-v1[2];
@@ -854,20 +854,20 @@ static int clipline(float v1[4], float v2[4]) /* return 0: do not draw */
* filled in with zbufwire correctly when rendering in parts. otherwise
* you see line endings at edges... */
- if (cliptestf(-dz, -dw, v1[3], v1[2], &u1,&u2)) {
- if (cliptestf(dz, -dw, v1[3], -v1[2], &u1,&u2)) {
+ if (cliptestf(-dz, -dw, v1[3], v1[2], &u1, &u2)) {
+ if (cliptestf(dz, -dw, v1[3], -v1[2], &u1, &u2)) {
dx= v2[0]-v1[0];
dz= 1.01f*(v2[3]-v1[3]);
v13= 1.01f*v1[3];
- if (cliptestf(-dx, -dz, v1[0], v13, &u1,&u2)) {
- if (cliptestf(dx, -dz, v13, -v1[0], &u1,&u2)) {
+ if (cliptestf(-dx, -dz, v1[0], v13, &u1, &u2)) {
+ if (cliptestf(dx, -dz, v13, -v1[0], &u1, &u2)) {
dy= v2[1]-v1[1];
- if (cliptestf(-dy, -dz, v1[1], v13, &u1,&u2)) {
- if (cliptestf(dy, -dz, v13, -v1[1], &u1,&u2)) {
+ if (cliptestf(-dy, -dz, v1[1], v13, &u1, &u2)) {
+ if (cliptestf(dy, -dz, v13, -v1[1], &u1, &u2)) {
if (u2<1.0f) {
v2[0]= v1[0]+u2*dx;
@@ -1042,8 +1042,8 @@ void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, const float ho1[4], const
static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4)
{
double zxd, zyd, zy0, zverg;
- float x0,y0,z0;
- float x1,y1,z1,x2,y2,z2,xx1;
+ float x0, y0, z0;
+ float x1, y1, z1, x2, y2, z2, xx1;
float *span1, *span2;
int *rectoofs, *ro;
int *rectpofs, *rp;
@@ -1164,8 +1164,8 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v
static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2, float *v3, float *v4)
{
double zxd, zyd, zy0, zverg;
- float x0,y0,z0;
- float x1,y1,z1,x2,y2,z2,xx1;
+ float x0, y0, z0;
+ float x1, y1, z1, x2, y2, z2, xx1;
float *span1, *span2;
int *rectoofs, *ro;
int *rectpofs, *rp;
@@ -1294,8 +1294,8 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), float *v1, float *v2, float *v3, float *v4)
{
double zxd, zyd, zy0, zverg;
- float x0,y0,z0;
- float x1,y1,z1,x2,y2,z2,xx1;
+ float x0, y0, z0;
+ float x1, y1, z1, x2, y2, z2, xx1;
float *span1, *span2;
int *rz, *rz1, x, y;
int sn1, sn2, rectx, *rectzofs, *rectzofs1= NULL, my0, my2;
@@ -1399,7 +1399,7 @@ static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), f
}
}
-/* 2d scanconvert for tria, calls func for each x,y coordinate and gives UV barycentrics */
+/* 2d scanconvert for tria, calls func for each x, y coordinate and gives UV barycentrics */
void zspan_scanconvert_strand(ZSpan *zspan, void *handle, float *v1, float *v2, float *v3, void (*func)(void *, int, int, float, float, float) )
{
float x0, y0, x1, y1, x2, y2, z0, z1, z2, z;
@@ -1498,7 +1498,7 @@ void zspan_scanconvert_strand(ZSpan *zspan, void *handle, float *v1, float *v2,
}
}
-/* scanconvert for strand triangles, calls func for each x,y coordinate and gives UV barycentrics and z */
+/* scanconvert for strand triangles, calls func for each x, y coordinate and gives UV barycentrics and z */
void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float *v3, void (*func)(void *, int, int, float, float) )
{
@@ -1603,7 +1603,7 @@ void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float *
static void clippyra(float *labda, float *v1, float *v2, int *b2, int *b3, int a, float clipcrop)
{
- float da,dw,u1=0.0,u2=1.0;
+ float da, dw, u1=0.0, u2=1.0;
float v13;
labda[0]= -1.0;
@@ -1627,8 +1627,8 @@ static void clippyra(float *labda, float *v1, float *v2, int *b2, int *b3, int a
* who would have thought that of L&B!
*/
- if (cliptestf(-da, -dw, v13, v1[a], &u1,&u2)) {
- if (cliptestf(da, -dw, v13, -v1[a], &u1,&u2)) {
+ if (cliptestf(-da, -dw, v13, v1[a], &u1, &u2)) {
+ if (cliptestf(da, -dw, v13, -v1[a], &u1, &u2)) {
*b3=1;
if (u2<1.0f) {
labda[1]= u2;
@@ -1701,7 +1701,7 @@ static void makevertpyra(float *vez, float *labda, float **trias, float *v1, flo
void projectverto(const float v1[3], float winmat[][4], float adr[4])
{
/* calcs homogenic coord of vertex v1 */
- float x,y,z;
+ float x, y, z;
x= v1[0];
y= v1[1];
@@ -1719,7 +1719,7 @@ void projectverto(const float v1[3], float winmat[][4], float adr[4])
void projectvert(const float v1[3], float winmat[][4], float adr[4])
{
/* calcs homogenic coord of vertex v1 */
- float x,y,z;
+ float x, y, z;
x= v1[0];
y= v1[1];
@@ -1877,9 +1877,9 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
else if (b==1) arg= 0;
else arg= 1;
- clippyra(labda[0], vlzp[v][0],vlzp[v][1], &b2,&b3, arg, zspan->clipcrop);
- clippyra(labda[1], vlzp[v][1],vlzp[v][2], &b2,&b3, arg, zspan->clipcrop);
- clippyra(labda[2], vlzp[v][2],vlzp[v][0], &b2,&b3, arg, zspan->clipcrop);
+ clippyra(labda[0], vlzp[v][0], vlzp[v][1], &b2, &b3, arg, zspan->clipcrop);
+ clippyra(labda[1], vlzp[v][1], vlzp[v][2], &b2, &b3, arg, zspan->clipcrop);
+ clippyra(labda[2], vlzp[v][2], vlzp[v][0], &b2, &b3, arg, zspan->clipcrop);
if (b2==0 && b3==1) {
/* completely 'in', but we copy because of last for () loop in this section */;
@@ -1895,9 +1895,9 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
}
else {
b1=0;
- makevertpyra(vez, labda[0], trias, vlzp[v][0],vlzp[v][1], &b1,&clve);
- makevertpyra(vez, labda[1], trias, vlzp[v][1],vlzp[v][2], &b1,&clve);
- makevertpyra(vez, labda[2], trias, vlzp[v][2],vlzp[v][0], &b1,&clve);
+ makevertpyra(vez, labda[0], trias, vlzp[v][0], vlzp[v][1], &b1, &clve);
+ makevertpyra(vez, labda[1], trias, vlzp[v][1], vlzp[v][2], &b1, &clve);
+ makevertpyra(vez, labda[2], trias, vlzp[v][2], vlzp[v][0], &b1, &clve);
/* after front clip done: now set clip flags */
if (b==0) {
@@ -1927,7 +1927,7 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
}
/* warning, this should never happen! */
- if (clve>38 || clvl>31) printf("clip overflow: clve clvl %d %d\n",clve,clvl);
+ if (clve>38 || clvl>31) printf("clip overflow: clve clvl %d %d\n", clve, clvl);
/* perspective division */
f1=vez;
@@ -1937,7 +1937,7 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
}
for (b=1;b<clvl;b++) {
if (vlzp[b][0]) {
- zspan->zbuffunc(zspan, obi, zvlnr, vlzp[b][0],vlzp[b][1],vlzp[b][2], NULL);
+ zspan->zbuffunc(zspan, obi, zvlnr, vlzp[b][0], vlzp[b][1], vlzp[b][2], NULL);
}
}
return;
@@ -1948,7 +1948,7 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
hoco_to_zco(zspan, vez, f1);
hoco_to_zco(zspan, vez+4, f2);
hoco_to_zco(zspan, vez+8, f3);
- zspan->zbuffunc(zspan, obi, zvlnr, vez,vez+4,vez+8, NULL);
+ zspan->zbuffunc(zspan, obi, zvlnr, vez, vez+4, vez+8, NULL);
}
void zbufclip4(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3, float *f4, int c1, int c2, int c3, int c4)
@@ -2648,8 +2648,8 @@ static void zbuf_fill_in_rgba(ZSpan *zspan, DrawBufPixel *col, float *v1, float
{
DrawBufPixel *rectpofs, *rp;
double zxd, zyd, zy0, zverg;
- float x0,y0,z0;
- float x1,y1,z1,x2,y2,z2,xx1;
+ float x0, y0, z0;
+ float x1, y1, z1, x2, y2, z2, xx1;
float *span1, *span2;
float *rectzofs, *rz;
int x, y;
@@ -2839,7 +2839,7 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove)
}
/* in: two vectors, first vector points from origin back in time, 2nd vector points to future */
-/* we make this into 3 points, center point is (0,0) */
+/* we make this into 3 points, center point is (0, 0) */
/* and offset the center point just enough to make curve go through midpoint */
static void quad_bezier_2d(float *result, float *v1, float *v2, float *ipodata)
@@ -3529,7 +3529,7 @@ void merge_transp_passes(RenderLayer *rl, ShadeResult *shr)
float *col= NULL;
int pixsize= 3;
- switch(rpass->passtype) {
+ switch (rpass->passtype) {
case SCE_PASS_RGBA:
col= shr->col;
pixsize= 4;
@@ -3629,7 +3629,7 @@ void add_transp_passes(RenderLayer *rl, int offset, ShadeResult *shr, float alph
float *fp, *col= NULL;
int pixsize= 3;
- switch(rpass->passtype) {
+ switch (rpass->passtype) {
case SCE_PASS_Z:
fp= rpass->rect + offset;
if (shr->z < *fp)
@@ -3772,7 +3772,7 @@ static void shade_tra_samples_fill(ShadeSample *ssamp, int x, int y, int z, int
for (samp=0; samp<R.osa; samp++) {
if (curmask & (1<<samp)) {
- xs= (float)x + R.jit[samp][0] + 0.5f; /* zbuffer has this inverse corrected, ensures xs,ys are inside pixel */
+ xs= (float)x + R.jit[samp][0] + 0.5f; /* zbuffer has this inverse corrected, ensures (xs, ys) are inside pixel */
ys= (float)y + R.jit[samp][1] + 0.5f;
if (shi_inc) {
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index ae02ff33950..9ff71c72e7e 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -691,8 +691,7 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot, P
if (properties) {
otmacro = ot->macro.first;
- RNA_STRUCT_BEGIN(properties, prop)
- {
+ RNA_STRUCT_BEGIN (properties, prop) {
if (otmacro == NULL)
break;
@@ -747,7 +746,7 @@ static void wm_region_mouse_co(bContext *C, wmEvent *event)
}
}
-#if 0 /* disabling for 2.63 release, since we keep getting reports some menu items are leaving props undefined */
+#if 1 /* disabling for 2.63 release, since we keep getting reports some menu items are leaving props undefined */
int WM_operator_last_properties_init(wmOperator *op)
{
int change = FALSE;
@@ -761,7 +760,7 @@ int WM_operator_last_properties_init(wmOperator *op)
iterprop = RNA_struct_iterator_property(op->type->srna);
- RNA_PROP_BEGIN(op->ptr, itemptr, iterprop) {
+ RNA_PROP_BEGIN (op->ptr, itemptr, iterprop) {
PropertyRNA *prop = itemptr.data;
if ((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
if (!RNA_property_is_set(op->ptr, prop)) { /* don't override a setting already set */
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 0c95ccea5d7..58c2c649163 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -364,7 +364,7 @@ void WM_exit_ext(bContext *C, const short do_python)
free_openrecent();
- BKE_freecubetable();
+ BKE_metaball_cubeTable_free();
ED_preview_free_dbase(); /* frees a Main dbase, before free_blender! */
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 48002029e56..cd7a8a93975 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -103,7 +103,9 @@ static int wm_keymap_item_equals_result(wmKeyMapItem *a, wmKeyMapItem *b)
if (!((a->ptr == NULL && b->ptr == NULL) ||
(a->ptr && b->ptr && IDP_EqualsProperties(a->ptr->data, b->ptr->data))))
+ {
return 0;
+ }
if ((a->flag & KMI_INACTIVE) != (b->flag & KMI_INACTIVE))
return 0;
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 514c159c87b..9ae0a88151c 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -589,7 +589,7 @@ void WM_operator_properties_alloc(PointerRNA **ptr, IDProperty **properties, con
void WM_operator_properties_sanitize(PointerRNA *ptr, const short no_context)
{
- RNA_STRUCT_BEGIN(ptr, prop) {
+ RNA_STRUCT_BEGIN (ptr, prop) {
switch (RNA_property_type(prop)) {
case PROP_ENUM:
if (no_context)
@@ -622,7 +622,7 @@ void WM_operator_properties_reset(wmOperator *op)
PropertyRNA *iterprop;
iterprop = RNA_struct_iterator_property(op->type->srna);
- RNA_PROP_BEGIN(op->ptr, itemptr, iterprop) {
+ RNA_PROP_BEGIN (op->ptr, itemptr, iterprop) {
PropertyRNA *prop = itemptr.data;
if ((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
@@ -1796,7 +1796,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
BLO_library_append_named_part_ex(C, mainl, &bh, name, idcode, flag);
}
else {
- RNA_BEGIN(op->ptr, itemptr, "files") {
+ RNA_BEGIN (op->ptr, itemptr, "files") {
RNA_string_get(&itemptr, "name", name);
BLO_library_append_named_part_ex(C, mainl, &bh, name, idcode, flag);
}
@@ -2326,10 +2326,10 @@ static int border_apply_rect(wmOperator *op)
/* operator arguments and storage. */
- RNA_int_set(op->ptr, "xmin", MIN2(rect->xmin, rect->xmax) );
- RNA_int_set(op->ptr, "ymin", MIN2(rect->ymin, rect->ymax) );
- RNA_int_set(op->ptr, "xmax", MAX2(rect->xmin, rect->xmax) );
- RNA_int_set(op->ptr, "ymax", MAX2(rect->ymin, rect->ymax) );
+ RNA_int_set(op->ptr, "xmin", MIN2(rect->xmin, rect->xmax));
+ RNA_int_set(op->ptr, "ymin", MIN2(rect->ymin, rect->ymax));
+ RNA_int_set(op->ptr, "xmax", MAX2(rect->xmin, rect->xmax));
+ RNA_int_set(op->ptr, "ymax", MAX2(rect->ymin, rect->ymax));
return 1;
}
@@ -2774,8 +2774,7 @@ int WM_gesture_lines_cancel(bContext *C, wmOperator *op)
static int gesture_lasso_exec(bContext *C, wmOperator *op)
{
- RNA_BEGIN(op->ptr, itemptr, "path")
- {
+ RNA_BEGIN (op->ptr, itemptr, "path") {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
@@ -3200,9 +3199,12 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
else {
if (use_secondary_prop &&
RNA_property_boolean_get(&use_secondary_ptr, use_secondary_prop))
+ {
data_path = "data_path_secondary";
- else
+ }
+ else {
data_path = "data_path_primary";
+ }
}
if (!radial_control_get_path(&ctx_ptr, op, data_path, &rc->ptr, &rc->prop, 0, 0))
@@ -3225,7 +3227,9 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
if (!radial_control_get_path(&ctx_ptr, op, "zoom_path",
&rc->zoom_ptr, &rc->zoom_prop, 2,
RC_PROP_REQUIRE_FLOAT | RC_PROP_ALLOW_MISSING))
+ {
return 0;
+ }
if (!radial_control_get_path(&ctx_ptr, op, "image_id", &rc->image_id_ptr, NULL, 0, 0))
return 0;
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 90d490dc279..a036e8a8212 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -122,11 +122,11 @@ void EDBM_mesh_normals_update(struct BMEditMesh *em) {}
void *g_system;
struct Heap* BLI_heap_new (void){return NULL;}
-void BLI_heap_free (struct Heap *heap, void *ptrfreefp) {}
+void BLI_heap_free(struct Heap *heap, void *ptrfreefp) {}
struct HeapNode* BLI_heap_insert (struct Heap *heap, float value, void *ptr){return NULL;}
-void BLI_heap_remove (struct Heap *heap, struct HeapNode *node) {}
-int BLI_heap_empty (struct Heap *heap) {return 0;}
-int BLI_heap_size (struct Heap *heap){return 0;}
+void BLI_heap_remove(struct Heap *heap, struct HeapNode *node) {}
+int BLI_heap_empty(struct Heap *heap) {return 0;}
+int BLI_heap_size(struct Heap *heap){return 0;}
struct HeapNode* BLI_heap_top (struct Heap *heap){return NULL;}
void* BLI_heap_popmin (struct Heap *heap){return NULL;}
@@ -191,7 +191,7 @@ float *give_cursor(struct Scene *scene, struct View3D *v3d){return (float *) NUL
void WM_menutype_free(void){}
void WM_menutype_freelink(struct MenuType* mt){}
int WM_menutype_add(struct MenuType *mt) {return 0;}
-int WM_operator_props_dialog_popup (struct bContext *C, struct wmOperator *op, int width, int height){return 0;}
+int WM_operator_props_dialog_popup(struct bContext *C, struct wmOperator *op, int width, int height){return 0;}
int WM_operator_confirm(struct bContext *C, struct wmOperator *op, struct wmEvent *event){return 0;}
struct MenuType *WM_menutype_find(const char *idname, int quiet){return (struct MenuType *) NULL;}
void WM_operator_stack_clear(struct bContext *C) {}
@@ -211,7 +211,7 @@ struct wmEventHandler *WM_event_add_modal_handler(struct bContext *C, struct wmO
struct wmTimer *WM_event_add_timer(struct wmWindowManager *wm, struct wmWindow *win, int event_type, double timestep){return (struct wmTimer *)NULL;}
void WM_event_remove_timer(struct wmWindowManager *wm, struct wmWindow *win, struct wmTimer *timer){}
void ED_armature_edit_bone_remove(struct bArmature *arm, struct EditBone *exBone){}
-void object_test_constraints (struct Object *owner){}
+void object_test_constraints(struct Object *owner){}
void ED_object_parent(struct Object *ob, struct Object *par, int type, const char *substr){}
void ED_object_constraint_set_active(struct Object *ob, struct bConstraint *con){}
void ED_node_composit_default(struct Scene *sce){}
@@ -271,11 +271,11 @@ struct KeyingSetInfo *ANIM_keyingset_info_find_named (const char name[]){return
struct KeyingSet *ANIM_scene_get_active_keyingset (struct Scene *scene){return (struct KeyingSet *) NULL;}
int ANIM_scene_get_keyingset_index(struct Scene *scene, struct KeyingSet *ks){return 0;}
struct ListBase builtin_keyingsets;
-void ANIM_keyingset_info_register (struct KeyingSetInfo *ksi){}
-void ANIM_keyingset_info_unregister (const struct bContext *C, struct KeyingSetInfo *ksi){}
-short ANIM_validate_keyingset (struct bContext *C, struct ListBase *dsources, struct KeyingSet *ks){return 0;}
+void ANIM_keyingset_info_register(struct KeyingSetInfo *ksi){}
+void ANIM_keyingset_info_unregister(const struct bContext *C, struct KeyingSetInfo *ksi){}
+short ANIM_validate_keyingset(struct bContext *C, struct ListBase *dsources, struct KeyingSet *ks){return 0;}
short ANIM_add_driver(struct ID *id, const char rna_path[], int array_index, short flag, int type){return 0;}
-short ANIM_remove_driver (struct ID *id, const char rna_path[], int array_index, short flag){return 0;}
+short ANIM_remove_driver(struct ID *id, const char rna_path[], int array_index, short flag){return 0;}
void ED_space_image_release_buffer(struct SpaceImage *sima, void *lock){}
struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **lock_r){return (struct ImBuf *) NULL;}
void ED_space_image_zoom(struct SpaceImage *sima, struct ARegion *ar, float *zoomx, float *zoomy) {}
@@ -285,7 +285,7 @@ void ED_area_tag_refresh(struct ScrArea *sa){}
void ED_area_newspace(struct bContext *C, struct ScrArea *sa, int type){}
void ED_region_tag_redraw(struct ARegion *ar){}
void WM_event_add_fileselect(struct bContext *C, struct wmOperator *op){}
-void WM_cursor_wait (int val) {}
+void WM_cursor_wait(int val) {}
void ED_node_texture_default(struct Tex *tx){}
void ED_node_changed_update(struct bContext *C, struct bNode *node){}
void ED_node_generic_update(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node){}
@@ -358,8 +358,8 @@ void ED_nurb_set_spline_type(struct Nurb *nu, int type){}
void make_editLatt(struct Object *obedit){}
void load_editLatt(struct Object *obedit){}
-void load_editNurb (struct Object *obedit){}
-void make_editNurb (struct Object *obedit){}
+void load_editNurb(struct Object *obedit){}
+void make_editNurb(struct Object *obedit){}
void uiItemR(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, int flag, char *name, int icon){}
@@ -469,7 +469,7 @@ void WM_operatortype_append_macro_ptr(void (*opfunc)(struct wmOperatorType*, voi
void WM_operator_bl_idname(char *to, const char *from){}
void WM_operator_py_idname(char *to, const char *from){}
void WM_operator_ui_popup(struct bContext *C, struct wmOperator *op, int width, int height){}
-short insert_keyframe (struct ID *id, struct bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short flag){return 0;}
+short insert_keyframe(struct ID *id, struct bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short flag){return 0;}
short delete_keyframe(struct ID *id, struct bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short flag){return 0;};
char *WM_operator_pystring(struct bContext *C, struct wmOperatorType *ot, struct PointerRNA *opptr, int all_args){return (char *)NULL;}
struct wmKeyMapItem *WM_modalkeymap_add_item(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value){return (struct wmKeyMapItem *)NULL;}
diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt
index 5a7304765e4..96b56768b8f 100644
--- a/source/gameengine/BlenderRoutines/CMakeLists.txt
+++ b/source/gameengine/BlenderRoutines/CMakeLists.txt
@@ -32,7 +32,7 @@ set(INC
)
set(INC_SYS
-
+ ${PTHREADS_INCLUDE_DIRS}
)
set(SRC
diff --git a/source/gameengine/BlenderRoutines/SConscript b/source/gameengine/BlenderRoutines/SConscript
index 8f59ec0bf04..998396aba7c 100644
--- a/source/gameengine/BlenderRoutines/SConscript
+++ b/source/gameengine/BlenderRoutines/SConscript
@@ -35,4 +35,7 @@ if env['WITH_BF_CXX_GUARDEDALLOC']:
incs += ' ' + env['BF_BULLET_INC']
incs += ' ' + env['BF_OPENGL_INC']
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
+ incs += ' ' + env['BF_PTHREADS_INC']
+
env.BlenderLib ( 'ge_blen_routines', sources, Split(incs), defs, libtype=['core','player'], priority=[300,35] , cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 382165065af..ad232818c33 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -1000,9 +1000,9 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
float fno[3];
if (mface->v4)
- normal_quad_v3( fno,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co);
+ normal_quad_v3(fno,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co);
else
- normal_tri_v3( fno,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co);
+ normal_tri_v3(fno,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co);
no0 = no1 = no2 = no3 = MT_Vector3(fno);
}
diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt
index b570489d6a2..1826f1ad25b 100644
--- a/source/gameengine/Converter/CMakeLists.txt
+++ b/source/gameengine/Converter/CMakeLists.txt
@@ -59,6 +59,7 @@ set(INC
)
set(INC_SYS
+ ${PTHREADS_INCLUDE_DIRS}
)
diff --git a/source/gameengine/Converter/SConscript b/source/gameengine/Converter/SConscript
index 4e2adbdc021..e95ae5448fb 100644
--- a/source/gameengine/Converter/SConscript
+++ b/source/gameengine/Converter/SConscript
@@ -39,4 +39,7 @@ if env['WITH_BF_CXX_GUARDEDALLOC']:
if env['WITH_BF_BULLET']:
defs.append('USE_BULLET')
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
+ incs += ' ' + env['BF_PTHREADS_INC']
+
env.BlenderLib ( 'ge_converter', sources, Split(incs), defs, libtype=['core','player'], priority=[305,40], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/Ketsji/BL_Shader.h b/source/gameengine/Ketsji/BL_Shader.h
index 3015dd204c8..47221365816 100644
--- a/source/gameengine/Ketsji/BL_Shader.h
+++ b/source/gameengine/Ketsji/BL_Shader.h
@@ -231,30 +231,30 @@ public:
virtual PyObject* py_repr(void) { return PyUnicode_FromFormat("BL_Shader\n\tvertex shader:%s\n\n\tfragment shader%s\n\n", vertProg, fragProg); }
// -----------------------------------
- KX_PYMETHOD_DOC( BL_Shader, setSource );
- KX_PYMETHOD_DOC( BL_Shader, delSource );
- KX_PYMETHOD_DOC( BL_Shader, getVertexProg );
- KX_PYMETHOD_DOC( BL_Shader, getFragmentProg );
- KX_PYMETHOD_DOC( BL_Shader, setNumberOfPasses );
- KX_PYMETHOD_DOC( BL_Shader, isValid);
- KX_PYMETHOD_DOC( BL_Shader, validate);
+ KX_PYMETHOD_DOC(BL_Shader, setSource);
+ KX_PYMETHOD_DOC(BL_Shader, delSource);
+ KX_PYMETHOD_DOC(BL_Shader, getVertexProg);
+ KX_PYMETHOD_DOC(BL_Shader, getFragmentProg);
+ KX_PYMETHOD_DOC(BL_Shader, setNumberOfPasses);
+ KX_PYMETHOD_DOC(BL_Shader, isValid);
+ KX_PYMETHOD_DOC(BL_Shader, validate);
// -----------------------------------
- KX_PYMETHOD_DOC( BL_Shader, setUniform4f );
- KX_PYMETHOD_DOC( BL_Shader, setUniform3f );
- KX_PYMETHOD_DOC( BL_Shader, setUniform2f );
- KX_PYMETHOD_DOC( BL_Shader, setUniform1f );
- KX_PYMETHOD_DOC( BL_Shader, setUniform4i );
- KX_PYMETHOD_DOC( BL_Shader, setUniform3i );
- KX_PYMETHOD_DOC( BL_Shader, setUniform2i );
- KX_PYMETHOD_DOC( BL_Shader, setUniform1i );
- KX_PYMETHOD_DOC( BL_Shader, setUniformfv );
- KX_PYMETHOD_DOC( BL_Shader, setUniformiv );
- KX_PYMETHOD_DOC( BL_Shader, setUniformMatrix4 );
- KX_PYMETHOD_DOC( BL_Shader, setUniformMatrix3 );
- KX_PYMETHOD_DOC( BL_Shader, setUniformDef );
- KX_PYMETHOD_DOC( BL_Shader, setAttrib );
- KX_PYMETHOD_DOC( BL_Shader, setSampler);
+ KX_PYMETHOD_DOC(BL_Shader, setUniform4f);
+ KX_PYMETHOD_DOC(BL_Shader, setUniform3f);
+ KX_PYMETHOD_DOC(BL_Shader, setUniform2f);
+ KX_PYMETHOD_DOC(BL_Shader, setUniform1f);
+ KX_PYMETHOD_DOC(BL_Shader, setUniform4i);
+ KX_PYMETHOD_DOC(BL_Shader, setUniform3i);
+ KX_PYMETHOD_DOC(BL_Shader, setUniform2i);
+ KX_PYMETHOD_DOC(BL_Shader, setUniform1i);
+ KX_PYMETHOD_DOC(BL_Shader, setUniformfv);
+ KX_PYMETHOD_DOC(BL_Shader, setUniformiv);
+ KX_PYMETHOD_DOC(BL_Shader, setUniformMatrix4);
+ KX_PYMETHOD_DOC(BL_Shader, setUniformMatrix3);
+ KX_PYMETHOD_DOC(BL_Shader, setUniformDef);
+ KX_PYMETHOD_DOC(BL_Shader, setAttrib);
+ KX_PYMETHOD_DOC(BL_Shader, setSampler);
#endif
};
diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt
index 8ed2d2f46db..c7f54838c10 100644
--- a/source/gameengine/Ketsji/CMakeLists.txt
+++ b/source/gameengine/Ketsji/CMakeLists.txt
@@ -55,6 +55,7 @@ set(INC
)
set(INC_SYS
+ ${PTHREADS_INCLUDE_DIRS}
${GLEW_INCLUDE_PATH}
../../../extern/recastnavigation/Recast/Include
../../../extern/recastnavigation/Detour/Include
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h
index af6771933eb..3a6dda06320 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.h
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h
@@ -113,12 +113,12 @@ public:
static PyObject* pyattr_get_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
- KX_PYMETHOD_DOC( KX_BlenderMaterial, getShader );
- KX_PYMETHOD_DOC( KX_BlenderMaterial, getMaterialIndex );
- KX_PYMETHOD_DOC( KX_BlenderMaterial, getTexture );
- KX_PYMETHOD_DOC( KX_BlenderMaterial, setTexture );
+ KX_PYMETHOD_DOC(KX_BlenderMaterial, getShader);
+ KX_PYMETHOD_DOC(KX_BlenderMaterial, getMaterialIndex);
+ KX_PYMETHOD_DOC(KX_BlenderMaterial, getTexture);
+ KX_PYMETHOD_DOC(KX_BlenderMaterial, setTexture);
- KX_PYMETHOD_DOC( KX_BlenderMaterial, setBlending );
+ KX_PYMETHOD_DOC(KX_BlenderMaterial, setBlending);
#endif // WITH_PYTHON
// --------------------------------
diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
index 9940b400527..f5926818e7d 100644
--- a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
+++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
@@ -121,8 +121,8 @@ void KX_BulletPhysicsController::RelativeTranslate(const MT_Vector3& dloc,bool l
void KX_BulletPhysicsController::RelativeRotate(const MT_Matrix3x3& drot,bool local)
{
- float rotval[12];
- drot.getValue(rotval);
+ float rotval[9];
+ drot.getValue3x3(rotval);
CcdPhysicsController::RelativeRotate(rotval,local);
}
diff --git a/source/gameengine/Ketsji/KX_FontObject.h b/source/gameengine/Ketsji/KX_FontObject.h
index affa882427f..30fe89162c0 100644
--- a/source/gameengine/Ketsji/KX_FontObject.h
+++ b/source/gameengine/Ketsji/KX_FontObject.h
@@ -39,10 +39,10 @@ class KX_FontObject : public KX_GameObject
{
public:
Py_Header
- KX_FontObject( void* sgReplicationInfo,
- SG_Callbacks callbacks,
- RAS_IRenderTools* rendertools,
- Object *ob);
+ KX_FontObject(void* sgReplicationInfo,
+ SG_Callbacks callbacks,
+ RAS_IRenderTools* rendertools,
+ Object *ob);
virtual ~KX_FontObject();
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index dbcfe7983c7..83b02acf1c3 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -52,12 +52,9 @@
#include "RAS_IRasterizer.h"
#include "RAS_IRenderTools.h"
#include "RAS_ICanvas.h"
-#include "STR_String.h"
#include "MT_Vector3.h"
#include "MT_Transform.h"
#include "SCA_IInputDevice.h"
-#include "KX_Scene.h"
-#include "MT_CmMatrix4x4.h"
#include "KX_Camera.h"
#include "KX_FontObject.h"
#include "KX_Dome.h"
@@ -90,6 +87,12 @@
#define DEFAULT_LOGIC_TIC_RATE 60.0
#define DEFAULT_PHYSICS_TIC_RATE 60.0
+#ifdef FREE_WINDOWS /* XXX mingw64 (gcc 4.7.0) defines a macro for DrawText that translates to DrawTextA. Not good */
+#ifdef DrawText
+#undef DrawText
+#endif
+#endif
+
const char KX_KetsjiEngine::m_profileLabels[tc_numCategories][15] = {
"Physics:", // tc_physics
"Logic:", // tc_logic
@@ -1063,37 +1066,30 @@ void KX_KetsjiEngine::EnableCameraOverride(const STR_String& forscene)
m_overrideSceneName = forscene;
}
-
-
void KX_KetsjiEngine::SetCameraZoom(float camzoom)
{
m_cameraZoom = camzoom;
}
-
-
void KX_KetsjiEngine::SetCameraOverrideUseOrtho(bool useOrtho)
{
m_overrideCamUseOrtho = useOrtho;
}
-
-
void KX_KetsjiEngine::SetCameraOverrideProjectionMatrix(const MT_CmMatrix4x4& mat)
{
m_overrideCamProjMat = mat;
}
-
void KX_KetsjiEngine::SetCameraOverrideViewMatrix(const MT_CmMatrix4x4& mat)
{
m_overrideCamViewMat = mat;
}
-void KX_KetsjiEngine::SetCameraOverrideClipping(float near, float far)
+void KX_KetsjiEngine::SetCameraOverrideClipping(float nearfrust, float farfrust)
{
- m_overrideCamNear = near;
- m_overrideCamFar = far;
+ m_overrideCamNear = nearfrust;
+ m_overrideCamFar = farfrust;
}
void KX_KetsjiEngine::SetCameraOverrideLens(float lens)
diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h
index 392a6633067..b0000405893 100644
--- a/source/gameengine/Ketsji/KX_PyMath.h
+++ b/source/gameengine/Ketsji/KX_PyMath.h
@@ -108,7 +108,7 @@ bool PyMatTo(PyObject* pymat, T& mat)
noerror = false;
else
{
- for( unsigned int col = 0; col < cols; col++)
+ for(unsigned int col = 0; col < cols; col++)
{
PyObject *item = PySequence_GetItem(pyrow, col); /* new ref */
mat[row][col] = PyFloat_AsDouble(item);
diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript
index 2943acd546d..5fdf250006f 100644
--- a/source/gameengine/Ketsji/SConscript
+++ b/source/gameengine/Ketsji/SConscript
@@ -47,4 +47,7 @@ if env['WITH_BF_BULLET']:
defs.append('USE_BULLET')
incs += ' #source/gameengine/Physics/Bullet'
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
+ incs += ' ' + env['BF_PTHREADS_INC']
+
env.BlenderLib ( 'ge_logic_ketsji', sources, Split(incs), defs, libtype=['core','player'], priority=[320,45], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/Rasterizer/RAS_ICanvas.h b/source/gameengine/Rasterizer/RAS_ICanvas.h
index 337ea247ce3..dae70c5c343 100644
--- a/source/gameengine/Rasterizer/RAS_ICanvas.h
+++ b/source/gameengine/Rasterizer/RAS_ICanvas.h
@@ -133,25 +133,25 @@ public:
virtual
int
- GetMouseX( int x
+ GetMouseX(int x
)=0;
virtual
int
- GetMouseY( int y
+ GetMouseY(int y
)= 0;
virtual
float
- GetMouseNormalizedX( int x
+ GetMouseNormalizedX(int x
)=0;
virtual
float
- GetMouseNormalizedY( int y
+ GetMouseNormalizedY(int y
)= 0;
- virtual
+ virtual
const RAS_Rect &
GetDisplayArea(
) const = 0;
diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp
index 9f7d42dcf56..98a3dc8f96a 100644
--- a/source/gameengine/VideoTexture/ImageRender.cpp
+++ b/source/gameengine/VideoTexture/ImageRender.cpp
@@ -608,10 +608,10 @@ ImageRender::ImageRender (KX_Scene * scene, KX_GameObject * observer, KX_GameObj
{
v4 = polygon->GetVertex(3);
mirrorVerts.push_back(v4);
- area = normal_quad_v3( normal,(float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ(), (float*)v4->getXYZ());
+ area = normal_quad_v3(normal,(float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ(), (float*)v4->getXYZ());
} else
{
- area = normal_tri_v3( normal,(float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ());
+ area = normal_tri_v3(normal,(float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ());
}
area = fabs(area);
mirrorArea += area;