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:
-rw-r--r--CMakeLists.txt36
-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--extern/libmv/libmv/simple_pipeline/modal_solver.cc126
-rw-r--r--extern/libmv/libmv/simple_pipeline/modal_solver.h48
-rw-r--r--intern/audaspace/intern/AUD_Reference.h12
-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_object.cpp2
-rw-r--r--intern/cycles/blender/blender_session.cpp7
-rw-r--r--intern/cycles/blender/blender_sync.cpp8
-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_binning.cpp223
-rw-r--r--intern/cycles/bvh/bvh_binning.h86
-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/bvh/bvh_split.cpp293
-rw-r--r--intern/cycles/bvh/bvh_split.h110
-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_cuda.cpp32
-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.h490
-rw-r--r--intern/cycles/util/util_task.cpp223
-rw-r--r--intern/cycles/util/util_task.h122
-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_transform.h12
-rw-r--r--intern/cycles/util/util_types.h268
-rw-r--r--intern/dualcon/intern/Projections.h18
-rw-r--r--intern/ghost/GHOST_Rect.h4
-rw-r--r--intern/ghost/intern/GHOST_NDOFManagerX11.cpp3
-rw-r--r--intern/guardedalloc/cpp/mallocn.cpp4
-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/presets/tracking_settings/blurry_movie.py11
-rw-r--r--release/scripts/startup/bl_operators/image.py26
-rw-r--r--release/scripts/startup/bl_operators/uvcalc_lightmap.py23
-rw-r--r--release/scripts/startup/bl_ui/properties_animviz.py46
-rw-r--r--release/scripts/startup/bl_ui/properties_data_armature.py14
-rw-r--r--release/scripts/startup/bl_ui/properties_object.py12
-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.py6
-rw-r--r--release/scripts/startup/bl_ui/space_sequencer.py5
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py4
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py72
-rw-r--r--source/blender/avi/intern/avi.c12
-rw-r--r--source/blender/avi/intern/codecs.c8
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/BKE_constraint.h2
-rw-r--r--source/blender/blenkernel/BKE_curve.h135
-rw-r--r--source/blender/blenkernel/BKE_customdata.h1
-rw-r--r--source/blender/blenkernel/BKE_lattice.h2
-rw-r--r--source/blender/blenkernel/BKE_mball.h147
-rw-r--r--source/blender/blenkernel/BKE_movieclip.h6
-rw-r--r--source/blender/blenkernel/BKE_object.h1
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c2
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c13
-rw-r--r--source/blender/blenkernel/intern/anim.c35
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c20
-rw-r--r--source/blender/blenkernel/intern/armature.c16
-rw-r--r--source/blender/blenkernel/intern/boids.c6
-rw-r--r--source/blender/blenkernel/intern/brush.c2
-rw-r--r--source/blender/blenkernel/intern/bvhutils.c6
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c6
-rw-r--r--source/blender/blenkernel/intern/cloth.c176
-rw-r--r--source/blender/blenkernel/intern/collision.c221
-rw-r--r--source/blender/blenkernel/intern/colortools.c15
-rw-r--r--source/blender/blenkernel/intern/constraint.c99
-rw-r--r--source/blender/blenkernel/intern/context.c2
-rw-r--r--source/blender/blenkernel/intern/curve.c184
-rw-r--r--source/blender/blenkernel/intern/customdata.c23
-rw-r--r--source/blender/blenkernel/intern/deform.c4
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c6
-rw-r--r--source/blender/blenkernel/intern/displist.c53
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c188
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c10
-rw-r--r--source/blender/blenkernel/intern/effect.c11
-rw-r--r--source/blender/blenkernel/intern/fcurve.c5
-rw-r--r--source/blender/blenkernel/intern/fluidsim.c4
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c3
-rw-r--r--source/blender/blenkernel/intern/font.c30
-rw-r--r--source/blender/blenkernel/intern/idprop.c3
-rw-r--r--source/blender/blenkernel/intern/image.c23
-rw-r--r--source/blender/blenkernel/intern/image_gen.c12
-rw-r--r--source/blender/blenkernel/intern/implicit.c221
-rw-r--r--source/blender/blenkernel/intern/ipo.c2
-rw-r--r--source/blender/blenkernel/intern/key.c8
-rw-r--r--source/blender/blenkernel/intern/lattice.c2
-rw-r--r--source/blender/blenkernel/intern/library.c29
-rw-r--r--source/blender/blenkernel/intern/material.c8
-rw-r--r--source/blender/blenkernel/intern/mball.c199
-rw-r--r--source/blender/blenkernel/intern/mesh.c63
-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.c2
-rw-r--r--source/blender/blenkernel/intern/navmesh_conversion.c117
-rw-r--r--source/blender/blenkernel/intern/nla.c4
-rw-r--r--source/blender/blenkernel/intern/node.c6
-rw-r--r--source/blender/blenkernel/intern/object.c49
-rw-r--r--source/blender/blenkernel/intern/ocean.c149
-rw-r--r--source/blender/blenkernel/intern/packedFile.c2
-rw-r--r--source/blender/blenkernel/intern/paint.c2
-rw-r--r--source/blender/blenkernel/intern/particle.c10
-rw-r--r--source/blender/blenkernel/intern/particle_system.c43
-rw-r--r--source/blender/blenkernel/intern/pointcache.c62
-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.c2
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c2
-rw-r--r--source/blender/blenkernel/intern/sequencer.c9
-rw-r--r--source/blender/blenkernel/intern/shrinkwrap.c67
-rw-r--r--source/blender/blenkernel/intern/sketch.c129
-rw-r--r--source/blender/blenkernel/intern/smoke.c1557
-rw-r--r--source/blender/blenkernel/intern/softbody.c43
-rw-r--r--source/blender/blenkernel/intern/sound.c104
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c18
-rw-r--r--source/blender/blenkernel/intern/text.c159
-rw-r--r--source/blender/blenkernel/intern/texture.c6
-rw-r--r--source/blender/blenkernel/intern/tracking.c43
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c30
-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.h1
-rw-r--r--source/blender/blenlib/BLI_ghash.h4
-rw-r--r--source/blender/blenlib/BLI_lasso.h41
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h2
-rw-r--r--source/blender/blenlib/CMakeLists.txt7
-rw-r--r--source/blender/blenlib/intern/BLI_ghash.c6
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c283
-rw-r--r--source/blender/blenlib/intern/DLRB_tree.c6
-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.c2
-rw-r--r--source/blender/blenlib/intern/freetypefont.c19
-rw-r--r--source/blender/blenlib/intern/graph.c399
-rw-r--r--source/blender/blenlib/intern/lasso.c129
-rw-r--r--source/blender/blenlib/intern/listbase.c10
-rw-r--r--source/blender/blenlib/intern/math_matrix.c29
-rw-r--r--source/blender/blenlib/intern/math_rotation.c20
-rw-r--r--source/blender/blenlib/intern/path_util.c2
-rw-r--r--source/blender/blenlib/intern/pbvh.c10
-rw-r--r--source/blender/blenlib/intern/storage.c17
-rw-r--r--source/blender/blenlib/intern/string.c2
-rw-r--r--source/blender/blenlib/intern/string_cursor_utf8.c1
-rw-r--r--source/blender/blenlib/intern/string_utf8.c2
-rw-r--r--source/blender/blenloader/intern/readblenentry.c3
-rw-r--r--source/blender/blenloader/intern/readfile.c239
-rw-r--r--source/blender/blenloader/intern/writefile.c31
-rw-r--r--source/blender/bmesh/intern/bmesh_construct.c17
-rw-r--r--source/blender/bmesh/intern/bmesh_core.c24
-rw-r--r--source/blender/bmesh/intern/bmesh_interp.c46
-rw-r--r--source/blender/bmesh/intern/bmesh_interp.h2
-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.c1
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_private.h1
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers.c3
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers_impl.c2
-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_dissolve.c93
-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_join_triangles.c2
-rw-r--r--source/blender/bmesh/operators/bmo_mirror.c2
-rw-r--r--source/blender/bmesh/operators/bmo_primitive.c1
-rw-r--r--source/blender/bmesh/operators/bmo_removedoubles.c10
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide.c47
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide.h1
-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.cpp110
-rw-r--r--source/blender/collada/AnimationImporter.cpp67
-rw-r--r--source/blender/collada/AnimationImporter.h1
-rw-r--r--source/blender/collada/ArmatureExporter.cpp38
-rw-r--r--source/blender/collada/ArmatureImporter.cpp7
-rw-r--r--source/blender/collada/CameraExporter.cpp11
-rw-r--r--source/blender/collada/DocumentExporter.cpp2
-rw-r--r--source/blender/collada/DocumentImporter.cpp38
-rw-r--r--source/blender/collada/EffectExporter.cpp5
-rw-r--r--source/blender/collada/ErrorHandler.cpp22
-rw-r--r--source/blender/collada/GeometryExporter.cpp8
-rw-r--r--source/blender/collada/GeometryExporter.h6
-rw-r--r--source/blender/collada/ImageExporter.cpp5
-rw-r--r--source/blender/collada/InstanceWriter.cpp2
-rw-r--r--source/blender/collada/LightExporter.cpp7
-rw-r--r--source/blender/collada/MaterialExporter.cpp5
-rw-r--r--source/blender/collada/MaterialExporter.h2
-rw-r--r--source/blender/collada/MeshImporter.cpp52
-rw-r--r--source/blender/collada/MeshImporter.h2
-rw-r--r--source/blender/collada/SceneExporter.cpp11
-rw-r--r--source/blender/collada/SkinInfo.cpp2
-rw-r--r--source/blender/collada/TransformReader.cpp2
-rw-r--r--source/blender/collada/TransformWriter.cpp9
-rw-r--r--source/blender/collada/collada_internal.cpp39
-rw-r--r--source/blender/collada/collada_utils.cpp15
-rw-r--r--source/blender/collada/collada_utils.h2
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c40
-rw-r--r--source/blender/editors/animation/anim_filter.c175
-rw-r--r--source/blender/editors/animation/anim_markers.c2
-rw-r--r--source/blender/editors/animation/keyframing.c3
-rw-r--r--source/blender/editors/armature/editarmature.c41
-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.c738
-rw-r--r--source/blender/editors/armature/poseUtils.c6
-rw-r--r--source/blender/editors/armature/poselib.c8
-rw-r--r--source/blender/editors/armature/poseobject.c129
-rw-r--r--source/blender/editors/armature/reeb.c810
-rw-r--r--source/blender/editors/curve/editcurve.c214
-rw-r--r--source/blender/editors/curve/editfont.c29
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c2
-rw-r--r--source/blender/editors/include/ED_anim_api.h2
-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_draw.c7
-rw-r--r--source/blender/editors/interface/interface_handlers.c8
-rw-r--r--source/blender/editors/interface/interface_layout.c4
-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.c7
-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.c3
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c6
-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.c16
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c76
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c2
-rw-r--r--source/blender/editors/mesh/mesh_data.c46
-rw-r--r--source/blender/editors/mesh/mesh_intern.h2
-rw-r--r--source/blender/editors/mesh/mesh_navmesh.c3
-rw-r--r--source/blender/editors/mesh/meshtools.c30
-rw-r--r--source/blender/editors/metaball/mball_edit.c2
-rw-r--r--source/blender/editors/object/object_add.c689
-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.c770
-rw-r--r--source/blender/editors/object/object_group.c90
-rw-r--r--source/blender/editors/object/object_hook.c324
-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.c428
-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.c26
-rw-r--r--source/blender/editors/physics/physics_fluid.c3
-rw-r--r--source/blender/editors/render/render_opengl.c7
-rw-r--r--source/blender/editors/render/render_shading.c6
-rw-r--r--source/blender/editors/screen/area.c78
-rw-r--r--source/blender/editors/screen/glutil.c18
-rw-r--r--source/blender/editors/screen/screen_edit.c4
-rw-r--r--source/blender/editors/screen/screen_ops.c12
-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_stroke.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c75
-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.c8
-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_draw.c5
-rw-r--r--source/blender/editors/space_clip/clip_graph_ops.c2
-rw-r--r--source/blender/editors/space_clip/clip_ops.c6
-rw-r--r--source/blender/editors/space_clip/space_clip.c16
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c35
-rw-r--r--source/blender/editors/space_file/file_draw.c8
-rw-r--r--source/blender/editors/space_file/file_ops.c3
-rw-r--r--source/blender/editors/space_file/filelist.c4
-rw-r--r--source/blender/editors/space_file/filesel.c3
-rw-r--r--source/blender/editors/space_file/fsmenu.c19
-rw-r--r--source/blender/editors/space_file/space_file.c8
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c2
-rw-r--r--source/blender/editors/space_graph/graph_draw.c4
-rw-r--r--source/blender/editors/space_graph/space_graph.c11
-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_window.c72
-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/space_nla.c20
-rw-r--r--source/blender/editors/space_node/drawnode.c48
-rw-r--r--source/blender/editors/space_node/node_edit.c55
-rw-r--r--source/blender/editors/space_node/node_ops.c5
-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.c16
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c4
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c2
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c16
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c12
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c12
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c21
-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/text_draw.c3
-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/drawmesh.c77
-rw-r--r--source/blender/editors/space_view3d/drawobject.c134
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c8
-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_intern.h1
-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.c171
-rw-r--r--source/blender/editors/transform/transform_constraints.c9
-rw-r--r--source/blender/editors/transform/transform_conversions.c82
-rw-r--r--source/blender/editors/transform/transform_generics.c117
-rw-r--r--source/blender/editors/transform/transform_input.c6
-rw-r--r--source/blender/editors/transform/transform_manipulator.c14
-rw-r--r--source/blender/editors/transform/transform_ops.c56
-rw-r--r--source/blender/editors/transform/transform_orientations.c16
-rw-r--r--source/blender/editors/transform/transform_snap.c240
-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.c252
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c10
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c4
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c6
-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.c19
-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/itasc_plugin.cpp34
-rw-r--r--source/blender/imbuf/intern/anim_movie.c2
-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/jpeg.c6
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp47
-rw-r--r--source/blender/imbuf/intern/png.c2
-rw-r--r--source/blender/imbuf/intern/radiance_hdr.c7
-rw-r--r--source/blender/imbuf/intern/targa.c4
-rw-r--r--source/blender/imbuf/intern/thumbs.c4
-rw-r--r--source/blender/imbuf/intern/tiff.c27
-rw-r--r--source/blender/imbuf/intern/util.c14
-rw-r--r--source/blender/makesdna/DNA_object_types.h8
-rw-r--r--source/blender/makesdna/DNA_scene_types.h10
-rw-r--r--source/blender/makesdna/DNA_smoke_types.h14
-rw-r--r--source/blender/makesdna/DNA_tracking_types.h11
-rw-r--r--source/blender/makesdna/intern/dna_genfile.c4
-rw-r--r--source/blender/makesdna/intern/makesdna.c3
-rw-r--r--source/blender/makesrna/RNA_enum_types.h2
-rw-r--r--source/blender/makesrna/intern/makesrna.c4
-rw-r--r--source/blender/makesrna/intern/rna_access.c15
-rw-r--r--source/blender/makesrna/intern/rna_actuator.c16
-rw-r--r--source/blender/makesrna/intern/rna_animation.c2
-rw-r--r--source/blender/makesrna/intern/rna_animviz.c14
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c4
-rw-r--r--source/blender/makesrna/intern/rna_curve.c60
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c6
-rw-r--r--source/blender/makesrna/intern/rna_main.c3
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c10
-rw-r--r--source/blender/makesrna/intern/rna_meta.c4
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c1
-rw-r--r--source/blender/makesrna/intern/rna_nla.c2
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c60
-rw-r--r--source/blender/makesrna/intern/rna_object.c9
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c4
-rw-r--r--source/blender/makesrna/intern/rna_scene.c20
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c22
-rw-r--r--source/blender/makesrna/intern/rna_smoke.c14
-rw-r--r--source/blender/makesrna/intern/rna_texture.c14
-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.c15
-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_cast.c14
-rw-r--r--source/blender/modifiers/intern/MOD_collision.c18
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c2
-rw-r--r--source/blender/modifiers/intern/MOD_explode.c4
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim_util.c42
-rw-r--r--source/blender/modifiers/intern/MOD_hook.c2
-rw-r--r--source/blender/modifiers/intern/MOD_mask.c15
-rw-r--r--source/blender/modifiers/intern/MOD_mirror.c11
-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_solidify.c27
-rw-r--r--source/blender/modifiers/intern/MOD_subsurf.c44
-rw-r--r--source/blender/modifiers/intern/MOD_util.c2
-rw-r--r--source/blender/modifiers/intern/MOD_warp.c2
-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/modifiers/intern/MOD_weightvgedit.c3
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgmix.c4
-rw-r--r--source/blender/nodes/composite/node_composite_util.c13
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_channelMatte.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_chromaMatte.c100
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorSpill.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_diffMatte.c97
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_distanceMatte.c161
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_filter.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_image.c7
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_levels.c8
-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_sepcombYCCA.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_stabilize2d.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_transform.c38
-rw-r--r--source/blender/nodes/intern/node_common.c3
-rw-r--r--source/blender/nodes/shader/node_shader_util.c6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_common.c6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_math.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_common.c6
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_math.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_output.c14
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_customdata.c120
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.c93
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.h7
-rw-r--r--source/blender/python/intern/bpy_props.c4
-rw-r--r--source/blender/python/intern/bpy_rna.c49
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c2
-rw-r--r--source/blender/quicktime/apple/quicktime_import.c40
-rw-r--r--source/blender/render/extern/include/RE_pipeline.h2
-rw-r--r--source/blender/render/intern/include/strand.h2
-rw-r--r--source/blender/render/intern/raytrace/bvh.h121
-rw-r--r--source/blender/render/intern/raytrace/rayobject.cpp80
-rw-r--r--source/blender/render/intern/raytrace/rayobject_blibvh.cpp3
-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.cpp72
-rw-r--r--source/blender/render/intern/raytrace/rayobject_qbvh.cpp3
-rw-r--r--source/blender/render/intern/raytrace/rayobject_rtbuild.cpp53
-rw-r--r--source/blender/render/intern/raytrace/rayobject_svbvh.cpp12
-rw-r--r--source/blender/render/intern/raytrace/rayobject_vbvh.cpp12
-rw-r--r--source/blender/render/intern/raytrace/reorganize.h188
-rw-r--r--source/blender/render/intern/raytrace/svbvh.h89
-rw-r--r--source/blender/render/intern/raytrace/vbvh.h35
-rw-r--r--source/blender/render/intern/source/convertblender.c23
-rw-r--r--source/blender/render/intern/source/initrender.c4
-rw-r--r--source/blender/render/intern/source/pipeline.c33
-rw-r--r--source/blender/render/intern/source/pointdensity.c2
-rw-r--r--source/blender/render/intern/source/rayshade.c102
-rw-r--r--source/blender/render/intern/source/render_result.c1
-rw-r--r--source/blender/render/intern/source/render_texture.c10
-rw-r--r--source/blender/render/intern/source/rendercore.c4
-rw-r--r--source/blender/render/intern/source/renderdatabase.c6
-rw-r--r--source/blender/render/intern/source/shadeoutput.c7
-rw-r--r--source/blender/render/intern/source/strand.c64
-rw-r--r--source/blender/render/intern/source/sunsky.c6
-rw-r--r--source/blender/render/intern/source/volume_precache.c33
-rw-r--r--source/blender/render/intern/source/volumetric.c3
-rw-r--r--source/blender/render/intern/source/voxeldata.c17
-rw-r--r--source/blender/render/intern/source/zbuf.c8
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c5
-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.c28
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c2
-rw-r--r--source/creator/creator.c2
-rw-r--r--source/gameengine/GamePlayer/common/GPC_Canvas.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_BulletPhysicsController.cpp4
530 files changed, 15232 insertions, 14463 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6a9ca35cd05..7e9e50fa8ed 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -802,35 +802,33 @@ elseif(WIN32)
endif()
if(MSVC)
- set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
+ if(CMAKE_CL_64)
+ set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
+ else()
+ set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
+ endif()
add_definitions(/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_CONSOLE /D_LIB)
- set(CMAKE_CXX_FLAGS "/nologo /J /Gd /EHsc" CACHE STRING "MSVC MT C++ flags " FORCE)
- set(CMAKE_C_FLAGS "/nologo /J /Gd" CACHE STRING "MSVC MT C++ flags " FORCE)
+ set(CMAKE_CXX_FLAGS "/nologo /J /W1 /Gd /wd4018 /wd4244 /wd4305 /wd4800 /wd4065 /wd4267 /we4013" CACHE STRING "MSVC MT C++ flags " FORCE)
+ set(CMAKE_C_FLAGS "/nologo /J /W1 /Gd /wd4018 /wd4244 /wd4305 /wd4800 /wd4065 /wd4267 /we4013 /EHsc" CACHE STRING "MSVC MT C++ flags " FORCE)
if(CMAKE_CL_64)
- set(CMAKE_CXX_FLAGS_DEBUG "/Od /Gm /RTC1 /MTd /Zi" CACHE STRING "MSVC MT flags " FORCE)
+ set(CMAKE_CXX_FLAGS_DEBUG "/Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
else()
- set(CMAKE_CXX_FLAGS_DEBUG "/Od /Gm /RTC1 /MTd /ZI" CACHE STRING "MSVC MT flags " FORCE)
+ set(CMAKE_CXX_FLAGS_DEBUG "/Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
endif()
- set(CMAKE_CXX_FLAGS_RELEASE "/O2 /Ob2 /MT" CACHE STRING "MSVC MT flags " FORCE)
- set(CMAKE_CXX_FLAGS_MINSIZEREL "/O1 /Ob1 /MT" CACHE STRING "MSVC MT flags " FORCE)
- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /MT /Zi" CACHE STRING "MSVC MT flags " FORCE)
+ set(CMAKE_CXX_FLAGS_RELEASE "/O2 /Ob2 /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
+ set(CMAKE_CXX_FLAGS_MINSIZEREL "/O1 /Ob1 /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
+ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
if(CMAKE_CL_64)
- set(CMAKE_C_FLAGS_DEBUG "/Od /Gm /RTC1 /MTd /Zi" CACHE STRING "MSVC MT flags " FORCE)
+ set(CMAKE_C_FLAGS_DEBUG "/Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
else()
- set(CMAKE_C_FLAGS_DEBUG "/Od /Gm /RTC1 /MTd /ZI" CACHE STRING "MSVC MT flags " FORCE)
+ set(CMAKE_C_FLAGS_DEBUG "/Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
endif()
- set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /MT" CACHE STRING "MSVC MT flags " FORCE)
- set(CMAKE_C_FLAGS_MINSIZEREL "/O1 /Ob1 /MT" CACHE STRING "MSVC MT flags " FORCE)
- 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(C_WARNINGS "${_WARNINGS}")
- set(CXX_WARNINGS "${_WARNINGS}")
- unset(_WARNINGS)
+ set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
+ set(CMAKE_C_FLAGS_MINSIZEREL "/O1 /Ob1 /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
+ set(CMAKE_C_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
if(WITH_INTERNATIONAL)
set(GETTEXT ${LIBDIR}/gettext)
diff --git a/build_files/buildbot/master.cfg b/build_files/buildbot/master.cfg
index 066c133d335..23751f7dcd4 100644
--- a/build_files/buildbot/master.cfg
+++ b/build_files/buildbot/master.cfg
@@ -117,8 +117,6 @@ 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 f67bd294496..3df22ad8745 100644
--- a/build_files/buildbot/master_unpack.py
+++ b/build_files/buildbot/master_unpack.py
@@ -48,8 +48,7 @@ def get_platform(filename):
tokens = filename.split("-")
platforms = ('osx', 'mac', 'bsd',
'win', 'linux', 'source',
- 'solaris',
- 'mingw')
+ 'solaris')
platform_tokens = []
found = False
diff --git a/build_files/buildbot/slave_compile.py b/build_files/buildbot/slave_compile.py
index eafdf0868cd..209253296be 100644
--- a/build_files/buildbot/slave_compile.py
+++ b/build_files/buildbot/slave_compile.py
@@ -117,8 +117,6 @@ 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 73c633d0c29..cb02e619c1d 100644
--- a/build_files/buildbot/slave_pack.py
+++ b/build_files/buildbot/slave_pack.py
@@ -81,8 +81,6 @@ 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 65593d559ed..efc80fcd3c5 100644
--- a/build_files/scons/tools/btools.py
+++ b/build_files/scons/tools/btools.py
@@ -622,13 +622,7 @@ def buildslave(target=None, source=None, env=None):
else:
extension = '.tar.bz2'
- if env['OURPLATFORM'] == 'win32-mingw':
- platform = 'mingw32'
- elif env['OURPLATFORM'] == 'win64-mingw':
- platform = 'mingw64'
- else:
- platform = env['OURPLATFORM'].split('-')[0]
-
+ platform = env['OURPLATFORM'].split('-')[0]
if platform == 'linux':
import platform
diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt
index 6be813883ec..02723b64b62 100644
--- a/extern/libmv/CMakeLists.txt
+++ b/extern/libmv/CMakeLists.txt
@@ -69,7 +69,6 @@ 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
@@ -127,7 +126,6 @@ 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 7248e4c9cd9..33068bddf90 100644
--- a/extern/libmv/ChangeLog
+++ b/extern/libmv/ChangeLog
@@ -1,16 +1,3 @@
-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
@@ -533,3 +520,9 @@ 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 85d09ce05b8..1e564d3a2f2 100644
--- a/extern/libmv/files.txt
+++ b/extern/libmv/files.txt
@@ -42,8 +42,6 @@ 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 6c20d76eeac..e4708e5907d 100644
--- a/extern/libmv/libmv-capi.cpp
+++ b/extern/libmv/libmv-capi.cpp
@@ -54,7 +54,6 @@
#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>
@@ -385,31 +384,6 @@ 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,
@@ -449,45 +423,26 @@ libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks *tracks, int keyfra
libmv::EuclideanCompleteReconstruction(normalized_tracks, reconstruction, &update_callback);
if (refine_intrinsics) {
- libmv_solveRefineIntrinsics((libmv::Tracks *)tracks, intrinsics, reconstruction,
- refine_intrinsics, progress_update_callback, callback_customdata);
- }
-
- 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);
+ /* 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;
+ }
- for (int i = 0; i < markers.size(); ++i) {
- intrinsics->InvertIntrinsics(markers[i].x,
- markers[i].y,
- &(markers[i].x),
- &(markers[i].y));
+ progress_update_callback(callback_customdata, 1.0, "Refining solution");
+ libmv::EuclideanBundleCommonIntrinsics(*(libmv::Tracks *)tracks, libmv_refine_flags,
+ reconstruction, intrinsics);
}
- 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 bccc4706832..01019832374 100644
--- a/extern/libmv/libmv-capi.h
+++ b/extern/libmv/libmv-capi.h
@@ -68,9 +68,6 @@ 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/extern/libmv/libmv/simple_pipeline/modal_solver.cc b/extern/libmv/libmv/simple_pipeline/modal_solver.cc
deleted file mode 100644
index bb49b30dbce..00000000000
--- a/extern/libmv/libmv/simple_pipeline/modal_solver.cc
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright (c) 2012 libmv authors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-
-#include <cstdio>
-
-#include "libmv/logging/logging.h"
-#include "libmv/simple_pipeline/modal_solver.h"
-#include "libmv/simple_pipeline/rigid_registration.h"
-
-#ifdef _MSC_VER
-# define snprintf _snprintf
-#endif
-
-namespace libmv {
-
-static void ProjectMarkerOnSphere(Marker &marker, Vec3 &X) {
- X(0) = marker.x;
- X(1) = marker.y;
- X(2) = 1.0;
-
- X *= 5.0 / X.norm();
-}
-
-static void ModalSolverLogProress(ProgressUpdateCallback *update_callback,
- double progress)
-{
- if (update_callback) {
- char message[256];
-
- snprintf(message, sizeof(message), "Solving progress %d%%", (int)(progress * 100));
-
- update_callback->invoke(progress, message);
- }
-}
-
-void ModalSolver(Tracks &tracks,
- EuclideanReconstruction *reconstruction,
- ProgressUpdateCallback *update_callback) {
- int max_image = tracks.MaxImage();
- int max_track = tracks.MaxTrack();
-
- LG << "Max image: " << max_image;
- LG << "Max track: " << max_track;
-
- Mat3 R = Mat3::Identity();
-
- for (int image = 0; image <= max_image; ++image) {
- vector<Marker> all_markers = tracks.MarkersInImage(image);
-
- ModalSolverLogProress(update_callback, (float) image / max_image);
-
- // Skip empty frames without doing anything
- if (all_markers.size() == 0) {
- LG << "Skipping frame: " << image;
- continue;
- }
-
- vector<Vec3> points, reference_points;
-
- // Cnstruct pairs of markers from current and previous image,
- // to reproject them and find rigid transformation between
- // previous and current image
- for (int track = 0; track <= max_track; ++track) {
- EuclideanPoint *point = reconstruction->PointForTrack(track);
-
- if (point) {
- Marker marker = tracks.MarkerInImageForTrack(image, track);
-
- if (marker.image == image) {
- Vec3 X;
-
- LG << "Use track " << track << " for rigid registration between image " <<
- image - 1 << " and " << image;
-
- ProjectMarkerOnSphere(marker, X);
-
- points.push_back(point->X);
- reference_points.push_back(X);
- }
- }
- }
-
- if (points.size()) {
- // Find rigid delta transformation to current image
- RigidRegistration(reference_points, points, R);
- }
-
- reconstruction->InsertCamera(image, R, Vec3::Zero());
-
- // Review if there's new tracks for which position might be reconstructed
- for (int track = 0; track <= max_track; ++track) {
- if (!reconstruction->PointForTrack(track)) {
- Marker marker = tracks.MarkerInImageForTrack(image, track);
-
- if (marker.image == image) {
- // New track appeared on this image, project it's position onto sphere
-
- LG << "Projecting track " << track << " at image " << image;
-
- Vec3 X;
- ProjectMarkerOnSphere(marker, X);
- reconstruction->InsertPoint(track, R.inverse() * X);
- }
- }
- }
- }
-}
-
-} // namespace libmv
diff --git a/extern/libmv/libmv/simple_pipeline/modal_solver.h b/extern/libmv/libmv/simple_pipeline/modal_solver.h
deleted file mode 100644
index 560b37c2987..00000000000
--- a/extern/libmv/libmv/simple_pipeline/modal_solver.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2012 libmv authors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-
-#ifndef LIBMV_SIMPLE_PIPELINE_MODAL_SOLVER_H_
-#define LIBMV_SIMPLE_PIPELINE_MODAL_SOLVER_H_
-
-#include "libmv/simple_pipeline/tracks.h"
-#include "libmv/simple_pipeline/reconstruction.h"
-#include "libmv/simple_pipeline/callbacks.h"
-
-namespace libmv {
-
-/*!
- This solver solves such camera motion as tripod rotation, reconstructing
- only camera motion itself. Bundles are not reconstructing properly, they're
- just getting projected onto sphere.
-
- Markers from tracks object would be used for recosntruction, and algorithm
- assumes thir's positions are undistorted already and they're in nnormalized
- space.
-
- Reconstructed cameras and projected bundles would be added to reconstruction
- object.
-*/
-void ModalSolver(Tracks &tracks,
- EuclideanReconstruction *reconstruction,
- ProgressUpdateCallback *update_callback = NULL);
-
-} // namespace libmv
-
-#endif // LIBMV_SIMPLE_PIPELINE_MODAL_SOLVER_H_
diff --git a/intern/audaspace/intern/AUD_Reference.h b/intern/audaspace/intern/AUD_Reference.h
index 0c9f02c0155..5a1aa947148 100644
--- a/intern/audaspace/intern/AUD_Reference.h
+++ b/intern/audaspace/intern/AUD_Reference.h
@@ -174,8 +174,14 @@ public:
std::cerr << "-" << typeid(*m_reference).name() << std::endl;
#endif
if(AUD_ReferenceHandler::decref(m_original))
+ {
+ pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
delete m_reference;
- pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
+ }
+ else
+ {
+ pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
+ }
}
/**
@@ -194,7 +200,11 @@ public:
std::cerr << "-" << typeid(*m_reference).name() << std::endl;
#endif
if(AUD_ReferenceHandler::decref(m_original))
+ {
+ pthread_mutex_unlock(AUD_ReferenceHandler::getMutex());
delete m_reference;
+ pthread_mutex_lock(AUD_ReferenceHandler::getMutex());
+ }
m_original = ref.m_original;
m_reference = ref.m_reference;
diff --git a/intern/container/CTR_Map.h b/intern/container/CTR_Map.h
index 9557821d642..8b6d84337c2 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 35f97bf629f..cb99ea3b499 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_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,
+ cls.blur_caustics = FloatProperty(
+ name="Blur Caustics",
+ description="Blur caustics to reduce noise",
+ min=0.0, max=1.0,
default=0.0,
)
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 0ed08589327..624d00b377d 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")
- col.separator()
-
- col.prop(cscene, "no_caustics")
- col.prop(cscene, "blur_glossy")
+ #row = col.row()
+ #row.prop(cscene, "blur_caustics")
+ #row.active = not cscene.no_caustics
class CyclesRender_PT_film(CyclesButtonsPanel, Panel):
@@ -178,7 +178,10 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
col = split.column()
col.prop(scene, "layers", text="Scene")
- col.prop(rl, "layers_exclude", text="Exclude")
+ col.label(text="Material:")
+ col.prop(rl, "material_override", text="")
+
+ col.prop(rl, "use_sky", "Use Environment")
col = split.column()
col.prop(rl, "layers", text="Layer")
@@ -188,16 +191,6 @@ 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_object.cpp b/intern/cycles/blender/blender_object.cpp
index 96faee19af4..f1c0175ddb5 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -253,7 +253,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d)
BL::Scene::objects_iterator b_ob;
for(b_scene.objects.begin(b_ob); b_ob != b_scene.objects.end(); ++b_ob) {
- bool hide = (b_v3d)? b_ob->hide(): b_ob->hide_render();
+ bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render();
uint ob_layer = get_layer(b_ob->layers());
if(!hide && (ob_layer & scene_layer)) {
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index 5ece7aa26e2..dc6c69e2904 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -218,13 +218,12 @@ 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 41cd200d003..639308e78d3 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -153,8 +153,6 @@ 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;
@@ -210,7 +208,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;
+ render_layer.use_viewport_visibility = true;
return;
}
}
@@ -223,13 +221,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()) & ~get_layer(b_rlay->layers_exclude());
+ render_layer.scene_layer = get_layer(b_scene.layers());
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();
+ render_layer.use_viewport_visibility = false;
}
first_layer = false;
diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h
index ab8e4bd8d00..68d7da3ad0a 100644
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@ -57,7 +57,6 @@ 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);
@@ -110,7 +109,7 @@ private:
: scene_layer(0), layer(0), holdout_layer(0),
material_override(PointerRNA_NULL),
use_background(true),
- samples(0)
+ use_viewport_visibility(false)
{}
string name;
@@ -119,7 +118,7 @@ private:
uint holdout_layer;
BL::Material material_override;
bool use_background;
- int samples;
+ bool use_viewport_visibility;
} render_layer;
};
diff --git a/intern/cycles/bvh/CMakeLists.txt b/intern/cycles/bvh/CMakeLists.txt
index 131a7a1f750..decc576fe51 100644
--- a/intern/cycles/bvh/CMakeLists.txt
+++ b/intern/cycles/bvh/CMakeLists.txt
@@ -10,21 +10,17 @@ 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 15695dddf45..c9bfa964332 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::empty;
+ BoundBox bbox;
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 = BoundBox::empty, bbox1 = BoundBox::empty;
+ BoundBox bbox0, bbox1;
uint visibility0 = 0, visibility1 = 0;
refit_node((c0 < 0)? -c0-1: c0, (c0 < 0), bbox0, visibility0);
diff --git a/intern/cycles/bvh/bvh_binning.cpp b/intern/cycles/bvh/bvh_binning.cpp
deleted file mode 100644
index 661541a8d23..00000000000
--- a/intern/cycles/bvh/bvh_binning.cpp
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Adapted from code copyright 2009-2011 Intel Corporation
- * Modifications Copyright 2012, Blender Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//#define __KERNEL_SSE__
-
-#include <stdlib.h>
-
-#include "bvh_binning.h"
-
-#include "util_algorithm.h"
-#include "util_boundbox.h"
-#include "util_types.h"
-
-CCL_NAMESPACE_BEGIN
-
-/* SSE replacements */
-
-__forceinline void prefetch_L1 (const void* ptr) { }
-__forceinline void prefetch_L2 (const void* ptr) { }
-__forceinline void prefetch_L3 (const void* ptr) { }
-__forceinline void prefetch_NTA(const void* ptr) { }
-
-template<size_t src> __forceinline float extract(const int4& b)
-{ return b[src]; }
-template<size_t dst> __forceinline const float4 insert(const float4& a, const float b)
-{ float4 r = a; r[dst] = b; return r; }
-
-__forceinline int get_best_dimension(const float4& bestSAH)
-{
- // return (int)__bsf(movemask(reduce_min(bestSAH) == bestSAH));
-
- float minSAH = min(bestSAH.x, min(bestSAH.y, bestSAH.z));
-
- if(bestSAH.x == minSAH) return 0;
- else if(bestSAH.y == minSAH) return 1;
- else return 2;
-}
-
-/* BVH Object Binning */
-
-BVHObjectBinning::BVHObjectBinning(const BVHRange& job, BVHReference *prims)
-: BVHRange(job), splitSAH(FLT_MAX), dim(0), pos(0)
-{
- /* compute number of bins to use and precompute scaling factor for binning */
- num_bins = min(size_t(MAX_BINS), size_t(4.0f + 0.05f*size()));
- scale = rcp(cent_bounds().size()) * make_float3((float)num_bins);
-
- /* initialize binning counter and bounds */
- BoundBox bin_bounds[MAX_BINS][4]; /* bounds for every bin in every dimension */
- int4 bin_count[MAX_BINS]; /* number of primitives mapped to bin */
-
- for(size_t i = 0; i < num_bins; i++) {
- bin_count[i] = make_int4(0);
- bin_bounds[i][0] = bin_bounds[i][1] = bin_bounds[i][2] = BoundBox::empty;
- }
-
- /* map geometry to bins, unrolled once */
- {
- ssize_t i;
-
- for(i = 0; i < ssize_t(size()) - 1; i += 2) {
- prefetch_L2(&prims[start() + i + 8]);
-
- /* map even and odd primitive to bin */
- BVHReference prim0 = prims[start() + i + 0];
- BVHReference prim1 = prims[start() + i + 1];
-
- int4 bin0 = get_bin(prim0.bounds());
- int4 bin1 = get_bin(prim1.bounds());
-
- /* increase bounds for bins for even primitive */
- int b00 = extract<0>(bin0); bin_count[b00][0]++; bin_bounds[b00][0].grow(prim0.bounds());
- int b01 = extract<1>(bin0); bin_count[b01][1]++; bin_bounds[b01][1].grow(prim0.bounds());
- int b02 = extract<2>(bin0); bin_count[b02][2]++; bin_bounds[b02][2].grow(prim0.bounds());
-
- /* increase bounds of bins for odd primitive */
- int b10 = extract<0>(bin1); bin_count[b10][0]++; bin_bounds[b10][0].grow(prim1.bounds());
- int b11 = extract<1>(bin1); bin_count[b11][1]++; bin_bounds[b11][1].grow(prim1.bounds());
- int b12 = extract<2>(bin1); bin_count[b12][2]++; bin_bounds[b12][2].grow(prim1.bounds());
- }
-
- /* for uneven number of primitives */
- if(i < ssize_t(size())) {
- /* map primitive to bin */
- BVHReference prim0 = prims[start() + i];
- int4 bin0 = get_bin(prim0.bounds());
-
- /* increase bounds of bins */
- int b00 = extract<0>(bin0); bin_count[b00][0]++; bin_bounds[b00][0].grow(prim0.bounds());
- int b01 = extract<1>(bin0); bin_count[b01][1]++; bin_bounds[b01][1].grow(prim0.bounds());
- int b02 = extract<2>(bin0); bin_count[b02][2]++; bin_bounds[b02][2].grow(prim0.bounds());
- }
- }
-
- /* sweep from right to left and compute parallel prefix of merged bounds */
- float4 r_area[MAX_BINS]; /* area of bounds of primitives on the right */
- float4 r_count[MAX_BINS]; /* number of primitives on the right */
- int4 count = make_int4(0);
-
- BoundBox bx = BoundBox::empty;
- BoundBox by = BoundBox::empty;
- BoundBox bz = BoundBox::empty;
-
- for(size_t i = num_bins - 1; i > 0; i--) {
- count = count + bin_count[i];
- r_count[i] = blocks(count);
-
- bx = merge(bx,bin_bounds[i][0]); r_area[i][0] = bx.half_area();
- by = merge(by,bin_bounds[i][1]); r_area[i][1] = by.half_area();
- bz = merge(bz,bin_bounds[i][2]); r_area[i][2] = bz.half_area();
- }
-
- /* sweep from left to right and compute SAH */
- int4 ii = make_int4(1);
- float4 bestSAH = make_float4(FLT_MAX);
- int4 bestSplit = make_int4(-1);
-
- count = make_int4(0);
-
- bx = BoundBox::empty;
- by = BoundBox::empty;
- bz = BoundBox::empty;
-
- for(size_t i = 1; i < num_bins; i++, ii += make_int4(1)) {
- count = count + bin_count[i-1];
-
- bx = merge(bx,bin_bounds[i-1][0]); float Ax = bx.half_area();
- by = merge(by,bin_bounds[i-1][1]); float Ay = by.half_area();
- bz = merge(bz,bin_bounds[i-1][2]); float Az = bz.half_area();
-
- float4 lCount = blocks(count);
- float4 lArea = make_float4(Ax,Ay,Az,Az);
- float4 sah = lArea*lCount + r_area[i]*r_count[i];
-
- bestSplit = select(sah < bestSAH,ii,bestSplit);
- bestSAH = min(sah,bestSAH);
- }
-
- int4 mask = float3_to_float4(cent_bounds().size()) <= make_float4(0.0f);
- bestSAH = insert<3>(select(mask, make_float4(FLT_MAX), bestSAH), FLT_MAX);
-
- /* find best dimension */
- dim = get_best_dimension(bestSAH);
- splitSAH = bestSAH[dim];
- pos = bestSplit[dim];
- leafSAH = bounds().half_area() * blocks(size());
-}
-
-void BVHObjectBinning::split(BVHReference* prims, BVHObjectBinning& left_o, BVHObjectBinning& right_o) const
-{
- size_t N = size();
-
- BoundBox lgeom_bounds = BoundBox::empty;
- BoundBox rgeom_bounds = BoundBox::empty;
- BoundBox lcent_bounds = BoundBox::empty;
- BoundBox rcent_bounds = BoundBox::empty;
-
- ssize_t l = 0, r = N-1;
-
- while(l <= r) {
- prefetch_L2(&prims[start() + l + 8]);
- prefetch_L2(&prims[start() + r - 8]);
-
- BVHReference prim = prims[start() + l];
- float3 center = prim.bounds().center2();
-
- if(get_bin(center)[dim] < pos) {
- lgeom_bounds.grow(prim.bounds());
- lcent_bounds.grow(center);
- l++;
- }
- else {
- rgeom_bounds.grow(prim.bounds());
- rcent_bounds.grow(center);
- swap(prims[start()+l],prims[start()+r]);
- r--;
- }
- }
-
- /* finish */
- if(l != 0 && N-1-r != 0) {
- right_o = BVHObjectBinning(BVHRange(rgeom_bounds, rcent_bounds, start() + l, N-1-r), prims);
- left_o = BVHObjectBinning(BVHRange(lgeom_bounds, lcent_bounds, start(), l), prims);
- return;
- }
-
- /* object medium split if we did not make progress, can happen when all
- primitives have same centroid */
- lgeom_bounds = BoundBox::empty;
- rgeom_bounds = BoundBox::empty;
- lcent_bounds = BoundBox::empty;
- rcent_bounds = BoundBox::empty;
-
- for(size_t i = 0; i < N/2; i++) {
- lgeom_bounds.grow(prims[start()+i].bounds());
- lcent_bounds.grow(prims[start()+i].bounds().center2());
- }
-
- for(size_t i = N/2; i < N; i++) {
- rgeom_bounds.grow(prims[start()+i].bounds());
- rcent_bounds.grow(prims[start()+i].bounds().center2());
- }
-
- right_o = BVHObjectBinning(BVHRange(rgeom_bounds, rcent_bounds, start() + N/2, N/2 + N%2), prims);
- left_o = BVHObjectBinning(BVHRange(lgeom_bounds, lcent_bounds, start(), N/2), prims);
-}
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/bvh/bvh_binning.h b/intern/cycles/bvh/bvh_binning.h
deleted file mode 100644
index 60742157055..00000000000
--- a/intern/cycles/bvh/bvh_binning.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Adapted from code copyright 2009-2011 Intel Corporation
- * Modifications Copyright 2012, Blender Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __BVH_BINNING_H__
-#define __BVH_BINNING_H__
-
-#include "bvh_params.h"
-
-#include "util_types.h"
-
-CCL_NAMESPACE_BEGIN
-
-/* Single threaded object binner. Finds the split with the best SAH heuristic
- * by testing for each dimension multiple partitionings for regular spaced
- * partition locations. A partitioning for a partition location is computed,
- * by putting primitives whose centroid is on the left and right of the split
- * location to different sets. The SAH is evaluated by computing the number of
- * blocks occupied by the primitives in the partitions. */
-
-class BVHObjectBinning : public BVHRange
-{
-public:
- __forceinline BVHObjectBinning() {}
- BVHObjectBinning(const BVHRange& job, BVHReference *prims);
-
- void split(BVHReference *prims, BVHObjectBinning& left_o, BVHObjectBinning& right_o) const;
-
- float splitSAH; /* SAH cost of the best split */
- float leafSAH; /* SAH cost of creating a leaf */
-
-protected:
- int dim; /* best split dimension */
- int pos; /* best split position */
- size_t num_bins; /* actual number of bins to use */
- float3 scale; /* scaling factor to compute bin */
-
- enum { MAX_BINS = 32 };
- enum { LOG_BLOCK_SIZE = 2 };
-
- /* computes the bin numbers for each dimension for a box. */
- __forceinline int4 get_bin(const BoundBox& box) const
- {
- int4 a = make_int4((box.center2() - cent_bounds().min)*scale - make_float3(0.5f));
- int4 mn = make_int4(0);
- int4 mx = make_int4((int)num_bins-1);
-
- return clamp(a, mn, mx);
- }
-
- /* computes the bin numbers for each dimension for a point. */
- __forceinline int4 get_bin(const float3& c) const
- {
- return make_int4((c - cent_bounds().min)*scale - make_float3(0.5f));
- }
-
- /* compute the number of blocks occupied for each dimension. */
- __forceinline float4 blocks(const int4& a) const
- {
- return make_float4((a + make_int4((1 << LOG_BLOCK_SIZE)-1)) >> LOG_BLOCK_SIZE);
- }
-
- /* compute the number of blocks occupied in one dimension. */
- __forceinline int blocks(size_t a) const
- {
- return (int)((a+((1LL << LOG_BLOCK_SIZE)-1)) >> LOG_BLOCK_SIZE);
- }
-};
-
-CCL_NAMESPACE_END
-
-#endif
-
diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp
index c5b4f1d01ae..38674c2c561 100644
--- a/intern/cycles/bvh/bvh_build.cpp
+++ b/intern/cycles/bvh/bvh_build.cpp
@@ -15,36 +15,22 @@
* limitations under the License.
*/
-#include "bvh_binning.h"
#include "bvh_build.h"
#include "bvh_node.h"
#include "bvh_params.h"
-#include "bvh_split.h"
+#include "bvh_sort.h"
#include "mesh.h"
#include "object.h"
#include "scene.h"
-#include "util_debug.h"
+#include "util_algorithm.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_,
@@ -55,10 +41,10 @@ BVHBuild::BVHBuild(const vector<Object*>& objects_,
prim_object(prim_object_),
params(params_),
progress(progress_),
- progress_start_time(0.0),
- task_pool(function_bind(&BVHBuild::thread_build_node, this, _1, _2))
+ progress_start_time(0.0)
{
spatial_min_overlap = 0.0f;
+ progress_num_duplicates = 0;
}
BVHBuild::~BVHBuild()
@@ -67,63 +53,57 @@ BVHBuild::~BVHBuild()
/* Adding References */
-void BVHBuild::add_reference_mesh(BoundBox& root, BoundBox& center, Mesh *mesh, int i)
+void BVHBuild::add_reference_mesh(NodeSpec& root, Mesh *mesh, int i)
{
for(uint j = 0; j < mesh->triangles.size(); j++) {
Mesh::Triangle t = mesh->triangles[j];
- BoundBox bounds = BoundBox::empty;
+ Reference ref;
for(int k = 0; k < 3; k++) {
float3 pt = mesh->verts[t.v[k]];
- bounds.grow(pt);
+ ref.bounds.grow(pt);
}
- if(bounds.valid()) {
- references.push_back(BVHReference(bounds, j, i));
- root.grow(bounds);
- center.grow(bounds.center2());
+ if(ref.bounds.valid()) {
+ ref.prim_index = j;
+ ref.prim_object = i;
+
+ references.push_back(ref);
+ root.bounds.grow(ref.bounds);
}
}
}
-void BVHBuild::add_reference_object(BoundBox& root, BoundBox& center, Object *ob, int i)
+void BVHBuild::add_reference_object(NodeSpec& root, Object *ob, int i)
{
- references.push_back(BVHReference(ob->bounds, -1, i));
- root.grow(ob->bounds);
- center.grow(ob->bounds.center2());
-}
+ Reference ref;
-void BVHBuild::add_references(BVHRange& root)
-{
- /* reserve space for references */
- size_t num_alloc_references = 0;
+ ref.prim_index = -1;
+ ref.prim_object = i;
+ ref.bounds = ob->bounds;
- 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.push_back(ref);
+ root.bounds.grow(ref.bounds);
+}
- references.reserve(num_alloc_references);
+void BVHBuild::add_references(NodeSpec& root)
+{
+ /* init root spec */
+ root.num = 0;
+ root.bounds = BoundBox();
- /* add references from objects */
- BoundBox bounds = BoundBox::empty, center = BoundBox::empty;
+ /* add objects */
int i = 0;
foreach(Object *ob, objects) {
if(params.top_level) {
if(ob->mesh->transform_applied)
- add_reference_mesh(bounds, center, ob->mesh, i);
+ add_reference_mesh(root, ob->mesh, i);
else
- add_reference_object(bounds, center, ob, i);
+ add_reference_object(root, ob, i);
}
else
- add_reference_mesh(bounds, center, ob->mesh, i);
+ add_reference_mesh(root, ob->mesh, i);
i++;
@@ -131,213 +111,129 @@ void BVHBuild::add_references(BVHRange& root)
}
/* happens mostly on empty meshes */
- if(!bounds.valid())
- bounds.grow(make_float3(0.0f, 0.0f, 0.0f));
+ if(!root.bounds.valid())
+ root.bounds.grow(make_float3(0.0f, 0.0f, 0.0f));
- root = BVHRange(bounds, center, 0, references.size());
+ root.num = references.size();
}
/* Build */
BVHNode* BVHBuild::run()
{
- BVHRange root;
+ NodeSpec 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().safe_area() * params.spatial_split_alpha;
+ spatial_min_overlap = root.bounds.area() * params.spatial_split_alpha;
spatial_right_bounds.clear();
- spatial_right_bounds.resize(max(root.size(), (int)BVHParams::NUM_SPATIAL_BINS) - 1);
+ spatial_right_bounds.resize(max(root.num, (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 */
- 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;
+ return build_node(root, 0, 0.0f, 1.0f);
}
-void BVHBuild::progress_update()
+void BVHBuild::progress_update(float progress_start, float progress_end)
{
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();
}
-void BVHBuild::thread_build_node(Task *task_, int thread_id)
+BVHNode* BVHBuild::build_node(const NodeSpec& spec, int level, float progress_start, float progress_end)
{
- if(progress.get_cancel())
- return;
-
- /* 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;
-
- /* update progress */
- if(task->range.size() < THREAD_TASK_SIZE) {
- /*rotate(node, INT_MAX, 5);*/
-
- thread_scoped_lock lock(build_mutex);
+ /* progress update */
+ progress_update(progress_start, progress_end);
+ if(progress.get_cancel()) return NULL;
- progress_count += task->range.size();
- progress_update();
+ /* 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);
}
-}
-/* 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;
+ /* leaf SAH is the lowest => create leaf. */
+ float minSAH = min(min(leafSAH, object.sah), spatial.sah);
- /* 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);
+ if(minSAH == leafSAH && spec.num <= params.max_leaf_size)
+ return create_leaf_node(spec);
- /* perform split */
- BVHObjectBinning left, right;
- range.split(&references[0], left, right);
+ /* perform split. */
+ NodeSpec left, right;
- /* create inner node. */
- InnerNode *inner;
-
- if(range.size() < THREAD_TASK_SIZE) {
- /* local build */
- BVHNode *leftnode = build_node(left, level + 1);
- BVHNode *rightnode = build_node(right, level + 1);
+ 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);
- inner = new InnerNode(range.bounds(), leftnode, rightnode);
- }
- else {
- /* threaded build */
- inner = new InnerNode(range.bounds());
+ /* create inner node. */
+ progress_num_duplicates += left.num + right.num - spec.num;
- task_pool.push(new BVHBuildTask(inner, 0, left, level + 1), true);
- task_pool.push(new BVHBuildTask(inner, 1, right, level + 1), true);
- }
+ float progress_mid = lerp(progress_start, progress_end, (float)right.num / (float)(left.num + right.num));
- return inner;
-}
-
-/* single threaded spatial split builder */
-BVHNode* BVHBuild::build_node(const BVHRange& range, int level)
-{
- /* progress update */
- progress_update();
- if(progress.get_cancel())
+ BVHNode* rightNode = build_node(right, level + 1, progress_start, progress_mid);
+ if(progress.get_cancel()) {
+ if(rightNode) rightNode->deleteSubtree();
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);
+ BVHNode* leftNode = build_node(left, level + 1, progress_mid, progress_end);
+ if(progress.get_cancel()) {
+ if(leftNode) leftNode->deleteSubtree();
+ return NULL;
}
-
- /* 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);
- /* inner node */
- return new InnerNode(range.bounds(), leftnode, rightnode);
+ return new InnerNode(spec.bounds, leftNode, rightNode);
}
-/* Create Nodes */
-
-BVHNode *BVHBuild::create_object_leaf_nodes(const BVHReference *ref, int start, int num)
+BVHNode *BVHBuild::create_object_leaf_nodes(const Reference *ref, int num)
{
if(num == 0) {
- BoundBox bounds = BoundBox::empty;
+ BoundBox bounds;
return new LeafNode(bounds, 0, 0, 0);
}
else if(num == 1) {
- 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);
+ 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());
}
else {
int mid = num/2;
- BVHNode *leaf0 = create_object_leaf_nodes(ref, start, mid);
- BVHNode *leaf1 = create_object_leaf_nodes(ref+mid, start+mid, num-mid);
+ BVHNode *leaf0 = create_object_leaf_nodes(ref, mid);
+ BVHNode *leaf1 = create_object_leaf_nodes(ref+mid, num-mid);
- BoundBox bounds = BoundBox::empty;
+ BoundBox bounds;
bounds.grow(leaf0->m_bounds);
bounds.grow(leaf1->m_bounds);
@@ -345,136 +241,310 @@ BVHNode *BVHBuild::create_object_leaf_nodes(const BVHReference *ref, int start,
}
}
-BVHNode* BVHBuild::create_leaf_node(const BVHRange& range)
+BVHNode* BVHBuild::create_leaf_node(const NodeSpec& spec)
{
vector<int>& p_index = prim_index;
vector<int>& p_object = prim_object;
- BoundBox bounds = BoundBox::empty;
- int num = 0, ob_num = 0;
+ BoundBox bounds;
+ int num = 0;
uint visibility = 0;
- 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;
+ 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();
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, range.start(), range.start() + num);
+ leaf = new LeafNode(bounds, visibility, p_index.size() - num, p_index.size());
- if(num == range.size())
+ if(num == spec.num)
return leaf;
}
/* while there may be multiple triangles in a leaf, for object primitives
- * 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);
+ * 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();
if(leaf)
- return new InnerNode(range.bounds(), leaf, oleaf);
+ return new InnerNode(spec.bounds, leaf, oleaf);
else
return oleaf;
}
-/* Tree Rotations */
+/* Object Split */
-void BVHBuild::rotate(BVHNode *node, int max_depth, int iterations)
+BVHBuild::ObjectSplit BVHBuild::find_object_split(const NodeSpec& spec, float nodeSAH)
{
- /* 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);
+ 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;
}
-void BVHBuild::rotate(BVHNode *node, int max_depth)
+void BVHBuild::do_object_split(NodeSpec& left, NodeSpec& right, const NodeSpec& spec, const ObjectSplit& split)
{
- /* nothing to rotate if we reached a leaf node. */
- if(node->is_leaf() || max_depth < 0)
- return;
-
- InnerNode *parent = (InnerNode*)node;
+ /* sort references according to split */
+ int start = references.size() - spec.num;
+ int end = references.size(); /* todo: is this right? */
- /* rotate all children first */
- for(size_t c = 0; c < 2; c++)
- rotate(parent->children[c], max_depth-1);
+ bvh_reference_sort(start, end, &references[0], split.dim);
- /* compute current area of all children */
- BoundBox bounds0 = parent->children[0]->m_bounds;
- BoundBox bounds1 = parent->children[1]->m_bounds;
-
- float area0 = bounds0.half_area();
- float area1 = bounds1.half_area();
- float4 child_area = make_float4(area0, area1, 0.0f, 0.0f);
+ /* 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;
+}
- /* 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 Split */
- for(size_t c = 0; c < 2; c++) {
- /* ignore leaf nodes as we cannot descent into */
- if(parent->children[c]->is_leaf())
- continue;
+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;
+ }
+ }
- InnerNode *child = (InnerNode*)parent->children[c];
- BoundBox& other = (c == 0)? bounds1: bounds0;
+ /* 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);
- /* transpose child bounds */
- BoundBox target0 = child->children[0]->m_bounds;
- BoundBox target1 = child->children[1]->m_bounds;
+ firstBin = clamp(firstBin, 0, BVHParams::NUM_SPATIAL_BINS - 1);
+ lastBin = clamp(lastBin, firstBin, BVHParams::NUM_SPATIAL_BINS - 1);
- /* 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];
+ for(int dim = 0; dim < 3; dim++) {
+ Reference currRef = ref;
- if(min(cost0,cost1) < best_cost) {
- best_child = (int)c;
- best_other = (int)(1-c);
+ for(int i = firstBin[dim]; i < lastBin[dim]; i++) {
+ Reference leftRef, rightRef;
- if(cost0 < cost1) {
- best_cost = cost0;
- bets_target = 0;
+ split_reference(leftRef, rightRef, currRef, dim, origin[dim] + binSize[dim] * (float)(i + 1));
+ spatial_bins[dim][i].bounds.grow(leftRef.bounds);
+ currRef = rightRef;
}
- else {
- best_cost = cost0;
- bets_target = 1;
+
+ spatial_bins[dim][lastBin[dim]].bounds.grow(currRef.bounds);
+ spatial_bins[dim][firstBin[dim]].enter++;
+ spatial_bins[dim][lastBin[dim]].exit++;
+ }
+ }
+
+ /* select best split plane. */
+ SpatialSplit split;
+
+ for(int dim = 0; dim < 3; dim++) {
+ /* sweep right to left and determine bounds. */
+ BoundBox right_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;
+ }
+
+ /* sweep left to right and select lowest SAH. */
+ BoundBox left_bounds;
+ int leftNum = 0;
+ int rightNum = spec.num;
+
+ 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 we did not find a swap that improves the SAH then do nothing */
- if(best_cost >= 0)
- return;
+ return split;
+}
- /* perform the best found tree rotation */
- InnerNode *child = (InnerNode*)parent->children[best_child];
+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;
+}
+
+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);
+ }
+ }
- swap(parent->children[best_other], child->children[bets_target]);
- child->m_bounds = merge(child->children[0]->m_bounds, child->children[1]->m_bounds);
+ /* intersect with original bounds. */
+ left.bounds.max[dim] = pos;
+ right.bounds.min[dim] = pos;
+ left.bounds.intersect(ref.bounds);
+ right.bounds.intersect(ref.bounds);
}
CCL_NAMESPACE_END
diff --git a/intern/cycles/bvh/bvh_build.h b/intern/cycles/bvh/bvh_build.h
index 84e14632b4b..1fa1951d7f2 100644
--- a/intern/cycles/bvh/bvh_build.h
+++ b/intern/cycles/bvh/bvh_build.h
@@ -21,10 +21,8 @@
#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
@@ -39,7 +37,28 @@ class Progress;
class BVHBuild
{
public:
- /* Constructor/Destructor */
+ struct Reference
+ {
+ int prim_index;
+ int prim_object;
+ BoundBox bounds;
+
+ Reference()
+ {
+ }
+ };
+
+ struct NodeSpec
+ {
+ int num;
+ BoundBox bounds;
+
+ NodeSpec()
+ {
+ num = 0;
+ }
+ };
+
BVHBuild(
const vector<Object*>& objects,
vector<int>& prim_index,
@@ -51,37 +70,63 @@ public:
BVHNode *run();
protected:
- friend class BVHMixedSplit;
- friend class BVHObjectSplit;
- friend class BVHSpatialSplit;
-
/* adding references */
- 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);
+ 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);
/* building */
- 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);
+ 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);
/* objects and primitive references */
vector<Object*> objects;
- vector<BVHReference> references;
- int num_original_references;
+ vector<Reference> references;
/* output primitive indexes and objects */
vector<int>& prim_index;
@@ -93,17 +138,12 @@ protected:
/* progress reporting */
Progress& progress;
double progress_start_time;
- size_t progress_count;
- size_t progress_total;
- size_t progress_original_total;
+ int progress_num_duplicates;
/* spatial splitting */
float spatial_min_overlap;
vector<BoundBox> spatial_right_bounds;
- BVHSpatialBin spatial_bins[3][BVHParams::NUM_SPATIAL_BINS];
-
- /* threads */
- TaskPool task_pool;
+ SpatialBin spatial_bins[3][BVHParams::NUM_SPATIAL_BINS];
};
CCL_NAMESPACE_END
diff --git a/intern/cycles/bvh/bvh_node.cpp b/intern/cycles/bvh/bvh_node.cpp
index 4edfb4b70a4..63683bae4a3 100644
--- a/intern/cycles/bvh/bvh_node.cpp
+++ b/intern/cycles/bvh/bvh_node.cpp
@@ -24,8 +24,6 @@
CCL_NAMESPACE_BEGIN
-/* BVH Node */
-
int BVHNode::getSubtreeSize(BVH_STAT stat) const
{
int cnt = 0;
@@ -61,8 +59,7 @@ int BVHNode::getSubtreeSize(BVH_STAT stat) const
void BVHNode::deleteSubtree()
{
for(int i=0;i<num_children();i++)
- if(get_child(i))
- get_child(i)->deleteSubtree();
+ get_child(i)->deleteSubtree();
delete this;
}
@@ -73,27 +70,12 @@ 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.safe_area()/m_bounds.safe_area());
+ SAH += child->computeSubtreeSAHCost(p, probability * child->m_bounds.area()/m_bounds.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 5c00f7b7a38..5e0a17a1193 100644
--- a/intern/cycles/bvh/bvh_node.h
+++ b/intern/cycles/bvh/bvh_node.h
@@ -49,6 +49,8 @@ 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;
@@ -56,8 +58,6 @@ 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,21 +66,9 @@ 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 0cf5e905fea..38093438500 100644
--- a/intern/cycles/bvh/bvh_params.h
+++ b/intern/cycles/bvh/bvh_params.h
@@ -18,8 +18,6 @@
#ifndef __BVH_PARAMS_H__
#define __BVH_PARAMS_H__
-#include "util_boundbox.h"
-
CCL_NAMESPACE_BEGIN
/* BVH Parameters */
@@ -75,97 +73,14 @@ public:
}
/* SAH costs */
- __forceinline float cost(int num_nodes, int num_tris) const
+ float cost(int num_nodes, int num_tris) const
{ return node_cost(num_nodes) + triangle_cost(num_tris); }
- __forceinline float triangle_cost(int n) const
+ float triangle_cost(int n) const
{ return n*sah_triangle_cost; }
- __forceinline float node_cost(int n) const
+ 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 bef384be592..ee4531a4843 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 BVHReference& ra, const BVHReference& rb)
+ bool operator()(const BVHBuild::Reference& ra, const BVHBuild::Reference& 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, BVHReference *data, int dim)
+void bvh_reference_sort(int start, int end, BVHBuild::Reference *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 ba35ba3fae7..f0676948146 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, BVHReference *data, int dim);
+void bvh_reference_sort(int start, int end, BVHBuild::Reference *data, int dim);
CCL_NAMESPACE_END
diff --git a/intern/cycles/bvh/bvh_split.cpp b/intern/cycles/bvh/bvh_split.cpp
deleted file mode 100644
index 263c5834428..00000000000
--- a/intern/cycles/bvh/bvh_split.cpp
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Adapted from code copyright 2009-2010 NVIDIA Corporation
- * Modifications Copyright 2011, Blender Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "bvh_build.h"
-#include "bvh_split.h"
-#include "bvh_sort.h"
-
-#include "mesh.h"
-#include "object.h"
-
-#include "util_algorithm.h"
-
-CCL_NAMESPACE_BEGIN
-
-/* Object Split */
-
-BVHObjectSplit::BVHObjectSplit(BVHBuild *builder, const BVHRange& range, float nodeSAH)
-: sah(FLT_MAX), dim(0), num_left(0), left_bounds(BoundBox::empty), right_bounds(BoundBox::empty)
-{
- const BVHReference *ref_ptr = &builder->references[range.start()];
- float min_sah = FLT_MAX;
-
- for(int dim = 0; dim < 3; dim++) {
- /* sort references */
- bvh_reference_sort(range.start(), range.end(), &builder->references[0], dim);
-
- /* sweep right to left and determine bounds. */
- BoundBox right_bounds = BoundBox::empty;
-
- for(int i = range.size() - 1; i > 0; i--) {
- right_bounds.grow(ref_ptr[i].bounds());
- builder->spatial_right_bounds[i - 1] = right_bounds;
- }
-
- /* sweep left to right and select lowest SAH. */
- BoundBox left_bounds = BoundBox::empty;
-
- for(int i = 1; i < range.size(); i++) {
- left_bounds.grow(ref_ptr[i - 1].bounds());
- right_bounds = builder->spatial_right_bounds[i - 1];
-
- float sah = nodeSAH +
- left_bounds.safe_area() * builder->params.triangle_cost(i) +
- right_bounds.safe_area() * builder->params.triangle_cost(range.size() - i);
-
- if(sah < min_sah) {
- min_sah = sah;
-
- this->sah = sah;
- this->dim = dim;
- this->num_left = i;
- this->left_bounds = left_bounds;
- this->right_bounds = right_bounds;
- }
- }
- }
-}
-
-void BVHObjectSplit::split(BVHBuild *builder, BVHRange& left, BVHRange& right, const BVHRange& range)
-{
- /* sort references according to split */
- bvh_reference_sort(range.start(), range.end(), &builder->references[0], this->dim);
-
- /* split node ranges */
- left = BVHRange(this->left_bounds, range.start(), this->num_left);
- right = BVHRange(this->right_bounds, left.end(), range.size() - this->num_left);
-
-}
-
-/* Spatial Split */
-
-BVHSpatialSplit::BVHSpatialSplit(BVHBuild *builder, const BVHRange& range, float nodeSAH)
-: sah(FLT_MAX), dim(0), pos(0.0f)
-{
- /* initialize bins. */
- float3 origin = range.bounds().min;
- float3 binSize = (range.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++) {
- BVHSpatialBin& bin = builder->spatial_bins[dim][i];
-
- bin.bounds = BoundBox::empty;
- bin.enter = 0;
- bin.exit = 0;
- }
- }
-
- /* chop references into bins. */
- for(unsigned int refIdx = range.start(); refIdx < range.end(); refIdx++) {
- const BVHReference& ref = builder->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);
-
- firstBin = clamp(firstBin, 0, BVHParams::NUM_SPATIAL_BINS - 1);
- lastBin = clamp(lastBin, firstBin, BVHParams::NUM_SPATIAL_BINS - 1);
-
- for(int dim = 0; dim < 3; dim++) {
- BVHReference currRef = ref;
-
- for(int i = firstBin[dim]; i < lastBin[dim]; i++) {
- BVHReference leftRef, rightRef;
-
- split_reference(builder, leftRef, rightRef, currRef, dim, origin[dim] + binSize[dim] * (float)(i + 1));
- builder->spatial_bins[dim][i].bounds.grow(leftRef.bounds());
- currRef = rightRef;
- }
-
- builder->spatial_bins[dim][lastBin[dim]].bounds.grow(currRef.bounds());
- builder->spatial_bins[dim][firstBin[dim]].enter++;
- builder->spatial_bins[dim][lastBin[dim]].exit++;
- }
- }
-
- /* select best split plane. */
- for(int dim = 0; dim < 3; dim++) {
- /* sweep right to left and determine bounds. */
- BoundBox right_bounds = BoundBox::empty;
-
- for(int i = BVHParams::NUM_SPATIAL_BINS - 1; i > 0; i--) {
- right_bounds.grow(builder->spatial_bins[dim][i].bounds);
- builder->spatial_right_bounds[i - 1] = right_bounds;
- }
-
- /* sweep left to right and select lowest SAH. */
- BoundBox left_bounds = BoundBox::empty;
- int leftNum = 0;
- int rightNum = range.size();
-
- for(int i = 1; i < BVHParams::NUM_SPATIAL_BINS; i++) {
- left_bounds.grow(builder->spatial_bins[dim][i - 1].bounds);
- leftNum += builder->spatial_bins[dim][i - 1].enter;
- rightNum -= builder->spatial_bins[dim][i - 1].exit;
-
- float sah = nodeSAH +
- left_bounds.safe_area() * builder->params.triangle_cost(leftNum) +
- builder->spatial_right_bounds[i - 1].safe_area() * builder->params.triangle_cost(rightNum);
-
- if(sah < this->sah) {
- this->sah = sah;
- this->dim = dim;
- this->pos = origin[dim] + binSize[dim] * (float)i;
- }
- }
- }
-}
-
-void BVHSpatialSplit::split(BVHBuild *builder, BVHRange& left, BVHRange& right, const BVHRange& range)
-{
- /* 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<BVHReference>& refs = builder->references;
- int left_start = range.start();
- int left_end = left_start;
- int right_start = range.end();
- int right_end = range.end();
- BoundBox left_bounds = BoundBox::empty;
- BoundBox right_bounds = BoundBox::empty;
-
- for(int i = left_end; i < right_start; i++) {
- if(refs[i].bounds().max[this->dim] <= this->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[this->dim] >= this->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. */
- BVHReference lref, rref;
-
- split_reference(builder, lref, rref, refs[left_end], this->dim, this->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 = builder->params.triangle_cost(left_end - left_start);
- float rac = builder->params.triangle_cost(right_end - right_start);
- float lbc = builder->params.triangle_cost(left_end - left_start + 1);
- float rbc = builder->params.triangle_cost(right_end - right_start + 1);
-
- float unsplitLeftSAH = lub.safe_area() * lbc + right_bounds.safe_area() * rac;
- float unsplitRightSAH = left_bounds.safe_area() * lac + rub.safe_area() * rbc;
- float duplicateSAH = ldb.safe_area() * lbc + rdb.safe_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.insert(refs.begin() + right_end, rref);
- right_end++;
- }
- }
-
- left = BVHRange(left_bounds, left_start, left_end - left_start);
- right = BVHRange(right_bounds, right_start, right_end - right_start);
-}
-
-void BVHSpatialSplit::split_reference(BVHBuild *builder, BVHReference& left, BVHReference& right, const BVHReference& ref, int dim, float pos)
-{
- /* initialize boundboxes */
- BoundBox left_bounds = BoundBox::empty;
- BoundBox right_bounds = BoundBox::empty;
-
- /* loop over vertices/edges. */
- Object *ob = builder->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);
- }
- }
-
- /* intersect with original bounds. */
- left_bounds.max[dim] = pos;
- right_bounds.min[dim] = pos;
- left_bounds.intersect(ref.bounds());
- right_bounds.intersect(ref.bounds());
-
- /* set referecnes */
- left = BVHReference(left_bounds, ref.prim_index(), ref.prim_object());
- right = BVHReference(right_bounds, ref.prim_index(), ref.prim_object());
-}
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/bvh/bvh_split.h b/intern/cycles/bvh/bvh_split.h
deleted file mode 100644
index 1f4befbe8e2..00000000000
--- a/intern/cycles/bvh/bvh_split.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Adapted from code copyright 2009-2010 NVIDIA Corporation
- * Modifications Copyright 2011, Blender Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __BVH_SPLIT_H__
-#define __BVH_SPLIT_H__
-
-#include "bvh_build.h"
-#include "bvh_params.h"
-
-CCL_NAMESPACE_BEGIN
-
-class BVHBuild;
-
-/* Object Split */
-
-class BVHObjectSplit
-{
-public:
- float sah;
- int dim;
- int num_left;
- BoundBox left_bounds;
- BoundBox right_bounds;
-
- BVHObjectSplit() {}
- BVHObjectSplit(BVHBuild *builder, const BVHRange& range, float nodeSAH);
-
- void split(BVHBuild *builder, BVHRange& left, BVHRange& right, const BVHRange& range);
-};
-
-/* Spatial Split */
-
-class BVHSpatialSplit
-{
-public:
- float sah;
- int dim;
- float pos;
-
- BVHSpatialSplit() : sah(FLT_MAX), dim(0), pos(0.0f) {}
- BVHSpatialSplit(BVHBuild *builder, const BVHRange& range, float nodeSAH);
-
- void split(BVHBuild *builder, BVHRange& left, BVHRange& right, const BVHRange& range);
- void split_reference(BVHBuild *builder, BVHReference& left, BVHReference& right, const BVHReference& ref, int dim, float pos);
-};
-
-/* Mixed Object-Spatial Split */
-
-class BVHMixedSplit
-{
-public:
- BVHObjectSplit object;
- BVHSpatialSplit spatial;
-
- float leafSAH;
- float nodeSAH;
- float minSAH;
-
- bool no_split;
-
- __forceinline BVHMixedSplit(BVHBuild *builder, const BVHRange& range, int level)
- {
- /* find split candidates. */
- float area = range.bounds().safe_area();
-
- leafSAH = area * builder->params.triangle_cost(range.size());
- nodeSAH = area * builder->params.node_cost(2);
-
- object = BVHObjectSplit(builder, range, nodeSAH);
-
- if(builder->params.use_spatial_split && level < BVHParams::MAX_SPATIAL_DEPTH) {
- BoundBox overlap = object.left_bounds;
- overlap.intersect(object.right_bounds);
-
- if(overlap.safe_area() >= builder->spatial_min_overlap)
- spatial = BVHSpatialSplit(builder, range, nodeSAH);
- }
-
- /* leaf SAH is the lowest => create leaf. */
- minSAH = min(min(leafSAH, object.sah), spatial.sah);
- no_split = (minSAH == leafSAH && range.size() <= builder->params.max_leaf_size);
- }
-
- __forceinline void split(BVHBuild *builder, BVHRange& left, BVHRange& right, const BVHRange& range)
- {
- if(builder->params.use_spatial_split && minSAH == spatial.sah)
- spatial.split(builder, left, right, range);
- if(!left.size() || !right.size())
- object.split(builder, left, right, range);
- }
-};
-
-CCL_NAMESPACE_END
-
-#endif /* __BVH_SPLIT_H__ */
-
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index 42dda1180c7..cceec8b8e5c 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -58,6 +58,15 @@ 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 87f255e54e7..af2567498d9 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -25,7 +25,6 @@
#include "util_list.h"
#include "util_string.h"
-#include "util_task.h"
#include "util_thread.h"
#include "util_types.h"
#include "util_vector.h"
@@ -67,7 +66,7 @@ public:
/* Device Task */
-class DeviceTask : public Task {
+class DeviceTask {
public:
typedef enum { PATH_TRACE, TONEMAP, SHADER } Type;
Type type;
@@ -88,6 +87,7 @@ 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 ec84047c44f..da977ed8472 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -40,21 +40,35 @@ CCL_NAMESPACE_BEGIN
class CPUDevice : public Device
{
public:
- TaskPool task_pool;
+ vector<thread*> threads;
+ ThreadQueue<DeviceTask> tasks;
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()
{
- task_pool.stop();
+ tasks.stop();
+
+ foreach(thread *t, threads) {
+ t->join();
+ delete t;
+ }
+
kernel_globals_free(kg);
}
@@ -113,21 +127,25 @@ public:
#endif
}
- void thread_run(Task *task_, int thread_id)
+ void thread_run(int t)
{
- 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);
+ 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();
+ }
}
void thread_path_trace(DeviceTask& task)
{
- if(task_pool.cancelled())
+ if(tasks.worker_cancel())
return;
#ifdef WITH_OSL
@@ -142,7 +160,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(task_pool.cancelled())
+ if(tasks.worker_cancel())
break;
}
}
@@ -154,7 +172,7 @@ public:
kernel_cpu_path_trace(kg, (float*)task.buffer, (unsigned int*)task.rng_state,
task.sample, x, y, task.offset, task.stride);
- if(task_pool.cancelled())
+ if(tasks.worker_cancel())
break;
}
}
@@ -196,7 +214,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(task_pool.cancelled())
+ if(tasks.worker_cancel())
break;
}
}
@@ -206,7 +224,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(task_pool.cancelled())
+ if(tasks.worker_cancel())
break;
}
}
@@ -221,22 +239,17 @@ public:
{
/* split task into smaller ones, more than number of threads for uneven
workloads where some parts of the image render slower than others */
- list<DeviceTask> tasks;
-
- task.split(tasks, TaskScheduler::num_threads()*10);
-
- foreach(DeviceTask& task, tasks)
- task_pool.push(new DeviceTask(task));
+ task.split(tasks, threads.size()*10);
}
void task_wait()
{
- task_pool.wait();
+ tasks.wait_done();
}
void task_cancel()
{
- task_pool.cancel();
+ tasks.cancel();
}
};
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index 0c08baae3ff..0a780e5f576 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -172,11 +172,18 @@ public:
CUresult result;
- if(background)
+ if(background) {
result = cuCtxCreate(&cuContext, 0, cuDevice);
- else
+ }
+ else {
result = cuGLCtxCreate(&cuContext, 0, cuDevice);
+ if(result != CUDA_SUCCESS) {
+ result = cuCtxCreate(&cuContext, 0, cuDevice);
+ background = true;
+ }
+ }
+
if(cuda_error(result))
return;
@@ -686,14 +693,25 @@ public:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glBindTexture(GL_TEXTURE_2D, 0);
- cuda_assert(cuGraphicsGLRegisterBuffer(&pmem.cuPBOresource, pmem.cuPBO, CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE))
+ CUresult result = cuGraphicsGLRegisterBuffer(&pmem.cuPBOresource, pmem.cuPBO, CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE);
- cuda_pop_context();
+ if(!cuda_error(result)) {
+ cuda_pop_context();
- mem.device_pointer = pmem.cuTexId;
- pixel_mem_map[mem.device_pointer] = pmem;
+ mem.device_pointer = pmem.cuTexId;
+ pixel_mem_map[mem.device_pointer] = pmem;
- return;
+ return;
+ }
+ else {
+ /* failed to register buffer, fallback to no interop */
+ glDeleteBuffers(1, &pmem.cuPBO);
+ glDeleteTextures(1, &pmem.cuTexId);
+
+ cuda_pop_context();
+
+ background = true;
+ }
}
Device::pixels_alloc(mem);
diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp
index 9f7d65e640b..1f69f2c53fa 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -257,14 +257,13 @@ public:
void task_add(DeviceTask& task)
{
- list<DeviceTask> tasks;
+ ThreadQueue<DeviceTask> tasks;
task.split(tasks, devices.size());
foreach(SubDevice& sub, devices) {
- if(!tasks.empty()) {
- DeviceTask subtask = tasks.front();
- tasks.pop_front();
+ DeviceTask subtask;
+ 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 6c3ade1c531..9a52531eec0 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(KernelGlobals *kg, PathRadiance *L)
+__device_inline float3 path_radiance_sum(PathRadiance *L)
{
#ifdef __PASSES__
if(L->use_light_pass) {
@@ -283,14 +283,9 @@ __device_inline float3 path_radiance_sum(KernelGlobals *kg, PathRadiance *L)
L->indirect_glossy *= L->indirect;
L->indirect_transmission *= L->indirect;
- float3 L_sum = L->emission
+ return L->emission + L->background
+ 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 8ebac177277..ff12e85375c 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -223,7 +223,6 @@ __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;
@@ -240,17 +239,13 @@ __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__
- /* sample background shader */
- float3 L_background = indirect_background(kg, &ray, state.flag, ray_pdf);
- path_radiance_accum_background(&L, throughput, L_background, state.bounce);
+ 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);
+ }
#endif
break;
@@ -264,18 +259,6 @@ __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);
@@ -395,10 +378,8 @@ __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);
@@ -413,7 +394,7 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R
#endif
}
- float3 L_sum = path_radiance_sum(kg, &L);
+ float3 L_sum = path_radiance_sum(&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 102a2bb036d..391dcd12dad 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -516,7 +516,6 @@ typedef struct KernelIntegrator {
/* caustics */
int no_caustics;
- float filter_glossy;
/* seed */
int seed;
@@ -526,6 +525,9 @@ 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 98f8734aed2..f494b6d66e1 100644
--- a/intern/cycles/kernel/svm/svm_tex_coord.h
+++ b/intern/cycles/kernel/svm/svm_tex_coord.h
@@ -40,15 +40,6 @@ __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;
@@ -94,15 +85,6 @@ __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;
@@ -151,15 +133,6 @@ __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 fa7c211b5f9..68eb39bdd29 100644
--- a/intern/cycles/kernel/svm/svm_types.h
+++ b/intern/cycles/kernel/svm/svm_types.h
@@ -119,7 +119,6 @@ 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 c1f066df10c..6e6d30f3879 100644
--- a/intern/cycles/render/integrator.cpp
+++ b/intern/cycles/render/integrator.cpp
@@ -41,7 +41,6 @@ Integrator::Integrator()
transparent_shadows = false;
no_caustics = false;
- filter_glossy = 0.0f;
seed = 0;
layer_flag = ~0;
sample_clamp = 0.0f;
@@ -82,8 +81,6 @@ 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;
@@ -122,7 +119,6 @@ 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 0817fcaa457..abbbaca894c 100644
--- a/intern/cycles/render/integrator.h
+++ b/intern/cycles/render/integrator.h
@@ -41,7 +41,6 @@ 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 0ce16e65621..a7eb365f983 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -43,7 +43,6 @@ Mesh::Mesh()
transform_applied = false;
transform_negative_scaled = false;
displacement_method = DISPLACE_BUMP;
- bounds = BoundBox::empty;
bvh = NULL;
@@ -97,7 +96,7 @@ void Mesh::add_triangle(int v0, int v1, int v2, int shader_, bool smooth_)
void Mesh::compute_bounds()
{
- BoundBox bnds = BoundBox::empty;
+ BoundBox bnds;
size_t verts_size = verts.size();
for(size_t i = 0; i < verts_size; i++)
@@ -698,8 +697,6 @@ 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;
@@ -707,6 +704,8 @@ 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 d71438ebae1..db696993737 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -1503,7 +1503,6 @@ 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);
@@ -1552,12 +1551,6 @@ 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 28645d856a8..5f7a5810c09 100644
--- a/intern/cycles/render/object.cpp
+++ b/intern/cycles/render/object.cpp
@@ -37,7 +37,6 @@ 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 34a0c0ff877..676f42be790 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -27,7 +27,6 @@
#include "util_foreach.h"
#include "util_function.h"
-#include "util_task.h"
#include "util_time.h"
CCL_NAMESPACE_BEGIN
@@ -38,8 +37,6 @@ 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);
@@ -91,8 +88,6 @@ 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 f6acc358959..ff477296c7e 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::empty;
+ BoundBox bbox;
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::empty;
+ BoundBox bbox;
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::empty;
+ BoundBox bbox;
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::empty;
+ BoundBox bbox;
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::empty;
+ BoundBox bbox;
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::empty;
+ BoundBox bbox;
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 87bd84b4e0f..9182ee4cbe1 100644
--- a/intern/cycles/util/CMakeLists.txt
+++ b/intern/cycles/util/CMakeLists.txt
@@ -15,7 +15,6 @@ set(SRC
util_path.cpp
util_string.cpp
util_system.cpp
- util_task.cpp
util_time.cpp
util_transform.cpp
)
@@ -51,7 +50,6 @@ 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 9511b48e103..bb1df0b220f 100644
--- a/intern/cycles/util/util_boundbox.h
+++ b/intern/cycles/util/util_boundbox.h
@@ -23,7 +23,6 @@
#include <float.h>
#include "util_math.h"
-#include "util_string.h"
#include "util_transform.h"
#include "util_types.h"
@@ -36,81 +35,45 @@ class BoundBox
public:
float3 min, max;
- __forceinline BoundBox()
+ BoundBox(void)
{
+ min = make_float3(FLT_MAX, FLT_MAX, FLT_MAX);
+ max = make_float3(-FLT_MAX, -FLT_MAX, -FLT_MAX);
}
- __forceinline BoundBox(const float3& pt)
- : min(pt), max(pt)
- {
- }
-
- __forceinline BoundBox(const float3& min_, const float3& max_)
+ BoundBox(const float3& min_, const float3& max_)
: min(min_), max(max_)
{
}
- 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)
+ void grow(const float3& pt)
{
min = ccl::min(min, pt);
max = ccl::max(max, pt);
}
- __forceinline void grow(const BoundBox& bbox)
+ void grow(const BoundBox& bbox)
{
grow(bbox.min);
grow(bbox.max);
}
- __forceinline void intersect(const BoundBox& bbox)
+ void intersect(const BoundBox& bbox)
{
min = ccl::max(min, bbox.min);
max = ccl::min(max, bbox.max);
}
- /* todo: avoid using this */
- __forceinline float safe_area() const
+ float area(void) const
{
- if(!((min.x <= max.x) && (min.y <= max.y) && (min.z <= max.z)))
+ if(!valid())
return 0.0f;
- return area();
- }
-
- __forceinline float area() const
- {
- return half_area()*2.0f;
- }
-
- __forceinline float half_area() const
- {
float3 d = max - min;
- return (d.x*d.z + d.y*d.z + d.x*d.y);
- }
-
- __forceinline float3 center() const
- {
- return 0.5f*(min + max);
+ return dot(d, d)*2.0f;
}
- __forceinline float3 center2() const
- {
- return min + max;
- }
-
- __forceinline float3 size() const
- {
- return max - min;
- }
-
- __forceinline bool valid() const
+ bool valid(void) const
{
return (min.x <= max.x) && (min.y <= max.y) && (min.z <= max.z) &&
(isfinite(min.x) && isfinite(min.y) && isfinite(min.z)) &&
@@ -119,7 +82,7 @@ public:
BoundBox transformed(const Transform *tfm)
{
- BoundBox result = BoundBox::empty;
+ BoundBox result;
for(int i = 0; i < 8; i++) {
float3 p;
@@ -135,31 +98,6 @@ 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 33e351c74e9..bffed7d7e5d 100644
--- a/intern/cycles/util/util_math.h
+++ b/intern/cycles/util/util_math.h
@@ -182,74 +182,93 @@ __device_inline float average(const float2 a)
__device_inline float2 operator-(const float2 a)
{
- return make_float2(-a.x, -a.y);
+ float2 r = {-a.x, -a.y};
+ return r;
}
__device_inline float2 operator*(const float2 a, const float2 b)
{
- return make_float2(a.x*b.x, a.y*b.y);
+ float2 r = {a.x*b.x, a.y*b.y};
+ return r;
}
__device_inline float2 operator*(const float2 a, float f)
{
- return make_float2(a.x*f, a.y*f);
+ float2 r = {a.x*f, a.y*f};
+ return r;
}
__device_inline float2 operator*(float f, const float2 a)
{
- return make_float2(a.x*f, a.y*f);
+ float2 r = {a.x*f, a.y*f};
+ return r;
}
__device_inline float2 operator/(float f, const float2 a)
{
- return make_float2(f/a.x, f/a.y);
+ float2 r = {f/a.x, f/a.y};
+ return r;
}
__device_inline float2 operator/(const float2 a, float f)
{
float invf = 1.0f/f;
- return make_float2(a.x*invf, a.y*invf);
+ float2 r = {a.x*invf, a.y*invf};
+ return r;
}
__device_inline float2 operator/(const float2 a, const float2 b)
{
- return make_float2(a.x/b.x, a.y/b.y);
+ float2 r = {a.x/b.x, a.y/b.y};
+ return r;
}
__device_inline float2 operator+(const float2 a, const float2 b)
{
- return make_float2(a.x+b.x, a.y+b.y);
+ float2 r = {a.x+b.x, a.y+b.y};
+ return r;
}
__device_inline float2 operator-(const float2 a, const float2 b)
{
- return make_float2(a.x-b.x, a.y-b.y);
+ float2 r = {a.x-b.x, a.y-b.y};
+ return r;
}
__device_inline float2 operator+=(float2& a, const float2 b)
{
- return a = a + b;
+ a.x += b.x;
+ a.y += b.y;
+ return a;
}
__device_inline float2 operator*=(float2& a, const float2 b)
{
- return a = a * b;
+ a.x *= b.x;
+ a.y *= b.y;
+ return a;
}
__device_inline float2 operator*=(float2& a, float f)
{
- return a = a * f;
+ a.x *= f;
+ a.y *= f;
+ return a;
}
__device_inline float2 operator/=(float2& a, const float2 b)
{
- return a = a / b;
+ a.x /= b.x;
+ a.y /= b.y;
+ return a;
}
__device_inline float2 operator/=(float2& a, float f)
{
float invf = 1.0f/f;
- return a = a * invf;
+ a.x *= invf;
+ a.y *= invf;
+ return a;
}
@@ -295,12 +314,14 @@ __device_inline bool operator!=(const float2 a, const float2 b)
__device_inline float2 min(float2 a, float2 b)
{
- return make_float2(min(a.x, b.x), min(a.y, b.y));
+ float2 r = {min(a.x, b.x), min(a.y, b.y)};
+ return r;
}
__device_inline float2 max(float2 a, float2 b)
{
- return make_float2(max(a.x, b.x), max(a.y, b.y));
+ float2 r = {max(a.x, b.x), max(a.y, b.y)};
+ return r;
}
__device_inline float2 clamp(float2 a, float2 mn, float2 mx)
@@ -340,78 +361,112 @@ __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)
{
- return make_float3(-a.x, -a.y, -a.z);
+ float3 r = make_float3(-a.x, -a.y, -a.z);
+ return r;
}
__device_inline float3 operator*(const float3 a, const float3 b)
{
- return make_float3(a.x*b.x, a.y*b.y, a.z*b.z);
+ float3 r = make_float3(a.x*b.x, a.y*b.y, a.z*b.z);
+ return r;
}
__device_inline float3 operator*(const float3 a, float f)
{
- return make_float3(a.x*f, a.y*f, a.z*f);
+ float3 r = make_float3(a.x*f, a.y*f, a.z*f);
+ return r;
}
__device_inline float3 operator*(float f, const float3 a)
{
- return make_float3(a.x*f, a.y*f, a.z*f);
+ float3 r = make_float3(a.x*f, a.y*f, a.z*f);
+ return r;
}
__device_inline float3 operator/(float f, const float3 a)
{
- return make_float3(f/a.x, f/a.y, f/a.z);
+ float3 r = make_float3(f/a.x, f/a.y, f/a.z);
+ return r;
}
__device_inline float3 operator/(const float3 a, float f)
{
float invf = 1.0f/f;
- return make_float3(a.x*invf, a.y*invf, a.z*invf);
+ float3 r = make_float3(a.x*invf, a.y*invf, a.z*invf);
+ return r;
}
__device_inline float3 operator/(const float3 a, const float3 b)
{
- return make_float3(a.x/b.x, a.y/b.y, a.z/b.z);
+ float3 r = make_float3(a.x/b.x, a.y/b.y, a.z/b.z);
+ return r;
}
__device_inline float3 operator+(const float3 a, const float3 b)
{
- return make_float3(a.x+b.x, a.y+b.y, a.z+b.z);
+ float3 r = make_float3(a.x+b.x, a.y+b.y, a.z+b.z);
+ return r;
}
__device_inline float3 operator-(const float3 a, const float3 b)
{
- return make_float3(a.x-b.x, a.y-b.y, a.z-b.z);
+ float3 r = make_float3(a.x-b.x, a.y-b.y, a.z-b.z);
+ return r;
}
__device_inline float3 operator+=(float3& a, const float3 b)
{
- return a = a + b;
+ a.x += b.x;
+ a.y += b.y;
+ a.z += b.z;
+ return a;
}
__device_inline float3 operator*=(float3& a, const float3 b)
{
- return a = a * b;
+ a.x *= b.x;
+ a.y *= b.y;
+ a.z *= b.z;
+ return a;
}
__device_inline float3 operator*=(float3& a, float f)
{
- return a = a * f;
+ a.x *= f;
+ a.y *= f;
+ a.z *= f;
+ return a;
}
__device_inline float3 operator/=(float3& a, const float3 b)
{
- return a = a / b;
+ a.x /= b.x;
+ a.y /= b.y;
+ a.z /= b.z;
+ return a;
}
__device_inline float3 operator/=(float3& a, float f)
{
float invf = 1.0f/f;
- return a = a * invf;
+ a.x *= invf;
+ a.y *= invf;
+ a.z *= invf;
+ return a;
}
__device_inline float dot(const float3 a, const float3 b)
@@ -432,6 +487,11 @@ __device_inline float len(const float3 a)
return sqrtf(dot(a, a));
}
+__device_inline float len_squared(const float3 a)
+{
+ return dot(a, a);
+}
+
#ifndef __KERNEL_OPENCL__
__device_inline float3 normalize(const float3 a)
@@ -451,11 +511,7 @@ __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)
@@ -465,20 +521,14 @@ __device_inline bool operator!=(const float3 a, const float3 b)
__device_inline float3 min(float3 a, float3 b)
{
-#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
+ float3 r = make_float3(min(a.x, b.x), min(a.y, b.y), min(a.z, b.z));
+ return r;
}
__device_inline float3 max(float3 a, float3 b)
{
-#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
+ float3 r = make_float3(max(a.x, b.x), max(a.y, b.y), max(a.z, b.z));
+ return r;
}
__device_inline float3 clamp(float3 a, float3 mn, float3 mx)
@@ -488,12 +538,7 @@ __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
@@ -515,16 +560,6 @@ __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)
@@ -532,257 +567,122 @@ __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 */
-#ifdef __KERNEL_SSE__
-
-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 _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(b), _MM_SHUFFLE(index_3, index_2, index_1, index_0)));
-}
-
-template<> __forceinline const float4 shuffle<0, 0, 2, 2>(const float4& b)
-{
- return _mm_moveldup_ps(b);
-}
+#ifndef __KERNEL_OPENCL__
-template<> __forceinline const float4 shuffle<1, 1, 3, 3>(const float4& b)
+__device_inline bool is_zero(const float4& a)
{
- return _mm_movehdup_ps(b);
+ return (a.x == 0.0f && a.y == 0.0f && a.z == 0.0f && a.w == 0.0f);
}
-template<> __forceinline const float4 shuffle<0, 1, 0, 1>(const float4& b)
+__device_inline float average(const float4& a)
{
- return _mm_castpd_ps(_mm_movedup_pd(_mm_castps_pd(b)));
+ return (a.x + a.y + a.z + a.w)*(1.0f/4.0f);
}
-#endif
-
-#ifndef __KERNEL_OPENCL__
-
__device_inline float4 operator-(const float4& a)
{
-#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
+ float4 r = {-a.x, -a.y, -a.z, -a.w};
+ return r;
}
__device_inline float4 operator*(const float4& a, const float4& b)
{
-#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
+ float4 r = {a.x*b.x, a.y*b.y, a.z*b.z, a.w*b.w};
+ return r;
}
__device_inline float4 operator*(const float4& a, float f)
{
-#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
+ float4 r = {a.x*f, a.y*f, a.z*f, a.w*f};
+ return r;
}
__device_inline float4 operator*(float f, const float4& a)
{
- 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
+ float4 r = {a.x*f, a.y*f, a.z*f, a.w*f};
+ return r;
}
__device_inline float4 operator/(const float4& a, float f)
{
- return a * (1.0f/f);
+ float invf = 1.0f/f;
+ float4 r = {a.x*invf, a.y*invf, a.z*invf, a.w*invf};
+ return r;
}
__device_inline float4 operator/(const float4& a, const float4& b)
{
-#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
-
+ float4 r = {a.x/b.x, a.y/b.y, a.z/b.z, a.w/b.w};
+ return r;
}
__device_inline float4 operator+(const float4& a, const float4& b)
{
-#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
+ float4 r = {a.x+b.x, a.y+b.y, a.z+b.z, a.w+b.w};
+ return r;
}
__device_inline float4 operator-(const float4& a, const float4& b)
{
-#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
+ float4 r = {a.x-b.x, a.y-b.y, a.z-b.z, a.w-b.w};
+ return r;
}
__device_inline float4 operator+=(float4& a, const float4& b)
{
- return a = a + b;
+ a.x += b.x;
+ a.y += b.y;
+ a.z += b.z;
+ a.w += b.w;
+ return a;
}
__device_inline float4 operator*=(float4& a, const float4& b)
{
- return a = a * b;
+ a.x *= b.x;
+ a.y *= b.y;
+ a.z *= b.z;
+ a.w *= b.w;
+ return a;
}
__device_inline float4 operator/=(float4& a, float f)
{
- return a = a / f;
-}
-
-__device_inline int4 operator<(const float4& a, const float4& b)
-{
-#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
+ float invf = 1.0f/f;
+ a.x *= invf;
+ a.y *= invf;
+ a.z *= invf;
+ a.w *= invf;
+ return a;
}
-__device_inline bool operator==(const float4 a, const float4 b)
+__device_inline float dot(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
+ return a.x*b.x + a.y*b.y + a.z*b.z + a.w*b.w;
}
__device_inline float4 cross(const float4& a, const float4& b)
{
-#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
+ 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;
}
__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);
@@ -790,77 +690,26 @@ __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)
{
-#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
+ int3 r = {max(a.x, b.x), max(a.y, b.y), max(a.z, b.z)};
+ return r;
}
__device_inline int3 clamp(const int3& a, int mn, int mx)
{
-#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
+ int3 r = {clamp(a.x, mn, mx), clamp(a.y, mn, mx), clamp(a.z, mn, mx)};
+ return r;
}
__device_inline int3 clamp(const int3& a, int3& mn, int mx)
{
-#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
+ int3 r = {clamp(a.x, mn.x, mx), clamp(a.y, mn.y, mx), clamp(a.z, mn.z, mx)};
+ return r;
}
#endif
@@ -876,63 +725,16 @@ __device_inline void print_int3(const char *label, const int3& a)
/* Int4 */
-#ifndef __KERNEL_GPU__
-
-__device_inline int4 operator+(const int4& a, const int4& b)
-{
-#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_OPENCL__
-__device_inline int4 min(int4 a, int4 b)
+__device_inline int4 operator>=(float4 a, float4 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
+ return make_int4(a.x >= b.x, a.y >= b.y, a.z >= b.z, a.w >= b.w);
}
-__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
-}
+#ifndef __KERNEL_GPU__
__device_inline void print_int4(const char *label, const int4& a)
{
diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp
deleted file mode 100644
index 6da9a70ec0c..00000000000
--- a/intern/cycles/util/util_task.cpp
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * 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.
- */
-
-#include "util_debug.h"
-#include "util_foreach.h"
-#include "util_system.h"
-#include "util_task.h"
-
-CCL_NAMESPACE_BEGIN
-
-/* Task Pool */
-
-TaskPool::TaskPool(const TaskRunFunction& run_)
-{
- num = 0;
- num_done = 0;
-
- do_cancel = false;
-
- run = run_;
-}
-
-TaskPool::~TaskPool()
-{
- stop();
-}
-
-void TaskPool::push(Task *task, bool front)
-{
- TaskScheduler::Entry entry;
-
- entry.task = task;
- entry.pool = this;
-
- TaskScheduler::push(entry, front);
-}
-
-void TaskPool::wait()
-{
- thread_scoped_lock lock(done_mutex);
-
- while(num_done != num)
- done_cond.wait(lock);
-}
-
-void TaskPool::cancel()
-{
- TaskScheduler::clear(this);
-
- do_cancel = true;
- wait();
- do_cancel = false;
-}
-
-void TaskPool::stop()
-{
- TaskScheduler::clear(this);
-
- assert(num_done == num);
-}
-
-bool TaskPool::cancelled()
-{
- return do_cancel;
-}
-
-void TaskPool::done_increase(int done)
-{
- done_mutex.lock();
- num_done += done;
- done_mutex.unlock();
-
- assert(num_done <= num);
- done_cond.notify_all();
-}
-
-/* Task Scheduler */
-
-thread_mutex TaskScheduler::mutex;
-int TaskScheduler::users = 0;
-vector<thread*> TaskScheduler::threads;
-volatile bool TaskScheduler::do_exit = false;
-
-list<TaskScheduler::Entry> TaskScheduler::queue;
-thread_mutex TaskScheduler::queue_mutex;
-thread_condition_variable TaskScheduler::queue_cond;
-
-void TaskScheduler::init(int num_threads)
-{
- thread_scoped_lock lock(mutex);
-
- /* multiple cycles instances can use this task scheduler, sharing the same
- threads, so we keep track of the number of users. */
- if(users == 0) {
- do_exit = false;
-
- /* launch threads that will be waiting for work */
- if(num_threads == 0)
- num_threads = system_cpu_thread_count();
-
- threads.resize(num_threads);
-
- for(size_t i = 0; i < threads.size(); i++)
- threads[i] = new thread(function_bind(&TaskScheduler::thread_run, i));
- }
-
- users++;
-}
-
-void TaskScheduler::exit()
-{
- thread_scoped_lock lock(mutex);
-
- users--;
-
- if(users == 0) {
- /* stop all waiting threads */
- do_exit = true;
- TaskScheduler::queue_cond.notify_all();
-
- /* delete threads */
- foreach(thread *t, threads) {
- t->join();
- delete t;
- }
-
- threads.clear();
- }
-}
-
-bool TaskScheduler::thread_wait_pop(Entry& entry)
-{
- thread_scoped_lock lock(queue_mutex);
-
- while(queue.empty() && !do_exit)
- queue_cond.wait(lock);
-
- if(queue.empty()) {
- assert(do_exit);
- return false;
- }
-
- entry = queue.front();
- queue.pop_front();
-
- return true;
-}
-
-void TaskScheduler::thread_run(int thread_id)
-{
- Entry entry;
-
- /* todo: test affinity/denormal mask */
-
- /* keep popping off tasks */
- while(thread_wait_pop(entry)) {
- /* run task */
- entry.pool->run(entry.task, thread_id);
-
- /* delete task */
- delete entry.task;
-
- /* notify pool task was done */
- entry.pool->done_increase(1);
- }
-}
-
-void TaskScheduler::push(Entry& entry, bool front)
-{
- /* add entry to queue */
- TaskScheduler::queue_mutex.lock();
- if(front)
- TaskScheduler::queue.push_front(entry);
- else
- TaskScheduler::queue.push_back(entry);
- entry.pool->num++;
- TaskScheduler::queue_mutex.unlock();
-
- TaskScheduler::queue_cond.notify_one();
-}
-
-void TaskScheduler::clear(TaskPool *pool)
-{
- thread_scoped_lock lock(TaskScheduler::queue_mutex);
-
- /* erase all tasks from this pool from the queue */
- list<TaskScheduler::Entry>::iterator it = TaskScheduler::queue.begin();
- int done = 0;
-
- while(it != TaskScheduler::queue.end()) {
- TaskScheduler::Entry& entry = *it;
-
- if(entry.pool == pool) {
- done++;
- delete entry.task;
-
- it = TaskScheduler::queue.erase(it);
- }
- else
- it++;
- }
-
- /* notify done */
- pool->done_increase(done);
-}
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/util/util_task.h b/intern/cycles/util/util_task.h
deleted file mode 100644
index acdb2cb50a2..00000000000
--- a/intern/cycles/util/util_task.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * 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.
- */
-
-#ifndef __UTIL_TASK_H__
-#define __UTIL_TASK_H__
-
-#include "util_list.h"
-#include "util_thread.h"
-#include "util_vector.h"
-
-CCL_NAMESPACE_BEGIN
-
-class Task;
-class TaskPool;
-class TaskScheduler;
-
-typedef boost::function<void(Task*,int)> TaskRunFunction;
-
-/* Task
- *
- * Base class for tasks to be executed in threads. */
-
-class Task
-{
-public:
- Task() {};
- virtual ~Task() {}
-};
-
-/* Task Pool
- *
- * Pool of tasks that will be executed by the central TaskScheduler.For each
- * pool, we can wait for all tasks to be done, or cancel them before they are
- * done.
- *
- * The run callback that actually executes the task may be create like this:
- * function_bind(&MyClass::task_execute, this, _1, _2) */
-
-class TaskPool
-{
-public:
- TaskPool(const TaskRunFunction& run);
- ~TaskPool();
-
- void push(Task *task, bool front = false);
-
- void wait(); /* wait until all tasks are done */
- void cancel(); /* cancel all tasks, keep worker threads running */
- void stop(); /* stop all worker threads */
-
- bool cancelled(); /* for worker threads, test if cancelled */
-
-protected:
- friend class TaskScheduler;
-
- void done_increase(int done);
-
- TaskRunFunction run;
-
- thread_mutex done_mutex;
- thread_condition_variable done_cond;
-
- volatile int num, num_done;
- volatile bool do_cancel;
-};
-
-/* Task Scheduler
- *
- * Central scheduler that holds running threads ready to execute tasks. A singe
- * queue holds the task from all pools. */
-
-class TaskScheduler
-{
-public:
- static void init(int num_threads = 0);
- static void exit();
-
- static int num_threads() { return threads.size(); }
-
-protected:
- friend class TaskPool;
-
- struct Entry {
- Task *task;
- TaskPool *pool;
- };
-
- static thread_mutex mutex;
- static int users;
- static vector<thread*> threads;
- static volatile bool do_exit;
-
- static list<Entry> queue;
- static thread_mutex queue_mutex;
- static thread_condition_variable queue_cond;
-
- static void thread_run(int thread_id);
- static bool thread_wait_pop(Entry& entry);
-
- static void push(Entry& entry, bool front);
- static void clear(TaskPool *pool);
-};
-
-CCL_NAMESPACE_END
-
-#endif
-
diff --git a/intern/cycles/util/util_thread.h b/intern/cycles/util/util_thread.h
index 3d15b342fe5..6836be203f5 100644
--- a/intern/cycles/util/util_thread.h
+++ b/intern/cycles/util/util_thread.h
@@ -69,6 +69,133 @@ 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 0fd26825911..61bc36ae888 100644
--- a/intern/cycles/util/util_transform.cpp
+++ b/intern/cycles/util/util_transform.cpp
@@ -129,26 +129,23 @@ static bool transform_matrix4_gj_inverse(float R[][4], float M[][4])
Transform transform_inverse(const Transform& tfm)
{
- Transform tfmR = transform_identity();
- float M[4][4], R[4][4];
+ union { Transform T; float M[4][4]; } R, M;
+
+ R.T = transform_identity();
+ M.T = tfm;
- memcpy(R, &tfmR, sizeof(R));
- memcpy(M, &tfm, sizeof(M));
-
- if(!transform_matrix4_gj_inverse(R, M)) {
+ if(!transform_matrix4_gj_inverse(R.M, M.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[0][0] += 1e-8f;
- M[1][1] += 1e-8f;
- M[2][2] += 1e-8f;
+ M.M[0][0] += 1e-8f;
+ M.M[1][1] += 1e-8f;
+ M.M[2][2] += 1e-8f;
- if(!transform_matrix4_gj_inverse(R, M))
+ if(!transform_matrix4_gj_inverse(R.M, M.M))
return transform_identity();
}
- memcpy(&tfmR, R, sizeof(R));
-
- return tfmR;
+ return R.T;
}
CCL_NAMESPACE_END
diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h
index aeaef7b0e21..a036277aef0 100644
--- a/intern/cycles/util/util_transform.h
+++ b/intern/cycles/util/util_transform.h
@@ -233,12 +233,12 @@ __device_inline bool transform_uniform_scale(const Transform& tfm, float& scale)
Transform ttfm = transform_transpose(tfm);
float eps = 1e-7f;
- float sx = len(float4_to_float3(tfm.x));
- float sy = len(float4_to_float3(tfm.y));
- float sz = len(float4_to_float3(tfm.z));
- float stx = len(float4_to_float3(ttfm.x));
- float sty = len(float4_to_float3(ttfm.y));
- float stz = len(float4_to_float3(ttfm.z));
+ float sx = len_squared(float4_to_float3(tfm.x));
+ float sy = len_squared(float4_to_float3(tfm.y));
+ float sz = len_squared(float4_to_float3(tfm.z));
+ float stx = len_squared(float4_to_float3(ttfm.x));
+ float sty = len_squared(float4_to_float3(ttfm.y));
+ float stz = len_squared(float4_to_float3(ttfm.z));
if(fabsf(sx - sy) < eps && fabsf(sx - sz) < eps &&
fabsf(sx - stx) < eps && fabsf(sx - sty) < eps &&
diff --git a/intern/cycles/util/util_types.h b/intern/cycles/util/util_types.h
index cf167707e47..efdda98571a 100644
--- a/intern/cycles/util/util_types.h
+++ b/intern/cycles/util/util_types.h
@@ -36,37 +36,23 @@
#define __shared
#define __constant
-#ifdef _WIN32
-#define __device_inline static __forceinline
-#define __align(...) __declspec(align(__VA_ARGS__))
-#else
+#ifdef __GNUC__
#define __device_inline static inline __attribute__((always_inline))
-#define __forceinline inline __attribute__((always_inline))
-#define __align(...) __attribute__((aligned(__VA_ARGS__)))
-#endif
-
+#else
+#define __device_inline static __forceinline
#endif
-/* Bitness */
-
-#if defined(__ppc64__) || defined(__PPC64__) || defined(__x86_64__) || defined(__ia64__) || defined(_M_X64)
-#define __KERNEL_64_BIT__
#endif
/* SIMD Types */
-/* not enabled, globally applying it just gives slowdown,
- * but useful for testing. */
-//#define __KERNEL_SSE__
-#ifdef __KERNEL_SSE__
+/* not needed yet, will be for qbvh
+#ifndef __KERNEL_GPU__
-#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 */
+#include <emmintrin.h>
+#include <xmmintrin.h>
-#endif
+#endif*/
#ifndef _WIN32
#ifndef __KERNEL_GPU__
@@ -111,12 +97,6 @@ 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 */
@@ -128,137 +108,89 @@ typedef uint64_t device_ptr;
struct uchar2 {
uchar x, y;
- __forceinline uchar operator[](int i) const { return *(&x + i); }
- __forceinline uchar& operator[](int i) { return *(&x + i); }
+ uchar operator[](int i) const { return *(&x + i); }
+ uchar& operator[](int i) { return *(&x + i); }
};
struct uchar3 {
uchar x, y, z;
- __forceinline uchar operator[](int i) const { return *(&x + i); }
- __forceinline uchar& operator[](int i) { return *(&x + i); }
+ uchar operator[](int i) const { return *(&x + i); }
+ uchar& operator[](int i) { return *(&x + i); }
};
struct uchar4 {
uchar x, y, z, w;
- __forceinline uchar operator[](int i) const { return *(&x + i); }
- __forceinline uchar& operator[](int i) { return *(&x + i); }
+ uchar operator[](int i) const { return *(&x + i); }
+ uchar& operator[](int i) { return *(&x + i); }
};
struct int2 {
int x, y;
- __forceinline int operator[](int i) const { return *(&x + i); }
- __forceinline int& operator[](int i) { return *(&x + i); }
+ int operator[](int i) const { return *(&x + i); }
+ 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, w;
-#endif
+ int x, y, z;
- __forceinline int operator[](int i) const { return *(&x + i); }
- __forceinline int& operator[](int i) { return *(&x + i); }
+ int operator[](int i) const { return *(&x + i); }
+ 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
- __forceinline int operator[](int i) const { return *(&x + i); }
- __forceinline int& operator[](int i) { return *(&x + i); }
+ int operator[](int i) const { return *(&x + i); }
+ int& operator[](int i) { return *(&x + i); }
};
struct uint2 {
uint x, y;
- __forceinline uint operator[](uint i) const { return *(&x + i); }
- __forceinline uint& operator[](uint i) { return *(&x + i); }
+ uint operator[](int i) const { return *(&x + i); }
+ uint& operator[](int i) { return *(&x + i); }
};
struct uint3 {
uint x, y, z;
- __forceinline uint operator[](uint i) const { return *(&x + i); }
- __forceinline uint& operator[](uint i) { return *(&x + i); }
+ uint operator[](int i) const { return *(&x + i); }
+ uint& operator[](int i) { return *(&x + i); }
};
struct uint4 {
uint x, y, z, w;
- __forceinline uint operator[](uint i) const { return *(&x + i); }
- __forceinline uint& operator[](uint i) { return *(&x + i); }
+ uint operator[](int i) const { return *(&x + i); }
+ uint& operator[](int i) { return *(&x + i); }
};
struct float2 {
float x, y;
- __forceinline float operator[](int i) const { return *(&x + i); }
- __forceinline float& operator[](int i) { return *(&x + i); }
+ float operator[](int i) const { return *(&x + i); }
+ 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, w;
+ float x, y, z;
+
+#ifdef WITH_OPENCL
+ float w;
#endif
- __forceinline float operator[](int i) const { return *(&x + i); }
- __forceinline float& operator[](int i) { return *(&x + i); }
+ float operator[](int i) const { return *(&x + i); }
+ 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
- __forceinline float operator[](int i) const { return *(&x + i); }
- __forceinline float& operator[](int i) { return *(&x + i); }
+ float operator[](int i) const { return *(&x + i); }
+ float& operator[](int i) { return *(&x + i); }
};
#endif
@@ -269,179 +201,87 @@ struct float4 {
*
* OpenCL does not support C++ class, so we use these instead. */
-__device_inline uchar2 make_uchar2(uchar x, uchar y)
+__device uchar2 make_uchar2(uchar x, uchar y)
{
uchar2 a = {x, y};
return a;
}
-__device_inline uchar3 make_uchar3(uchar x, uchar y, uchar z)
+__device uchar3 make_uchar3(uchar x, uchar y, uchar z)
{
uchar3 a = {x, y, z};
return a;
}
-__device_inline uchar4 make_uchar4(uchar x, uchar y, uchar z, uchar w)
+__device uchar4 make_uchar4(uchar x, uchar y, uchar z, uchar w)
{
uchar4 a = {x, y, z, w};
return a;
}
-__device_inline int2 make_int2(int x, int y)
+__device int2 make_int2(int x, int y)
{
int2 a = {x, y};
return a;
}
-__device_inline int3 make_int3(int x, int y, int z)
+__device int3 make_int3(int x, int y, int z)
{
-#ifdef __KERNEL_SSE__
- int3 a;
- a.m128 = _mm_set_epi32(0, z, y, x);
-#else
- int3 a = {x, y, z, 0};
-#endif
-
+ int3 a = {x, y, z};
return a;
}
-__device_inline int4 make_int4(int x, int y, int z, int w)
+__device 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_inline uint2 make_uint2(uint x, uint y)
+__device uint2 make_uint2(uint x, uint y)
{
uint2 a = {x, y};
return a;
}
-__device_inline uint3 make_uint3(uint x, uint y, uint z)
+__device uint3 make_uint3(uint x, uint y, uint z)
{
uint3 a = {x, y, z};
return a;
}
-__device_inline uint4 make_uint4(uint x, uint y, uint z, uint w)
+__device uint4 make_uint4(uint x, uint y, uint z, uint w)
{
uint4 a = {x, y, z, w};
return a;
}
-__device_inline float2 make_float2(float x, float y)
+__device float2 make_float2(float x, float y)
{
float2 a = {x, y};
return a;
}
-__device_inline float3 make_float3(float x, float y, float z)
+__device float3 make_float3(float x, float y, float z)
{
-#ifdef __KERNEL_SSE__
- float3 a;
- a.m128 = _mm_set_ps(0.0f, z, y, x);
-#else
+#ifdef WITH_OPENCL
float3 a = {x, y, z, 0.0f};
+#else
+ float3 a = {x, y, z};
#endif
-
return a;
}
-__device_inline float4 make_float4(float x, float y, float z, float w)
+__device 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_inline int align_up(int offset, int alignment)
+__device 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/dualcon/intern/Projections.h b/intern/dualcon/intern/Projections.h
index 18533b218ff..1477dd9dccf 100644
--- a/intern/dualcon/intern/Projections.h
+++ b/intern/dualcon/intern/Projections.h
@@ -788,17 +788,17 @@ public:
LONG proj0 = cubeProj[i][0] ;
LONG proj1 = cubeProj[i][0] + cubeProj[i][edgeInd + 1] ;
LONG proj2 = inherit->trigProj[i][1] ;
+ LONG d = proj1 - proj0;
+ double alpha;
- // double alpha = (double)( ( proj2 - proj0 ) * cubeProj[edgeInd][edgeInd + 1] ) / (double)( proj1 - proj0 ) ;
- double alpha = (double)( ( proj2 - proj0 ) ) / (double)( proj1 - proj0 ) ;
-
- if ( alpha < 0 )
- {
- alpha = 0.5 ;
+ if (d == 0) {
+ alpha = 0.5;
}
- else if ( alpha > 1 )
- {
- alpha = 0.5 ;
+ else {
+ alpha = (double)((proj2 - proj0)) / (double)d;
+
+ if (alpha < 0 || alpha > 1)
+ alpha = 0.5;
}
diff --git a/intern/ghost/GHOST_Rect.h b/intern/ghost/GHOST_Rect.h
index 30d9d16b701..bcbcaded364 100644
--- a/intern/ghost/GHOST_Rect.h
+++ b/intern/ghost/GHOST_Rect.h
@@ -241,10 +241,8 @@ 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_NDOFManagerX11.cpp b/intern/ghost/intern/GHOST_NDOFManagerX11.cpp
index 1e78cafd4f6..565324ae211 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerX11.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManagerX11.cpp
@@ -37,6 +37,8 @@ GHOST_NDOFManagerX11::GHOST_NDOFManagerX11(GHOST_System& sys)
setDeadZone(0.1f); /* how to calibrate on Linux? throw away slight motion! */
if (spnav_open() != -1) {
+ m_available = true;
+
/* determine exactly which device (if any) is plugged in */
#define MAX_LINE_LENGTH 100
@@ -49,7 +51,6 @@ GHOST_NDOFManagerX11::GHOST_NDOFManagerX11(GHOST_System& sys)
unsigned short vendor_id = 0, product_id = 0;
if (sscanf(line, "Bus %*d Device %*d: ID %hx:%hx", &vendor_id, &product_id) == 2)
if (setDevice(vendor_id, product_id)) {
- m_available = true;
break; /* stop looking once the first 3D mouse is found */
}
}
diff --git a/intern/guardedalloc/cpp/mallocn.cpp b/intern/guardedalloc/cpp/mallocn.cpp
index 97e68d06ace..130fcb6960b 100644
--- a/intern/guardedalloc/cpp/mallocn.cpp
+++ b/intern/guardedalloc/cpp/mallocn.cpp
@@ -41,5 +41,7 @@ void* operator new (size_t size, const char *str)
void operator delete (void *p)
{
- MEM_freeN(p);
+ /* delete NULL is valid in c++ */
+ if(p)
+ MEM_freeN(p);
}
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index bb3a1c66ddc..2a6a0df0ff4 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 24c77c439a7..2036e601bcb 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 a0eb1bf38e0..9d5dfd98823 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, float dtdef);
+struct FLUID_3D *smoke_init(int *res, float *p0);
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, float dtSubdiv);
+void smoke_step(struct FLUID_3D *fluid, size_t framenr, float fps);
float *smoke_get_density(struct FLUID_3D *fluid);
float *smoke_get_heat(struct FLUID_3D *fluid);
@@ -53,9 +53,6 @@ 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 04971f898e9..9f036cc6d2f 100644
--- a/intern/smoke/intern/FLUID_3D.cpp
+++ b/intern/smoke/intern/FLUID_3D.cpp
@@ -34,8 +34,6 @@
#include "SPHERE.h"
#include <zlib.h>
-#include "float.h"
-
#if PARALLEL==1
#include <omp.h>
#endif // PARALLEL
@@ -44,11 +42,11 @@
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
-FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
+FLUID_3D::FLUID_3D(int *res, float *p0) :
_xRes(res[0]), _yRes(res[1]), _zRes(res[2]), _res(0.0f)
{
// set simulation consts
- _dt = dtdef; // just in case. set in step from a RNA factor
+ _dt = DT_DEFAULT; // just in case. set in step from a RNA factor
// start point of array
_p0[0] = p0[0];
@@ -83,9 +81,6 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
_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];
@@ -116,9 +111,6 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
_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;
@@ -139,15 +131,9 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
_colloPrev = 1; // default value
- setBorderObstacles(); // walls
-
-}
-void FLUID_3D::setBorderObstacles()
-{
-
// set side obstacles
- unsigned int index;
+ int index;
for (int y = 0; y < _yRes; y++)
for (int x = 0; x < _xRes; x++)
{
@@ -183,6 +169,7 @@ void FLUID_3D::setBorderObstacles()
index += _xRes - 1;
if(_domainBcRight==1) _obstacles[index] = 1;
}
+
}
FLUID_3D::~FLUID_3D()
@@ -190,9 +177,6 @@ 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;
@@ -230,18 +214,10 @@ 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
@@ -810,7 +786,6 @@ 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
@@ -823,49 +798,12 @@ 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];
@@ -873,82 +811,26 @@ void FLUID_3D::project()
float ztop = _zVelocity[index + _slabSize];
float zbottom = _zVelocity[index - _slabSize];
- if(_obstacles[index+1]) xright = - _xVelocity[index]; // DG: +=
+ if(_obstacles[index+1]) xright = - _xVelocity[index];
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 );
- // Pressure is zero anyway since now a local array is used
- _pressure[index] = 0.0f;
+ // DG: commenting this helps CG to get a better start, 10-20% speed improvement
+ // _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
@@ -966,74 +848,12 @@ 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
@@ -1072,7 +892,7 @@ void FLUID_3D::addObstacle(OBSTACLE* obstacle)
void FLUID_3D::setObstaclePressure(float *_pressure, int zBegin, int zEnd)
{
- // completely TODO <-- who wrote this and what is here TODO? DG
+ // compleately TODO
const size_t index_ = _slabSize + _xRes + 1;
@@ -1094,7 +914,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] /* && !(_obstacles[index] & 8) DG TODO TEST THIS CONDITION */)
+ if (_obstacles[index])
{
const int top = _obstacles[index + _slabSize];
const int bottom= _obstacles[index - _slabSize];
@@ -1108,11 +928,9 @@ 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
@@ -1435,35 +1253,7 @@ 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 5704cba3ed4..c9e18926fb2 100644
--- a/intern/smoke/intern/FLUID_3D.h
+++ b/intern/smoke/intern/FLUID_3D.h
@@ -39,6 +39,9 @@
// #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;
@@ -46,7 +49,7 @@ class WTURBULENCE;
class FLUID_3D
{
public:
- FLUID_3D(int *res, /* int amplify, */ float *p0, float dtdef);
+ FLUID_3D(int *res, /* int amplify, */ float *p0);
FLUID_3D() {};
virtual ~FLUID_3D();
@@ -69,7 +72,7 @@ class FLUID_3D
int yRes() const { return _yRes; };
int zRes() const { return _zRes; };
- public:
+ public:
// dimensions
int _xRes, _yRes, _zRes, _maxRes;
Vec3Int _res;
@@ -86,8 +89,6 @@ class FLUID_3D
void artificialDampingSL(int zBegin, int zEnd);
void artificialDampingExactSL(int pos);
- void setBorderObstacles();
-
// fields
float* _density;
float* _densityOld;
@@ -96,17 +97,13 @@ 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; /* only used (usefull) for static obstacles like domain boundaries */
- unsigned char* _obstaclesAnim;
+ unsigned char* _obstacles;
// Required for proper threading:
float* _xVelocityTemp;
@@ -140,8 +137,6 @@ 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 da8ec6be024..61d47b727f0 100644
--- a/intern/smoke/intern/OBSTACLE.h
+++ b/intern/smoke/intern/OBSTACLE.h
@@ -27,11 +27,9 @@
#define OBSTACLE_H
enum OBSTACLE_FLAGS {
- EMPTY = 0,
- /* 1 is used to flag an object cell */
+ EMPTY = 0,
MARCHED = 2,
- RETIRED = 4,
- ANIMATED = 8,
+ RETIRED = 4
};
class OBSTACLE
diff --git a/intern/smoke/intern/WTURBULENCE.cpp b/intern/smoke/intern/WTURBULENCE.cpp
index 83bec466c9f..cd18cf7b344 100644
--- a/intern/smoke/intern/WTURBULENCE.cpp
+++ b/intern/smoke/intern/WTURBULENCE.cpp
@@ -431,11 +431,8 @@ 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 *origObstacles)
+void WTURBULENCE::computeEnergy(float *_energy, float* xvel, float* yvel, float* zvel, unsigned char *obstacles)
{
- 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]);
@@ -509,9 +506,7 @@ 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; // DG TODO ? animated obstacle flag?
-
- free(obstacles);
+ obstacles[index] = 1;
}
//////////////////////////////////////////////////////////////////////////////////////////
diff --git a/intern/smoke/intern/smoke_API.cpp b/intern/smoke/intern/smoke_API.cpp
index 78f7d35360a..a2f3c21bbbf 100644
--- a/intern/smoke/intern/smoke_API.cpp
+++ b/intern/smoke/intern/smoke_API.cpp
@@ -19,7 +19,6 @@
* All rights reserved.
*
* Contributor(s): Daniel Genrich
- * Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -37,10 +36,10 @@
#include <math.h>
// y in smoke is z in blender
-extern "C" FLUID_3D *smoke_init(int *res, float *p0, float dtdef)
+extern "C" FLUID_3D *smoke_init(int *res, float *p0)
{
// smoke lib uses y as top-bottom/vertical axis where blender uses z
- FLUID_3D *fluid = new FLUID_3D(res, p0, dtdef);
+ FLUID_3D *fluid = new FLUID_3D(res, p0);
// printf("xres: %d, yres: %d, zres: %d\n", res[0], res[1], res[2]);
@@ -79,9 +78,41 @@ 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, float dtSubdiv)
+extern "C" void smoke_step(FLUID_3D *fluid, size_t framenr, float fps)
{
- fluid->step(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);
}
extern "C" void smoke_turbulence_step(WTURBULENCE *wt, FLUID_3D *fluid)
@@ -276,18 +307,6 @@ 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 68d1d6bb403..2e200ea3ad3 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 b59d7fbd005..e95c243b558 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 8561d11dc3b..fc20f5769ef 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 11e1ed8f8af..151f64b6dab 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 695bb8cb6b6..588c10eea54 100644
--- a/release/scripts/modules/addon_utils.py
+++ b/release/scripts/modules/addon_utils.py
@@ -212,13 +212,10 @@ 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, persistent=False):
+def enable(module_name, default_set=True):
"""
Enables an addon by name.
@@ -286,7 +283,6 @@ def enable(module_name, default_set=True, persistent=False):
ext.module = module_name
mod.__addon_enabled__ = True
- mod.__addon_persistent__ = persistent
if _bpy.app.debug_python:
print("\taddon_utils.enable", mod.__name__)
@@ -309,7 +305,6 @@ 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/presets/tracking_settings/blurry_movie.py b/release/scripts/presets/tracking_settings/blurry_movie.py
new file mode 100644
index 00000000000..8a503bec9bd
--- /dev/null
+++ b/release/scripts/presets/tracking_settings/blurry_movie.py
@@ -0,0 +1,11 @@
+import bpy
+settings = bpy.context.edit_movieclip.tracking.settings
+
+settings.default_tracker = 'KLT'
+settings.default_pyramid_levels = 4
+settings.default_correlation_min = 0.75
+settings.default_pattern_size = 11
+settings.default_search_size = 202
+settings.default_frames_limit = 25
+settings.default_pattern_match = 'KEYFRAME'
+settings.default_margin = 0
diff --git a/release/scripts/startup/bl_operators/image.py b/release/scripts/startup/bl_operators/image.py
index 1b7d5e3a40d..6af6488e86b 100644
--- a/release/scripts/startup/bl_operators/image.py
+++ b/release/scripts/startup/bl_operators/image.py
@@ -118,16 +118,24 @@ class SaveDirty(Operator):
unique_paths = set()
for image in bpy.data.images:
if image.is_dirty:
- filepath = bpy.path.abspath(image.filepath)
- if "\\" not in filepath and "/" not in filepath:
- self.report({'WARNING'}, "Invalid path: " + filepath)
- elif filepath in unique_paths:
- self.report({'WARNING'},
- "Path used by more then one image: %r" %
- filepath)
+ if image.packed_file:
+ if image.library:
+ self.report({'WARNING'},
+ "Packed library image: %r from library %r can't be re-packed" %
+ (image.name, image.library.filepath))
+ else:
+ image.pack(as_png=True)
else:
- unique_paths.add(filepath)
- image.save()
+ filepath = bpy.path.abspath(image.filepath, library=image.library)
+ if "\\" not in filepath and "/" not in filepath:
+ self.report({'WARNING'}, "Invalid path: " + filepath)
+ elif filepath in unique_paths:
+ self.report({'WARNING'},
+ "Path used by more then one image: %r" %
+ filepath)
+ else:
+ unique_paths.add(filepath)
+ image.save()
return {'FINISHED'}
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_animviz.py b/release/scripts/startup/bl_ui/properties_animviz.py
index 93feb8adc7a..3f25006766e 100644
--- a/release/scripts/startup/bl_ui/properties_animviz.py
+++ b/release/scripts/startup/bl_ui/properties_animviz.py
@@ -31,16 +31,18 @@ class MotionPathButtonsPanel():
bl_label = "Motion Paths"
bl_options = {'DEFAULT_CLOSED'}
- def draw_settings(self, context, avs, bones=False):
+ def draw_settings(self, context, avs, mpath, bones=False):
layout = self.layout
mps = avs.motion_path
-
+
+ # Display Range
layout.prop(mps, "type", expand=True)
split = layout.split()
col = split.column()
+ col.label(text="Display Range:")
sub = col.column(align=True)
if (mps.type == 'CURRENT_FRAME'):
sub.prop(mps, "frame_before", text="Before")
@@ -48,18 +50,46 @@ class MotionPathButtonsPanel():
elif (mps.type == 'RANGE'):
sub.prop(mps, "frame_start", text="Start")
sub.prop(mps, "frame_end", text="End")
-
+
sub.prop(mps, "frame_step", text="Step")
+
+ col = split.column()
if bones:
- col.row().prop(mps, "bake_location", expand=True)
-
+ col.label(text="Cache for Bone:")
+ else:
+ col.label(text="Cache:")
+
+ if mpath:
+ sub = col.column(align=True)
+ sub.enabled = False
+ sub.prop(mpath, "frame_start", text="From")
+ sub.prop(mpath, "frame_end", text="To")
+
+ sub = col.column() # align=True
+ sub.operator_context = 'EXEC_DEFAULT'
+ if bones:
+ col.operator("pose.paths_calculate", text="Update", icon='BONE_DATA')
+ else:
+ col.operator("object.paths_calculate", text="Update", icon='OBJECT_DATA')
+ else:
+ col.label(text="Not available yet...", icon='ERROR')
+ col.label(text="Calculate Paths first", icon='INFO')
+
+
+ # Display Settings
+ split = layout.split()
+
col = split.column()
- col.label(text="Display:")
+ col.label(text="Show:")
col.prop(mps, "show_frame_numbers", text="Frame Numbers")
+
+ col = split.column()
col.prop(mps, "show_keyframe_highlight", text="Keyframes")
+ sub = col.column()
+ sub.enabled = mps.show_keyframe_highlight
if bones:
- col.prop(mps, "show_keyframe_action_all", text="+ Non-Grouped Keyframes")
- col.prop(mps, "show_keyframe_numbers", text="Keyframe Numbers")
+ sub.prop(mps, "show_keyframe_action_all", text="+ Non-Grouped Keyframes")
+ sub.prop(mps, "show_keyframe_numbers", text="Keyframe Numbers")
# FIXME: this panel still needs to be ported so that it will work correctly with animviz
diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py
index 08529a0423d..63dc64190bb 100644
--- a/release/scripts/startup/bl_ui/properties_data_armature.py
+++ b/release/scripts/startup/bl_ui/properties_data_armature.py
@@ -308,14 +308,12 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel):
layout = self.layout
ob = context.object
-
- self.draw_settings(context, ob.pose.animation_visualisation, bones=True)
-
- layout.separator()
-
- split = layout.split()
- split.operator("pose.paths_calculate", text="Calculate Paths")
- split.operator("pose.paths_clear", text="Clear Paths")
+ avs = ob.pose.animation_visualisation
+
+ pchan = context.active_pose_bone
+ mpath = pchan.motion_path if pchan else None
+
+ self.draw_settings(context, avs, mpath, bones=True)
class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , Panel): # inherit from panel when ready
diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
index d7b4b1a2b44..cdef7e703e5 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -299,14 +299,10 @@ class OBJECT_PT_motion_paths(MotionPathButtonsPanel, Panel):
layout = self.layout
ob = context.object
-
- self.draw_settings(context, ob.animation_visualisation)
-
- layout.separator()
-
- row = layout.row()
- row.operator("object.paths_calculate", text="Calculate Paths")
- row.operator("object.paths_clear", text="Clear Paths")
+ avs = ob.animation_visualisation
+ mpath = ob.motion_path
+
+ self.draw_settings(context, avs, mpath)
class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): # , Panel): # inherit from panel when ready
diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py
index 4db056e77a2..f623d9a37eb 100644
--- a/release/scripts/startup/bl_ui/properties_physics_common.py
+++ b/release/scripts/startup/bl_ui/properties_physics_common.py
@@ -94,25 +94,18 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
if cachetype in {'PSYS', 'HAIR', 'SMOKE'}:
row.prop(cache, "use_external")
- if cachetype == 'SMOKE':
- row.prop(cache, "use_library_path", "Use Lib Path")
-
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:")
+ split = layout.split(percentage=0.80)
+ split.prop(cache, "name", text="File Name")
+ split.prop(cache, "index", text="")
- 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)
+ row = layout.row()
+ row.label(text="File Path:")
+ row.prop(cache, "use_library_path", "Use Lib Path")
+
+ layout.prop(cache, "filepath", text="")
+
+ layout.label(text=cache.info)
else:
if cachetype in {'SMOKE', 'DYNAMIC_PAINT'}:
if not bpy.data.is_saved:
@@ -124,7 +117,6 @@ 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 d3ab616a793..9f760f2f024 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -100,15 +100,6 @@ 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 ace208eb9b1..5cbe03bba1a 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -227,16 +227,12 @@ 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 and not settings.use_tripod_solver
+ col.active = tracking_object.is_camera
col.label(text="Refine:")
col.prop(settings, "refine_intrinsics", text="")
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index 43d675c1417..aae950519a4 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -220,6 +220,7 @@ 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'
@@ -487,7 +488,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', 'WIPE'}:
+ elif strip.type in {'CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE'}:
col.prop(strip, "use_default_fade", "Default fade")
if not strip.use_default_fade:
col.prop(strip, "effect_fader", text="Effect fader")
@@ -552,6 +553,7 @@ 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'}
@@ -714,6 +716,7 @@ 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_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 113c370e687..78d3ebce2e9 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -781,6 +781,8 @@ 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:")
@@ -791,6 +793,8 @@ 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..9dda960ea3b 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -69,7 +69,7 @@ class VIEW3D_HT_header(Header):
row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True)
# Occlude geometry
- if view.viewport_shade in {'SOLID', 'SHADED', 'TEXTURED'} and (obj.mode == 'PARTICLE_EDIT' or (obj.mode == 'EDIT' and obj.type == 'MESH')):
+ if view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'} and (obj.mode == 'PARTICLE_EDIT' or (obj.mode == 'EDIT' and obj.type == 'MESH')):
row.prop(view, "use_occlude_geometry", text="")
# Proportional editing
@@ -135,7 +135,9 @@ class ShowHideMenu():
layout.operator("%s.hide" % self._operator_name, text="Hide Unselected").unselected = True
-class VIEW3D_MT_transform(Menu):
+# Standard transforms which apply to all cases
+# NOTE: this doesn't seem to be able to be used directly
+class VIEW3D_MT_transform_base(Menu):
bl_label = "Transform"
# TODO: get rid of the custom text strings?
@@ -156,22 +158,38 @@ class VIEW3D_MT_transform(Menu):
layout.operator("transform.warp", text="Warp")
layout.operator("transform.push_pull", text="Push/Pull")
+
+# Generic transform menu - geometry types
+class VIEW3D_MT_transform(VIEW3D_MT_transform_base):
+ def draw(self, context):
+ # base menu
+ VIEW3D_MT_transform_base.draw(self, context)
+
+ # generic...
+ layout = self.layout
layout.separator()
layout.operator("transform.translate", text="Move Texture Space").texture_space = True
layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
- layout.separator()
- obj = context.object
- if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'} and obj.data.draw_type in {'BBONE', 'ENVELOPE'}:
- layout.operator("transform.transform", text="Scale Envelope/BBone").mode = 'BONE_SIZE'
+# Object-specific extensions to Transform menu
+class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base):
+ def draw(self, context):
+ # base menu
+ VIEW3D_MT_transform_base.draw(self, context)
+
+ # object-specific option follow...
+ layout = self.layout
+ layout.separator()
- if context.edit_object and context.edit_object.type == 'ARMATURE':
- layout.operator("armature.align")
- else:
- layout.operator_context = 'EXEC_REGION_WIN'
- layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this working
+ layout.operator("transform.translate", text="Move Texture Space").texture_space = True
+ layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
+
+ layout.separator()
+
+ layout.operator_context = 'EXEC_REGION_WIN'
+ layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this working
layout.separator()
@@ -191,6 +209,25 @@ class VIEW3D_MT_transform(Menu):
layout.operator("object.anim_transforms_to_deltas")
+# Armature EditMode extensions to Transform menu
+class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base):
+ def draw(self, context):
+ # base menu
+ VIEW3D_MT_transform_base.draw(self, context)
+
+ # armature specific extensions follow...
+ layout = self.layout
+ layout.separator()
+
+ obj = context.object
+ if (obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'} and
+ obj.data.draw_type in {'BBONE', 'ENVELOPE'}):
+ layout.operator("transform.transform", text="Scale Envelope/BBone").mode = 'BONE_SIZE'
+
+ if context.edit_object and context.edit_object.type == 'ARMATURE':
+ layout.operator("armature.align")
+
+
class VIEW3D_MT_mirror(Menu):
bl_label = "Mirror"
@@ -699,7 +736,7 @@ class VIEW3D_MT_object(Menu):
layout.separator()
- layout.menu("VIEW3D_MT_transform")
+ layout.menu("VIEW3D_MT_transform_object")
layout.menu("VIEW3D_MT_mirror")
layout.menu("VIEW3D_MT_object_clear")
layout.menu("VIEW3D_MT_object_apply")
@@ -1317,7 +1354,7 @@ class VIEW3D_MT_pose(Menu):
layout.separator()
- layout.menu("VIEW3D_MT_transform")
+ layout.menu("VIEW3D_MT_transform_armature")
layout.menu("VIEW3D_MT_pose_transform")
layout.menu("VIEW3D_MT_pose_apply")
@@ -2071,7 +2108,7 @@ class VIEW3D_MT_edit_armature(Menu):
edit_object = context.edit_object
arm = edit_object.data
- layout.menu("VIEW3D_MT_transform")
+ layout.menu("VIEW3D_MT_transform_armature")
layout.menu("VIEW3D_MT_mirror")
layout.menu("VIEW3D_MT_snap")
layout.menu("VIEW3D_MT_edit_armature_roll")
@@ -2378,9 +2415,10 @@ class VIEW3D_PT_view3d_meshdisplay(Panel):
col.separator()
col.label(text="Normals:")
- row = col.row(align=True)
- row.prop(mesh, "show_normal_vertex", text="", icon='VERTEXSEL')
- row.prop(mesh, "show_normal_face", text="", icon='FACESEL')
+ row = col.row()
+ sub = row.row(align=True)
+ sub.prop(mesh, "show_normal_vertex", text="", icon='VERTEXSEL')
+ sub.prop(mesh, "show_normal_face", text="", icon='FACESEL')
row.prop(context.scene.tool_settings, "normal_size", text="Size")
col.separator()
diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c
index 637d4be30fd..59ce879520e 100644
--- a/source/blender/avi/intern/avi.c
+++ b/source/blender/avi/intern/avi.c
@@ -442,9 +442,7 @@ 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");
@@ -1004,7 +1002,7 @@ AviError AVI_write_frame (AviMovie *movie, int frame_num, ...)
movie->entries[frame_num * (movie->header->Streams+1) + stream + 1].ChunkId = chunk.fcc;
movie->entries[frame_num * (movie->header->Streams+1) + stream + 1].Flags = AVIIF_KEYFRAME;
- movie->entries[frame_num * (movie->header->Streams+1) + stream + 1].Offset = (int)(ftell(movie->fp) - 12L - movie->movi_offset);
+ movie->entries[frame_num * (movie->header->Streams+1) + stream + 1].Offset = ftell(movie->fp)-12L-movie->movi_offset;
movie->entries[frame_num * (movie->header->Streams+1) + stream + 1].Size = chunk.size;
/* Write the chunk */
@@ -1026,8 +1024,8 @@ AviError AVI_write_frame (AviMovie *movie, int frame_num, ...)
movie->entries[frame_num * (movie->header->Streams+1)].ChunkId = FCC("rec ");
movie->entries[frame_num * (movie->header->Streams+1)].Flags = AVIIF_LIST;
- movie->entries[frame_num * (movie->header->Streams+1)].Offset = (int)(rec_off - 8L - movie->movi_offset);
- movie->entries[frame_num * (movie->header->Streams+1)].Size = (int)(ftell(movie->fp) - (rec_off + 4L));
+ movie->entries[frame_num * (movie->header->Streams+1)].Offset = rec_off-8L-movie->movi_offset;
+ movie->entries[frame_num * (movie->header->Streams+1)].Size = ftell(movie->fp)-(rec_off+4L);
/* Update the record size */
fseek (movie->fp, rec_off, SEEK_SET);
@@ -1046,7 +1044,7 @@ AviError AVI_close_compress (AviMovie *movie)
int temp, movi_size, i;
fseek (movie->fp, 0L, SEEK_END);
- movi_size = (int)ftell(movie->fp);
+ movi_size = ftell (movie->fp);
PUT_FCC ("idx1", movie->fp);
PUT_FCCN ((movie->index_entries*(movie->header->Streams+1)*16), movie->fp);
@@ -1054,7 +1052,7 @@ AviError AVI_close_compress (AviMovie *movie)
for (temp=0; temp < movie->index_entries*(movie->header->Streams+1); temp++)
awrite (movie, &movie->entries[temp], 1, sizeof(AviIndexEntry), movie->fp, AVI_INDEXE);
- temp = (int)ftell(movie->fp);
+ temp = ftell (movie->fp);
fseek (movie->fp, AVI_RIFF_SOFF, SEEK_SET);
diff --git a/source/blender/avi/intern/codecs.c b/source/blender/avi/intern/codecs.c
index 2c244177655..73af7097994 100644
--- a/source/blender/avi/intern/codecs.c
+++ b/source/blender/avi/intern/codecs.c
@@ -46,12 +46,10 @@ 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:
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 14f5c27c3df..5afe27f7be3 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -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 alpha
+#define BLENDER_VERSION_CYCLE release
extern char versionstr[]; /* from blender.c */
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h
index f834ad5e774..b12ab538184 100644
--- a/source/blender/blenkernel/BKE_constraint.h
+++ b/source/blender/blenkernel/BKE_constraint.h
@@ -62,7 +62,7 @@ typedef struct bConstraintOb {
/* ---------------------------------------------------------------------------- */
/* Callback format for performing operations on ID-pointers for Constraints */
-typedef void (*ConstraintIDFunc)(struct bConstraint *con, struct ID **idpoin, void *userdata);
+typedef void (*ConstraintIDFunc)(struct bConstraint *con, struct ID **idpoin, short isReference, void *userdata);
/* ....... */
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index 3b9328ae1aa..fa3a1a6897a 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -53,83 +53,72 @@ 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);
-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);
+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);
/* nurb checks if they can be drawn, also clamp order func */
-int BKE_nurb_check_valid_u(struct Nurb *nu);
-int BKE_nurb_check_valid_v(struct Nurb *nu);
+int check_valid_nurb_u(struct Nurb *nu);
+int check_valid_nurb_v(struct Nurb *nu);
-int BKE_nurb_order_clamp_u(struct Nurb *nu);
-int BKE_nurb_order_clamp_v(struct Nurb *nu);
+int clamp_nurb_order_u(struct Nurb *nu);
+int clamp_nurb_order_v(struct Nurb *nu);
-void BKE_nurb_direction_switch(struct Nurb *nu);
-
-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);
+ListBase *BKE_curve_nurbs(struct Curve *cu);
+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
+
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index 6a3625e2133..4b52189d8b7 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -305,6 +305,7 @@ int CustomData_sizeof(int type);
/* get the name of a layer type */
const char *CustomData_layertype_name(int type);
+int CustomData_layertype_is_singleton(int type);
/* make sure the name of layer at index is unique */
void CustomData_set_layer_unique_name(struct CustomData *data, int index);
diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h
index a0075c4d6be..29c78510fd8 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[3], float weight);
+void calc_latt_deform(struct Object *, float *co, 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_mball.h b/source/blender/blenkernel/BKE_mball.h
index 018ee7f6c94..fafd2a3d30e 100644
--- a/source/blender/blenkernel/BKE_mball.h
+++ b/source/blender/blenkernel/BKE_mball.h
@@ -37,30 +37,147 @@ struct Object;
struct Scene;
struct MetaElem;
-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 point { /* a three-dimensional point */
+ float x, y, z; /* its coordinates */
+} MB_POINT;
-void BKE_metaball_make_local(struct MetaBall *mb);
+typedef struct vertex { /* surface vertex */
+ MB_POINT position, normal; /* position and surface normal */
+} VERTEX;
-void BKE_metaball_cubeTable_free(void);
+typedef struct vertices { /* list of vertices in polygonization */
+ int count, max; /* # vertices, max # allowed */
+ VERTEX *ptr; /* dynamically allocated */
+} VERTICES;
-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 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_tex_space_calc(struct Object *ob);
-float *BKE_metaball_make_orco(struct Object *ob, struct ListBase *dispbase);
+typedef struct cube { /* partitioning cell (cube) */
+ int i, j, k; /* lattice location of cube */
+ CORNER *corners[8]; /* eight corners */
+} CUBE;
-void BKE_metaball_properties_copy(struct Scene *scene, struct Object *active_object);
+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);
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]);
-struct MetaElem *BKE_metaball_element_add(struct MetaBall *mb, const int type);
-
#endif
+
diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h
index 29924542494..d7b2f271a83 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 BKE_movieclip_free(struct MovieClip *clip);
-void BKE_movieclip_unlink(struct Main *bmain, struct MovieClip *clip);
+void free_movieclip(struct MovieClip *clip);
+void unlink_movieclip(struct Main *bmain, struct MovieClip *clip);
-struct MovieClip *BKE_movieclip_file_add(const char *name);
+struct MovieClip *BKE_add_movieclip_file(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_object.h b/source/blender/blenkernel/BKE_object.h
index 971320765e9..5d69b03ad69 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -80,6 +80,7 @@ int exist_object(struct Object *obtest);
struct Object *add_only_object(int type, const char *name);
struct Object *add_object(struct Scene *scene, int type);
+void *add_obdata_from_type(int type);
struct Object *copy_object(struct Object *ob);
void make_local_object(struct Object *ob);
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 53e4a973cd4..f5718974f9f 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -1272,9 +1272,7 @@ 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 0fd030be39c..c28958d5b0d 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -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_grow_items(wtcol_l, mp->totloop);
+ BLI_array_growitems(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,10 +2279,8 @@ 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;
@@ -2294,10 +2292,8 @@ 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;
}
@@ -2705,7 +2701,8 @@ 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]];
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 38c73ba72b9..c0e214a02d1 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -144,9 +144,11 @@ void animviz_free_motionpath(bMotionPath *mpath)
/* ------------------- */
/* Setup motion paths for the given data
- * - scene: current scene (for frame ranges, etc.)
- * - ob: object to add paths for (must be provided)
- * - pchan: posechannel to add paths for (optional; if not provided, object-paths are assumed)
+ * - Only used when explicitly calculating paths on bones which may/may not be consider already
+ *
+ * < scene: current scene (for frame ranges, etc.)
+ * < ob: object to add paths for (must be provided)
+ * < pchan: posechannel to add paths for (optional; if not provided, object-paths are assumed)
*/
bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Object *ob, bPoseChannel *pchan)
{
@@ -180,14 +182,25 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Objec
}
/* if there is already a motionpath, just return that,
- * but provided it's settings are ok
+ * provided it's settings are ok (saves extra free+alloc)
*/
if (*dst != NULL) {
+ int expected_length = avs->path_ef - avs->path_sf;
+
mpath= *dst;
- /* if range is not invalid, and/or length is set ok, just return */
- if ((mpath->start_frame != mpath->end_frame) && (mpath->length > 0))
- return mpath;
+ /* path is "valid" if length is valid, but must also be of the same length as is being requested */
+ if ((mpath->start_frame != mpath->end_frame) && (mpath->length > 0)) {
+ /* outer check ensures that we have some curve data for this path */
+ if (mpath->length == expected_length) {
+ /* return/use this as it is already valid length */
+ return mpath;
+ }
+ else {
+ /* clear the existing path (as the range has changed), and reallocate below */
+ animviz_free_motionpath_cache(mpath);
+ }
+ }
}
else {
/* create a new motionpath, and assign it */
@@ -482,7 +495,7 @@ void calc_curvepath(Object *ob)
if (ob==NULL || ob->type != OB_CURVE) return;
cu= ob->data;
- nurbs= BKE_curve_nurbs_get(cu);
+ nurbs= BKE_curve_nurbs(cu);
nu= nurbs->first;
if (cu->path) free_path(cu->path);
@@ -1350,11 +1363,9 @@ 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] */
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index be53e3ddcba..873f7f162f8 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1250,7 +1250,8 @@ 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 */
@@ -1273,7 +1274,8 @@ 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;
@@ -1349,7 +1351,8 @@ 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);
@@ -1965,7 +1968,8 @@ 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));
@@ -2035,8 +2039,10 @@ static void animsys_evaluate_nla (ListBase *echannels, PointerRNA *ptr, AnimData
/* add 'active' Action (may be tweaking track) as last strip to evaluate in NLA stack
* - only do this if we're not exclusively evaluating the 'solo' NLA-track
+ * - however, if the 'solo' track houses the current 'tweaking' strip,
+ * then we should allow this to play, otherwise nothing happens
*/
- if ((adt->action) && !(adt->flag & ADT_NLA_SOLO_TRACK)) {
+ if ((adt->action) && ((adt->flag & ADT_NLA_SOLO_TRACK)==0 || (adt->flag & ADT_NLA_EDIT_ON))) {
/* if there are strips, evaluate action as per NLA rules */
if ((has_strips) || (adt->actstrip)) {
/* make dummy NLA strip, and add that to the stack */
@@ -2213,9 +2219,7 @@ 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)
- /* XXX for now, don't check yet, as depsgraph hasn't been updated */
- /* && (adt->recalc & ADT_RECALC_DRIVERS)*/)
+ if ((recalc & ADT_RECALC_DRIVERS) /*&& (adt->recalc & ADT_RECALC_DRIVERS)*/) // XXX for now, don't check yet, as depsgraph hasn't been updated
{
animsys_evaluate_drivers(&id_ptr, adt, ctime);
}
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index d1d6833e903..597bcb55a43 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -566,13 +566,13 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
if (bone->segments > MAX_BBONE_SUBDIV)
bone->segments = MAX_BBONE_SUBDIV;
- BKE_curve_forward_diff_bezier(0.0, h1[0], h2[0], 0.0, data[0],
+ forward_diff_bezier(0.0, h1[0], h2[0], 0.0, data[0],
MAX_BBONE_SUBDIV, 4*sizeof(float));
- BKE_curve_forward_diff_bezier(0.0, h1[1], length + h2[1], length, data[0]+1,
+ forward_diff_bezier(0.0, h1[1], length + h2[1], length, data[0]+1,
MAX_BBONE_SUBDIV, 4*sizeof(float));
- BKE_curve_forward_diff_bezier(0.0, h1[2], h2[2], 0.0, data[0]+2,
+ forward_diff_bezier(0.0, h1[2], h2[2], 0.0, data[0]+2,
MAX_BBONE_SUBDIV, 4*sizeof(float));
- BKE_curve_forward_diff_bezier(roll1, roll1 + 0.390464f*(roll2-roll1), roll2 - 0.390464f*(roll2-roll1), roll2, data[0]+3,
+ 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! */
@@ -1372,7 +1372,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;
@@ -1516,8 +1516,12 @@ 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]...
+ *
+ * was 0.0000000000001, caused bug [#], smaller values give unstable
+ * roll when toggling editmode again...
+ * No good value here, trying 0.000000001 as best compromize. :/
*/
- if (dot_v3v3(axis,axis) > 1.0e-13f) {
+ if (dot_v3v3(axis, axis) > 1.0e-9f) {
/* if nor is *not* a multiple of target ... */
normalize_v3(axis);
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index fbcabccd2b9..a556c99dc7d 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -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) {
@@ -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];
@@ -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 3df6de2fd24..e7ba09d3959 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -337,7 +337,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;
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index df80ce6e87c..009b7ca7f99 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -649,7 +649,8 @@ 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);
@@ -674,7 +675,8 @@ BVHTree* bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float
}
}
}
- else {
+ else
+ {
// printf("BVHTree is already build, using cached tree\n");
}
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 4de7df098c3..a93772cfc6f 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -267,6 +267,8 @@ static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
if (!cddm->pbvh && ob->type == OB_MESH) {
SculptSession *ss= ob->sculpt;
Mesh *me= ob->data;
+ int deformed = 0;
+
cddm->pbvh = BLI_pbvh_new();
cddm->pbvh_draw = can_pbvh_draw(ob, dm);
@@ -275,7 +277,9 @@ static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
BLI_pbvh_build_mesh(cddm->pbvh, me->mface, me->mvert,
me->totface, me->totvert);
- if (ss->modifiers_active && ob->derivedDeform) {
+ deformed = ss->modifiers_active || me->key;
+
+ if (deformed && ob->derivedDeform) {
DerivedMesh *deformdm= ob->derivedDeform;
float (*vertCos)[3];
int totvert;
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 97baaad430b..a0c273cf962 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -191,7 +191,8 @@ 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);
@@ -231,7 +232,8 @@ 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);
@@ -264,8 +266,10 @@ 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);
@@ -274,7 +278,8 @@ 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);
@@ -314,12 +319,15 @@ 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);
@@ -550,9 +558,11 @@ 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 );
}
@@ -564,9 +574,11 @@ 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 );
@@ -616,12 +628,14 @@ 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 );
}
@@ -633,9 +647,11 @@ 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 );
@@ -692,7 +708,8 @@ 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 */
}
@@ -732,12 +749,17 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *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 */
@@ -747,18 +769,22 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
*/
verts->goal = ( float ) pow ( verts->goal , 4.0f );
- if ( verts->goal >=SOFTGOALSNAP ) {
+ 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;
}
}
@@ -786,7 +812,8 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
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");
@@ -794,7 +821,8 @@ 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;
@@ -823,8 +851,10 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
verts = clmd->clothObject->verts;
// set initial values
- for ( i = 0; i < dm->getNumVerts(dm); i++, verts++ ) {
- if (first) {
+ 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 );
@@ -861,15 +891,18 @@ 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);
}
}
@@ -884,7 +917,8 @@ 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));
}
@@ -903,7 +937,8 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm )
/* 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");
@@ -913,7 +948,8 @@ 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");
@@ -941,7 +977,8 @@ int cloth_add_spring ( ClothModifierData *clmd, unsigned int indexA, unsigned in
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" );
@@ -969,9 +1006,11 @@ 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 );
@@ -982,8 +1021,10 @@ static void cloth_free_errorsprings(Cloth *cloth, EdgeHash *UNUSED(edgehash), Li
cloth->springs = NULL;
}
- if (edgelist) {
- for ( i = 0; i < cloth->numverts; i++ ) {
+ if (edgelist)
+ {
+ for ( i = 0; i < cloth->numverts; i++ )
+ {
BLI_linklist_free ( edgelist[i],NULL );
}
@@ -1021,7 +1062,8 @@ 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;
}
@@ -1032,10 +1074,12 @@ 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);
@@ -1060,19 +1104,22 @@ 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;
}
@@ -1093,7 +1140,8 @@ 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;
}
@@ -1114,13 +1162,15 @@ 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 ) );
@@ -1131,7 +1181,8 @@ 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;
}
@@ -1161,14 +1212,16 @@ 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;
}
@@ -1189,12 +1242,13 @@ 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 */
+ 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) {
+
+ 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 );
@@ -1204,8 +1258,10 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
cloth->numsprings = struct_springs + shear_springs + bend_springs;
- if ( edgelist ) {
- for ( i = 0; i < numverts; i++ ) {
+ if ( edgelist )
+ {
+ for ( i = 0; i < numverts; i++ )
+ {
BLI_linklist_free ( edgelist[i],NULL );
}
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 264a251c317..5b03f73e120 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -80,7 +80,8 @@ 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++ ) {
+ 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 );
@@ -100,7 +101,8 @@ 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 );
@@ -126,8 +128,10 @@ 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 );
@@ -135,7 +139,8 @@ 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 );
@@ -145,7 +150,8 @@ 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 ) );
}
@@ -459,7 +465,8 @@ 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;
}
@@ -497,7 +504,8 @@ 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;
@@ -532,7 +540,8 @@ 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;
@@ -549,7 +558,8 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
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 ) {
+ if ( magtangent > ALMOST_ZERO )
+ {
normalize_v3( vrel_t_pre );
impulse = magtangent / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); // 2.0 *
@@ -577,7 +587,8 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
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
@@ -674,8 +685,10 @@ 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;
@@ -686,8 +699,10 @@ 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;
@@ -702,8 +717,10 @@ 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;
@@ -718,8 +735,10 @@ 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;
@@ -828,7 +847,8 @@ 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;
@@ -845,7 +865,8 @@ static int cloth_edge_collision_response_moving ( ClothModifierData *clmd, Colli
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;
@@ -864,7 +885,8 @@ static int cloth_edge_collision_response_moving ( ClothModifierData *clmd, Colli
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 ) {
+ if ( magtangent > ALMOST_ZERO )
+ {
normalize_v3( vrel_t_pre );
impulse = magtangent;
@@ -884,7 +906,8 @@ static int cloth_edge_collision_response_moving ( ClothModifierData *clmd, Colli
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
@@ -926,7 +949,8 @@ 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;
@@ -943,7 +967,8 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
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;
@@ -960,7 +985,8 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
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 ) {
+ if ( magtangent > ALMOST_ZERO )
+ {
normalize_v3( vrel_t_pre );
impulse = magtangent; // 2.0 *
@@ -980,7 +1006,8 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
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
@@ -1007,7 +1034,8 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
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;
@@ -1024,7 +1052,8 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
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 ) {
+ if ( magtangent > ALMOST_ZERO )
+ {
normalize_v3( vrel_t_pre );
impulse = magtangent; // 2.0 *
@@ -1043,7 +1072,8 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
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
@@ -1172,8 +1202,10 @@ 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;
@@ -1184,8 +1216,10 @@ 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;
@@ -1200,8 +1234,10 @@ 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;
@@ -1216,8 +1252,10 @@ 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;
@@ -1379,8 +1417,10 @@ 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;
@@ -1391,8 +1431,10 @@ 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;
@@ -1406,8 +1448,10 @@ 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;
@@ -1421,8 +1465,10 @@ 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;
@@ -1467,7 +1513,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2,
distance = 2.0 * (double)( epsilon1 + epsilon2 + ALMOST_ZERO );
#endif
- if ( distance <= ( epsilon1 + epsilon2 + ALMOST_ZERO ) ) {
+ if ( distance <= ( epsilon1 + epsilon2 + ALMOST_ZERO ) )
+ {
normalize_v3_v3( collpair->normal, collpair->vector );
collpair->distance = distance;
@@ -2236,12 +2283,14 @@ 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 );
}
@@ -2249,7 +2298,8 @@ 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 );
}
@@ -2273,10 +2323,12 @@ 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);
@@ -2287,11 +2339,14 @@ 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;
@@ -2347,7 +2402,8 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
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;
@@ -2379,7 +2435,8 @@ 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] );
}
@@ -2392,9 +2449,12 @@ 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;
}
}
@@ -2407,8 +2467,10 @@ 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;
@@ -2421,12 +2483,14 @@ 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;
@@ -2436,7 +2500,8 @@ 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 ) )
{
@@ -2449,24 +2514,29 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
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 );
- if ( length < mindistance ) {
+ if ( length < mindistance )
+ {
float correction = mindistance - length;
- if ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED ) {
+ 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 ) {
+ else if ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED )
+ {
mul_v3_fl( temp, correction );
VECADD ( verts[i].tx, verts[i].tx, temp );
}
- else {
+ else
+ {
mul_v3_fl( temp, correction * -0.5 );
VECADD ( verts[j].tx, verts[j].tx, temp );
@@ -2490,9 +2560,12 @@ 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 ) ) {
+ 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 6dc1b2a4b00..25391a34689 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,9 +252,10 @@ 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;
@@ -499,8 +500,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]);
- 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));
+ 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));
}
/* store first and last handle for extrapolation, unit length */
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 82a908eaf57..a0b8cd3b5b3 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -781,7 +781,7 @@ static void childof_id_looper (bConstraint *con, ConstraintIDFunc func, void *us
bChildOfConstraint *data= con->data;
/* target only */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
}
static int childof_get_tars (bConstraint *con, ListBase *list)
@@ -917,7 +917,7 @@ static void trackto_id_looper (bConstraint *con, ConstraintIDFunc func, void *us
bTrackToConstraint *data= con->data;
/* target only */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
}
static int trackto_get_tars (bConstraint *con, ListBase *list)
@@ -1098,10 +1098,10 @@ static void kinematic_id_looper (bConstraint *con, ConstraintIDFunc func, void *
bKinematicConstraint *data= con->data;
/* chain target */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
/* poletarget */
- func(con, (ID**)&data->poletar, userdata);
+ func(con, (ID**)&data->poletar, FALSE, userdata);
}
static int kinematic_get_tars (bConstraint *con, ListBase *list)
@@ -1191,7 +1191,7 @@ static void followpath_id_looper (bConstraint *con, ConstraintIDFunc func, void
bFollowPathConstraint *data= con->data;
/* target only */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
}
static int followpath_get_tars (bConstraint *con, ListBase *list)
@@ -1541,7 +1541,7 @@ static void loclike_id_looper (bConstraint *con, ConstraintIDFunc func, void *us
bLocateLikeConstraint *data= con->data;
/* target only */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
}
static int loclike_get_tars (bConstraint *con, ListBase *list)
@@ -1632,7 +1632,7 @@ static void rotlike_id_looper (bConstraint *con, ConstraintIDFunc func, void *us
bChildOfConstraint *data= con->data;
/* target only */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
}
static int rotlike_get_tars (bConstraint *con, ListBase *list)
@@ -1745,7 +1745,7 @@ static void sizelike_id_looper (bConstraint *con, ConstraintIDFunc func, void *u
bSizeLikeConstraint *data= con->data;
/* target only */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
}
static int sizelike_get_tars (bConstraint *con, ListBase *list)
@@ -1835,7 +1835,7 @@ static void translike_id_looper (bConstraint *con, ConstraintIDFunc func, void *
bTransLikeConstraint *data= con->data;
/* target only */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
}
static int translike_get_tars (bConstraint *con, ListBase *list)
@@ -2007,10 +2007,10 @@ static void pycon_id_looper (bConstraint *con, ConstraintIDFunc func, void *user
/* targets */
for (ct= data->targets.first; ct; ct= ct->next)
- func(con, (ID**)&ct->tar, userdata);
+ func(con, (ID**)&ct->tar, FALSE, userdata);
/* script */
- func(con, (ID**)&data->text, userdata);
+ func(con, (ID**)&data->text, TRUE, userdata);
}
/* Whether this approach is maintained remains to be seen (aligorith) */
@@ -2107,10 +2107,10 @@ static void actcon_id_looper (bConstraint *con, ConstraintIDFunc func, void *use
bActionConstraint *data= con->data;
/* target */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
/* action */
- func(con, (ID**)&data->act, userdata);
+ func(con, (ID**)&data->act, TRUE, userdata);
}
static int actcon_get_tars (bConstraint *con, ListBase *list)
@@ -2273,7 +2273,7 @@ static void locktrack_id_looper (bConstraint *con, ConstraintIDFunc func, void *
bLockTrackConstraint *data= con->data;
/* target only */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
}
static int locktrack_get_tars (bConstraint *con, ListBase *list)
@@ -2584,7 +2584,7 @@ static void distlimit_id_looper (bConstraint *con, ConstraintIDFunc func, void *
bDistLimitConstraint *data= con->data;
/* target only */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
}
static int distlimit_get_tars (bConstraint *con, ListBase *list)
@@ -2712,7 +2712,7 @@ static void stretchto_id_looper (bConstraint *con, ConstraintIDFunc func, void *
bStretchToConstraint *data= con->data;
/* target only */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
}
static int stretchto_get_tars (bConstraint *con, ListBase *list)
@@ -2887,7 +2887,7 @@ static void minmax_id_looper (bConstraint *con, ConstraintIDFunc func, void *use
bMinMaxConstraint *data= con->data;
/* target only */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
}
static int minmax_get_tars (bConstraint *con, ListBase *list)
@@ -3030,8 +3030,8 @@ static void rbj_id_looper (bConstraint *con, ConstraintIDFunc func, void *userda
bRigidBodyJointConstraint *data= con->data;
/* target only */
- func(con, (ID**)&data->tar, userdata);
- func(con, (ID**)&data->child, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
+ func(con, (ID**)&data->child, FALSE, userdata);
}
static int rbj_get_tars (bConstraint *con, ListBase *list)
@@ -3083,7 +3083,7 @@ static void clampto_id_looper (bConstraint *con, ConstraintIDFunc func, void *us
bClampToConstraint *data= con->data;
/* target only */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
}
static int clampto_get_tars (bConstraint *con, ListBase *list)
@@ -3268,7 +3268,7 @@ static void transform_id_looper (bConstraint *con, ConstraintIDFunc func, void *
bTransformConstraint *data= con->data;
/* target only */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
}
static int transform_get_tars (bConstraint *con, ListBase *list)
@@ -3403,10 +3403,10 @@ static bConstraintTypeInfo CTI_TRANSFORM = {
static void shrinkwrap_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
{
- bShrinkwrapConstraint *data= con->data;
+ bShrinkwrapConstraint *data = con->data;
/* target only */
- func(con, (ID**)&data->target, userdata);
+ func(con, (ID**)&data->target, FALSE, userdata);
}
static int shrinkwrap_get_tars (bConstraint *con, ListBase *list)
@@ -3439,7 +3439,8 @@ 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};
@@ -3460,10 +3461,12 @@ 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:
@@ -3472,7 +3475,8 @@ 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;
}
@@ -3502,12 +3506,14 @@ 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;
}
@@ -3536,7 +3542,8 @@ 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]);
}
}
@@ -3571,7 +3578,7 @@ static void damptrack_id_looper (bConstraint *con, ConstraintIDFunc func, void *
bDampTrackConstraint *data= con->data;
/* target only */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
}
static int damptrack_get_tars (bConstraint *con, ListBase *list)
@@ -3717,7 +3724,7 @@ static void splineik_id_looper (bConstraint *con, ConstraintIDFunc func, void *u
bSplineIKConstraint *data= con->data;
/* target only */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
}
static int splineik_get_tars (bConstraint *con, ListBase *list)
@@ -3790,7 +3797,7 @@ static void pivotcon_id_looper (bConstraint *con, ConstraintIDFunc func, void *u
bPivotConstraint *data= con->data;
/* target only */
- func(con, (ID**)&data->tar, userdata);
+ func(con, (ID**)&data->tar, FALSE, userdata);
}
static int pivotcon_get_tars (bConstraint *con, ListBase *list)
@@ -3922,9 +3929,9 @@ static void followtrack_id_looper(bConstraint *con, ConstraintIDFunc func, void
{
bFollowTrackConstraint *data = con->data;
- func(con, (ID**)&data->clip, userdata);
- func(con, (ID**)&data->camera, userdata);
- func(con, (ID**)&data->depth_ob, userdata);
+ func(con, (ID**)&data->clip, TRUE, userdata);
+ func(con, (ID**)&data->camera, FALSE, userdata);
+ func(con, (ID**)&data->depth_ob, FALSE, userdata);
}
static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
@@ -4116,7 +4123,7 @@ static void camerasolver_id_looper(bConstraint *con, ConstraintIDFunc func, void
{
bCameraSolverConstraint *data = con->data;
- func(con, (ID**)&data->clip, userdata);
+ func(con, (ID**)&data->clip, TRUE, userdata);
}
static void camerasolver_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
@@ -4172,8 +4179,8 @@ static void objectsolver_id_looper(bConstraint *con, ConstraintIDFunc func, void
{
bObjectSolverConstraint *data= con->data;
- func(con, (ID**)&data->clip, userdata);
- func(con, (ID**)&data->camera, userdata);
+ func(con, (ID**)&data->clip, FALSE, userdata);
+ func(con, (ID**)&data->camera, FALSE, userdata);
}
static void objectsolver_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
@@ -4535,12 +4542,20 @@ void id_loop_constraints (ListBase *conlist, ConstraintIDFunc func, void *userda
/* ......... */
/* helper for copy_constraints(), to be used for making sure that ID's are valid */
-static void con_extern_cb(bConstraint *UNUSED(con), ID **idpoin, void *UNUSED(userData))
+static void con_extern_cb(bConstraint *UNUSED(con), ID **idpoin, short UNUSED(isReference), void *UNUSED(userData))
{
if (*idpoin && (*idpoin)->lib)
id_lib_extern(*idpoin);
}
+/* helper for copy_constraints(), to be used for making sure that usercounts of copied ID's are fixed up */
+static void con_fix_copied_refs_cb(bConstraint *con, ID **idpoin, short isReference, void *UNUSED(userData))
+{
+ /* increment usercount if this is a reference type */
+ if ((*idpoin) && (isReference))
+ id_us_plus(*idpoin);
+}
+
/* duplicate all of the constraints in a constraint stack */
void copy_constraints (ListBase *dst, const ListBase *src, int do_extern)
{
@@ -4560,6 +4575,10 @@ void copy_constraints (ListBase *dst, const ListBase *src, int do_extern)
/* perform custom copying operations if needed */
if (cti->copy_data)
cti->copy_data(con, srccon);
+
+ /* fix usercounts for all referenced data in referenced data */
+ if (cti->id_looper)
+ cti->id_looper(con, con_fix_copied_refs_cb, NULL);
/* for proxies we don't want to make extern */
if (do_extern) {
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 7a5b4ef9b24..e9dd4d01b0e 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 e0cadac586b..9232fe8ec04 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 BKE_curve_unlink(Curve *cu)
+void unlink_curve(Curve *cu)
{
int a;
@@ -95,7 +95,7 @@ void BKE_curve_unlink(Curve *cu)
}
/* frees editcurve entirely */
-void BKE_curve_editfont_free(Curve *cu)
+void BKE_free_editfont(Curve *cu)
{
if (cu->editfont) {
EditFont *ef= cu->editfont;
@@ -112,7 +112,7 @@ void BKE_curve_editfont_free(Curve *cu)
}
}
-void BKE_curve_editNurb_keyIndex_free(EditNurb *editnurb)
+void free_curve_editNurb_keyIndex(EditNurb *editnurb)
{
if (!editnurb->keyindex) {
return;
@@ -121,26 +121,26 @@ void BKE_curve_editNurb_keyIndex_free(EditNurb *editnurb)
editnurb->keyindex= NULL;
}
-void BKE_curve_editNurb_free (Curve *cu)
+void free_curve_editNurb (Curve *cu)
{
if (cu->editnurb) {
- BKE_nurbList_free(&cu->editnurb->nurbs);
- BKE_curve_editNurb_keyIndex_free(cu->editnurb);
+ freeNurblist(&cu->editnurb->nurbs);
+ free_curve_editNurb_keyIndex(cu->editnurb);
MEM_freeN(cu->editnurb);
cu->editnurb= NULL;
}
}
/* don't free curve itself */
-void BKE_curve_free(Curve *cu)
+void free_curve(Curve *cu)
{
- BKE_nurbList_free(&cu->nurb);
+ freeNurblist(&cu->nurb);
BLI_freelistN(&cu->bev);
freedisplist(&cu->disp);
- BKE_curve_editfont_free(cu);
+ BKE_free_editfont(cu);
- BKE_curve_editNurb_free(cu);
- BKE_curve_unlink(cu);
+ free_curve_editNurb(cu);
+ unlink_curve(cu);
BKE_free_animdata((ID *)cu);
if (cu->mat) MEM_freeN(cu->mat);
@@ -151,7 +151,7 @@ void BKE_curve_free(Curve *cu)
if (cu->tb) MEM_freeN(cu->tb);
}
-Curve *BKE_curve_add(const char *name, int type)
+Curve *add_curve(const char *name, int type)
{
Curve *cu;
@@ -187,14 +187,14 @@ Curve *BKE_curve_add(const char *name, int type)
return cu;
}
-Curve *BKE_curve_copy(Curve *cu)
+Curve *copy_curve(Curve *cu)
{
Curve *cun;
int a;
cun= copy_libblock(&cu->id);
cun->nurb.first= cun->nurb.last= NULL;
- BKE_nurbList_duplicate( &(cun->nurb), &(cu->nurb));
+ duplicateNurblist( &(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 BKE_curve_make_local(Curve *cu)
+void make_local_curve(Curve *cu)
{
Main *bmain= G.main;
Object *ob;
@@ -273,7 +273,7 @@ void BKE_curve_make_local(Curve *cu)
extern_local_curve(cu);
}
else if (is_local && is_lib) {
- Curve *cu_new= BKE_curve_copy(cu);
+ Curve *cu_new= copy_curve(cu);
cu_new->id.us= 0;
BKE_id_lib_local_paths(bmain, cu->id.lib, &cu_new->id);
@@ -291,7 +291,7 @@ void BKE_curve_make_local(Curve *cu)
}
/* Get list of nurbs from editnurbs structure */
-ListBase *BKE_curve_editNurbs_get(Curve *cu)
+ListBase *curve_editnurbs(Curve *cu)
{
if (cu->editnurb) {
return &cu->editnurb->nurbs;
@@ -300,7 +300,7 @@ ListBase *BKE_curve_editNurbs_get(Curve *cu)
return NULL;
}
-short BKE_curve_type_get(Curve *cu)
+short curve_type(Curve *cu)
{
Nurb *nu;
int type= cu->type;
@@ -322,9 +322,9 @@ short BKE_curve_type_get(Curve *cu)
return type;
}
-void BKE_curve_curve_dimension_update(Curve *cu)
+void update_curve_dimension(Curve *cu)
{
- ListBase *nurbs= BKE_curve_nurbs_get(cu);
+ ListBase *nurbs= BKE_curve_nurbs(cu);
Nurb *nu= nurbs->first;
if (cu->flag&CU_3D) {
@@ -335,24 +335,24 @@ void BKE_curve_curve_dimension_update(Curve *cu)
else {
for ( ; nu; nu= nu->next) {
nu->flag |= CU_2D;
- BKE_nurb_test2D(nu);
+ test2DNurb(nu);
/* since the handles are moved they need to be auto-located again */
if (nu->type == CU_BEZIER)
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(nu);
}
}
}
-void BKE_curve_type_test(Object *ob)
+void test_curve_type(Object *ob)
{
- ob->type= BKE_curve_type_get(ob->data);
+ ob->type= curve_type(ob->data);
if (ob->type==OB_CURVE)
- BKE_curve_curve_dimension_update((Curve *)ob->data);
+ update_curve_dimension((Curve *)ob->data);
}
-void BKE_curve_tex_space_calc(Curve *cu)
+void tex_space_curve(Curve *cu)
{
DispList *dl;
BoundBox *bb;
@@ -408,7 +408,7 @@ void BKE_curve_tex_space_calc(Curve *cu)
}
}
-int BKE_nurbList_verts_count(ListBase *nurb)
+int count_curveverts(ListBase *nurb)
{
Nurb *nu;
int tot=0;
@@ -423,7 +423,7 @@ int BKE_nurbList_verts_count(ListBase *nurb)
return tot;
}
-int BKE_nurbList_verts_count_without_handles(ListBase *nurb)
+int count_curveverts_without_handles(ListBase *nurb)
{
Nurb *nu;
int tot=0;
@@ -440,7 +440,7 @@ int BKE_nurbList_verts_count_without_handles(ListBase *nurb)
/* **************** NURBS ROUTINES ******************** */
-void BKE_nurb_free(Nurb *nu)
+void freeNurb(Nurb *nu)
{
if (nu==NULL) return;
@@ -460,7 +460,7 @@ void BKE_nurb_free(Nurb *nu)
}
-void BKE_nurbList_free(ListBase *lb)
+void freeNurblist(ListBase *lb)
{
Nurb *nu, *next;
@@ -469,13 +469,13 @@ void BKE_nurbList_free(ListBase *lb)
nu= lb->first;
while (nu) {
next= nu->next;
- BKE_nurb_free(nu);
+ freeNurb(nu);
nu= next;
}
lb->first= lb->last= NULL;
}
-Nurb *BKE_nurb_duplicate(Nurb *nu)
+Nurb *duplicateNurb(Nurb *nu)
{
Nurb *newnu;
int len;
@@ -515,22 +515,22 @@ Nurb *BKE_nurb_duplicate(Nurb *nu)
return newnu;
}
-void BKE_nurbList_duplicate(ListBase *lb1, ListBase *lb2)
+void duplicateNurblist(ListBase *lb1, ListBase *lb2)
{
Nurb *nu, *nun;
- BKE_nurbList_free(lb1);
+ freeNurblist(lb1);
nu= lb2->first;
while (nu) {
- nun= BKE_nurb_duplicate(nu);
+ nun= duplicateNurb(nu);
BLI_addtail(lb1, nun);
nu= nu->next;
}
}
-void BKE_nurb_test2D(Nurb *nu)
+void test2DNurb(Nurb *nu)
{
BezTriple *bezt;
BPoint *bp;
@@ -559,7 +559,7 @@ void BKE_nurb_test2D(Nurb *nu)
}
}
-void BKE_nurb_minmax(Nurb *nu, float *min, float *max)
+void minmaxNurb(Nurb *nu, float *min, float *max)
{
BezTriple *bezt;
BPoint *bp;
@@ -586,7 +586,7 @@ void BKE_nurb_minmax(Nurb *nu, float *min, float *max)
}
/* be sure to call makeknots after this */
-void BKE_nurb_points_add(Nurb *nu, int number)
+void addNurbPoints(Nurb *nu, int number)
{
BPoint *tmp= nu->bp;
int i;
@@ -606,7 +606,7 @@ void BKE_nurb_points_add(Nurb *nu, int number)
nu->pntsu += number;
}
-void BKE_nurb_bezierPoints_add(Nurb *nu, int number)
+void addNurbPointsBezier(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 (BKE_nurb_check_valid_u(nu)) {
+ if (check_valid_nurb_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 (BKE_nurb_check_valid_v(nu)) {
+ if (check_valid_nurb_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 BKE_nurb_knot_calc_u(Nurb *nu)
+void nurbs_knot_calc_u(Nurb *nu)
{
makeknots(nu, 1);
}
-void BKE_nurb_knot_calc_v(Nurb *nu)
+void nurbs_knot_calc_v(Nurb *nu)
{
makeknots(nu, 2);
}
@@ -809,7 +809,7 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas
}
-void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int resolv)
+void makeNurbfaces(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;
@@ -972,7 +972,7 @@ void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu,
MEM_freeN(jend);
}
-void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride)
+void makeNurbcurve(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,7 +1074,7 @@ void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float *
}
/* forward differencing method for bezier curve */
-void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride)
+void forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride)
{
float rt0,rt1,rt2,rt3,f;
int a;
@@ -1122,7 +1122,7 @@ static void forward_diff_bezier_cotangent(float *p0, float *p1, float *p2, float
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-float *BKE_curve_surf_make_orco(Object *ob)
+float *make_orco_surf(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 *BKE_curve_surf_make_orco(Object *ob)
float *_tdata= MEM_callocN((nu->pntsu*resolu) * (nu->pntsv*resolv) *3*sizeof(float), "temp data");
float *tdata= _tdata;
- BKE_nurb_makeFaces(nu, tdata, 0, resolu, resolv);
+ makeNurbfaces(nu, tdata, 0, resolu, resolv);
for (b=0; b<sizeu; b++) {
int use_b= b;
@@ -1224,7 +1224,7 @@ float *BKE_curve_surf_make_orco(Object *ob)
/* NOTE: This routine is tied to the order of vertex
* built by displist and as passed to the renderer.
*/
-float *BKE_curve_make_orco(Scene *scene, Object *ob)
+float *make_orco_curve(Scene *scene, Object *ob)
{
Curve *cu = ob->data;
DispList *dl;
@@ -1312,7 +1312,7 @@ float *BKE_curve_make_orco(Scene *scene, Object *ob)
/* ***************** BEVEL ****************** */
-void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, int forRender)
+void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
{
DispList *dl, *dlnew;
Curve *bevcu, *cu;
@@ -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;
@@ -2083,7 +2083,7 @@ static void make_bevel_list_segment_3D(BevList *bl)
-void BKE_curve_bevelList_make(Object *ob)
+void makeBevelList(Object *ob)
{
/*
* - convert all curves to polys, with indication of resol and flags for double-vertices
@@ -2112,7 +2112,7 @@ void BKE_curve_bevelList_make(Object *ob)
BLI_freelistN(&(cu->bev));
if (cu->editnurb && ob->type!=OB_FONT) {
- ListBase *nurbs= BKE_curve_editNurbs_get(cu);
+ ListBase *nurbs= curve_editnurbs(cu);
nu = nurbs->first;
}
else {
@@ -2128,7 +2128,7 @@ void BKE_curve_bevelList_make(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 (!BKE_nurb_check_valid_u(nu)) {
+ if (!check_valid_nurb_u(nu)) {
bl= MEM_callocN(sizeof(BevList)+1*sizeof(BevPoint), "makeBevelList1");
BLI_addtail(&(cu->bev), bl);
bl->nr= 0;
@@ -2201,7 +2201,7 @@ void BKE_curve_bevelList_make(Object *ob)
/* BevPoint must stay aligned to 4 so sizeof(BevPoint)/sizeof(float) works */
for (j=0; j<3; j++) {
- BKE_curve_forward_diff_bezier( prevbezt->vec[1][j], prevbezt->vec[2][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));
}
@@ -2256,7 +2256,7 @@ void BKE_curve_bevelList_make(Object *ob)
else bl->poly= -1;
bevp= (BevPoint *)(bl+1);
- BKE_nurb_makeCurve( nu, &bevp->vec[0],
+ makeNurbcurve( nu, &bevp->vec[0],
do_tilt ? &bevp->alfa : NULL,
do_radius ? &bevp->radius : NULL,
do_weight ? &bevp->weight : NULL,
@@ -2719,18 +2719,18 @@ static void calchandlesNurb_intern(Nurb *nu, int skip_align)
}
}
-void BKE_nurb_handle_calc(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
+void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
{
calchandleNurb_intern(bezt, prev, next, mode, FALSE);
}
-void BKE_nurb_handles_calc(Nurb *nu) /* first, if needed, set handle flags */
+void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */
{
calchandlesNurb_intern(nu, FALSE);
}
-void BKE_nurb_handles_test(Nurb *nu)
+void testhandlesNurb(Nurb *nu)
{
/* use when something has changed with handles.
* it treats all BezTriples with the following rules:
@@ -2770,10 +2770,10 @@ void BKE_nurb_handles_test(Nurb *nu)
bezt++;
}
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(nu);
}
-void BKE_nurb_handles_autocalc(Nurb *nu, int flag)
+void autocalchandlesNurb(Nurb *nu, int flag)
{
/* checks handle coordinates and calculates type */
@@ -2841,21 +2841,21 @@ void BKE_nurb_handles_autocalc(Nurb *nu, int flag)
bezt2++;
}
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(nu);
}
-void BKE_nurbList_handles_autocalc(ListBase *editnurb, int flag)
+void autocalchandlesNurb_all(ListBase *editnurb, int flag)
{
Nurb *nu;
nu= editnurb->first;
while (nu) {
- BKE_nurb_handles_autocalc(nu, flag);
+ autocalchandlesNurb(nu, flag);
nu= nu->next;
}
}
-void BKE_nurbList_handles_set(ListBase *editnurb, short code)
+void sethandlesNurb(ListBase *editnurb, short code)
{
/* code==1: set autohandle */
/* code==2: set vectorhandle */
@@ -2884,7 +2884,7 @@ void BKE_nurbList_handles_set(ListBase *editnurb, short code)
}
bezt++;
}
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(nu);
}
nu= nu->next;
}
@@ -2928,7 +2928,7 @@ void BKE_nurbList_handles_set(ListBase *editnurb, short code)
bezt++;
}
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(nu);
}
nu= nu->next;
}
@@ -2958,7 +2958,7 @@ static void swapdata(void *adr1, void *adr2, int len)
}
}
-void BKE_nurb_direction_switch(Nurb *nu)
+void switchdirectionNurb(Nurb *nu)
{
BezTriple *bezt1, *bezt2;
BPoint *bp1, *bp2;
@@ -3064,9 +3064,9 @@ void BKE_nurb_direction_switch(Nurb *nu)
}
-float (*BKE_curve_vertexCos_get(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3]
+float (*curve_getVertexCos(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3]
{
- int i, numVerts = *numVerts_r = BKE_nurbList_verts_count(lb);
+ int i, numVerts = *numVerts_r = count_curveverts(lb);
float *co, (*cos)[3] = MEM_mallocN(sizeof(*cos)*numVerts, "cu_vcos");
Nurb *nu;
@@ -3093,7 +3093,7 @@ float (*BKE_curve_vertexCos_get(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r
return cos;
}
-void BK_curve_vertexCos_apply(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3])
+void curve_applyVertexCos(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3])
{
float *co = vertexCos[0];
Nurb *nu;
@@ -3121,9 +3121,9 @@ void BK_curve_vertexCos_apply(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos
}
}
-float (*BKE_curve_keyVertexCos_get(Curve *UNUSED(cu), ListBase *lb, float *key))[3]
+float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3]
{
- int i, numVerts = BKE_nurbList_verts_count(lb);
+ int i, numVerts = count_curveverts(lb);
float *co, (*cos)[3] = MEM_mallocN(sizeof(*cos)*numVerts, "cu_vcos");
Nurb *nu;
@@ -3152,7 +3152,7 @@ float (*BKE_curve_keyVertexCos_get(Curve *UNUSED(cu), ListBase *lb, float *key))
return cos;
}
-void BKE_curve_keyVertexTilts_apply(Curve *UNUSED(cu), ListBase *lb, float *key)
+void curve_applyKeyVertexTilts(Curve *UNUSED(cu), ListBase *lb, float *key)
{
Nurb *nu;
int i;
@@ -3179,7 +3179,7 @@ void BKE_curve_keyVertexTilts_apply(Curve *UNUSED(cu), ListBase *lb, float *key)
}
}
-int BKE_nurb_check_valid_u( struct Nurb *nu )
+int check_valid_nurb_u( struct Nurb *nu )
{
if (nu==NULL) return 0;
if (nu->pntsu <= 1) return 0;
@@ -3194,7 +3194,7 @@ int BKE_nurb_check_valid_u( struct Nurb *nu )
}
return 1;
}
-int BKE_nurb_check_valid_v( struct Nurb *nu)
+int check_valid_nurb_v( struct Nurb *nu)
{
if (nu==NULL) return 0;
if (nu->pntsv <= 1) return 0;
@@ -3210,7 +3210,7 @@ int BKE_nurb_check_valid_v( struct Nurb *nu)
return 1;
}
-int BKE_nurb_order_clamp_u( struct Nurb *nu )
+int clamp_nurb_order_u( struct Nurb *nu )
{
int change = 0;
if (nu->pntsu<nu->orderu) {
@@ -3224,7 +3224,7 @@ int BKE_nurb_order_clamp_u( struct Nurb *nu )
return change;
}
-int BKE_nurb_order_clamp_v( struct Nurb *nu)
+int clamp_nurb_order_v( struct Nurb *nu)
{
int change = 0;
if (nu->pntsv<nu->orderv) {
@@ -3239,10 +3239,10 @@ int BKE_nurb_order_clamp_v( struct Nurb *nu)
}
/* Get edit nurbs or normal nurbs list */
-ListBase *BKE_curve_nurbs_get(Curve *cu)
+ListBase *BKE_curve_nurbs(Curve *cu)
{
if (cu->editnurb) {
- return BKE_curve_editNurbs_get(cu);
+ return curve_editnurbs(cu);
}
return &cu->nurb;
@@ -3250,20 +3250,20 @@ ListBase *BKE_curve_nurbs_get(Curve *cu)
/* basic vertex data functions */
-int BKE_curve_minmax(Curve *cu, float min[3], float max[3])
+int minmax_curve(Curve *cu, float min[3], float max[3])
{
- ListBase *nurb_lb= BKE_curve_nurbs_get(cu);
+ ListBase *nurb_lb= BKE_curve_nurbs(cu);
Nurb *nu;
for (nu= nurb_lb->first; nu; nu= nu->next)
- BKE_nurb_minmax(nu, min, max);
+ minmaxNurb(nu, min, max);
return (nurb_lb->first != NULL);
}
-int BKE_curve_center_median(Curve *cu, float cent[3])
+int curve_center_median(Curve *cu, float cent[3])
{
- ListBase *nurb_lb= BKE_curve_nurbs_get(cu);
+ ListBase *nurb_lb= BKE_curve_nurbs(cu);
Nurb *nu;
int total= 0;
@@ -3297,11 +3297,11 @@ int BKE_curve_center_median(Curve *cu, float cent[3])
return (total != 0);
}
-int BKE_curve_center_bounds(Curve *cu, float cent[3])
+int curve_center_bounds(Curve *cu, float cent[3])
{
float min[3], max[3];
INIT_MINMAX(min, max);
- if (BKE_curve_minmax(cu, min, max)) {
+ if (minmax_curve(cu, min, max)) {
mid_v3_v3v3(cent, min, max);
return 1;
}
@@ -3309,9 +3309,9 @@ int BKE_curve_center_bounds(Curve *cu, float cent[3])
return 0;
}
-void BKE_curve_translate(Curve *cu, float offset[3], int do_keys)
+void curve_translate(Curve *cu, float offset[3], int do_keys)
{
- ListBase *nurb_lb= BKE_curve_nurbs_get(cu);
+ ListBase *nurb_lb= BKE_curve_nurbs(cu);
Nurb *nu;
int i;
@@ -3346,9 +3346,9 @@ void BKE_curve_translate(Curve *cu, float offset[3], int do_keys)
}
}
-void BKE_curve_delete_material_index(Curve *cu, int index)
+void curve_delete_material_index(Curve *cu, int index)
{
- const int curvetype= BKE_curve_type_get(cu);
+ const int curvetype= curve_type(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 ee8e57d5a3e..957144bca47 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -71,7 +71,11 @@ typedef struct LayerTypeInfo {
int size; /* the memory size of one element of this layer's data */
const char *structname; /* name of the struct used, for file writing */
int structnum; /* number of structs per element, for file writing */
- const char *defaultname; /* default layer name */
+
+ /* default layer name.
+ * note! when NULL this is a way to ensure there is only ever one item
+ * see: CustomData_layertype_is_singleton() */
+ const char *defaultname;
/* a function to copy count elements of this layer's data
* (deep copy if appropriate)
@@ -2337,10 +2341,7 @@ 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;
}
@@ -2601,6 +2602,16 @@ const char *CustomData_layertype_name(int type)
return layerType_getName(type);
}
+
+/**
+ * Can only ever be one of these.
+ */
+int CustomData_layertype_is_singleton(int type)
+{
+ const LayerTypeInfo *typeInfo = layerType_getInfo(type);
+ return typeInfo->defaultname == NULL;
+}
+
static int CustomData_is_property_layer(int type)
{
if ((type == CD_PROP_FLT) || (type == CD_PROP_INT) || (type == CD_PROP_STR))
@@ -2687,9 +2698,7 @@ 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 3e0c947ff4a..1232177fa10 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -479,7 +479,7 @@ void flip_side_name(char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_
/* first case; separator . - _ with extensions r R l L */
if (is_char_sep(name[len - 2]) ) {
- switch (name[len - 1]) {
+ switch(name[len - 1]) {
case 'l':
prefix[len - 1] = 0;
strcpy(replace, "r");
@@ -500,7 +500,7 @@ void flip_side_name(char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_
}
/* case; beginning with r R l L , with separator after it */
else if (is_char_sep(name[1]) ) {
- switch (name[0]) {
+ 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 045d85242f1..aa6d42977ca 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -462,7 +462,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
if (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");
break;
@@ -539,7 +539,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
break;
case OB_MBALL:
{
- Object *mom= BKE_metaball_basis_find(scene, ob);
+ Object *mom= find_basis_mball(scene, ob);
if (mom!=ob) {
node2 = dag_get_node(dag, mom);
@@ -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) {
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 3d79386e19a..01d5d6ef2ad 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -1,5 +1,4 @@
/*
-
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -229,7 +228,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);
@@ -297,7 +296,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
else
resolu= nu->resolu;
- if (!BKE_nurb_check_valid_u(nu));
+ if (!check_valid_nurb_u(nu));
else if (nu->type == CU_BEZIER) {
/* count */
@@ -352,7 +351,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
else {
int j;
for (j=0; j<3; j++) {
- BKE_curve_forward_diff_bezier( prevbezt->vec[1][j],
+ forward_diff_bezier( prevbezt->vec[1][j],
prevbezt->vec[2][j],
bezt->vec[0][j],
bezt->vec[1][j],
@@ -385,7 +384,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;
- BKE_nurb_makeCurve(nu, data, NULL, NULL, NULL, resolu, 3*sizeof(float));
+ makeNurbcurve(nu, data, NULL, NULL, NULL, resolu, 3*sizeof(float));
}
else if (nu->type == CU_POLY) {
len= nu->pntsu;
@@ -673,9 +672,9 @@ void makeDispListMBall(Scene *scene, Object *ob)
freedisplist(&(ob->disp));
if (ob->type==OB_MBALL) {
- if (ob==BKE_metaball_basis_find(scene, ob)) {
- BKE_metaball_polygonize(scene, ob, &ob->disp);
- BKE_metaball_tex_space_calc(ob);
+ if (ob==find_basis_mball(scene, ob)) {
+ metaball_polygonize(scene, ob, &ob->disp);
+ tex_space_mball(ob);
object_deform_mball(ob, &ob->disp);
}
@@ -686,8 +685,8 @@ void makeDispListMBall(Scene *scene, Object *ob)
void makeDispListMBall_forRender(Scene *scene, Object *ob, ListBase *dispbase)
{
- BKE_metaball_polygonize(scene, ob, dispbase);
- BKE_metaball_tex_space_calc(ob);
+ metaball_polygonize(scene, ob, dispbase);
+ tex_space_mball(ob);
object_deform_mball(ob, dispbase);
}
@@ -731,7 +730,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_get(cu);
+ ListBase *nurb= BKE_curve_nurbs(cu);
int numVerts = 0;
int editmode = (!forRender && cu->editnurb);
float (*originalVerts)[3] = NULL;
@@ -754,9 +753,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= BKE_curve_keyVertexCos_get(cu, nurb, keyVerts);
+ deformedVerts= curve_getKeyVertexCos(cu, nurb, keyVerts);
originalVerts= MEM_dupallocN(deformedVerts);
- numVerts = BKE_nurbList_verts_count_without_handles(nurb);
+ numVerts = count_curveverts_without_handles(nurb);
}
}
@@ -771,7 +770,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
if (mti->type!=eModifierTypeType_OnlyDeform) continue;
if (!deformedVerts) {
- deformedVerts = BKE_curve_vertexCos_get(cu, nurb, &numVerts);
+ deformedVerts = curve_getVertexCos(cu, nurb, &numVerts);
originalVerts = MEM_dupallocN(deformedVerts);
}
@@ -783,9 +782,9 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
}
if (deformedVerts)
- BK_curve_vertexCos_apply(cu, nurb, deformedVerts);
+ curve_applyVertexCos(cu, nurb, deformedVerts);
if (keyVerts) /* these are not passed through modifier stack */
- BKE_curve_keyVertexTilts_apply(cu, nurb, keyVerts);
+ curve_applyKeyVertexTilts(cu, nurb, keyVerts);
if (keyVerts)
MEM_freeN(keyVerts);
@@ -835,7 +834,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_get(cu);
+ ListBase *nurb= BKE_curve_nurbs(cu);
int required_mode = 0, totvert = 0;
int editmode = (!forRender && cu->editnurb);
DerivedMesh *dm= NULL, *ndm;
@@ -957,7 +956,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
}
if (deformedVerts) {
- BK_curve_vertexCos_apply(ob->data, nurb, originalVerts);
+ curve_applyVertexCos(ob->data, nurb, originalVerts);
MEM_freeN(originalVerts);
MEM_freeN(deformedVerts);
}
@@ -1024,7 +1023,7 @@ static void add_orco_dm(Scene *scene, Object *ob, DerivedMesh *dm, DerivedMesh *
dm->getVertCos(dm, orco);
}
else {
- orco= (float(*)[3])BKE_curve_make_orco(scene, ob);
+ orco= (float(*)[3])make_orco_curve(scene, ob);
}
for (a=0; a<totvert; a++) {
@@ -1109,7 +1108,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
float (*deformedVerts)[3];
if (!forRender && cu->editnurb)
- nubase= BKE_curve_editNurbs_get(cu);
+ nubase= curve_editnurbs(cu);
else
nubase= &cu->nurb;
@@ -1145,7 +1144,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
if (nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
else dl->type= DL_SEGM;
- BKE_nurb_makeCurve(nu, data, NULL, NULL, NULL, resolu, 3*sizeof(float));
+ makeNurbcurve(nu, data, NULL, NULL, NULL, resolu, 3*sizeof(float));
}
else {
len= (nu->pntsu*resolu) * (nu->pntsv*resolv);
@@ -1169,7 +1168,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;
- BKE_nurb_makeFaces(nu, data, 0, resolu, resolv);
+ makeNurbfaces(nu, data, 0, resolu, resolv);
/* gl array drawing: using indices */
displist_surf_indices(dl);
@@ -1183,7 +1182,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
copy_displist(&cu->disp, dispbase);
if (!forRender) {
- BKE_curve_tex_space_calc(cu);
+ tex_space_curve(cu);
}
if (!forOrco)
@@ -1263,7 +1262,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
float (*deformedVerts)[3];
int numVerts;
- nubase= BKE_curve_nurbs_get(cu);
+ nubase= BKE_curve_nurbs(cu);
BLI_freelistN(&(cu->bev));
@@ -1274,10 +1273,10 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
if (!forOrco) curve_calc_modifiers_pre(scene, ob, forRender, &originalVerts, &deformedVerts, &numVerts);
- BKE_curve_bevelList_make(ob);
+ makeBevelList(ob);
/* If curve has no bevel will return nothing */
- BKE_curve_bevel_make(scene, ob, &dlbev, forRender);
+ makebevelcurve(scene, ob, &dlbev, forRender);
/* no bevel or extrude, and no width correction? */
if (!dlbev.first && cu->width==1.0f) {
@@ -1411,7 +1410,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
copy_displist(&cu->disp, dispbase);
if (!forRender) {
- BKE_curve_tex_space_calc(cu);
+ tex_space_curve(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 e6f38a3a334..9ce4d68eeed 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -231,22 +231,13 @@ 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;
- }
- }
- else {
- return 1;
+ surface->type == MOD_DPAINT_SURFACE_T_WAVE) return 0;
+ else return 1;
}
+ else return 1;
}
/* get currently active surface (in user interface) */
@@ -402,15 +393,11 @@ 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;
}
@@ -561,7 +548,8 @@ static int surface_getBrushFlags(DynamicPaintSurface *surface, Scene *scene)
else
base = scene->base.first;
- while (base || go) {
+ while (base || go)
+ {
brushObj = NULL;
/* select object */
@@ -571,7 +559,8 @@ 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;
@@ -583,10 +572,12 @@ 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)
@@ -897,10 +888,8 @@ 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)
@@ -1230,13 +1219,9 @@ 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;
- }
- else {
- return 0;
- }
+ surface->flags & MOD_DPAINT_ANTIALIAS) return 1;
+
+ return 0;
}
/* initialize surface adjacency data */
@@ -1309,12 +1294,10 @@ 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;
}
@@ -1880,10 +1863,8 @@ 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);
@@ -2061,12 +2042,9 @@ 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
@@ -2207,9 +2185,11 @@ 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]);
@@ -2277,7 +2257,8 @@ 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
@@ -2349,9 +2330,11 @@ 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]);
@@ -2425,9 +2408,11 @@ 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]);
@@ -2455,9 +2440,11 @@ 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) {
@@ -2589,7 +2576,8 @@ 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 */
@@ -2771,7 +2759,8 @@ 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;
@@ -2791,7 +2780,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[3], BVHTreeNearest *nearest)
+static void mesh_faces_nearest_point_dp(void *userdata, int index, const float *co, BVHTreeNearest *nearest)
{
const BVHTreeFromMesh *data = (BVHTreeFromMesh*) userdata;
MVert *vert = data->vert;
@@ -2810,7 +2799,8 @@ static void mesh_faces_nearest_point_dp(void *userdata, int index, const float c
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);
@@ -3198,7 +3188,8 @@ 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];
@@ -3212,7 +3203,8 @@ 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;
@@ -3228,7 +3220,8 @@ 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;
@@ -3270,7 +3263,8 @@ 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 */
@@ -3283,7 +3277,8 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
/* 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;
@@ -3347,7 +3342,8 @@ 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);
@@ -3450,7 +3446,8 @@ 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;
@@ -3592,7 +3589,8 @@ 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];
@@ -3605,14 +3603,13 @@ 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;
@@ -3717,7 +3714,8 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
}
}
- if (strength > 0.001f) {
+ if (strength > 0.001f)
+ {
float paintColor[4] = {0.0f};
float depth = 0.0f;
@@ -3783,7 +3781,8 @@ 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;
@@ -3892,7 +3891,8 @@ static void dynamicPaint_prepareAdjacencyData(DynamicPaintSurface *surface, int
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,7 +3911,8 @@ 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];
@@ -4079,7 +4080,8 @@ 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 */
@@ -4119,7 +4121,8 @@ 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;
@@ -4168,7 +4171,8 @@ 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];
@@ -4210,7 +4214,8 @@ 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;
@@ -4251,7 +4256,8 @@ 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));
@@ -4329,7 +4335,8 @@ 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];
@@ -4428,7 +4435,8 @@ 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];
@@ -4643,7 +4651,8 @@ 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);
@@ -4787,7 +4796,8 @@ 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) {
@@ -4811,10 +4821,12 @@ 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 263f89a363e..5f97e02fa0d 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_grow_one(looptris);
+ BLI_array_growone(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_grow_items(looptris, 2);
+ BLI_array_growitems(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_grow_items(looptris, totfilltri);
+ BLI_array_growitems(looptris, totfilltri);
for (efa = sf_ctx.fillfacebase.first; efa; efa=efa->next) {
BMLoop *l1= efa->v1->tmp.p;
@@ -815,7 +815,6 @@ static void emDM_drawFacesTex_common(
if (vertexCos) {
BM_mesh_elem_index_ensure(bm, BM_VERT);
- glBegin(GL_TRIANGLES);
for (i=0; i<em->tottri; i++) {
BMLoop **ls = em->looptris[i];
MTexPoly *tp= has_uv ? CustomData_bmesh_get(&bm->pdata, ls[0]->f->head.data, CD_MTEXPOLY) : NULL;
@@ -839,6 +838,7 @@ static void emDM_drawFacesTex_common(
if (draw_option != DM_DRAW_OPTION_SKIP) {
+ glBegin(GL_TRIANGLES);
if (!drawSmooth) {
glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]);
@@ -880,9 +880,9 @@ static void emDM_drawFacesTex_common(
glNormal3fv(vertexNos[BM_elem_index_get(ls[2]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ls[2]->v)]);
}
+ glEnd();
}
}
- glEnd();
}
else {
BM_mesh_elem_index_ensure(bm, BM_VERT);
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index c275d4ef0ac..4f320b41184 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,7 +419,8 @@ 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)
@@ -505,8 +506,7 @@ 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,7 +529,6 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU
falloff*= falloff_func_rad(eff->pd, r_fac);
break;
- }
}
return falloff;
@@ -836,7 +835,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);
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index e85432581d5..bb8cfe37a88 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -800,7 +800,7 @@ 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 */
- BKE_nurb_handle_calc(bezt, prev, next, 1); /* 1==special autohandle */
+ calchandleNurb(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)) {
@@ -1655,7 +1655,8 @@ static float evaluate_driver (ChannelDriver *driver, const float evaltime)
{
driver->curval= 0.0f;
}
- else {
+ else
+ {
/* this evaluates the expression using Python,and returns its result:
* - on errors it reports, then returns 0.0f
*/
diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c
index a930818dd15..131f30a76c9 100644
--- a/source/blender/blenkernel/intern/fluidsim.c
+++ b/source/blender/blenkernel/intern/fluidsim.c
@@ -78,7 +78,8 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob,
int *tris;
dm = mesh_create_derived_index_render(scene, ob, CD_MASK_BAREMESH, modifierIndex);
- //dm = mesh_create_derived_no_deform(ob,NULL);
+
+ DM_ensure_tessface(dm);
mvert = dm->getVertArray(dm);
mface = dm->getTessFaceArray(dm);
@@ -122,3 +123,4 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob,
dm->release(dm);
}
+
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 0b722aabd4c..ed5cf5e7924 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -318,7 +318,8 @@ 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;
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 5d7960a9823..b2759f18e9b 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -68,7 +68,8 @@ 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) {
@@ -135,7 +136,8 @@ 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;
@@ -278,7 +280,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:
@@ -395,7 +397,8 @@ 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");
@@ -819,15 +822,10 @@ 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++)
- {
- /* pass */
- }
-
+ 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++);
if ((mem[j]!='\r') && (mem[j]!='\n') &&
((chartransdata[j].dobreak!=0))) {
if (mem[i]==' ') curofs += (linedata3[ct->linenr]-linedata[ct->linenr])/linedata4[ct->linenr];
@@ -835,7 +833,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++;
- }
+ }
}
}
@@ -952,7 +950,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;
@@ -1011,7 +1009,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
if (mode == FO_EDIT) {
/* make nurbdata */
- BKE_nurbList_free(&cu->nurb);
+ freeNurblist(&cu->nurb);
ct= chartransdata;
if (cu->sepchar==0) {
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index dfe73ae20db..bb51325a6ef 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -581,7 +581,8 @@ 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 5c9c942cc6c..6e0330f5316 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:
@@ -1110,11 +1110,8 @@ 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
@@ -1794,7 +1791,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)
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c
index 1441bd7b12b..675c0771140 100644
--- a/source/blender/blenkernel/intern/image_gen.c
+++ b/source/blender/blenkernel/intern/image_gen.c
@@ -169,10 +169,12 @@ 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);
@@ -289,10 +291,12 @@ 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 b593419db9f..a4edc1e531a 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -178,7 +178,8 @@ 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]);
}
}
@@ -192,7 +193,8 @@ 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);
}
@@ -206,7 +208,8 @@ 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);
}
}
@@ -220,7 +223,8 @@ 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);
}
}
@@ -229,7 +233,8 @@ 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);
}
}
@@ -253,7 +258,8 @@ 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]);
}
@@ -263,7 +269,8 @@ 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);
}
@@ -273,7 +280,8 @@ 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);
}
}
@@ -281,7 +289,8 @@ 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);
}
@@ -291,7 +300,8 @@ 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]);
}
@@ -340,12 +350,15 @@ 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;
@@ -522,7 +535,8 @@ 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);
}
}
@@ -540,7 +554,8 @@ 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);
}
}
@@ -552,10 +567,12 @@ 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}};
- 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);
}
}
@@ -564,7 +581,8 @@ 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);
}
}
@@ -583,13 +601,15 @@ 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]);
}
}
@@ -607,7 +627,8 @@ 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]);
}
}
@@ -618,7 +639,8 @@ 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);
}
@@ -629,7 +651,8 @@ 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);
}
@@ -640,7 +663,8 @@ 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);
}
@@ -651,7 +675,8 @@ 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);
}
@@ -662,7 +687,8 @@ 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);
}
@@ -673,7 +699,8 @@ 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);
}
@@ -686,7 +713,8 @@ 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);
}
@@ -744,10 +772,12 @@ 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++;
@@ -761,7 +791,8 @@ 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 =
@@ -779,7 +810,8 @@ 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);
}
@@ -791,10 +823,12 @@ int implicit_free (ClothModifierData *clmd)
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);
@@ -852,10 +886,12 @@ 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);
}
}
@@ -864,7 +900,8 @@ 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);
}
}
@@ -899,7 +936,8 @@ static int cg_filtered(lfVector *ldV, fmatrix3x3 *lA, lfVector *lB, lfVector *z
s = dot_lfvector(r, r, numverts);
starget = s * sqrt(conjgrad_epsilon);
- while (s>starget && conjgrad_loopcount < conjgrad_looplimit) {
+ while (s>starget && conjgrad_loopcount < conjgrad_looplimit)
+ {
// Mul(q,A,d); // q = A*d;
mul_bfmatrix_lfvector(q, lA, d);
@@ -941,7 +979,8 @@ 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);
@@ -1216,7 +1255,8 @@ 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)
{
@@ -1230,13 +1270,16 @@ 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;
@@ -1294,8 +1337,10 @@ 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;
@@ -1313,8 +1358,10 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
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);
@@ -1439,7 +1486,8 @@ 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];
@@ -1545,7 +1593,8 @@ 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);
@@ -1554,7 +1603,8 @@ 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);
@@ -1562,12 +1612,14 @@ 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++) {
+ 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};
@@ -1598,7 +1650,8 @@ 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);
@@ -1639,7 +1692,8 @@ 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);
@@ -1649,7 +1703,8 @@ 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);
@@ -1781,17 +1836,21 @@ 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);
@@ -1805,10 +1864,13 @@ 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.0f, 0.0f, 0.0f};
+ 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};
sub_v3_v3v3(tvect, verts[i].xconst, verts[i].xold);
mul_fvector_S(tvect, tvect, step+dt);
VECADD(tvect, tvect, verts[i].xold);
@@ -1819,12 +1881,14 @@ 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);
@@ -1840,7 +1904,8 @@ 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]);
}
@@ -1848,9 +1913,11 @@ 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;
@@ -1866,7 +1933,8 @@ 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);
@@ -1876,7 +1944,8 @@ 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);
}
@@ -1890,13 +1959,16 @@ 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]);
@@ -1915,7 +1987,8 @@ void implicit_set_positions (ClothModifierData *clmd)
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 c33bb973385..2fd1d291363 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -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 54a2613991a..0a1c0467244 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 = BKE_nurbList_verts_count(nurb);
+ tot = count_curveverts(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 = BKE_nurbList_verts_count(nurb);
+ tot = count_curveverts(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 = BKE_nurbList_verts_count(&cu->nurb);
+ tot = count_curveverts(&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 = BKE_nurbList_verts_count(&cu->nurb);
+ tot = count_curveverts(&cu->nurb);
}
if (tot == 0) {
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 12f11a9dee1..f182d7bcb7c 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -342,7 +342,7 @@ void init_latt_deform(Object *oblatt, Object *ob)
}
}
-void calc_latt_deform(Object *ob, float co[3], float weight)
+void calc_latt_deform(Object *ob, float *co, float weight)
{
Lattice *lt= ob->data;
float u, v, w, tu[4], tv[4], tw[4];
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 71266275fbd..7e756e853b1 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) {
- BKE_curve_make_local((Curve*)id);
+ make_local_curve((Curve*)id);
make_local_key(((Curve*)id)->key);
}
return 1;
case ID_MB:
- if (!test) BKE_metaball_make_local((MetaBall*)id);
+ if (!test) make_local_mball((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*)BKE_curve_copy((Curve*)id);
+ if (!test) *newid= (ID*)copy_curve((Curve*)id);
return 1;
case ID_MB:
- if (!test) *newid= (ID*)BKE_metaball_copy((MetaBall*)id);
+ if (!test) *newid= (ID*)copy_mball((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:
- BKE_curve_free((Curve *)id);
+ free_curve((Curve *)id);
break;
case ID_MB:
- BKE_metaball_free((MetaBall *)id);
+ free_mball((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:
- BKE_movieclip_free((MovieClip *)id);
+ free_movieclip((MovieClip *)id);
break;
}
@@ -1010,7 +1010,8 @@ 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 */
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 2dfd41f299a..6d44282c60a 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:
- BKE_curve_delete_material_index((Curve *)id, index);
+ curve_delete_material_index((Curve *)id, index);
break;
case ID_MB:
/* meta-elems don't have materials atm */
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 73e3576b57f..c06d796d562 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -65,106 +65,6 @@
#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;
@@ -173,7 +73,7 @@ static MetaElem **mainb;
static octal_tree *metaball_tree = NULL;
/* Functions */
-void BKE_metaball_unlink(MetaBall *mb)
+void unlink_mball(MetaBall *mb)
{
int a;
@@ -185,9 +85,9 @@ void BKE_metaball_unlink(MetaBall *mb)
/* do not free mball itself */
-void BKE_metaball_free(MetaBall *mb)
+void free_mball(MetaBall *mb)
{
- BKE_metaball_unlink(mb);
+ unlink_mball(mb);
if (mb->adt) {
BKE_free_animdata((ID *)mb);
@@ -199,7 +99,7 @@ void BKE_metaball_free(MetaBall *mb)
if (mb->disp.first) freedisplist(&mb->disp);
}
-MetaBall *BKE_metaball_add(const char *name)
+MetaBall *add_mball(const char *name)
{
MetaBall *mb;
@@ -215,7 +115,7 @@ MetaBall *BKE_metaball_add(const char *name)
return mb;
}
-MetaBall *BKE_metaball_copy(MetaBall *mb)
+MetaBall *copy_mball(MetaBall *mb)
{
MetaBall *mbn;
int a;
@@ -243,7 +143,7 @@ static void extern_local_mball(MetaBall *mb)
}
}
-void BKE_metaball_make_local(MetaBall *mb)
+void make_local_mball(MetaBall *mb)
{
Main *bmain= G.main;
Object *ob;
@@ -274,7 +174,7 @@ void BKE_metaball_make_local(MetaBall *mb)
extern_local_mball(mb);
}
else if (is_local && is_lib) {
- MetaBall *mb_new= BKE_metaball_copy(mb);
+ MetaBall *mb_new= copy_mball(mb);
mb_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
@@ -294,7 +194,7 @@ void BKE_metaball_make_local(MetaBall *mb)
/* most simple meta-element adding function
* don't do context manipulation here (rna uses) */
-MetaElem *BKE_metaball_element_add(MetaBall *mb, const int type)
+MetaElem *add_metaball_element(MetaBall *mb, const int type)
{
MetaElem *ml= MEM_callocN(sizeof(MetaElem), "metaelem");
@@ -304,7 +204,7 @@ MetaElem *BKE_metaball_element_add(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;
@@ -346,7 +246,7 @@ MetaElem *BKE_metaball_element_add(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 BKE_metaball_tex_space_calc(Object *ob)
+void tex_space_mball(Object *ob)
{
DispList *dl;
BoundBox *bb;
@@ -390,7 +290,7 @@ void BKE_metaball_tex_space_calc(Object *ob)
boundbox_set_from_min_max(bb, min, max);
}
-float *BKE_metaball_make_orco(Object *ob, ListBase *dispbase)
+float *make_orco_mball(Object *ob, ListBase *dispbase)
{
BoundBox *bb;
DispList *dl;
@@ -442,7 +342,7 @@ float *BKE_metaball_make_orco(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 BKE_metaball_is_basis(Object *ob)
+int is_basis_mball(Object *ob)
{
int len;
@@ -453,7 +353,7 @@ int BKE_metaball_is_basis(Object *ob)
}
/* return nonzero if ob1 is a basis mball for ob */
-int BKE_metaball_is_basis_for (Object *ob1, Object *ob2)
+int is_mball_basis_for (Object *ob1, Object *ob2)
{
int basis1nr, basis2nr;
char basis1name[MAX_ID_NAME], basis2name[MAX_ID_NAME];
@@ -461,7 +361,7 @@ int BKE_metaball_is_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 BKE_metaball_is_basis(ob1);
+ if (!strcmp(basis1name, basis2name)) return is_basis_mball(ob1);
else return 0;
}
@@ -471,7 +371,7 @@ int BKE_metaball_is_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 BKE_metaball_properties_copy(Scene *scene, Object *active_object)
+void copy_mball_properties(Scene *scene, Object *active_object)
{
Scene *sce_iter= scene;
Base *base;
@@ -516,7 +416,7 @@ void BKE_metaball_properties_copy(Scene *scene, Object *active_object)
*
* warning!, is_basis_mball() can fail on returned object, see long note above.
*/
-Object *BKE_metaball_basis_find(Scene *scene, Object *basis)
+Object *find_basis_mball(Scene *scene, Object *basis)
{
Scene *sce_iter= scene;
Base *base;
@@ -622,14 +522,14 @@ Object *BKE_metaball_basis_find(Scene *scene, Object *basis)
/* **************** POLYGONIZATION ************************ */
-static void calc_mballco(MetaElem *ml, float vec[3])
+void calc_mballco(MetaElem *ml, float vec[3])
{
if (ml->mat) {
mul_m4_v3((float (*)[4])ml->mat, vec);
}
}
-static float densfunc(MetaElem *ball, float x, float y, float z)
+float densfunc(MetaElem *ball, float x, float y, float z)
{
float dist2 = 0.0, dx, dy, dz;
float vec[3];
@@ -705,7 +605,7 @@ static float densfunc(MetaElem *ball, float x, float y, float z)
}
}
-static octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z, short depth)
+octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z, short depth)
{
if (!depth) return node;
@@ -773,7 +673,7 @@ static octal_node* find_metaball_octal_node(octal_node *node, float x, float y,
return node;
}
-static float metaball(float x, float y, float z)
+float metaball(float x, float y, float z)
/* float x, y, z; */
{
struct octal_node *node;
@@ -813,7 +713,7 @@ static int *indices=NULL;
static int totindex, curindex;
-static void accum_mballfaces(int i1, int i2, int i3, int i4)
+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 */
@@ -846,7 +746,7 @@ static void accum_mballfaces(int i1, int i2, int i3, int i4)
}
/* ******************* MEMORY MANAGEMENT *********************** */
-static void *new_pgn_element(int size)
+void *new_pgn_element(int size)
{
/* during polygonize 1000s of elements are allocated
* and never freed in between. Freeing only done at the end.
@@ -889,7 +789,7 @@ static void *new_pgn_element(int size)
return cur->data;
}
-static void freepolygonize(PROCESS *p)
+void freepolygonize(PROCESS *p)
{
MEM_freeN(p->corners);
MEM_freeN(p->edges);
@@ -932,7 +832,7 @@ static int rightface[12] = {
/* docube: triangulate the cube directly, without decomposition */
-static void docube(CUBE *cube, PROCESS *p, MetaBall *mb)
+void docube(CUBE *cube, PROCESS *p, MetaBall *mb)
{
INTLISTS *polys;
CORNER *c1, *c2;
@@ -953,7 +853,7 @@ static 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;
@@ -1000,7 +900,7 @@ static 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 */
-static void testface(int i, int j, int k, CUBE* old, int bit, int c1, int c2, int c3, int c4, PROCESS *p)
+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;
@@ -1051,7 +951,7 @@ static void testface(int i, int j, int k, CUBE* old, int bit, int c1, int c2, in
/* setcorner: return corner with the given lattice location
* set (and cache) its function value */
-static CORNER *setcorner (PROCESS* p, int i, int j, int k)
+CORNER *setcorner (PROCESS* p, int i, int j, int k)
{
/* for speed, do corner value caching here */
CORNER *c;
@@ -1086,7 +986,7 @@ static CORNER *setcorner (PROCESS* p, int i, int j, int k)
/* nextcwedge: return next clockwise edge from given edge around given face */
-static int nextcwedge (int edge, int face)
+int nextcwedge (int edge, int face)
{
switch (edge) {
case LB:
@@ -1120,7 +1020,7 @@ static int nextcwedge (int edge, int face)
/* otherface: return face adjoining edge that is not the given face */
-static int otherface (int edge, int face)
+int otherface (int edge, int face)
{
int other = leftface[edge];
return face == other? rightface[edge] : other;
@@ -1129,7 +1029,7 @@ static int otherface (int edge, int face)
/* makecubetable: create the 256 entry table for cubical polygonization */
-static void makecubetable (void)
+void makecubetable (void)
{
static int isdone= 0;
int i, e, c, done[12], pos[8];
@@ -1170,7 +1070,7 @@ static void makecubetable (void)
}
}
-void BKE_metaball_cubeTable_free(void)
+void BKE_freecubetable(void)
{
int i;
INTLISTS *lists, *nlists;
@@ -1200,7 +1100,7 @@ void BKE_metaball_cubeTable_free(void)
/* setcenter: set (i,j,k) entry of table[]
* return 1 if already set; otherwise, set and return 0 */
-static int setcenter(CENTERLIST *table[], int i, int j, int k)
+int setcenter(CENTERLIST *table[], int i, int j, int k)
{
int index;
CENTERLIST *newc, *l, *q;
@@ -1225,7 +1125,7 @@ static int setcenter(CENTERLIST *table[], int i, int j, int k)
/* setedge: set vertex id for edge */
-static void setedge (EDGELIST *table[],
+void setedge (EDGELIST *table[],
int i1, int j1,
int k1, int i2,
int j2, int k2,
@@ -1261,7 +1161,7 @@ static void setedge (EDGELIST *table[],
/* getedge: return vertex id for edge; return -1 if not set */
-static int getedge (EDGELIST *table[],
+int getedge (EDGELIST *table[],
int i1, int j1, int k1,
int i2, int j2, int k2)
{
@@ -1279,13 +1179,10 @@ static 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;
}
@@ -1302,7 +1199,7 @@ static int getedge (EDGELIST *table[],
/* addtovertices: add v to sequence of vertices */
-static void addtovertices (VERTICES *vertices, VERTEX v)
+void addtovertices (VERTICES *vertices, VERTEX v)
{
if (vertices->count == vertices->max) {
int i;
@@ -1320,7 +1217,7 @@ static void addtovertices (VERTICES *vertices, VERTEX v)
/* vnormal: compute unit length surface normal at point */
-static void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v)
+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);
@@ -1370,7 +1267,7 @@ static void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v)
}
-static int vertid (CORNER *c1, CORNER *c2, PROCESS *p, MetaBall *mb)
+int vertid (CORNER *c1, CORNER *c2, PROCESS *p, MetaBall *mb)
{
VERTEX v;
MB_POINT a, b;
@@ -1399,7 +1296,7 @@ static 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 */
-static void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
+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;
@@ -1499,7 +1396,7 @@ static void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
}
/* ************************************** */
-static void add_cube(PROCESS *mbproc, int i, int j, int k, int count)
+void add_cube(PROCESS *mbproc, int i, int j, int k, int count)
{
CUBES *ncube;
int n;
@@ -1529,7 +1426,7 @@ static void add_cube(PROCESS *mbproc, int i, int j, int k, int count)
}
-static void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
+void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
{
MB_POINT IN, in, OUT, out; /*point;*/
MetaElem *ml;
@@ -1649,7 +1546,7 @@ static void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
}
}
-static void polygonize(PROCESS *mbproc, MetaBall *mb)
+void polygonize(PROCESS *mbproc, MetaBall *mb)
{
CUBE c;
int a;
@@ -1689,7 +1586,7 @@ static void polygonize(PROCESS *mbproc, MetaBall *mb)
}
}
-static float init_meta(Scene *scene, Object *ob) /* return totsize */
+float init_meta(Scene *scene, Object *ob) /* return totsize */
{
Scene *sce_iter= scene;
Base *base;
@@ -1915,7 +1812,7 @@ static 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)
*/
-static void fill_metaball_octal_node(octal_node *node, MetaElem *ml, short i)
+void fill_metaball_octal_node(octal_node *node, MetaElem *ml, short i)
{
ml_pointer *ml_p;
@@ -1947,7 +1844,7 @@ static void fill_metaball_octal_node(octal_node *node, MetaElem *ml, short i)
* +------+------+
*
*/
-static void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y, float size_z, short depth)
+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;
@@ -2204,7 +2101,7 @@ static void subdivide_metaball_octal_node(octal_node *node, float size_x, float
}
/* free all octal nodes recursively */
-static void free_metaball_octal_node(octal_node *node)
+void free_metaball_octal_node(octal_node *node)
{
int a;
for (a=0;a<8;a++) {
@@ -2215,7 +2112,7 @@ static void free_metaball_octal_node(octal_node *node)
}
/* If scene include more then one MetaElem, then octree is used */
-static void init_metaball_octal_tree(int depth)
+void init_metaball_octal_tree(int depth)
{
struct octal_node *node;
ml_pointer *ml_p;
@@ -2273,7 +2170,7 @@ static void init_metaball_octal_tree(int depth)
subdivide_metaball_octal_node(node, size[0], size[1], size[2], metaball_tree->depth);
}
-void BKE_metaball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
+void 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 c7f6bf93831..2bcf17a8fc6 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -128,22 +128,18 @@ 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;
@@ -152,16 +148,12 @@ 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;
@@ -1616,7 +1608,7 @@ void mesh_to_curve(Scene *scene, Object *ob)
BLI_edgehash_free(eh, NULL);
if (edges.first) {
- Curve *cu = BKE_curve_add(ob->id.name+2, OB_CURVE);
+ Curve *cu = add_curve(ob->id.name+2, OB_CURVE);
cu->flag |= CU_3D;
while (edges.first) {
@@ -1783,7 +1775,7 @@ void mesh_calc_normals_mapping(MVert *mverts, int numVerts,
{
mesh_calc_normals_mapping_ex(mverts, numVerts, mloop, mpolys,
numLoops, numPolys, polyNors_r, mfaces, numFaces,
- origIndexFace, faceNors_r, TRUE);
+ origIndexFace, faceNors_r, FALSE);
}
void mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts,
@@ -1875,8 +1867,8 @@ void mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpolys,
BLI_array_empty(vertcos);
BLI_array_empty(vertnos);
- BLI_array_grow_items(vertcos, mp->totloop);
- BLI_array_grow_items(vertnos, mp->totloop);
+ BLI_array_growitems(vertcos, mp->totloop);
+ BLI_array_growitems(vertnos, mp->totloop);
for (j=0; j < mp->totloop; j++) {
int vindex = ml[j].v;
@@ -1885,7 +1877,7 @@ void mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpolys,
}
BLI_array_empty(edgevecbuf);
- BLI_array_grow_items(edgevecbuf, mp->totloop);
+ BLI_array_growitems(edgevecbuf, mp->totloop);
accumulate_vertex_normals_poly(vertnos, pnors[i], vertcos, edgevecbuf, mp->totloop);
}
@@ -2422,8 +2414,8 @@ int mesh_recalcTessellation(CustomData *fdata,
#ifdef USE_TESSFACE_SPEEDUP
#define ML_TO_MF(i1, i2, i3) \
- BLI_array_grow_one(mface_to_poly_map); \
- BLI_array_grow_one(mface); \
+ BLI_array_growone(mface_to_poly_map); \
+ BLI_array_growone(mface); \
mface_to_poly_map[mface_index] = poly_index; \
mf= &mface[mface_index]; \
/* set loop indices, transformed to vert indices later */ \
@@ -2441,8 +2433,8 @@ int mesh_recalcTessellation(CustomData *fdata,
/* ALMOST IDENTICAL TO DEFINE ABOVE (see EXCEPTION) */
#define ML_TO_MF_QUAD() \
- BLI_array_grow_one(mface_to_poly_map); \
- BLI_array_grow_one(mface); \
+ BLI_array_growone(mface_to_poly_map); \
+ BLI_array_growone(mface); \
mface_to_poly_map[mface_index] = poly_index; \
mf= &mface[mface_index]; \
/* set loop indices, transformed to vert indices later */ \
@@ -2500,10 +2492,10 @@ int mesh_recalcTessellation(CustomData *fdata,
totfilltri = BLI_edgefill(&sf_ctx, FALSE);
if (totfilltri) {
- BLI_array_grow_items(mface_to_poly_map, totfilltri);
- BLI_array_grow_items(mface, totfilltri);
+ BLI_array_growitems(mface_to_poly_map, totfilltri);
+ BLI_array_growitems(mface, totfilltri);
if (poly_orig_index) {
- BLI_array_grow_items(mface_orig_index, totfilltri);
+ BLI_array_growitems(mface_orig_index, totfilltri);
}
for (f = sf_ctx.fillfacebase.first; f; f = f->next, mf++) {
@@ -2672,7 +2664,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_grow_one(mface);
+ BLI_array_growone(mface);
mf = &mface[k];
mf->mat_nr = mp->mat_nr;
@@ -3062,13 +3054,10 @@ 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/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c
index 99bb3468320..573b8a725b3 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_grow_items(verts, mp->totloop);
- BLI_array_grow_items(edges, mp->totloop);
+ BLI_array_growitems(verts, mp->totloop);
+ BLI_array_growitems(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 d548d7589bb..7eee478def4 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_movieclip_file_add(const char *name)
+MovieClip *BKE_add_movieclip_file(const char *name)
{
MovieClip *clip;
MovieClipUser user;
@@ -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 = clip->lastsize[0];
- *height = clip->lastsize[1];
+ *width = 0;
+ *height = 0;
}
if (ibuf)
@@ -1038,7 +1038,7 @@ void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClip
scopes->track_disabled = FALSE;
- if (ibuf && ibuf->rect) {
+ if (ibuf && (ibuf->rect || ibuf->rect_float)) {
ImBuf *tmpibuf;
MovieTrackingMarker undist_marker = *marker;
@@ -1149,14 +1149,14 @@ void BKE_movieclip_build_proxy_frame(MovieClip *clip, int clip_flag, struct Movi
}
}
-void BKE_movieclip_free(MovieClip *clip)
+void free_movieclip(MovieClip *clip)
{
free_buffers(clip);
BKE_tracking_free(&clip->tracking);
}
-void BKE_movieclip_unlink(Main *bmain, MovieClip *clip)
+void unlink_movieclip(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 d7212e5eaf9..ea61332a392 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -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 */
diff --git a/source/blender/blenkernel/intern/navmesh_conversion.c b/source/blender/blenkernel/intern/navmesh_conversion.c
index 23d2f50c3f7..34e0be1de92 100644
--- a/source/blender/blenkernel/intern/navmesh_conversion.c
+++ b/source/blender/blenkernel/intern/navmesh_conversion.c
@@ -57,7 +57,8 @@ 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++;
@@ -70,7 +71,8 @@ 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]];
@@ -117,7 +119,8 @@ 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;
}
@@ -125,7 +128,8 @@ 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]);
}
@@ -133,7 +137,8 @@ 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++;
@@ -144,13 +149,15 @@ 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;
@@ -180,7 +187,8 @@ 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;
@@ -194,18 +202,22 @@ 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);
@@ -217,10 +229,13 @@ 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");
@@ -236,13 +251,16 @@ 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;
@@ -255,7 +273,8 @@ 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];
@@ -269,13 +288,17 @@ 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;
}
@@ -283,8 +306,10 @@ 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];
}
}
@@ -328,7 +353,8 @@ 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;
}
@@ -344,14 +370,17 @@ 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;
@@ -367,7 +396,8 @@ 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);
}
@@ -375,9 +405,11 @@ 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;
}
@@ -394,10 +426,13 @@ 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;
}
@@ -441,7 +476,8 @@ 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;
}
@@ -449,7 +485,8 @@ int buildNavMeshDataByDerivedMesh(DerivedMesh *dm, int *vertsPerPoly,
res = buildNavMeshData(*nverts, *verts, ntris, tris, recastData, *trisToFacesMap,
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;
}
@@ -464,10 +501,12 @@ 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 5dfeb37b2ee..56fec119cce 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -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 */
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 2fb3f81b147..0fac497850f 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -339,15 +339,15 @@ bNode *nodeAddNode(bNodeTree *ntree, struct bNodeTemplate *ntemp)
node_add_sockets_from_type(ntree, node, ntype);
- if (ntype->initfunc!=NULL)
- ntype->initfunc(ntree, node, ntemp);
-
/* initialize the node name with the node label */
BLI_strncpy(node->name, nodeLabel(node), NODE_MAXSTR);
nodeUniqueName(ntree, node);
BLI_addtail(&ntree->nodes, node);
+ if (ntype->initfunc!=NULL)
+ ntype->initfunc(ntree, node, ntemp);
+
ntree->update |= NTREE_UPDATE_NODES;
return node;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 3ffd8115914..beddf745740 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -319,8 +319,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) BKE_curve_unlink(ob->data);
- else if (ob->type==OB_MBALL) BKE_metaball_unlink(ob->data);
+ else if (ob->type==OB_CURVE) unlink_curve(ob->data);
+ else if (ob->type==OB_MBALL) unlink_mball(ob->data);
}
ob->data= NULL;
}
@@ -459,7 +459,7 @@ void unlink_object(Object *ob)
}
}
else if (ELEM(OB_MBALL, ob->type, obt->type)) {
- if (BKE_metaball_is_basis_for (obt, ob))
+ if (is_mball_basis_for (obt, ob))
obt->recalc|= OB_RECALC_DATA;
}
@@ -625,11 +625,10 @@ 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
}
}
@@ -745,14 +744,14 @@ int exist_object(Object *obtest)
/* *************************************************** */
-static void *add_obdata_from_type(int type)
+void *add_obdata_from_type(int type)
{
switch (type) {
case OB_MESH: return add_mesh("Mesh");
- 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_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_CAMERA: return add_camera("Camera");
case OB_LAMP: return add_lamp("Lamp");
case OB_LATTICE: return add_lattice("Lattice");
@@ -790,6 +789,9 @@ Object *add_only_object(int type, const char *name)
{
Object *ob;
+ if(!name)
+ name = get_obdata_defname(type);
+
ob= alloc_libblock(&G.main->object, ID_OB, name);
/* default object vars */
@@ -878,6 +880,7 @@ Object *add_object(struct Scene *scene, int type)
ob->lay= scene->lay;
base= scene_add_base(scene, ob);
+ scene_deselect_all(scene);
scene_select_base(scene, base);
ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
@@ -1484,7 +1487,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];
@@ -1822,7 +1825,7 @@ static void give_parvert(Object *par, int nr, float vec[3])
ListBase *nurbs;
cu= par->data;
- nurbs= BKE_curve_nurbs_get(cu);
+ nurbs= BKE_curve_nurbs(cu);
nu= nurbs->first;
count= 0;
@@ -2026,7 +2029,7 @@ 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) {
@@ -2261,14 +2264,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) BKE_curve_tex_space_calc(cu);
+ if (cu->bb==NULL) tex_space_curve(cu);
bb= *(cu->bb);
for (a=0; a<8; a++) {
@@ -2569,7 +2572,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'
@@ -2785,7 +2788,8 @@ 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,7 +2816,8 @@ 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)
@@ -2930,7 +2935,7 @@ 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_get(cu);
+ ListBase *lb= BKE_curve_nurbs(cu);
int newkey= 0;
if (key==NULL) {
@@ -2957,7 +2962,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= BKE_nurbList_verts_count(lb);
+ kb->totelem= count_curveverts(lb);
kb->data= data;
}
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index 5ba1b3d86c3..907de7888cb 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -196,13 +196,15 @@ 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;
}
@@ -419,15 +421,18 @@ void BKE_ocean_eval_uv_catrom(struct Ocean *oc, struct OceanResult *ocr, float u
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);
}
@@ -436,7 +441,8 @@ void BKE_ocean_eval_uv_catrom(struct Ocean *oc, struct OceanResult *ocr, float u
ocr->disp[2] = 0.0;
}
- if (oc->_do_jacobian) {
+ if (oc->_do_jacobian)
+ {
compute_eigenstuff(ocr, INTERP(oc->_Jxx),INTERP(oc->_Jzz),INTERP(oc->_Jxz));
}
}
@@ -468,7 +474,8 @@ 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];
}
@@ -477,7 +484,8 @@ 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];
@@ -485,7 +493,8 @@ void BKE_ocean_eval_ij(struct Ocean *oc, struct OceanResult *ocr, int i,int j)
normalize_v3(ocr->normal);
}
- if (oc->_do_jacobian) {
+ 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]);
}
@@ -502,10 +511,12 @@ 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;
@@ -530,7 +541,8 @@ 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);
}
@@ -538,10 +550,13 @@ 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;
@@ -560,10 +575,13 @@ 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;
@@ -582,10 +600,13 @@ 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);
@@ -599,8 +620,10 @@ 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;
}
}
@@ -609,10 +632,13 @@ 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);
@@ -625,8 +651,10 @@ 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;
}
}
@@ -635,10 +663,13 @@ 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);
@@ -657,9 +688,12 @@ 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);
@@ -675,9 +709,12 @@ 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);
@@ -720,9 +757,12 @@ 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]);
}
}
@@ -811,8 +851,10 @@ 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();
@@ -879,12 +921,14 @@ 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);
@@ -894,7 +938,8 @@ 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);
@@ -903,7 +948,8 @@ 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);
@@ -956,7 +1002,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;
@@ -997,7 +1043,8 @@ 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]);
}
@@ -1006,7 +1053,8 @@ 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]);
}
@@ -1015,7 +1063,8 @@ 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]);
}
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index e0c61fbcc90..b55033b8493 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;
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index f417f9b79fb..27f5f7d9eb1 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 febe4277010..a154a1f8926 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -1572,7 +1572,7 @@ 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:
@@ -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);
@@ -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;
@@ -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;
@@ -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;
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index d3644657de7..416b0752af3 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -787,7 +787,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
pa->num = i = ctx->index[p];
mface = dm->getTessFaceData(dm,i,CD_MFACE);
- switch (distr) {
+ switch(distr) {
case PART_DISTR_JIT:
if (ctx->jitlevel == 1) {
if (mface->v4)
@@ -855,15 +855,13 @@ 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;
}
}
}
@@ -1064,7 +1062,8 @@ 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);
+ DM_ensure_tessface(dm);
+ distribute_grid(dm, psys);
dm->release(dm);
return 0;
}
@@ -1577,7 +1576,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;
@@ -1781,7 +1780,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
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;
@@ -2143,7 +2142,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;
@@ -2177,7 +2176,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);
@@ -2195,7 +2194,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);
@@ -2861,7 +2860,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);
@@ -2886,7 +2885,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);
@@ -3835,7 +3834,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;
@@ -3910,7 +3909,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 {
@@ -4501,7 +4500,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 */
@@ -4553,7 +4552,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:
{
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 39293084dc0..dbcef9ad4c8 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -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,20 +690,14 @@ 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");
@@ -733,20 +727,14 @@ 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);
@@ -1001,7 +989,8 @@ 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);
@@ -1009,7 +998,8 @@ 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) {
@@ -1215,7 +1205,8 @@ 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));
@@ -1279,7 +1270,8 @@ 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));
@@ -2321,7 +2313,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
if (timescale) {
time= BKE_curframe(scene);
- nexttime = BKE_frame_to_ctime(scene, CFRA + 1.0f);
+ nexttime= BKE_frame_to_ctime(scene, CFRA+1);
*timescale= MAX2(nexttime - time, 0.0f);
}
@@ -2513,14 +2505,16 @@ 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) {
@@ -2819,7 +2813,8 @@ 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);
@@ -3251,7 +3246,8 @@ 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 e7247be7f51..066de61575d 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 a7df6b10f06..b3e288dfc74 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 b5bb6b76c61..8123cbf3f0b 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..04218de367e 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -888,8 +888,6 @@ void scene_deselect_all(Scene *sce)
void scene_select_base(Scene *sce, Base *selbase)
{
- scene_deselect_all(sce);
-
selbase->flag |= SELECT;
selbase->object->flag= selbase->flag;
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index d3eade834e6..8015e53e4c9 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -2112,7 +2112,7 @@ 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);
break;
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 9291cb90dff..6a845ab9ed7 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -259,7 +259,8 @@ 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
@@ -362,7 +363,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 */
@@ -3112,17 +3113,13 @@ 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 e201209ec3f..4006837efd6 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -146,7 +146,8 @@ 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;
}
@@ -157,7 +158,8 @@ 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);
@@ -187,7 +189,8 @@ 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,7 +224,8 @@ int normal_projection_project_vertex(char options, const float *vert, const floa
memcpy( &hit_tmp, hit, sizeof(hit_tmp) );
//Apply space transform (TODO readjust dist)
- if (transf) {
+ if (transf)
+ {
copy_v3_v3( tmp_co, vert );
space_transform_apply( transf, tmp_co );
co = tmp_co;
@@ -294,7 +298,8 @@ 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 {
@@ -311,7 +316,8 @@ 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;
@@ -326,14 +332,16 @@ 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 */
@@ -356,7 +364,8 @@ 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);
@@ -365,7 +374,8 @@ 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);
@@ -376,7 +386,8 @@ 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);
}
@@ -403,7 +414,8 @@ 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;
}
@@ -417,7 +429,8 @@ 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);
@@ -445,8 +458,10 @@ 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);
}
@@ -496,7 +511,8 @@ 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
@@ -512,24 +528,28 @@ 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);
}
}
@@ -542,7 +562,8 @@ 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 32681c3a041..71ea85de716 100644
--- a/source/blender/blenkernel/intern/sketch.c
+++ b/source/blender/blenkernel/intern/sketch.c
@@ -44,7 +44,8 @@ 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);
@@ -118,7 +119,8 @@ 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;
@@ -133,7 +135,8 @@ 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;
@@ -148,10 +151,12 @@ 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;
}
@@ -197,7 +202,8 @@ 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));
@@ -212,7 +218,8 @@ 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));
}
@@ -246,7 +253,8 @@ 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;
@@ -261,23 +269,30 @@ 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));
}
@@ -286,7 +301,8 @@ 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;
@@ -307,7 +323,8 @@ 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;
@@ -325,7 +342,8 @@ 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;
}
@@ -340,7 +358,8 @@ 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);
}
@@ -357,7 +376,8 @@ 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;
}
@@ -366,7 +386,8 @@ 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);
}
@@ -377,7 +398,8 @@ void sk_filterStroke(SK_Stroke *stk, int start, int end)
work = 1;
/* while still reducing */
- while (work) {
+ while (work)
+ {
int ls, le;
work = 0;
@@ -385,13 +407,15 @@ 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++;
}
@@ -400,7 +424,8 @@ 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];
@@ -408,7 +433,8 @@ 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;
}
@@ -416,13 +442,15 @@ 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;
}
@@ -434,8 +462,10 @@ 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);
}
}
@@ -443,7 +473,8 @@ 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);
}
@@ -459,11 +490,13 @@ 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);
}
}
@@ -472,7 +505,8 @@ 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);
}
@@ -486,7 +520,8 @@ 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));
}
}
@@ -494,7 +529,8 @@ 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;
}
@@ -515,10 +551,12 @@ 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);
}
}
@@ -528,26 +566,31 @@ 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 f3939a2ebfc..4042cb2c519 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -21,7 +21,6 @@
* The Original Code is: all of this file.
*
* Contributor(s): Daniel Genrich
- * Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -54,7 +53,6 @@
#include "BKE_bvhutils.h"
#include "BKE_cdderivedmesh.h"
-#include "BKE_collision.h"
#include "BKE_customdata.h"
#include "BKE_DerivedMesh.h"
#include "BKE_effect.h"
@@ -120,6 +118,7 @@ static void tend ( void )
gettimeofday ( &_tend,&tz );
}
+#if 0 // unused
static double tval()
{
double t1, t2;
@@ -128,16 +127,14 @@ static double tval()
return t2-t1;
}
#endif
+#endif
struct Object;
struct Scene;
struct DerivedMesh;
struct SmokeModifierData;
-#define TRI_UVOFFSET (1./4.)
-
-// timestep default value for nice appearance 0.1f
-#define DT_DEFAULT 0.1f
+#define TRI_UVOFFSET (1.0 / 4.0)
/* forward declerations */
static void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *tris, int numfaces, int numtris, int **tridivs, float cell_len);
@@ -162,7 +159,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};
@@ -174,7 +171,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];
@@ -201,32 +198,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; // dx is in global coords
+ smd->domain->dx = size[0] / res;
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; // dx is in global coords
+ smd->domain->dx = size[2] / res;
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; // dx is in global coords
+ smd->domain->dx = size[1] / res;
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);
@@ -246,10 +243,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, DT_DEFAULT);
+ smd->domain->fluid = smoke_init(smd->domain->res, smd->domain->p0);
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);
@@ -260,77 +257,49 @@ 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
smd->time = scene->r.cfra;
- if (smd->flow->psys && smd->flow->psys->part && !(smd->flow->flags & MOD_SMOKE_FLOW_INIT))
- {
- // update particle lifetime to be one frame
- smd->flow->psys->part->lifetime = 1; // scene->r.efra + 1;
-
- // use "unborn" flag as standard setting
- smd->flow->psys->part->flag |= PART_UNBORN;
-
- smd->flow->flags |= MOD_SMOKE_FLOW_INIT;
- }
-
-/*
- 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);
-
- // copy obmat
- // copy_m4_m4(smd->flow->mat, ob->obmat);
- // copy_m4_m4(smd->flow->mat_old, ob->obmat);
- }
-*/
-
return 1;
}
- else if((smd->type & MOD_SMOKE_TYPE_COLL))
+ else if ((smd->type & MOD_SMOKE_TYPE_COLL))
{
- // todo: delete this when loading colls work -dg
+ smd->time = scene->r.cfra;
- if(!smd->coll)
- {
+ // todo: delete this when loading colls work -dg
+ 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 );
}
@@ -345,52 +314,50 @@ 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;
-
- // DG TODO: need to do this dynamically according to the domain object!
- float cell_len = scs->dx;
+ int *tridivs = NULL;
+ float cell_len = 1.0 / 50.0; // for res = 50
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++;
}
- 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);
+ calcTriangleDivs(ob, mvert, dm->getNumVerts(dm), mface, dm->getNumTessFaces(dm), dm->getNumTessFaces(dm) + quads, &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 += (scs->tridivs[3 * i] + 1) * (scs->tridivs[3 * i + 1] + 1) * (scs->tridivs[3 * i + 2] + 1);
+ divs += (tridivs[3 * i] + 1) * (tridivs[3 * i + 1] + 1) * (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); // DG: use local coordinates, we save MAT anyway
+ mul_m4_v3(ob->obmat, tmpvec);
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 = scs->tridivs[3 * facecounter + 0];
- int divs2 = scs->tridivs[3 * facecounter + 1];
- //int divs3 = scs->tridivs[3 * facecounter + 2];
+ int divs1 = tridivs[3 * facecounter + 0];
+ int divs2 = tridivs[3 * facecounter + 1];
+ //int divs3 = 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);
@@ -405,23 +372,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);
@@ -438,211 +405,40 @@ 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); // DG: use local coordinates, we save MAT anyway
+ mul_m4_v3(ob->obmat, tmpvec);
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); // DG: use local coordinates, we save MAT anyway
+ mul_m4_v3(ob->obmat, tmpvec);
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;
- for(i = 0; i < scs->numpoints * 3; i++)
- {
- scs->points_old[i] = scs->points[i];
- }
-}
-
-
-static void fill_scs_points_anim(Object *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;
-
+ MEM_freeN(tridivs);
}
/*! init triangle divisions */
@@ -653,22 +449,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); get max scale value
+ float maxscale[3] = {1,1,1}; // = channelFindMaxVf(mcScale);
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.75 * scaleFac; // fsTri = cell_len * 0.9;
+ fsTri = cell_len * 0.5 * scaleFac;
- 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];
@@ -687,22 +483,21 @@ 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;
@@ -710,7 +505,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;
@@ -727,12 +522,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);
@@ -750,19 +545,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;
@@ -776,10 +571,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);
@@ -793,37 +588,22 @@ static void smokeModifier_freeFlow(SmokeModifierData *smd)
static void smokeModifier_freeCollision(SmokeModifierData *smd)
{
- if(smd->coll)
+ if (smd->coll)
{
- SmokeCollSettings *scs = smd->coll;
-
- if(scs->numpoints)
+ if (smd->coll->points)
{
- 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;
- }
+ MEM_freeN(smd->coll->points);
+ smd->coll->points = NULL;
}
- if(scs->bvhtree)
+ if (smd->coll->bvhtree)
{
- BLI_bvhtree_free(scs->bvhtree);
- scs->bvhtree = NULL;
+ BLI_bvhtree_free(smd->coll->bvhtree);
+ smd->coll->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
@@ -835,7 +615,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;
@@ -844,15 +624,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;
@@ -864,10 +644,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);
@@ -875,33 +655,33 @@ void smokeModifier_reset(struct SmokeModifierData *smd)
smd->flow->bvh = NULL;
*/
}
- else if(smd->coll)
+ else if (smd->coll)
{
- SmokeCollSettings *scs = smd->coll;
+ if (smd->coll->points)
+ {
+ MEM_freeN(smd->coll->points);
+ smd->coll->points = NULL;
+ }
- if(scs->numpoints && scs->points)
+ if (smd->coll->bvhtree)
{
- 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;
- }
+ BLI_bvhtree_free(smd->coll->bvhtree);
+ smd->coll->bvhtree = 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)
{
- if(smd)
+ if (smd)
{
smokeModifier_freeDomain(smd);
smokeModifier_freeFlow(smd);
@@ -911,11 +691,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");
@@ -942,7 +722,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 = SM_BORDER_OPEN; // open domain
+ smd->domain->border_collisions = 1; // vertically non-colliding
smd->domain->flags = MOD_SMOKE_DISSOLVE_LOG | MOD_SMOKE_HIGH_SMOOTH;
smd->domain->strength = 2.0;
smd->domain->noise = MOD_SMOKE_NOISEWAVE;
@@ -952,9 +732,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");
@@ -970,23 +750,17 @@ 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;
@@ -1021,7 +795,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;
@@ -1048,15 +822,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;
}
@@ -1068,603 +842,497 @@ static int get_lamp(Scene *scene, float *light)
static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *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)
{
- unsigned int i;
- Object **collobjs = NULL;
- unsigned int numcollobj = 0;
- collobjs = get_collisionobjects(scene, ob, sds->coll_group, &numcollobj);
+ 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;
- for(i = 0; i < numcollobj; i++)
+ while (base || go)
{
- Object *collob= collobjs[i];
- SmokeModifierData *smd2 = (SmokeModifierData*)modifiers_findByType(collob, eModifierType_Smoke);
+ 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);
// check for active smoke modifier
- // 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)
+ if (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))
{
- // ??? 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;
- }
+ SmokeModifierData *smd2 = (SmokeModifierData *)md;
- 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)
- */
-
- /* 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 */
+ if ((smd2->type & MOD_SMOKE_TYPE_COLL) && smd2->coll && smd2->coll->points)
{
- float tmp[3];
-
- /* x_current = x_old + (x_new - x_old) * step_current / steps_total */
- float mulStep = (float)(((float)substep) / ((float)totalsteps));
+ // we got nice collision object
+ SmokeCollSettings *scs = smd2->coll;
+ size_t i, j;
+ unsigned char *obstacles = smoke_get_obstacle(smd->domain->fluid);
- 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))
+ for (i = 0; i < scs->numpoints; i++)
{
- 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 */;
+ int badcell = 0;
+ size_t index = 0;
+ int cell[3];
- if(len_v3(vel) > FLT_EPSILON)
- {
- // Collision object is moving
-
- velx[index] = vel[0]; // use "+="?
- vely[index] = vel[1];
- velz[index] = vel[2];
+ // 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;
+ */
+ }
}
}
+
+ if (sds->coll_group)
+ go = go->next;
+ else
+ base= base->next;
}
}
- 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++)
+ // do flows and fluids
+ if (1)
{
- Object *collob= flowobjs[flowIndex];
- SmokeModifierData *smd2 = (SmokeModifierData*)modifiers_findByType(collob, eModifierType_Smoke);
-
- // check for initialized smoke object
- if((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow)
- {
- // 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
+ 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)
{
- 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))
- {
- 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;
- }
+ if (go->ob)
+ otherobj = go->ob;
+ }
+ else
+ otherobj = base->object;
+ if (!otherobj)
+ {
+ if (sds->fluid_group)
+ go = go->next;
else
- totchild=psys->totchild*psys->part->disp/100;
+ base= base->next;
- for(p=0; p<totpart+totchild; p++)
- {
- int cell[3];
- size_t i = 0;
- size_t index = 0;
- int badcell = 0;
- ParticleKey state;
+ continue;
+ }
- if(p < totpart)
+ md = modifiers_findByType(otherobj, eModifierType_Smoke);
+
+ // check for active smoke modifier
+ if (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))
+ {
+ SmokeModifierData *smd2 = (SmokeModifierData *)md;
+
+ // check for initialized smoke object
+ if ((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow)
+ {
+ // 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
{
- 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))
+ 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))
{
- 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)
- {
- // 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;
- }
+ 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;
+ }
}
- }
- } // 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;
-
- 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++)
+
+ // mostly copied from particle code
+ if (psys->part->type==PART_HAIR)
+ {
+ /*
+ if (psys->childcache)
{
- // neighbor cell emission densities (for high resolution smoke smooth interpolation)
- float c000, c001, c010, c011, c100, c101, c110, c111;
+ totchild = psys->totchildcache;
+ }
+ else
+ */
- 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
+ // 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;
- // get cell index
- index = smoke_get_index(x, sds->res[0], y, sds->res[1], z);
+ if (p < totpart)
+ {
+ 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;
+ }
- // add emission to low resolution density
- if (absolute_flow)
+ 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))
{
- if (temp_emission_map[index]>0)
- density[index] = temp_emission_map[index];
- }
- else
+ 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)
{
- density[index] += temp_emission_map[index];
-
- if (density[index]>1)
- density[index]=1.0f;
+ // 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;
+ }
}
+ }
+ } // particles loop
- smoke_turbulence_get_res(sds->wt, bigres);
- /* 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++)
- {
+ // apply emission values
+ if (!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW)) {
- float fx,fy,fz, interpolated_value;
- int shift_x, shift_y, shift_z;
+ // initialize variables
+ int ii, jj, kk, x, y, z, block_size;
+ size_t index, index_big;
+ smoke_turbulence_get_res(smd->domain->wt, bigres);
+ block_size = smd->domain->amplify + 1; // high res block size
- /*
- * 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;
- }
- } // end of hires loop
- } // end of low res loop
+ // 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++)
+ {
- // free temporary emission map
- if (temp_emission_map)
- MEM_freeN(temp_emission_map);
+ // neighbor cell emission densities (for high resolution smoke smooth interpolation)
+ float c000, c001, c010, c011, c100, c101, c110, c111;
- } // end emission
- }
- }
- }
+ 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;
- if(flowobjs)
- MEM_freeN(flowobjs);
-}
+ 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
-static void update_effectors(Scene *scene, Object *ob, SmokeDomainSettings *sds, float 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);
-}
+ // get cell index
+ index = smoke_get_index(x, sds->res[0], y, sds->res[1], z);
-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)
+ // 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;
+ }
- float dt = DT_DEFAULT;
- float maxVelMag = 0.0f;
- int totalSubsteps;
- int substep = 0;
- float dtSubdiv;
+ smoke_turbulence_get_res(smd->domain->wt, bigres);
- SmokeDomainSettings *sds = smd->domain;
- /* 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];
- 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;
+ /*
+ 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;
+ }
- /* adapt timestep for different framerates, dt = 0.1 is at 25fps */
- dt *= (25.0f / fps);
+ } // end of hires loop
- // printf("test maxVel: %f\n", (sds->dx * 1.5) / dt); // gives 0.9
- maxVel = (sds->dx * 1.5);
+ } // end of low res loop
- 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;
- }
+ // free temporary emission map
+ if (temp_emission_map) MEM_freeN(temp_emission_map);
- 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;
+ } // end emission
- // totalSubsteps = 2.0f; // DEBUG
- dtSubdiv = (float)dt / (float)totalSubsteps;
+
+ }
+ else {
+ /*
+ for ()
+ {
+ // no psys
+ BVHTreeNearest nearest;
+ nearest.index = -1;
+ nearest.dist = FLT_MAX;
- // printf("totalSubsteps: %d, maxVelMag: %f, dt: %f\n", totalSubsteps, maxVelMag, dt);
+ 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(substep = 0; substep < totalSubsteps; substep++)
+ // do effectors
{
- // 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
-
- smoke_step(sds->fluid, dtSubdiv);
+ ListBase *effectors = pdInitEffectors(scene, ob, NULL, sds->effector_weights);
- // move animated obstacle: Done in update_obstacles() */
+ 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);
+ }
+ }
- // where to delete old obstacles from array? Done in update_obstacles() */
+ pdEndEffectors(&effectors);
}
-}
+}
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;
@@ -1675,102 +1343,40 @@ 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)
{
- /* 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)
+ if (scene->r.cfra >= smd->time)
smokeModifier_init(smd, ob, scene, dm);
- if(scene->r.cfra > smd->time)
+ if (scene->r.cfra > smd->time)
{
- 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?
+ // XXX TODO
smd->time = scene->r.cfra;
- // rigid movement support
- copy_m4_m4(scs->mat_old, scs->mat);
- copy_m4_m4(scs->mat, ob->obmat);
-
- 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
-
- if(scs->numverts != dm->getNumVerts(dm))
- {
- // DG TODO: reset modifier?
- return;
- }
+#ifdef USE_SMOKE_COLLISION_DM
+ if (smd->coll->dm)
+ smd->coll->dm->release(smd->coll->dm);
- for(i = 0; i < numpoints * 3; i++)
- {
- points_old[i] = points[i];
- }
+ smd->coll->dm = CDDM_copy_from_tessface(dm);
+#endif
- DM_ensure_tessface(dm);
- fill_scs_points_anim(ob, dm, scs);
- }
+ // rigid movement support
+ copy_m4_m4(smd->coll->mat_old, smd->coll->mat);
+ copy_m4_m4(smd->coll->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_DOMAIN)
+ else if (smd->type & MOD_SMOKE_TYPE_DOMAIN)
{
SmokeDomainSettings *sds = smd->domain;
float light[3];
@@ -1787,14 +1393,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;
@@ -1807,21 +1413,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 */
@@ -1833,14 +1439,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);
}
@@ -1857,31 +1463,30 @@ 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);
-
- step(scene, ob, smd, scene->r.frs_sec / scene->r.frs_sec_base);
+ smoke_step(sds->fluid, smd->time, 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\n", (int)smd->time, ( float ) tval() );
+ //printf ( "Frame: %d, Time: %f\n", (int)smd->time, ( float ) tval() );
}
}
@@ -1892,7 +1497,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;
@@ -1946,7 +1551,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;
@@ -1960,12 +1565,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;
@@ -1979,12 +1584,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;
@@ -2026,7 +1631,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];
@@ -2039,27 +1644,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 5d8a4955e58..e3a309fc945 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -402,10 +402,7 @@ 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;
@@ -1391,7 +1388,8 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
}
bf = sb->scratch->bodyface;
for (a=0; a<sb->scratch->totface; a++, bf++) {
- if (( bf->flag & BFF_INTERSECT) || ( bf->flag & BFF_CLOSEVERT)) {
+ 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);
@@ -1937,8 +1935,8 @@ 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);
@@ -2833,7 +2831,8 @@ 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();
}
@@ -3231,7 +3230,8 @@ 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
@@ -3307,7 +3307,8 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
this enables per vertex *mass painting*
*/
- if (sb->namedVG_Mass[0]) {
+ 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) {
@@ -3320,7 +3321,8 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
/* first set the default */
bp->springweight = 1.0f;
- if (sb->namedVG_Spring_K[0]) {
+ 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) {
@@ -3559,7 +3561,7 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob)
int a, curindex=0;
int totvert, totspring = 0, setgoal=0;
- totvert= BKE_nurbList_verts_count(&cu->nurb);
+ totvert= count_curveverts(&cu->nurb);
if (ob->softflag & OB_SB_EDGES) {
if (ob->type==OB_CURVE) {
@@ -3637,7 +3639,8 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob)
}
}
- if (totspring) {
+ if (totspring)
+ {
build_bps_springlist(ob); /* link bps to springs */
if (ob->softflag & OB_SB_SELF) {calculate_collision_balls(ob);}
}
@@ -3893,7 +3896,7 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int
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;
@@ -3949,7 +3952,8 @@ 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)));
@@ -4017,11 +4021,12 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
}
}
- 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) {
@@ -4078,7 +4083,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 28ce95ea8d1..c2dbb518837 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -95,7 +95,8 @@ 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;
}
@@ -105,19 +106,22 @@ 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;
}
@@ -137,8 +141,10 @@ 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
@@ -276,7 +282,8 @@ 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);
@@ -305,7 +312,8 @@ 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;
@@ -314,13 +322,16 @@ 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;
@@ -330,7 +341,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
@@ -365,13 +376,15 @@ 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);
}
@@ -544,12 +557,14 @@ 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);
}
@@ -562,7 +577,8 @@ 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)
@@ -580,10 +596,12 @@ 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;
}
@@ -598,8 +616,10 @@ 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);
}
@@ -628,7 +648,8 @@ 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
@@ -647,7 +668,8 @@ 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);
}
@@ -661,7 +683,8 @@ 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;
@@ -686,16 +709,23 @@ 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 {
@@ -704,13 +734,15 @@ 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,
@@ -733,11 +765,13 @@ 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 129d3a3f698..e98f4f6fa3d 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_grow_items(fverts, nverts);
+ BLI_array_growitems(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_grow_items(fverts, nverts);
+ BLI_array_growitems(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_grow_items(fVerts, mp->totloop);
+ BLI_array_growitems(fVerts, mp->totloop);
ml = mloop + mp->loopstart;
for (j = 0; j < mp->totloop; j++, ml++) {
@@ -2102,7 +2102,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
}
}
else {
- glShadeModel(GL_FLAT);
+ glShadeModel((cp)? GL_SMOOTH: GL_FLAT);
glBegin(GL_QUADS);
for (y = 0; y < gridFaces; y++) {
for (x = 0; x < gridFaces; x++) {
@@ -2423,9 +2423,7 @@ 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)
@@ -3134,8 +3132,6 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
float *w2;
int s, x, y;
- origIndex = base_polyOrigIndex ? base_polyOrigIndex[origIndex] : origIndex;
-
w = get_ss_weights(&wtable, gridCuts, numVerts);
ccgdm->faceMap[index].startVert = vertNum;
@@ -3146,17 +3142,19 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
faceFlags->mat_nr = mpoly ? mpoly[origIndex].mat_nr : 0;
faceFlags++;
+ origIndex = base_polyOrigIndex ? base_polyOrigIndex[origIndex] : origIndex;
+
/* set the face base vert */
*((int *)ccgSubSurf_getFaceUserData(ss, f)) = vertNum;
BLI_array_empty(loopidx);
- BLI_array_grow_items(loopidx, numVerts);
+ BLI_array_growitems(loopidx, numVerts);
for (s = 0; s < numVerts; s++) {
loopidx[s] = loopindex++;
}
BLI_array_empty(vertidx);
- BLI_array_grow_items(vertidx, numVerts);
+ BLI_array_growitems(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 cb7369476c0..746e901c6d4 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -956,70 +956,46 @@ void txt_move_right(Text *text, short sel)
void txt_jump_left(Text *text, short sel)
{
- TextLine **linep, *oldl;
- int *charp, oldc, oldflags, i;
- unsigned char oldu;
- int pos;
-
+ TextLine **linep;
+ int *charp, oldc;
+
if (!text) return;
if (sel) txt_curs_sel(text, &linep, &charp);
else { txt_pop_first(text); txt_curs_cur(text, &linep, &charp); }
if (!*linep) return;
+ oldc = *charp;
- oldflags = text->flags;
- text->flags &= ~TXT_TABSTOSPACES;
-
- oldl= *linep;
- oldc= *charp;
- oldu= undoing;
- undoing= 1; /* Don't push individual moves to undo stack */
-
- pos = *charp;
BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
- &pos, STRCUR_DIR_PREV,
+ charp, STRCUR_DIR_PREV,
STRCUR_JUMP_DELIM);
- for (i = *charp; i > pos; i--) {
- txt_move_left(text, sel);
+
+ if (!sel) txt_pop_sel(text);
+ if (!undoing) {
+ int span = txt_get_span(text->lines.first, *linep);
+ txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, span, oldc, span, (unsigned short)*charp);
}
-
- text->flags = oldflags;
-
- undoing= oldu;
- 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_jump_right(Text *text, short sel)
{
- TextLine **linep, *oldl;
- int *charp, oldc, oldflags, i;
- unsigned char oldu;
- int pos;
-
+ TextLine **linep;
+ int *charp, oldc;
+
if (!text) return;
if (sel) txt_curs_sel(text, &linep, &charp);
else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); }
if (!*linep) return;
-
- oldflags = text->flags;
- text->flags &= ~TXT_TABSTOSPACES;
-
- oldl= *linep;
- oldc= *charp;
- oldu= undoing;
- undoing= 1; /* Don't push individual moves to undo stack */
-
- pos = *charp;
+ oldc = *charp;
+
BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
- &pos, STRCUR_DIR_NEXT,
+ charp, STRCUR_DIR_NEXT,
STRCUR_JUMP_DELIM);
- for (i = *charp; i < pos; i++) {
- txt_move_right(text, sel);
+
+ if (!sel) txt_pop_sel(text);
+ if (!undoing) {
+ int span = txt_get_span(text->lines.first, *linep);
+ txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, span, oldc, span, (unsigned short)*charp);
}
-
- text->flags = oldflags;
-
- undoing= oldu;
- 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)
@@ -1193,11 +1169,9 @@ 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)
@@ -2020,7 +1994,7 @@ void txt_do_undo(Text *text)
undoing= 1;
- switch (op) {
+ switch(op) {
case UNDO_CLEFT:
txt_move_right(text, 0);
break;
@@ -2247,7 +2221,7 @@ void txt_do_redo(Text *text)
undoing= 1;
- switch (op) {
+ switch(op) {
case UNDO_CLEFT:
txt_move_left(text, 0);
break;
@@ -2834,7 +2808,8 @@ void txt_indent(Text *text)
}
num = 0;
- while (TRUE) {
+ while (TRUE)
+ {
tmp= MEM_mallocN(text->curl->len+indentlen+1, "textline_string");
text->curc = 0;
@@ -2852,7 +2827,8 @@ 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,12 +2838,14 @@ 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);
}
}
@@ -2891,10 +2869,12 @@ 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++;
@@ -2905,7 +2885,8 @@ 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;
}
@@ -2916,12 +2897,14 @@ 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);
}
}
@@ -2937,7 +2920,8 @@ 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;
@@ -2955,7 +2939,8 @@ 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;
}
@@ -2965,12 +2950,14 @@ 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);
}
}
@@ -2984,10 +2971,12 @@ 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++;
@@ -2999,7 +2988,8 @@ 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;
}
@@ -3010,12 +3000,14 @@ 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);
}
}
@@ -3031,23 +3023,27 @@ 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;
@@ -3064,10 +3060,13 @@ 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;
}
}
@@ -3116,16 +3115,14 @@ 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 29b9505f449..23d818369a2 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -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)
@@ -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 e511cd362de..2d5d47e8dd0 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -680,6 +680,8 @@ void BKE_tracking_clipboard_copy_tracks(MovieTracking *tracking, MovieTrackingOb
ListBase *tracksbase = BKE_tracking_object_tracks(tracking, object);
MovieTrackingTrack *track = tracksbase->first;
+ BKE_tracking_free_clipboard();
+
while (track) {
if (TRACK_SELECTED(track) && (track->flag & TRACK_HIDDEN) == 0) {
MovieTrackingTrack *new_track = duplicate_track(track);
@@ -1164,7 +1166,13 @@ static ImBuf *get_area_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTracki
x1 = x-(int)(w * (-min[0] / (max[0] - min[0])));
y1 = y-(int)(h * (-min[1] / (max[1] - min[1])));
- tmpibuf = IMB_allocImBuf(w+margin*2, h+margin*2, 32, IB_rect);
+ if (ibuf->rect_float)
+ tmpibuf = IMB_allocImBuf(w + margin * 2, h + margin * 2, 32, IB_rectfloat);
+ else
+ tmpibuf = IMB_allocImBuf(w + margin * 2, h + margin * 2, 32, IB_rect);
+
+ tmpibuf->profile = ibuf->profile;
+
IMB_rectcpy(tmpibuf, ibuf, 0, 0, x1 - margin, y1 - margin, w + margin * 2, h + margin * 2);
if (pos != NULL) {
@@ -1523,7 +1531,6 @@ typedef struct MovieReconstructContext {
#endif
char object_name[MAX_NAME];
int is_camera;
- short motion_flag;
float focal_length;
float principal_point[2];
@@ -1753,11 +1760,7 @@ int BKE_tracking_can_reconstruct(MovieTracking *tracking, MovieTrackingObject *o
#if WITH_LIBMV
ListBase *tracksbase = BKE_tracking_object_tracks(tracking, object);
- 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) {
+ 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;
@@ -1786,8 +1789,7 @@ 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->motion_flag = tracking->settings.motion_flag;
+ context->is_camera = object->flag&TRACKING_OBJECT_CAMERA;
context->tracks_map = tracks_map_new(context->object_name, context->is_camera, num_tracks, 0);
@@ -1900,22 +1902,13 @@ void BKE_tracking_solve_reconstruction(MovieReconstructContext *context, short *
progressdata.stats_message = stats_message;
progressdata.message_size = message_size;
- 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);
- }
+ 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/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 079bde0afec..59c38117858 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -120,17 +120,19 @@ 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);
@@ -173,7 +175,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;
@@ -370,7 +372,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);
@@ -715,7 +717,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:
@@ -927,7 +929,8 @@ 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;
@@ -971,7 +974,8 @@ 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));
@@ -1168,12 +1172,10 @@ 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/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h
index 7069732eeb6..dac0143b5b6 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_grow_one(arr);
+ * BLI_array_growone(arr);
* arr[i] = something;
* }
* BLI_array_free(arr);
@@ -116,32 +116,32 @@
)
/* grow an array by a specified number of items */
-#define BLI_array_grow_items(arr, num) ( \
+#define BLI_array_growitems(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_grow_one(arr) BLI_array_grow_items(arr, 1)
+#define BLI_array_growone(arr) BLI_array_growitems(arr, 1)
/* appends an item to the array. */
#define BLI_array_append(arr, item) ( \
- (void) BLI_array_grow_one(arr), \
+ (void) BLI_array_growone(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_grow_one(arr), \
+ (void) BLI_array_growone(arr), \
(void) (arr[_##arr##_count - 1] = item), \
(&arr[_##arr##_count - 1]) \
)
#define BLI_array_reserve(arr, num) \
- BLI_array_grow_items(arr, num), (void)(_##arr##_count -= (num))
+ BLI_array_growitems(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_length_set(arr, count) \
+#define BLI_array_set_length(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
new file mode 100644
index 00000000000..0f754d5fc98
--- /dev/null
+++ b/source/blender/blenlib/BLI_editVert.h
@@ -0,0 +1,191 @@
+/*
+ * ***** 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.h b/source/blender/blenlib/BLI_fileops.h
index 73220cbd739..1bf4efca8a0 100644
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -55,6 +55,7 @@ int BLI_rename(const char *from, const char *to);
int BLI_delete(const char *path, int dir, int recursive);
int BLI_move(const char *path, const char *to);
int BLI_create_symlink(const char *path, const char *to);
+int BLI_stat(const char *path, struct stat *buffer);
/* Directories */
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h
index 457f098bff7..79089b4f6a6 100644
--- a/source/blender/blenlib/BLI_ghash.h
+++ b/source/blender/blenlib/BLI_ghash.h
@@ -144,10 +144,10 @@ int BLI_ghashutil_intcmp (const void *a, const void *b);
typedef struct GHashPair {
const void *first;
- int second;
+ const void *second;
} GHashPair;
-GHashPair* BLI_ghashutil_pairalloc (const void *first, int second);
+GHashPair* BLI_ghashutil_pairalloc (const void *first, const void *second);
unsigned int BLI_ghashutil_pairhash (const void *ptr);
int BLI_ghashutil_paircmp (const void *a, const void *b);
void BLI_ghashutil_pairfree (void *ptr);
diff --git a/source/blender/blenlib/BLI_lasso.h b/source/blender/blenlib/BLI_lasso.h
deleted file mode 100644
index 2360173c3b8..00000000000
--- a/source/blender/blenlib/BLI_lasso.h
+++ /dev/null
@@ -1,41 +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_LASSO_H__
-#define __BLI_LASSO_H__
-
-/** \file BLI_lasso.h
- * \ingroup bli
- */
-
-struct rcti;
-
-void BLI_lasso_boundbox(struct rcti *rect, int mcords[][2], short moves);
-int BLI_lasso_is_point_inside(int mcords[][2], short moves, int sx, int sy, const int error_value);
-int BLI_lasso_is_edge_inside(int mcords[][2], short moves, int x0, int y0, int x1, int y1, const int error_value);
-
-#endif
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 00a751f9da3..1d99fd4fa27 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -126,6 +126,8 @@ int is_orthogonal_m4(float mat[4][4]);
int is_orthonormal_m3(float mat[3][3]);
int is_orthonormal_m4(float mat[4][4]);
+int is_uniform_scaled_m3(float mat[3][3]);
+
void adjoint_m3_m3(float R[3][3], float A[3][3]);
void adjoint_m4_m4(float R[4][4], float A[4][4]);
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index d4b9bc3d2bc..c06a1240729 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -61,7 +61,6 @@ 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
@@ -91,9 +90,10 @@ 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,6 +103,7 @@ set(SRC
BLI_dynlib.h
BLI_dynstr.h
BLI_edgehash.h
+ BLI_editVert.h
BLI_fileops.h
BLI_fileops_types.h
BLI_fnmatch.h
@@ -113,7 +114,6 @@ set(SRC
BLI_jitter.h
BLI_kdopbvh.h
BLI_kdtree.h
- BLI_lasso.h
BLI_linklist.h
BLI_listbase.h
BLI_math.h
@@ -133,7 +133,6 @@ 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_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index 28b4794ed1b..4dba726cb61 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -305,7 +305,7 @@ int BLI_ghashutil_strcmp(const void *a, const void *b)
return strcmp(a, b);
}
-GHashPair *BLI_ghashutil_pairalloc(const void *first, int second)
+GHashPair *BLI_ghashutil_pairalloc(const void *first, const void *second)
{
GHashPair *pair = MEM_mallocN(sizeof(GHashPair), "GHashPair");
pair->first = first;
@@ -317,7 +317,7 @@ unsigned int BLI_ghashutil_pairhash(const void *ptr)
{
const GHashPair *pair = ptr;
unsigned int hash = BLI_ghashutil_ptrhash(pair->first);
- return hash ^ BLI_ghashutil_inthash(SET_INT_IN_POINTER(pair->second));
+ return hash ^ BLI_ghashutil_ptrhash(pair->second);
}
int BLI_ghashutil_paircmp(const void *a, const void *b)
@@ -327,7 +327,7 @@ int BLI_ghashutil_paircmp(const void *a, const void *b)
int cmp = BLI_ghashutil_ptrcmp(A->first, B->first);
if (cmp == 0)
- return BLI_ghashutil_intcmp(SET_INT_IN_POINTER(A->second), SET_INT_IN_POINTER(B->second));
+ return BLI_ghashutil_ptrcmp(A->second, B->second);
return cmp;
}
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 3921c01d2cf..2cc67b3f0aa 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -217,10 +217,12 @@ static void bvh_insertionsort(BVHNode **a, int lo, int hi, int axis)
{
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--;
}
@@ -231,7 +233,8 @@ 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--;
@@ -281,18 +284,22 @@ static void bvh_heapsort(BVHNode **a, int lo, int hi, int axis)
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
@@ -347,7 +354,8 @@ 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;
@@ -367,7 +375,8 @@ 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] );
else
@@ -387,16 +396,20 @@ 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;
@@ -414,14 +427,17 @@ static void refit_kdop_hull(BVHTree *tree, BVHNode *node, int start, int end)
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;
@@ -443,13 +459,15 @@ 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
@@ -463,14 +481,18 @@ 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)];
@@ -597,17 +619,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)
- {
- /* pass */
- }
+ for (
+ data->leafs_per_child[0] = 1;
+ data->leafs_per_child[0] < data->totleafs;
+ data->leafs_per_child[0] *= data->tree_type
+ );
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;
}
@@ -678,7 +700,8 @@ static int implicit_needed_branches(int tree_type, int leafs)
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;
@@ -719,7 +742,8 @@ 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;
@@ -734,7 +758,8 @@ 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;
@@ -860,19 +885,22 @@ 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);
@@ -880,7 +908,8 @@ 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);
@@ -889,7 +918,8 @@ 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;
}
@@ -901,7 +931,8 @@ 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);
@@ -954,7 +985,8 @@ 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
}
@@ -981,7 +1013,8 @@ 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
}
@@ -1024,7 +1057,8 @@ 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;
}
@@ -1036,21 +1070,27 @@ 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;
}
@@ -1063,15 +1103,20 @@ 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);
}
@@ -1097,7 +1142,8 @@ 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
@@ -1111,7 +1157,8 @@ 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]);
}
@@ -1120,12 +1167,14 @@ 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]);
}
@@ -1142,7 +1191,8 @@ 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])
@@ -1185,28 +1235,35 @@ typedef struct NodeDistance
// 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 {
+ 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]);
}
@@ -1324,14 +1381,17 @@ 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) {
+ if (nearest)
+ {
memcpy( &data.nearest , nearest, sizeof(*nearest) );
}
- else {
+ else
+ {
data.nearest.index = -1;
data.nearest.dist = FLT_MAX;
}
@@ -1341,7 +1401,8 @@ 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));
}
@@ -1363,8 +1424,10 @@ 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)
@@ -1372,15 +1435,18 @@ 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;
}
@@ -1428,25 +1494,31 @@ 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]);
}
}
@@ -1503,11 +1575,13 @@ 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;
@@ -1519,12 +1593,14 @@ 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 {
+ else
+ {
data.hit.index = -1;
data.hit.dist = FLT_MAX;
}
- if (root) {
+ if (root)
+ {
dfs_raycast(&data, root);
// iterative_raycast(&data, root);
}
@@ -1559,7 +1635,8 @@ 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;
@@ -1589,7 +1666,8 @@ 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];
@@ -1598,14 +1676,18 @@ 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);
}
@@ -1629,12 +1711,15 @@ 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);
}
diff --git a/source/blender/blenlib/intern/DLRB_tree.c b/source/blender/blenlib/intern/DLRB_tree.c
index 7c5ee236a35..0e90042a35f 100644
--- a/source/blender/blenlib/intern/DLRB_tree.c
+++ b/source/blender/blenlib/intern/DLRB_tree.c
@@ -141,7 +141,8 @@ 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
*/
@@ -182,7 +183,8 @@ 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
*/
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c
index 8534621ccf1..0504ac5be60 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 c80f3e08e3b..e300d09ffbc 100644
--- a/source/blender/blenlib/intern/dynlib.c
+++ b/source/blender/blenlib/intern/dynlib.c
@@ -85,9 +85,7 @@ 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..4b5ea44e97c 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -230,7 +230,7 @@ void *BLI_gzopen(const char *filename, const char *mode)
GetShortPathNameW(filename_16,short_name_16, 256);
for (i = 0; i < 256; i++) {
- short_name[i] = (char)short_name_16[i];
+ short_name[i] = short_name_16[i];
}
gzfile = gzopen(short_name,mode);
diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c
index 8f2a2e6f8b5..a9a1f2bc57e 100644
--- a/source/blender/blenlib/intern/freetypefont.c
+++ b/source/blender/blenlib/intern/freetypefont.c
@@ -127,21 +127,17 @@ 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++) {
- l = (j > 0) ? (k + ftoutline.contours[j - 1] + 1) : k;
-
- if (ftoutline.tags[l] == FT_Curve_Tag_On)
- onpoints[j]++;
+ if (j > 0) l = k + ftoutline.contours[j - 1] + 1; else l = 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]++;
- }
- }
}
}
@@ -402,7 +398,8 @@ 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);
diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c
index 432a74a5890..75131f81ade 100644
--- a/source/blender/blenlib/intern/graph.c
+++ b/source/blender/blenlib/intern/graph.c
@@ -46,11 +46,13 @@ 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);
}
}
@@ -68,7 +70,8 @@ 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);
}
@@ -79,7 +82,8 @@ 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;
}
}
@@ -88,7 +92,8 @@ 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;
}
}
@@ -104,8 +109,10 @@ 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);
}
@@ -115,13 +122,16 @@ 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);
}
}
@@ -131,7 +141,8 @@ void BLI_rebuildAdjacencyListForNode(BGraph* graph, BNode *node)
{
BArc *arc;
- if (node->arcs != NULL) {
+ if (node->arcs != NULL)
+ {
MEM_freeN(node->arcs);
}
@@ -140,16 +151,20 @@ 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);
}
}
@@ -158,8 +173,10 @@ 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;
}
@@ -170,8 +187,10 @@ 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;
}
}
@@ -181,24 +200,28 @@ 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);
}
}
@@ -207,22 +230,26 @@ 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);
@@ -230,7 +257,8 @@ 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);
}
}
@@ -239,9 +267,12 @@ 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);
}
}
@@ -254,9 +285,11 @@ 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;
}
@@ -268,13 +301,15 @@ 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);
}
@@ -286,16 +321,20 @@ 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);
}
@@ -308,8 +347,10 @@ 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;
}
}
@@ -321,22 +362,26 @@ 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;
}
@@ -354,9 +399,11 @@ 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);
}
}
@@ -368,8 +415,10 @@ 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;
}
}
@@ -385,24 +434,30 @@ 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);
}
}
@@ -425,11 +480,13 @@ 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);
}
@@ -446,12 +503,15 @@ 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;
@@ -482,27 +542,32 @@ 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];
@@ -510,7 +575,8 @@ 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];
@@ -527,25 +593,29 @@ 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);
}
}
@@ -564,11 +634,13 @@ 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++;
}
}
@@ -577,11 +649,13 @@ 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];
@@ -602,16 +676,19 @@ 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;
@@ -619,7 +696,8 @@ static void handleRadialSymmetry(BGraph *graph, BNode *root_node, int depth, flo
ring[j + 1] = ring[j];
ring[j] = tmp;
}
- else {
+ else
+ {
break;
}
}
@@ -629,32 +707,38 @@ 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;
@@ -666,12 +750,14 @@ 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];
}
@@ -679,7 +765,8 @@ 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);
}
@@ -699,10 +786,12 @@ 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;
}
}
@@ -720,13 +809,16 @@ 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);
}
@@ -735,7 +827,8 @@ 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;
@@ -745,11 +838,13 @@ 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 */
}
}
@@ -763,16 +858,20 @@ 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 */
@@ -781,7 +880,8 @@ 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;
}
@@ -797,15 +897,18 @@ 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);
}
@@ -814,18 +917,22 @@ 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);
}
@@ -837,16 +944,19 @@ 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 */
@@ -856,22 +966,26 @@ 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;
@@ -880,12 +994,15 @@ 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;
}
@@ -893,17 +1010,20 @@ 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);
}
@@ -915,11 +1035,13 @@ 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;
}
@@ -932,29 +1054,37 @@ 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;
}
}
@@ -978,13 +1108,16 @@ 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/lasso.c b/source/blender/blenlib/intern/lasso.c
deleted file mode 100644
index 29b967fcd37..00000000000
--- a/source/blender/blenlib/intern/lasso.c
+++ /dev/null
@@ -1,129 +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 *****
- *
- */
-
-/** \file blender/blenlib/intern/lasso.c
- * \ingroup bli
- */
-
-#include "DNA_vec_types.h"
-
-#include "BLI_math.h"
-#include "BLI_rect.h"
-
-#include "BLI_lasso.h" /* own include */
-
-void BLI_lasso_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];
- }
-}
-
-
-int BLI_lasso_is_point_inside(int mcords[][2], short moves,
- const int sx, const int sy,
- const int error_value)
-{
- /* we do the angle rule, define that all added angles should be about zero or (2 * PI) */
- float angletot = 0.0, dot, ang, cross, fp1[2], fp2[2];
- int a;
- int *p1, *p2;
-
- if (sx == error_value) {
- return 0;
- }
-
- p1 = mcords[moves - 1];
- p2 = mcords[0];
-
- /* first vector */
- fp1[0] = (float)(p1[0] - sx);
- fp1[1] = (float)(p1[1] - sy);
- normalize_v2(fp1);
-
- for (a = 0; a < moves; a++) {
- /* second vector */
- fp2[0] = (float)(p2[0] - sx);
- fp2[1] = (float)(p2[1] - sy);
- normalize_v2(fp2);
-
- /* 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 BLI_lasso_is_edge_inside(int mcords[][2], short moves,
- int x0, int y0, int x1, int y1,
- const int error_value)
-{
- int v1[2], v2[2];
- int a;
-
- if (x0 == error_value || x1 == error_value) {
- return 0;
- }
-
- v1[0] = x0, v1[1] = y0;
- v2[0] = x1, v2[1] = y1;
-
- /* check points in lasso */
- if (BLI_lasso_is_point_inside(mcords, moves, v1[0], v1[1], error_value)) return 1;
- if (BLI_lasso_is_point_inside(mcords, moves, v2[0], v2[1], error_value)) 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;
-}
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index f7114822dfd..fecaa507b5c 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -1,4 +1,9 @@
-/*
+/* util.c
+ *
+ * various string, file, list operations.
+ *
+ *
+ *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -184,7 +189,8 @@ 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..739ef47d487 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -866,6 +866,35 @@ int is_orthonormal_m4(float m[][4])
return 0;
}
+int is_uniform_scaled_m3(float m[][3])
+{
+ const float eps = 1e-7;
+ float t[3][3];
+ float l1, l2, l3, l4, l5, l6;
+
+ copy_m3_m3(t, m);
+ transpose_m3(t);
+
+ l1 = len_squared_v3(m[0]);
+ l2 = len_squared_v3(m[1]);
+ l3 = len_squared_v3(m[2]);
+
+ l4 = len_squared_v3(t[0]);
+ l5 = len_squared_v3(t[1]);
+ l6 = len_squared_v3(t[2]);
+
+ if (fabsf(l2 - l1) <= eps &&
+ fabsf(l3 - l1) <= eps &&
+ fabsf(l4 - l1) <= eps &&
+ fabsf(l5 - l1) <= eps &&
+ fabsf(l6 - l1) <= eps)
+ {
+ return 1;
+ }
+
+ return 0;
+}
+
void normalize_m3(float mat[][3])
{
normalize_v3(mat[0]);
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 37402f9391c..ec5fd39cd87 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -78,23 +78,7 @@ void mul_qt_qtqt(float q[4], const float q1[4], const float q2[4])
q[2] = t2;
}
-/**
- * \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:]
- */
+/* Assumes a unit quaternion */
void mul_qt_v3(const float q[4], float v[3])
{
float t0, t1, t2;
@@ -1631,7 +1615,7 @@ void normalize_dq(DualQuat *dq, float totweight)
}
}
-void mul_v3m3_dq(float co[3], float mat[][3], DualQuat *dq)
+void mul_v3m3_dq(float *co, 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/path_util.c b/source/blender/blenlib/intern/path_util.c
index f52921cd19b..3c59ca8d52b 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -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;
diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c
index f4481c37f2d..7a955cf6ed9 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,9 +1290,7 @@ 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);
@@ -1347,7 +1345,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;
@@ -1362,7 +1360,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;
@@ -1506,7 +1504,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..ca1189eb161 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -493,6 +493,23 @@ int BLI_exists(const char *name)
return(st.st_mode);
}
+
+#ifdef WIN32
+int BLI_stat(const char *path, struct stat *buffer)
+{
+ int r;
+ UTF16_ENCODE(path);
+ r=_wstat(path_16,buffer);
+ UTF16_UN_ENCODE(path);
+ return r;
+}
+#else
+int BLI_stat(const char *path, struct stat *buffer)
+{
+ return stat(path, buffer);
+}
+#endif
+
/* would be better in fileops.c except that it needs stat.h so add here */
int BLI_is_dir(const char *file)
{
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index b2245226a3c..4c92a872ed7 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 '\\':
diff --git a/source/blender/blenlib/intern/string_cursor_utf8.c b/source/blender/blenlib/intern/string_cursor_utf8.c
index 97559d6ba10..422a600e51c 100644
--- a/source/blender/blenlib/intern/string_cursor_utf8.c
+++ b/source/blender/blenlib/intern/string_cursor_utf8.c
@@ -93,6 +93,7 @@ static strCursorDelimType test_special_char(const char *ch_utf8)
return STRCUR_DELIM_QUOTE;
case ' ':
+ case '\t':
return STRCUR_DELIM_WHITESPACE;
case '\\':
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
index 20c5c8082ce..aede08be7f9 100644
--- a/source/blender/blenlib/intern/string_utf8.c
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -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/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index 8f3131c733a..49990a953f6 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -156,7 +156,8 @@ 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 9aa87a86b3e..4adcf6add2a 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -1061,7 +1061,8 @@ void blo_freefiledata(FileData *fd)
close(fd->filedes);
}
- if (fd->gzfiledes != NULL) {
+ if (fd->gzfiledes != NULL)
+ {
gzclose(fd->gzfiledes);
}
@@ -2457,10 +2458,19 @@ typedef struct tConstraintLinkData {
ID *id;
} tConstraintLinkData;
/* callback function used to relink constraint ID-links */
-static void lib_link_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, void *userdata)
+static void lib_link_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, short isReference, void *userdata)
{
tConstraintLinkData *cld= (tConstraintLinkData *)userdata;
- *idpoin = newlibadr(cld->fd, cld->id->lib, *idpoin);
+
+ /* for reference types, we need to increment the usercounts on load... */
+ if (isReference) {
+ /* reference type - with usercount */
+ *idpoin = newlibadr_us(cld->fd, cld->id->lib, *idpoin);
+ }
+ else {
+ /* target type - no usercount needed */
+ *idpoin = newlibadr(cld->fd, cld->id->lib, *idpoin);
+ }
}
static void lib_link_constraints(FileData *fd, ID *id, ListBase *conlist)
@@ -2755,9 +2765,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:
@@ -3441,7 +3451,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:
{
@@ -4234,7 +4244,8 @@ 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 */
}
}
@@ -4357,7 +4368,8 @@ 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);
@@ -4402,7 +4414,8 @@ 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;
}
@@ -4414,7 +4427,8 @@ 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;
@@ -4434,7 +4448,8 @@ 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);
@@ -4841,7 +4856,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) {
@@ -4972,7 +4987,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);
@@ -6083,7 +6098,8 @@ 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;
}
@@ -6226,7 +6242,8 @@ 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";
@@ -6336,7 +6353,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;
@@ -6914,7 +6931,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);
@@ -7036,7 +7053,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;
@@ -7442,7 +7459,8 @@ 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;
@@ -7688,10 +7706,15 @@ static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNo
bNodeSocket *old_image = BLI_findlink(&node->inputs, 0);
bNodeSocket *old_z = BLI_findlink(&node->inputs, 1);
bNodeSocket *sock;
+ char basepath[FILE_MAXDIR];
+ char filename[FILE_MAXFILE];
node->storage= nimf;
- BLI_strncpy(nimf->base_path, old_data->name, sizeof(nimf->base_path));
+ /* split off filename from the old path, to be used as socket sub-path */
+ BLI_split_dirfile(old_data->name, basepath, filename, sizeof(basepath), sizeof(filename));
+
+ BLI_strncpy(nimf->base_path, basepath, sizeof(nimf->base_path));
nimf->format = old_data->im_format;
/* if z buffer is saved, change the image type to multilayer exr.
@@ -7699,21 +7722,32 @@ static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNo
* i'm just assuming here that IRIZ means IRIS with z buffer ...
*/
if (ELEM(old_data->im_format.imtype, R_IMF_IMTYPE_IRIZ, R_IMF_IMTYPE_OPENEXR)) {
+ char sockpath[FILE_MAX];
+
nimf->format.imtype = R_IMF_IMTYPE_MULTILAYER;
- sock = ntreeCompositOutputFileAddSocket(ntree, node, old_image->name, &nimf->format);
+
+ BLI_snprintf(sockpath, sizeof(sockpath), "%s_Image", filename);
+ sock = ntreeCompositOutputFileAddSocket(ntree, node, sockpath, &nimf->format);
+ /* XXX later do_versions copies path from socket name, need to set this explicitely */
+ BLI_strncpy(sock->name, sockpath, sizeof(sock->name));
if (old_image->link) {
old_image->link->tosock = sock;
sock->link = old_image->link;
}
- sock = ntreeCompositOutputFileAddSocket(ntree, node, old_z->name, &nimf->format);
+
+ BLI_snprintf(sockpath, sizeof(sockpath), "%s_Z", filename);
+ sock = ntreeCompositOutputFileAddSocket(ntree, node, sockpath, &nimf->format);
+ /* XXX later do_versions copies path from socket name, need to set this explicitely */
+ BLI_strncpy(sock->name, sockpath, sizeof(sock->name));
if (old_z->link) {
old_z->link->tosock = sock;
sock->link = old_z->link;
}
}
else {
- /* saves directly to base path, which is the old image output path */
- sock = ntreeCompositOutputFileAddSocket(ntree, node, "", &nimf->format);
+ sock = ntreeCompositOutputFileAddSocket(ntree, node, filename, &nimf->format);
+ /* XXX later do_versions copies path from socket name, need to set this explicitely */
+ BLI_strncpy(sock->name, filename, sizeof(sock->name));
if (old_image->link) {
old_image->link->tosock = sock;
sock->link = old_image->link;
@@ -8327,7 +8361,8 @@ 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;
@@ -8994,7 +9029,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;
}
@@ -9743,16 +9778,17 @@ 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;
@@ -10051,7 +10087,8 @@ 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])
@@ -10409,7 +10446,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;
}
@@ -10467,11 +10504,13 @@ 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);
@@ -10762,7 +10801,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;
}
@@ -10795,8 +10834,10 @@ 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;
}
@@ -10806,7 +10847,8 @@ 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;
@@ -10829,10 +10871,13 @@ 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);
@@ -11208,7 +11253,8 @@ 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;
@@ -11350,7 +11396,8 @@ 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) {
@@ -11472,7 +11519,8 @@ 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;
@@ -11498,7 +11546,8 @@ 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 */
@@ -11515,7 +11564,8 @@ 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;
@@ -11554,7 +11604,8 @@ 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;
@@ -11596,7 +11647,8 @@ 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;
@@ -11801,7 +11853,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
@@ -11957,7 +12009,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
- if (main->versionfile < 253) {
+ if (main->versionfile < 253)
+ {
Object *ob;
Scene *scene;
bScreen *sc;
@@ -12070,7 +12123,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;
}
@@ -12168,7 +12221,8 @@ 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) {
@@ -12177,7 +12231,8 @@ 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;
@@ -12196,7 +12251,8 @@ 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;
}
}
@@ -12282,7 +12338,8 @@ 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;
}
}
@@ -12542,10 +12599,11 @@ 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
@@ -12716,7 +12774,8 @@ 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;
@@ -12896,7 +12955,8 @@ 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;
@@ -12960,7 +13020,8 @@ 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) {
@@ -12969,7 +13030,8 @@ 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;
@@ -13070,7 +13132,8 @@ 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;
@@ -13104,7 +13167,8 @@ 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;
@@ -13130,7 +13194,8 @@ 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;
@@ -13145,7 +13210,8 @@ 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;
@@ -13160,7 +13226,8 @@ 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;
@@ -13177,7 +13244,8 @@ 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;
@@ -13192,7 +13260,8 @@ 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) {
@@ -13202,7 +13271,8 @@ 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;
@@ -13216,7 +13286,8 @@ 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;
@@ -13230,7 +13301,8 @@ 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;
@@ -13254,7 +13326,8 @@ 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)
@@ -13392,7 +13465,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 */
@@ -13960,7 +14033,7 @@ typedef struct tConstraintExpandData {
Main *mainvar;
} tConstraintExpandData;
/* callback function used to expand constraint ID-links */
-static void expand_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, void *userdata)
+static void expand_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, short UNUSED(isReference), void *userdata)
{
tConstraintExpandData *ced= (tConstraintExpandData *)userdata;
expand_doit(ced->fd, ced->mainvar, *idpoin);
@@ -14220,7 +14293,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);
@@ -14288,7 +14361,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);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 42736b6b787..37e6387d160 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -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);
@@ -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,8 +1316,10 @@ 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 */
@@ -1351,7 +1353,8 @@ 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);
@@ -1365,7 +1368,8 @@ 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);
@@ -2108,19 +2112,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;
@@ -2254,7 +2258,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;
@@ -2694,6 +2698,9 @@ static void write_movieclips(WriteData *wd, ListBase *idbase)
MovieTrackingObject *object;
writestruct(wd, ID_MC, "MovieClip", 1, clip);
+ if (clip->id.properties)
+ IDP_WriteProperty(clip->id.properties, wd);
+
if (clip->adt)
write_animdata(wd, clip->adt);
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c
index c2d5d93cbc3..ac2e31c714f 100644
--- a/source/blender/bmesh/intern/bmesh_construct.c
+++ b/source/blender/bmesh/intern/bmesh_construct.c
@@ -214,6 +214,9 @@ BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, i
BLI_array_append(verts, v);
BLI_array_append(edges2, e);
+ /* we only flag the verts to check if they are in the face more then once */
+ BM_ELEM_API_FLAG_ENABLE(v, _FLAG_MV);
+
do {
e2 = bmesh_disk_edge_next(e2, v);
if (e2 != e && BM_ELEM_API_FLAG_TEST(e2, _FLAG_MF)) {
@@ -269,6 +272,12 @@ BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, i
if (!edges2[i]) {
goto err;
}
+
+ /* check if vert is in face more then once. if the flag is disabled. we've already visited */
+ if (!BM_ELEM_API_FLAG_TEST(verts[i], _FLAG_MV)) {
+ goto err;
+ }
+ BM_ELEM_API_FLAG_DISABLE(verts[i], _FLAG_MV);
}
f = BM_face_create(bm, verts, edges2, len, nodouble);
@@ -286,6 +295,10 @@ BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, i
err:
for (i = 0; i < len; i++) {
BM_ELEM_API_FLAG_DISABLE(edges[i], _FLAG_MF);
+ /* vert count may != len */
+ if (i < BLI_array_count(verts)) {
+ BM_ELEM_API_FLAG_DISABLE(verts[i], _FLAG_MV);
+ }
}
BLI_array_free(verts);
@@ -871,8 +884,8 @@ BMesh *BM_mesh_copy(BMesh *bm_old)
BLI_array_empty(loops);
BLI_array_empty(edges);
- BLI_array_grow_items(loops, f->len);
- BLI_array_grow_items(edges, f->len);
+ BLI_array_growitems(loops, f->len);
+ BLI_array_growitems(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 f38c737b8ac..e20eb103e1b 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -582,6 +582,9 @@ void BM_face_verts_kill(BMesh *bm, BMFace *f)
BLI_array_free(verts);
}
+/**
+ * Kills \a f and its loops.
+ */
void BM_face_kill(BMesh *bm, BMFace *f)
{
#ifdef USE_BMESH_HOLES
@@ -671,7 +674,10 @@ void BM_vert_kill(BMesh *bm, BMVert *v)
/********** private disk and radial cycle functions ********** */
-static int bm_loop_length(BMLoop *l)
+/**
+ * return the length of the face, should always equal \a l->f->len
+ */
+static int UNUSED_FUNCTION(bm_loop_length)(BMLoop *l)
{
BMLoop *l_first = l;
int i = 0;
@@ -707,18 +713,15 @@ static int bm_loop_reverse_loop(BMesh *bm, BMFace *f
BMLoop *l_first = f->l_first;
#endif
+ const int len = f->len;
+ const int do_disps = CustomData_has_layer(&bm->ldata, CD_MDISPS);
BMLoop *l_iter, *oldprev, *oldnext;
BMEdge **edar = NULL;
- MDisps *md;
- BLI_array_staticdeclare(edar, BM_NGON_STACK_SIZE);
- int i, j, edok, len = 0, do_disps = CustomData_has_layer(&bm->ldata, CD_MDISPS);
-
- len = bm_loop_length(l_first);
+ BLI_array_fixedstack_declare(edar, BM_NGON_STACK_SIZE, len, __func__);
+ int i, j, edok;
for (i = 0, l_iter = l_first; i < len; i++, l_iter = l_iter->next) {
- BMEdge *curedge = l_iter->e;
- bmesh_radial_loop_remove(l_iter, curedge);
- BLI_array_append(edar, curedge);
+ bmesh_radial_loop_remove(l_iter, (edar[i] = l_iter->e));
}
/* actually reverse the loop */
@@ -732,6 +735,7 @@ static int bm_loop_reverse_loop(BMesh *bm, BMFace *f
if (do_disps) {
float (*co)[3];
int x, y, sides;
+ MDisps *md;
md = CustomData_bmesh_get(&bm->ldata, l_iter->head.data, CD_MDISPS);
if (!md->totdisp || !md->disps)
@@ -777,7 +781,7 @@ static int bm_loop_reverse_loop(BMesh *bm, BMFace *f
BM_CHECK_ELEMENT(l_iter->f);
}
- BLI_array_free(edar);
+ BLI_array_fixedstack_free(edar);
BM_CHECK_ELEMENT(f);
diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c
index 5149a5436a2..c774880332b 100644
--- a/source/blender/bmesh/intern/bmesh_interp.c
+++ b/source/blender/bmesh/intern/bmesh_interp.c
@@ -853,6 +853,52 @@ void BM_data_layer_free_n(BMesh *bm, CustomData *data, int type, int n)
if (olddata.layers) MEM_freeN(olddata.layers);
}
+void BM_data_layer_copy(BMesh *bm, CustomData *data, int type, int src_n, int dst_n)
+{
+ BMIter iter;
+
+ if (&bm->vdata == data) {
+ BMVert *eve;
+
+ BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+ void *ptr = CustomData_bmesh_get_n(data, eve->head.data, type, dst_n);
+ CustomData_bmesh_set_n(data, eve->head.data, type, src_n, ptr);
+ }
+ }
+ else if (&bm->edata == data) {
+ BMEdge *eed;
+
+ BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
+ void *ptr = CustomData_bmesh_get_n(data, eed->head.data, type, dst_n);
+ CustomData_bmesh_set_n(data, eed->head.data, type, src_n, ptr);
+ }
+ }
+ else if (&bm->pdata == data) {
+ BMFace *efa;
+
+ BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+ void *ptr = CustomData_bmesh_get_n(data, efa->head.data, type, dst_n);
+ CustomData_bmesh_set_n(data, efa->head.data, type, src_n, ptr);
+ }
+ }
+ else if (&bm->ldata == data) {
+ BMIter liter;
+ BMFace *efa;
+ BMLoop *l;
+
+ BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+ BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+ void *ptr = CustomData_bmesh_get_n(data, l->head.data, type, dst_n);
+ CustomData_bmesh_set_n(data, l->head.data, type, src_n, ptr);
+ }
+ }
+ }
+ else {
+ /* should never reach this! */
+ BLI_assert(0);
+ }
+}
+
float BM_elem_float_data_get(CustomData *cd, void *element, int type)
{
float *f = CustomData_bmesh_get(cd, ((BMHeader *)element)->data, type);
diff --git a/source/blender/bmesh/intern/bmesh_interp.h b/source/blender/bmesh/intern/bmesh_interp.h
index 0d97fbcc0ec..3380a3e6b1b 100644
--- a/source/blender/bmesh/intern/bmesh_interp.h
+++ b/source/blender/bmesh/intern/bmesh_interp.h
@@ -36,6 +36,8 @@ void BM_data_layer_add(BMesh *em, CustomData *data, int type);
void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const char *name);
void BM_data_layer_free(BMesh *em, CustomData *data, int type);
void BM_data_layer_free_n(BMesh *bm, CustomData *data, int type, int n);
+void BM_data_layer_copy(BMesh *bm, CustomData *data, int type, int src_n, int dst_n);
+
float BM_elem_float_data_get(CustomData *cd, void *element, int type);
void BM_elem_float_data_set(CustomData *cd, void *element, int type, const float val);
diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c
index 8103ae1ee11..384715d74f7 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.c
+++ b/source/blender/bmesh/intern/bmesh_iterators.c
@@ -104,50 +104,6 @@ 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 1361a91a692..c687e4b4e7a 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.h
+++ b/source/blender/bmesh/intern/bmesh_iterators.h
@@ -117,8 +117,6 @@ 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 351fb8e941b..f72efe8ab5f 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_grow_items(fedges, mpoly->totloop);
- BLI_array_grow_items(verts, mpoly->totloop);
+ BLI_array_growitems(fedges, mpoly->totloop);
+ BLI_array_growitems(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 5f3836cc413..a5e761af783 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_grow_items(verts, face->len);
+ BLI_array_growitems(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..d74ffdc06d2 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -696,6 +696,7 @@ static BMOpDefine bmo_esubd_def = {
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"},
{BMO_OP_SLOT_FLT, "smooth"},
{BMO_OP_SLOT_FLT, "fractal"},
+ {BMO_OP_SLOT_FLT, "along_normal"},
{BMO_OP_SLOT_INT, "numcuts"},
{BMO_OP_SLOT_INT, "seed"},
{BMO_OP_SLOT_MAPPING, "custompatterns"},
diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h
index f4db13e2777..b0a647b7009 100644
--- a/source/blender/bmesh/intern/bmesh_operators.h
+++ b/source/blender/bmesh/intern/bmesh_operators.h
@@ -98,7 +98,7 @@ extern int bmesh_total_ops;
struct Object;
void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
- float smooth, float fractal,
+ float smooth, float fractal, float along_normal,
int numcuts,
int seltype, int cornertype,
const short use_singleedge, const short use_gridfill,
diff --git a/source/blender/bmesh/intern/bmesh_private.h b/source/blender/bmesh/intern/bmesh_private.h
index 6297e20d9d2..da238123775 100644
--- a/source/blender/bmesh/intern/bmesh_private.h
+++ b/source/blender/bmesh/intern/bmesh_private.h
@@ -60,6 +60,7 @@ int bmesh_disk_count(BMVert *v);
* on using these internal flags!*/
#define _FLAG_JF 1 /* join faces */
#define _FLAG_MF 2 /* make face */
+#define _FLAG_MV 2 /* make face, vertex */
#define BM_ELEM_API_FLAG_ENABLE(element, f) ((element)->oflags[0].pflag |= (f))
#define BM_ELEM_API_FLAG_DISABLE(element, f) ((element)->oflags[0].pflag &= ~(f))
diff --git a/source/blender/bmesh/intern/bmesh_walkers.c b/source/blender/bmesh/intern/bmesh_walkers.c
index ea29c149c1a..a3b5d94ba8e 100644
--- a/source/blender/bmesh/intern/bmesh_walkers.c
+++ b/source/blender/bmesh/intern/bmesh_walkers.c
@@ -226,7 +226,8 @@ 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 ec4b97d59f3..113e1ddc164 100644
--- a/source/blender/bmesh/intern/bmesh_walkers_impl.c
+++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c
@@ -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 b6b54b82f3d..46dd7606940 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_grow_one(etags);
+ BLI_array_growone(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_grow_one(tags);
+ BLI_array_growone(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_grow_one(etags);
+ BLI_array_growone(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_grow_one(etags);
+ BLI_array_growone(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_grow_one(tags);
+ BLI_array_growone(tags);
BM_elem_index_set(l2, BLI_array_count(tags) - 1); /* set_loop */
if (!BLI_smallhash_haskey(&hash, (intptr_t)l2->e)) {
- BLI_array_grow_one(etags);
+ BLI_array_growone(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 b8abe112c4d..3c1f10be4c4 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_grow_one(loops);
+ BLI_array_growone(loops);
loops[BLI_array_count(loops) - 1] = lastl;
- BLI_array_grow_one(loops);
+ BLI_array_growone(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_grow_one(loops);
+ BLI_array_growone(loops);
loops[BLI_array_count(loops) - 1] = loops[BLI_array_count(loops) - 2];
- BLI_array_grow_one(loops);
+ BLI_array_growone(loops);
loops[BLI_array_count(loops) - 1] = loops[0];
}
@@ -101,10 +101,10 @@ void bmo_connectverts_exec(BMesh *bm, BMOperator *op)
continue;
}
- BLI_array_grow_one(verts);
+ BLI_array_growone(verts);
verts[BLI_array_count(verts) - 1] = loops[i * 2]->v;
- BLI_array_grow_one(verts);
+ BLI_array_growone(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 6f08ab421f3..f2ba110b43d 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_grow_one(verts);
+ BLI_array_growone(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_grow_one(edges);
+ BLI_array_growone(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_grow_one(edges);
+ BLI_array_growone(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_grow_one(edges);
+ BLI_array_growone(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_length_set(edges1, BLI_array_count(edges));
+ BLI_array_set_length(edges1, BLI_array_count(edges));
}
else {
edges2 = edges;
- BLI_array_length_set(edges2, BLI_array_count(edges));
+ BLI_array_set_length(edges2, BLI_array_count(edges));
}
BLI_array_empty(edges);
diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c
index 8e7723fefdd..1451625d3bb 100644
--- a/source/blender/bmesh/operators/bmo_dissolve.c
+++ b/source/blender/bmesh/operators/bmo_dissolve.c
@@ -34,14 +34,14 @@
#include "intern/bmesh_operators_private.h" /* own include */
-#define FACE_MARK 1
-#define FACE_ORIG 2
-#define FACE_NEW 4
-#define EDGE_MARK 1
+#define FACE_MARK 1
+#define FACE_ORIG 2
+#define FACE_NEW 4
+#define EDGE_MARK 1
-#define VERT_MARK 1
+#define VERT_MARK 1
-static int UNUSED_FUNCTION(check_hole_in_region)(BMesh *bm, BMFace *f)
+static int UNUSED_FUNCTION(check_hole_in_region) (BMesh * bm, BMFace * f)
{
BMWalker regwalker;
BMIter liter2;
@@ -60,8 +60,8 @@ static int UNUSED_FUNCTION(check_hole_in_region)(BMesh *bm, BMFace *f)
l2 = BM_iter_new(&liter2, bm, BM_LOOPS_OF_FACE, f2);
for ( ; l2; l2 = BM_iter_step(&liter2)) {
l3 = l2->radial_next;
- if ( BMO_elem_flag_test(bm, l3->f, FACE_MARK) !=
- BMO_elem_flag_test(bm, l2->f, FACE_MARK))
+ if (BMO_elem_flag_test(bm, l3->f, FACE_MARK) !=
+ BMO_elem_flag_test(bm, l2->f, FACE_MARK))
{
if (!BMO_elem_flag_test(bm, l2->e, EDGE_MARK)) {
return FALSE;
@@ -433,8 +433,8 @@ void dummy_exec(BMesh *bm, BMOperator *op)
fe = l->e;
for ( ; l; l = BM_iter_step(&liter)) {
f2 = BM_iter_new(&fiter, bm,
- BM_FACES_OF_EDGE, l->e);
- for ( ; f2; f2 = BM_iter_step(&fiter)) {
+ BM_FACES_OF_EDGE, l->e);
+ for (; f2; f2 = BM_iter_step(&fiter)) {
if (f2 != f) {
BM_faces_join_pair(bm, f, f2, l->e);
found2 = 1;
@@ -478,8 +478,8 @@ void dummy_exec(BMesh *bm, BMOperator *op)
/* Limited Dissolve */
-#define UNIT_TO_ANGLE DEG2RADF(90.0)
-#define ANGLE_TO_UNIT (1.0 / UNIT_TO_ANGLE)
+#define UNIT_TO_ANGLE DEG2RADF(90.0f)
+#define ANGLE_TO_UNIT (1.0f / UNIT_TO_ANGLE)
/* multiply vertex edge angle by face angle
* this means we are not left with sharp corners between _almost_ planer faces
@@ -520,14 +520,28 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
const float angle_max = (float)M_PI / 2.0f;
const float angle_limit = minf(angle_max, BMO_slot_float_get(op, "angle_limit"));
DissolveElemWeight *weight_elems = MEM_mallocN(MAX2(einput->len, vinput->len) *
- sizeof(DissolveElemWeight), __func__);
+ sizeof(DissolveElemWeight), __func__);
int i, tot_found;
+ BMIter iter;
+ BMEdge *e_iter;
+ BMEdge **earray;
+
+ int *vert_reverse_lookup;
+
+ BMEdge **einput_arr = (BMEdge **)einput->data.p;
+ BMVert **vinput_arr = (BMVert **)vinput->data.p;
+
/* --- first edges --- */
+ /* wire -> tag */
+ BM_ITER_MESH (e_iter, &iter, bm, BM_EDGES_OF_MESH) {
+ BM_elem_flag_set(e_iter, BM_ELEM_TAG, BM_edge_is_wire(e_iter));
+ }
+
/* go through and split edge */
for (i = 0, tot_found = 0; i < einput->len; i++) {
- BMEdge *e = ((BMEdge **)einput->data.p)[i];
+ BMEdge *e = einput_arr[i];
const float angle = BM_edge_calc_face_angle(e);
if (angle < angle_limit) {
@@ -562,24 +576,53 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
}
}
}
+ }
- /* remove all edges/verts left behind from dissolving */
- for (i = 0; i < einput->len; i++) {
- BMEdge *e = (BMEdge *)weight_elems[i].ele;
- if (BM_edge_is_wire(e)) {
- BMVert *v1 = e->v1;
- BMVert *v2 = e->v2;
- BM_edge_kill(bm, e);
- if (v1->e == NULL) BM_vert_kill(bm, v1);
- if (v2->e == NULL) BM_vert_kill(bm, v2);
+ /* prepare for cleanup */
+ BM_mesh_elem_index_ensure(bm, BM_VERT);
+ vert_reverse_lookup = MEM_mallocN(sizeof(int) * bm->totvert, __func__);
+ fill_vn_i(vert_reverse_lookup, bm->totvert, -1);
+ for (i = 0, tot_found = 0; i < vinput->len; i++) {
+ BMVert *v = vinput_arr[i];
+ vert_reverse_lookup[BM_elem_index_get(v)] = i;
+ }
+
+ /* --- cleanup --- */
+ earray = MEM_mallocN(sizeof(BMEdge *) * bm->totedge, __func__);
+ BM_ITER_MESH_INDEX (e_iter, &iter, bm, BM_EDGES_OF_MESH, i) {
+ earray[i] = e_iter;
+ }
+ /* remove all edges/verts left behind from dissolving, NULL'ing the vertex array so we dont re-use */
+ for (i = bm->totedge - 1; i != -1; i--) {
+ e_iter = earray[i];
+
+ if (BM_edge_is_wire(e_iter) && (BM_elem_flag_test(e_iter, BM_ELEM_TAG) == FALSE)) {
+ /* edge has become wire */
+ int vidx_reverse;
+ BMVert *v1 = e_iter->v1;
+ BMVert *v2 = e_iter->v2;
+ BM_edge_kill(bm, e_iter);
+ if (v1->e == NULL) {
+ vidx_reverse = vert_reverse_lookup[BM_elem_index_get(v1)];
+ if (vidx_reverse != -1) vinput_arr[vidx_reverse] = NULL;
+ BM_vert_kill(bm, v1);
+ }
+ if (v2->e == NULL) {
+ vidx_reverse = vert_reverse_lookup[BM_elem_index_get(v2)];
+ if (vidx_reverse != -1) vinput_arr[vidx_reverse] = NULL;
+ BM_vert_kill(bm, v2);
}
}
}
+ MEM_freeN(vert_reverse_lookup);
+
+ MEM_freeN(earray);
+
/* --- second verts --- */
for (i = 0, tot_found = 0; i < vinput->len; i++) {
- BMVert *v = ((BMVert **)vinput->data.p)[i];
- const float angle = bm_vert_edge_face_angle(v);
+ BMVert *v = vinput_arr[i];
+ const float angle = v ? bm_vert_edge_face_angle(v) : angle_limit;
if (angle < angle_limit) {
weight_elems[i].ele = (BMHeader *)v;
diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c
index 0659a42c26d..36d446a0a8c 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_grow_items(vtar, f->len);
- BLI_array_grow_items(edar, f->len);
+ BLI_array_growitems(vtar, f->len);
+ BLI_array_growitems(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 4fced09c588..19e2dd85b0e 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_grow_items(edges, f->len);
+ BLI_array_growitems(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_grow_items(verts, f->len);
+ BLI_array_growitems(verts, f->len);
BM_ITER_ELEM_INDEX (l, &loopIter, f, BM_LOOPS_OF_FACE, i) {
verts[i] = l->v->co;
}
- BLI_array_grow_items(face_angles, f->len);
+ BLI_array_growitems(face_angles, f->len);
angle_poly_v3(face_angles, (const float **)verts, f->len);
i = 0;
diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c
index d780e309118..582039fc1a2 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_grow_one(jedges);
+ BLI_array_growone(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 53c51dfd483..cf1669d441e 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_grow_one(vmap);
+ BLI_array_growone(vmap);
vmap[i] = v;
/* v2 = BM_iter_step(&iter); */ /* UNUSED */
i++;
diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c
index 6fd3c8ce99c..77d10347f99 100644
--- a/source/blender/bmesh/operators/bmo_primitive.c
+++ b/source/blender/bmesh/operators/bmo_primitive.c
@@ -260,6 +260,7 @@ void bmo_create_grid_exec(BMesh *bm, BMOperator *op)
}
/* extrude and translate */
+ phid = 2.0f / ((float)seg - 1);
vec[0] = vec[2] = 0.0f;
vec[1] = dia * phid;
mul_mat3_m4_v3(mat, vec);
diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c
index 70dcc6fa3ae..149f2537a12 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_grow_one(edges);
- BLI_array_grow_one(loops);
+ BLI_array_growone(edges);
+ BLI_array_growone(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_grow_one(edges);
+ BLI_array_growone(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_grow_one(blocks);
+ BLI_array_growone(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_grow_one(verts);
+ BLI_array_growone(verts);
verts[i++] = v;
}
diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c
index d96d0f6c74d..92854c93827 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.c
+++ b/source/blender/bmesh/operators/bmo_subdivide.c
@@ -141,23 +141,24 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const SubDPar
if (params->use_fractal) {
float len = len_v3v3(vsta->co, vend->co);
- float vec2[3] = {0.0f, 0.0f, 0.0f}, co2[3];
+ float normal[3] = {0.0f, 0.0f, 0.0f}, co2[3], base1[3], base2[3];
fac = params->fractal * len;
- add_v3_v3(vec2, vsta->no);
- add_v3_v3(vec2, vend->no);
- mul_v3_fl(vec2, 0.5f);
+ mid_v3_v3v3(normal, vsta->no, vend->no);
+ ortho_basis_v3v3_v3(base1, base2, normal);
add_v3_v3v3(co2, v->co, params->off);
- tvec[0] = fac * (BLI_gTurbulence(1.0, co2[0], co2[1], co2[2], 15, 0, 1) - 0.5f);
- tvec[1] = fac * (BLI_gTurbulence(1.0, co2[0], co2[1], co2[2], 15, 0, 1) - 0.5f);
- tvec[2] = fac * (BLI_gTurbulence(1.0, co2[0], co2[1], co2[2], 15, 0, 1) - 0.5f);
+ mul_v3_fl(co2, 10.0f);
- mul_v3_v3(vec2, tvec);
+ tvec[0] = fac * (BLI_gTurbulence(1.0, co2[0], co2[1], co2[2], 15, 0, 2) - 0.5f);
+ tvec[1] = fac * (BLI_gTurbulence(1.0, co2[1], co2[0], co2[2], 15, 0, 2) - 0.5f);
+ tvec[2] = fac * (BLI_gTurbulence(1.0, co2[1], co2[2], co2[0], 15, 0, 2) - 0.5f);
/* add displacement */
- add_v3_v3v3(co, co, vec2);
+ madd_v3_v3fl(co, normal, tvec[0]);
+ madd_v3_v3fl(co, base1, tvec[1] * (1.0f - params->along_normal));
+ madd_v3_v3fl(co, base2, tvec[2] * (1.0f - params->along_normal));
}
/* apply the new difference to the rest of the shape keys,
@@ -687,7 +688,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
BLI_array_declare(facedata);
BLI_array_declare(edges);
BLI_array_declare(verts);
- float smooth, fractal;
+ float smooth, fractal, along_normal;
int use_sphere, cornertype, use_singleedge, use_gridfill;
int skey, seed, i, j, matched, a, b, numcuts, totesel;
@@ -697,6 +698,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
seed = BMO_slot_int_get(op, "seed");
smooth = BMO_slot_float_get(op, "smooth");
fractal = BMO_slot_float_get(op, "fractal");
+ along_normal = BMO_slot_float_get(op, "along_normal");
cornertype = BMO_slot_int_get(op, "quadcornertype");
use_singleedge = BMO_slot_bool_get(op, "use_singleedge");
@@ -754,6 +756,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
params.smooth = smooth;
params.seed = seed;
params.fractal = fractal;
+ params.along_normal = along_normal;
params.use_smooth = (smooth != 0.0f);
params.use_fractal = (fractal != 0.0f);
params.use_sphere = use_sphere;
@@ -778,8 +781,8 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
BLI_array_empty(edges);
BLI_array_empty(verts);
- BLI_array_grow_items(edges, face->len);
- BLI_array_grow_items(verts, face->len);
+ BLI_array_growitems(edges, face->len);
+ BLI_array_growitems(verts, face->len);
matched = 0;
@@ -825,7 +828,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
}
}
if (matched) {
- BLI_array_grow_one(facedata);
+ BLI_array_growone(facedata);
b = BLI_array_count(facedata) - 1;
facedata[b].pat = pat;
facedata[b].start = verts[i];
@@ -861,7 +864,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
}
}
if (matched) {
- BLI_array_grow_one(facedata);
+ BLI_array_growone(facedata);
j = BLI_array_count(facedata) - 1;
BMO_elem_flag_enable(bm, face, SUBD_SPLIT);
@@ -877,7 +880,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
}
if (!matched && totesel) {
- BLI_array_grow_one(facedata);
+ BLI_array_growone(facedata);
j = BLI_array_count(facedata) - 1;
BMO_elem_flag_enable(bm, face, SUBD_SPLIT);
@@ -918,7 +921,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_grow_one(loops);
+ BLI_array_growone(loops);
loops[BLI_array_count(loops) - 1] = l;
}
@@ -951,10 +954,10 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
b += numcuts - 1;
for (j = 0; j < numcuts; j++) {
- BLI_array_grow_one(splits);
+ BLI_array_growone(splits);
splits[BLI_array_count(splits) - 1] = loops[a];
- BLI_array_grow_one(splits);
+ BLI_array_growone(splits);
splits[BLI_array_count(splits) - 1] = loops[b];
b = (b - 1) % vlen;
@@ -989,7 +992,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
}
for (j = 0; j < face->len; j++) {
- BLI_array_grow_one(verts);
+ BLI_array_growone(verts);
}
j = 0;
@@ -1025,7 +1028,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
/* editmesh-emulating function */
void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
- float smooth, float fractal,
+ float smooth, float fractal, float along_normal,
int numcuts,
int seltype, int cornertype,
const short use_singleedge, const short use_gridfill,
@@ -1036,13 +1039,13 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
/* use_sphere isnt exposed here since its only used for new primitives */
BMO_op_initf(bm, &op,
"esubd edges=%he "
- "smooth=%f fractal=%f "
+ "smooth=%f fractal=%f along_normal=%f "
"numcuts=%i "
"quadcornertype=%i "
"use_singleedge=%b use_gridfill=%b "
"seed=%i",
edge_hflag,
- smooth, fractal,
+ smooth, fractal, along_normal,
numcuts,
cornertype,
use_singleedge, use_gridfill,
diff --git a/source/blender/bmesh/operators/bmo_subdivide.h b/source/blender/bmesh/operators/bmo_subdivide.h
index cc6ced8bfaa..d4b926b9275 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.h
+++ b/source/blender/bmesh/operators/bmo_subdivide.h
@@ -31,6 +31,7 @@ typedef struct SubDParams {
int numcuts;
float smooth;
float fractal;
+ float along_normal;
//int beauty;
short use_smooth;
short use_sphere;
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index 9632a79b7dd..7fd6cf6769c 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_grow_items(projectverts, face->len * 3);
- BLI_array_grow_items(newfaces, face->len);
+ BLI_array_growitems(projectverts, face->len * 3);
+ BLI_array_growitems(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 8409c5b76b8..3cfa70f6e6c 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_grow_one(fstack);
+ BLI_array_growone(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_grow_one(fstack);
+ BLI_array_growone(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_grow_one(cos);
+ BLI_array_growone(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_grow_items(uvs, fs->len);
+ BLI_array_growitems(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_grow_items(cols, fs->len);
+ BLI_array_growitems(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 c93ee832fe6..778e3029266 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,11 +59,13 @@ 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);
@@ -77,63 +79,59 @@ 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")))
- {
+ (!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")))
- {
+ 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;
}
}
@@ -150,7 +148,8 @@ 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") ) {
@@ -200,7 +199,8 @@ 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,20 +223,23 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa
if (fcu->array_index < 3)
axis_name = axis_names[fcu->array_index];
}
- else {
- /* no axis name. single parameter */
+
+ //no axis name. single parameter.
+ else{
axis_name = "";
}
std::string ob_name = std::string("null");
//Create anim Id
- if (ob->type == OB_ARMATURE) {
+ 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
@@ -254,17 +257,18 @@ 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);
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
@@ -303,7 +307,8 @@ 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);
@@ -344,7 +349,8 @@ 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);
@@ -363,7 +369,8 @@ 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) {
+ 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;
@@ -504,7 +511,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:
@@ -524,7 +531,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;
@@ -537,7 +544,8 @@ 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
@@ -770,7 +778,8 @@ 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;
@@ -778,7 +787,8 @@ 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;
@@ -1118,7 +1128,7 @@ bool AnimationExporter::hasAnimations(Scene *sce)
{
Base *base= (Base*) sce->base.first;
- while (base) {
+ while(base) {
Object *ob = base->object;
FCurve *fcu = 0;
@@ -1133,10 +1143,12 @@ 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;
}
}
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index 8ef2235b6fb..8e691c6da67 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -138,7 +138,8 @@ 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;
}
@@ -438,6 +439,16 @@ void AnimationImporter::modify_fcurve(std::vector<FCurve*>* curves , const char*
}
}
+void AnimationImporter::unused_fcurve(std::vector<FCurve*>* curves)
+{
+ // when an error happens and we can't actually use curve remove it from unused_curves
+ std::vector<FCurve*>::iterator it;
+ for (it = curves->begin(); it != curves->end(); it++) {
+ FCurve *fcu = *it;
+ unused_curves.erase(std::remove(unused_curves.begin(), unused_curves.end(), fcu), unused_curves.end());
+ }
+}
+
void AnimationImporter::find_frames( std::vector<float>* frames , std::vector<FCurve*>* curves)
{
std::vector<FCurve*>::iterator iter;
@@ -499,6 +510,7 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation *
modify_fcurve(curves, rna_path, -1 );
break;
default:
+ unused_fcurve(curves);
fprintf(stderr, "AnimationClass %d is not supported for %s.\n",
binding->animationClass, loc ? "TRANSLATE" : "SCALE");
}
@@ -534,10 +546,13 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation *
else if (COLLADABU::Math::Vector3::UNIT_Z == axis) {
modify_fcurve(curves, rna_path, 2 );
}
+ else
+ unused_fcurve(curves);
break;
case COLLADAFW::AnimationList::AXISANGLE:
// TODO convert axis-angle to quat? or XYZ?
default:
+ unused_fcurve(curves);
fprintf(stderr, "AnimationClass %d is not supported for ROTATE transformation.\n",
binding->animationClass);
}
@@ -553,9 +568,11 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation *
}
}*/
+ unused_fcurve(curves);
break;
case COLLADAFW::Transformation::SKEW:
case COLLADAFW::Transformation::LOOKAT:
+ unused_fcurve(curves);
fprintf(stderr, "Animation of SKEW and LOOKAT transformations is not supported yet.\n");
break;
}
@@ -591,6 +608,7 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list
break;
default:
+ unused_fcurve(&animcurves);
fprintf(stderr, "AnimationClass %d is not supported for %s.\n",
bindings[j].animationClass, "COLOR" );
}
@@ -788,15 +806,17 @@ 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; */ /* UNUSED */
+ if ( (animType->transform) != 0 )
+ {
+ const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL;
char joint_path[200];
if ( is_joint )
@@ -864,7 +884,8 @@ 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);
@@ -876,19 +897,22 @@ 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");
}
- if ( (animType->light & LIGHT_FOE) != 0 ) {
+ if ( (animType->light & LIGHT_FOE) != 0 )
+ {
const COLLADAFW::AnimatableFloat *foe = &(light->getFallOffExponent());
const COLLADAFW::UniqueId& listid = foe->getAnimationList();
@@ -898,7 +922,8 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
}
}
- 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);
@@ -910,25 +935,29 @@ 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");
}
- 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");
}
- 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");
}
- 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");
@@ -1150,10 +1179,12 @@ 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 ) {
+ if ( camera->getCameraType() == COLLADAFW::Camera::PERSPECTIVE )
+ {
types->camera = setAnimType(&(camera->getXMag()),(types->camera), CAMERA_XFOV);
}
- else {
+ else
+ {
types->camera = setAnimType(&(camera->getXMag()),(types->camera), CAMERA_XMAG);
}
types->camera = setAnimType(&(camera->getFarClippingPlane()),(types->camera), CAMERA_ZFAR);
@@ -1627,7 +1658,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
COLLADABU::Math::Vector3& axis = ((COLLADAFW::Rotate*)tm)->getRotationAxis();
- float ax[3] = {(float)axis[0], (float)axis[1], (float)axis[2]};
+ float ax[3] = {axis[0], axis[1], axis[2]};
float angle = evaluate_fcurve(curves[0], fra);
axis_angle_to_mat4(mat, ax, angle);
@@ -1753,9 +1784,7 @@ bool AnimationImporter::calc_joint_parent_mat_rest(float mat[4][4], float par[4]
Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::Node *node, Object *par_job)
{
if (joint_objects.find(node->getUniqueId()) == joint_objects.end()) {
- Object *job = add_object(scene, OB_EMPTY);
-
- rename_id((ID*)&job->id, (char*)get_joint_name(node));
+ Object *job = bc_add_object(scene, OB_EMPTY, (char*)get_joint_name(node));
job->lay = object_in_scene(job, scene)->lay = 2;
diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h
index e42a1cc7a55..563f4677572 100644
--- a/source/blender/collada/AnimationImporter.h
+++ b/source/blender/collada/AnimationImporter.h
@@ -165,6 +165,7 @@ public:
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 unused_fcurve(std::vector<FCurve*>* curves );
// prerequisites:
// animlist_map - map animlist id -> animlist
// curve_map - map anim id -> curve(s)
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index 0d45df37796..743d3c2a158 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,8 +191,10 @@ 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);
@@ -208,7 +210,8 @@ 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];
@@ -271,7 +274,8 @@ 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];
@@ -281,7 +285,8 @@ 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;
@@ -365,21 +370,25 @@ 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);
@@ -493,14 +502,16 @@ 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);
}
@@ -586,7 +597,8 @@ 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 05a2e5643f2..e484fd55eff 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -278,7 +278,8 @@ 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;
@@ -367,7 +368,7 @@ Object *ArmatureImporter::get_empty_for_leaves()
{
if (empty) return empty;
- empty = add_object(scene, OB_EMPTY);
+ empty = bc_add_object(scene, OB_EMPTY, NULL);
empty->empty_drawtype = OB_EMPTY_SPHERE;
return empty;
@@ -412,7 +413,7 @@ void ArmatureImporter::create_armature_bones( )
if ( get_armature_for_joint(*ri) != NULL ) continue;
//add armature object for current joint
- //Object *ob_arm = add_object(scene, OB_ARMATURE);
+ //Object *ob_arm = bc_add_object(scene, OB_ARMATURE, NULL);
Object *ob_arm = joint_parent_map[(*ri)->getUniqueId()];
diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp
index 8640e544dbf..fcb98cc7c32 100644
--- a/source/blender/collada/CameraExporter.cpp
+++ b/source/blender/collada/CameraExporter.cpp
@@ -42,14 +42,15 @@ 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;
}
}
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index 19fc30a2790..52261346acb 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 d81ffebae66..68bfeb73c4a 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++;
}
@@ -121,6 +121,9 @@ bool DocumentImporter::import()
loader.registerExtraDataCallbackHandler(ehandler);
+ // deselect all to select new objects
+ scene_deselect_all(CTX_data_scene(mContext));
+
if (!root.loadDocument(mFilename)) {
fprintf(stderr, "COLLADAFW::Root::loadDocument() returned false on 1st pass\n");
return false;
@@ -144,6 +147,8 @@ bool DocumentImporter::import()
delete ehandler;
+ mesh_importer.bmeshConversion();
+
return true;
}
@@ -157,7 +162,9 @@ void DocumentImporter::cancel(const COLLADAFW::String& errorMessage)
// The latter sounds better.
}
-void DocumentImporter::start() {}
+void DocumentImporter::start()
+{
+}
void DocumentImporter::finish()
{
@@ -178,7 +185,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;
@@ -298,7 +305,8 @@ Object* DocumentImporter::create_camera_object(COLLADAFW::InstanceCamera *camera
fprintf(stderr, "Couldn't find camera by UID.\n");
return NULL;
}
- Object *ob = add_object(sce, OB_CAMERA);
+
+ Object *ob = bc_add_object(sce, OB_CAMERA, NULL);
Camera *cam = uid_camera_map[cam_uid];
Camera *old_cam = (Camera*)ob->data;
ob->data = cam;
@@ -315,7 +323,8 @@ Object* DocumentImporter::create_lamp_object(COLLADAFW::InstanceLight *lamp, Sce
fprintf(stderr, "Couldn't find lamp by UID.\n");
return NULL;
}
- Object *ob = add_object(sce, OB_LAMP);
+
+ Object *ob = bc_add_object(sce, OB_LAMP, NULL);
Lamp *la = uid_lamp_map[lamp_uid];
Lamp *old_lamp = (Lamp*)ob->data;
ob->data = la;
@@ -395,7 +404,7 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
if (is_joint) {
if ( par ) {
Object * empty = par;
- par = add_object(sce, OB_ARMATURE);
+ par = bc_add_object(sce, OB_ARMATURE, NULL);
bc_set_parent(par,empty->parent, mContext);
//remove empty : todo
object_map[parent_node->getUniqueId()] = par;
@@ -455,7 +464,7 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
// if node is empty - create empty object
// XXX empty node may not mean it is empty object, not sure about this
if ( (geom_done + camera_done + lamp_done + controller_done + inst_done) < 1) {
- ob = add_object(sce, OB_EMPTY);
+ ob = bc_add_object(sce, OB_EMPTY, NULL);
}
// XXX: if there're multiple instances, only one is stored
@@ -744,7 +753,8 @@ 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;
@@ -788,7 +798,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;
@@ -807,10 +817,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();
@@ -838,7 +848,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;
@@ -855,7 +865,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;
@@ -1029,7 +1039,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 bbc7677c279..9720b92ffae 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -60,10 +60,11 @@ 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
diff --git a/source/blender/collada/ErrorHandler.cpp b/source/blender/collada/ErrorHandler.cpp
index 530158ed418..1c0f40d2185 100644
--- a/source/blender/collada/ErrorHandler.cpp
+++ b/source/blender/collada/ErrorHandler.cpp
@@ -49,31 +49,37 @@ 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/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index 8e4fa057daf..3c1c9cb6d6b 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -177,7 +177,7 @@ void GeometryExporter::createPolylist(short material_index,
// sets material name
if (ma) {
std::ostringstream ostr;
- ostr << translate_id(id_name(ma)) << material_index+1;
+ ostr << translate_id(id_name(ma));
polylist.setMaterial(ostr.str());
}
@@ -440,9 +440,9 @@ void GeometryExporter::create_normals(std::vector<Normal> &nor, std::vector<Face
*nn = nshar[*vv];
else {
Normal n = {
- (float)vert[*vv].no[0] / 32767.0f,
- (float)vert[*vv].no[1] / 32767.0f,
- (float)vert[*vv].no[2] / 32767.0f
+ vert[*vv].no[0]/32767.0,
+ vert[*vv].no[1]/32767.0,
+ vert[*vv].no[2]/32767.0
};
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 5d79fabb713..9c1d51230d3 100644
--- a/source/blender/collada/GeometryExporter.h
+++ b/source/blender/collada/GeometryExporter.h
@@ -108,12 +108,12 @@ 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))
+ !(export_selected && !(ob->flag & SELECT)) &&
+ ((sce->lay & ob->lay)!=0))
{
f(ob);
}
diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp
index 4d7c56ab419..946effda832 100644
--- a/source/blender/collada/ImageExporter.cpp
+++ b/source/blender/collada/ImageExporter.cpp
@@ -48,10 +48,11 @@ 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/InstanceWriter.cpp b/source/blender/collada/InstanceWriter.cpp
index a605bdeefcc..f83289ff5f5 100644
--- a/source/blender/collada/InstanceWriter.cpp
+++ b/source/blender/collada/InstanceWriter.cpp
@@ -52,7 +52,7 @@ void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_materia
std::string matid(get_material_id(ma));
matid = translate_id(matid);
std::ostringstream ostr;
- ostr << translate_id(id_name(ma)) << a+1;
+ ostr << translate_id(id_name(ma));
COLLADASW::InstanceMaterial im(ostr.str(), COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, matid));
// create <bind_vertex_input> for each uv map
diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp
index 1d7afb9b1a1..51242b36b64 100644
--- a/source/blender/collada/LightExporter.cpp
+++ b/source/blender/collada/LightExporter.cpp
@@ -39,10 +39,11 @@ 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;
diff --git a/source/blender/collada/MaterialExporter.cpp b/source/blender/collada/MaterialExporter.cpp
index ac1a5d32a08..1e3358c9216 100644
--- a/source/blender/collada/MaterialExporter.cpp
+++ b/source/blender/collada/MaterialExporter.cpp
@@ -50,10 +50,11 @@ 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 4a5422184d4..eb7886c23b9 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 0bf33206fa7..44f95888521 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();
@@ -727,6 +727,22 @@ bool MeshImporter::flat_face(unsigned int *nind, COLLADAFW::MeshVertexData& nor,
MeshImporter::MeshImporter(UnitConverter *unitconv, ArmatureImporter *arm, Scene *sce) : unitconverter(unitconv), scene(sce), armature_importer(arm) {}
+void MeshImporter::bmeshConversion()
+{
+ for (std::map<COLLADAFW::UniqueId, Mesh*>::iterator m = uid_mesh_map.begin();
+ m != uid_mesh_map.end(); ++m)
+ {
+ if ((*m).second) {
+ Mesh *me = (*m).second;
+ BKE_mesh_convert_mfaces_to_mpolys(me);
+ BKE_mesh_tessface_clear(me);
+
+ mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL);
+ }
+ }
+}
+
+
Object *MeshImporter::get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid)
{
if (uid_object_map.find(geom_uid) != uid_object_map.end())
@@ -797,7 +813,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++;
}
@@ -839,13 +855,12 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri
for (it = prims.begin(); it != prims.end(); it++) {
Primitive& prim = *it;
- i = 0;
- while (i++ < prim.totface) {
- prim.mface->mat_nr = mat_index;
- prim.mface++;
+ MFace *mface = prim.mface;
+
+ for (i = 0; i < prim.totface; i++, mface++) {
+ mface->mat_nr = mat_index;
// bind texture images to faces
if (texture_face && (*color_texture)) {
- texture_face->mode = TF_TEX;
texture_face->tpage = (Image*)(*color_texture)->tex->ima;
texture_face++;
}
@@ -856,7 +871,6 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri
return texture_face;
}
-
Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::InstanceGeometry *geom,
bool isController,
std::map<COLLADAFW::UniqueId, Material*>& uid_material_map,
@@ -885,16 +899,16 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
}
if (!uid_mesh_map[*geom_uid]) return NULL;
- Object *ob = add_object(scene, OB_MESH);
+ // name Object
+ const std::string& id = node->getName().size() ? node->getName() : node->getOriginalId();
+ const char *name = (id.length())? id.c_str(): NULL;
+
+ // add object
+ Object *ob = bc_add_object(scene, OB_MESH, name);
// store object pointer for ArmatureImporter
uid_object_map[*geom_uid] = ob;
- // name Object
- const std::string& id = node->getName().size() ? node->getName() : node->getOriginalId();
- if (id.length())
- rename_id(&ob->id, (char*)id.c_str());
-
// replace ob->data freeing the old one
Mesh *old_mesh = (Mesh*)ob->data;
@@ -922,7 +936,7 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
fprintf(stderr, "invalid referenced material for %s\n", mat_array[i].getName().c_str());
}
}
-
+
return ob;
}
@@ -949,6 +963,7 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry* geom)
const std::string& str_geom_id = mesh->getName().size() ? mesh->getName() : mesh->getOriginalId();
Mesh *me = add_mesh((char*)str_geom_id.c_str());
+ me->id.us--; // is already 1 here, but will be set later in set_mesh
// store the Mesh pointer to link it later with an Object
this->uid_mesh_map[mesh->getUniqueId()] = me;
@@ -963,8 +978,5 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry* geom)
make_edges(me, 0);
- mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL);
-
- BKE_mesh_convert_mfaces_to_mpolys(me);
return true;
}
diff --git a/source/blender/collada/MeshImporter.h b/source/blender/collada/MeshImporter.h
index 0c2e600121f..97ae4d99ad7 100644
--- a/source/blender/collada/MeshImporter.h
+++ b/source/blender/collada/MeshImporter.h
@@ -129,6 +129,8 @@ public:
MeshImporter(UnitConverter *unitconv, ArmatureImporter *arm, Scene *sce);
+ void bmeshConversion();
+
virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid);
MTex *assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBinding &ctexture,
diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp
index cd36267fd56..9010fd5062a 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,7 +154,8 @@ 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/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp
index 99a4f024f77..0727ec21682 100644
--- a/source/blender/collada/SkinInfo.cpp
+++ b/source/blender/collada/SkinInfo.cpp
@@ -151,7 +151,7 @@ void SkinInfo::set_controller(const COLLADAFW::SkinController* co)
// called from write_controller
Object *SkinInfo::create_armature(Scene *scene)
{
- ob_arm = add_object(scene, OB_ARMATURE);
+ ob_arm = bc_add_object(scene, OB_ARMATURE, NULL);
return ob_arm;
}
diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp
index 4c7fde8ef17..a73d5243624 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 f96aff8aa90..f441833233c 100644
--- a/source/blender/collada/TransformWriter.cpp
+++ b/source/blender/collada/TransformWriter.cpp
@@ -95,16 +95,19 @@ 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 fa99d460184..fc4093bd795 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,39 +198,44 @@ 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();
@@ -274,7 +279,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/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index 4aed29defbc..bd0f82fb0ac 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -34,6 +34,7 @@
#include "DNA_customdata_types.h"
#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
#include "BLI_math.h"
@@ -41,6 +42,7 @@
#include "BKE_customdata.h"
#include "BKE_depsgraph.h"
#include "BKE_object.h"
+#include "BKE_scene.h"
#include "WM_api.h" // XXX hrm, see if we can do without this
#include "WM_types.h"
@@ -110,3 +112,16 @@ int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space)
return true;
}
+Object *bc_add_object(Scene *scene, int type, const char *name)
+{
+ Object *ob = add_only_object(type, name);
+
+ ob->data= add_obdata_from_type(type);
+ ob->lay= scene->lay;
+ ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+
+ scene_select_base(scene, scene_add_base(scene, ob));
+
+ return ob;
+}
+
diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h
index b0c24152652..1f5d2b1d8da 100644
--- a/source/blender/collada/collada_utils.h
+++ b/source/blender/collada/collada_utils.h
@@ -39,6 +39,7 @@
#include "DNA_customdata_types.h"
#include "DNA_texture_types.h"
#include "BKE_context.h"
+#include "DNA_scene_types.h"
typedef std::map<COLLADAFW::TextureMapId, std::vector<MTex*> > TexIndexTextureArrayMap;
@@ -48,5 +49,6 @@ extern int bc_test_parent_loop(Object *par, Object *ob);
extern int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space=true);
extern char *bc_CustomData_get_layer_name(const CustomData *data, int type, int n);
extern char *bc_CustomData_get_active_layer_name(const CustomData *data, int type);
+extern Object *bc_add_object(Scene *scene, int type, const char *name);
#endif
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 8aafdc6ab40..01ab36133fd 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 r_color[3])
+static void acf_generic_root_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color)
{
/* darker blue for top-level widgets */
- UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELOB, r_color);
+ UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELOB, 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 r_color[3])
+static void acf_generic_dataexpand_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color)
{
/* lighter color than top-level widget */
- UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELSUBOB, r_color);
+ UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELSUBOB, 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 r_color[3])
+static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, float *color)
{
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(r_color, cp);
+ rgb_uchar_to_float(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, r_color);
+ UI_GetThemeColorShade3fv(TH_HEADER, colOfs, color);
}
}
@@ -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 r_color[3])
+static void acf_summary_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color)
{
// FIXME: hardcoded color - same as the 'action' line in NLA
// reddish color
- r_color[0] = 0.8f;
- r_color[1] = 0.2f;
- r_color[2] = 0.0f;
+ color[0] = 0.8f;
+ color[1] = 0.2f;
+ 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 r_color[3])
+static void acf_group_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float *color)
{
/* highlight only for action group channels */
if (ale->flag & AGRP_ACTIVE)
- UI_GetThemeColorShade3fv(TH_GROUP_ACTIVE, 10, r_color);
+ UI_GetThemeColorShade3fv(TH_GROUP_ACTIVE, 10, color);
else
- UI_GetThemeColorShade3fv(TH_GROUP, 20, r_color);
+ UI_GetThemeColorShade3fv(TH_GROUP, 20, 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= BKE_curve_type_get(cu);
+ short obtype= curve_type(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 r_color[3])
+static void acf_gpd_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color)
{
/* these are ID-blocks, but not exactly standalone... */
- UI_GetThemeColorShade3fv(TH_DOPESHEET_CHANNELSUBOB, 20, r_color);
+ UI_GetThemeColorShade3fv(TH_DOPESHEET_CHANNELSUBOB, 20, color);
}
// TODO: just get this from RNA?
@@ -3043,8 +3043,7 @@ 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;
@@ -3223,8 +3222,7 @@ 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_filter.c b/source/blender/editors/animation/anim_filter.c
index 922156ebb7a..dad261c3f80 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -137,7 +137,7 @@ static short actedit_get_context (bAnimContext *ac, SpaceAction *saction)
if (ac->obact && ac->obact->adt)
saction->action = ac->obact->adt->action;
else
- saction->action= NULL;
+ saction->action = NULL;
}
ac->datatype= ANIMCONT_ACTION;
@@ -150,6 +150,16 @@ static short actedit_get_context (bAnimContext *ac, SpaceAction *saction)
ac->datatype= ANIMCONT_SHAPEKEY;
ac->data= actedit_get_shapekeys(ac);
+ /* if not pinned, sync with active object */
+ if (/*saction->pin == 0*/1) {
+ Key *key = (Key *)ac->data;
+
+ if (key && key->adt)
+ saction->action = key->adt->action;
+ else
+ saction->action = NULL;
+ }
+
ac->mode= saction->mode;
return 1;
@@ -824,11 +834,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 +858,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 +892,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 +912,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 +962,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,7 +1016,8 @@ 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);
}
@@ -1451,51 +1476,83 @@ static size_t animdata_filter_ds_textures (bAnimContext *ac, ListBase *anim_data
return items;
}
-static size_t animdata_filter_ds_materials (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Object *ob, int filter_mode)
+
+static size_t animdata_filter_ds_material (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Material *ma, int filter_mode)
{
- size_t items=0;
- int a=0;
+ ListBase tmp_data = {NULL, NULL};
+ size_t tmp_items = 0;
+ size_t items = 0;
- /* firstly check that we actuallly have some materials, by gathering all materials in a temp list */
- for (a=1; a <= ob->totcol; a++) {
- Material *ma= give_current_material(ob, a);
- ListBase tmp_data = {NULL, NULL};
- size_t tmp_items = 0;
+ /* add material's animation data to temp collection */
+ BEGIN_ANIMFILTER_SUBCHANNELS(FILTER_MAT_OBJD(ma))
+ {
+ /* material's animation data */
+ tmp_items += animfilter_block_data(ac, &tmp_data, ads, (ID *)ma, filter_mode);
+
+ /* textures */
+ if (!(ads->filterflag & ADS_FILTER_NOTEX))
+ tmp_items += animdata_filter_ds_textures(ac, &tmp_data, ads, (ID *)ma, filter_mode);
+
+ /* nodes */
+ if ((ma->nodetree) && !(ads->filterflag & ADS_FILTER_NONTREE))
+ tmp_items += animdata_filter_ds_nodetree(ac, &tmp_data, ads, (ID *)ma, ma->nodetree, filter_mode);
+ }
+ END_ANIMFILTER_SUBCHANNELS;
+
+ /* did we find anything? */
+ if (tmp_items) {
+ /* include material-expand widget first */
+ // hmm... do we need to store the index of this material in the array anywhere?
+ if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
+ /* check if filtering by active status */
+ if (ANIMCHANNEL_ACTIVEOK(ma)) {
+ ANIMCHANNEL_NEW_CHANNEL(ma, ANIMTYPE_DSMAT, ma);
+ }
+ }
- /* if no material returned, skip - so that we don't get weird blank entries... */
- if (ma == NULL) continue;
+ /* now add the list of collected channels */
+ BLI_movelisttolist(anim_data, &tmp_data);
+ BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
+ items += tmp_items;
+ }
+
+ return items;
+}
+
+static size_t animdata_filter_ds_materials (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Object *ob, int filter_mode)
+{
+ short has_nested = 0;
+ size_t items = 0;
+ int a = 0;
+
+ /* first pass: take the materials referenced via the Material slots of the object */
+ for (a = 1; a <= ob->totcol; a++) {
+ Material *ma = give_current_material(ob, a);
- /* add material's animation data to temp collection */
- BEGIN_ANIMFILTER_SUBCHANNELS(FILTER_MAT_OBJD(ma))
- {
- /* material's animation data */
- tmp_items += animfilter_block_data(ac, &tmp_data, ads, (ID *)ma, filter_mode);
-
- /* textures */
- if (!(ads->filterflag & ADS_FILTER_NOTEX))
- tmp_items += animdata_filter_ds_textures(ac, &tmp_data, ads, (ID *)ma, filter_mode);
-
- /* nodes */
- if ((ma->nodetree) && !(ads->filterflag & ADS_FILTER_NONTREE))
- tmp_items += animdata_filter_ds_nodetree(ac, &tmp_data, ads, (ID *)ma, ma->nodetree, filter_mode);
+ /* if material is valid, try to add relevant contents from here */
+ if (ma) {
+ /* add channels */
+ items += animdata_filter_ds_material(ac, anim_data, ads, ma, filter_mode);
+
+ /* for optimising second pass - check if there's a nested material here to come back for */
+ if (has_nested == 0)
+ has_nested = give_node_material(ma) != NULL;
}
- END_ANIMFILTER_SUBCHANNELS;
-
- /* did we find anything? */
- if (tmp_items) {
- /* include material-expand widget first */
- // hmm... do we need to store the index of this material in the array anywhere?
- if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
- /* check if filtering by active status */
- if (ANIMCHANNEL_ACTIVEOK(ma)) {
- ANIMCHANNEL_NEW_CHANNEL(ma, ANIMTYPE_DSMAT, ma);
- }
- }
+ }
+
+ /* second pass: go through a second time looking for "nested" materials (material.material references)
+ *
+ * NOTE: here we ignore the expanded status of the parent, as it could be too confusing as to why these are
+ * disappearing/not available, since the relationships between these is not that clear
+ */
+ if (has_nested) {
+ for (a = 1; a <= ob->totcol; a++) {
+ Material *base = give_current_material(ob, a);
+ Material *ma = give_node_material(base);
- /* now add the list of collected channels */
- BLI_movelisttolist(anim_data, &tmp_data);
- BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
- items += tmp_items;
+ /* add channels from the nested material if it exists */
+ if (ma)
+ items += animdata_filter_ds_material(ac, anim_data, ads, ma, filter_mode);
}
}
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 94d9d426932..73dba91207f 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -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/keyframing.c b/source/blender/editors/animation/keyframing.c
index dcaa4073bae..47972ca2c6f 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1353,7 +1353,8 @@ 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;
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index cd698bbf09f..cc3d0c6e184 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -755,7 +755,8 @@ 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
@@ -921,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;
@@ -1192,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;
}
@@ -2457,7 +2458,8 @@ 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;
}
}
@@ -2815,7 +2817,8 @@ 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)
@@ -3528,7 +3531,8 @@ 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;
@@ -3816,7 +3820,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);
@@ -3841,7 +3845,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;
}
@@ -3900,7 +3904,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;
@@ -3936,7 +3940,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 */
@@ -3978,7 +3982,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) {
@@ -4212,7 +4216,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);
@@ -4901,7 +4905,8 @@ 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);
@@ -5042,7 +5047,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:
@@ -5431,7 +5436,8 @@ 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);
}
@@ -5475,7 +5481,8 @@ 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);
@@ -5793,7 +5800,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 5b56f5fe7fe..37d095221c9 100644
--- a/source/blender/editors/armature/editarmature_generate.c
+++ b/source/blender/editors/armature/editarmature_generate.c
@@ -52,7 +52,8 @@
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);
@@ -66,14 +67,16 @@ 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);
@@ -86,7 +89,8 @@ 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;
@@ -106,7 +110,8 @@ float calcArcCorrelation(BArcIterator *iter, int start, int end, float v0[3], fl
return 1.0f - s_xyz / s_t;
}
- else {
+ else
+ {
return 1.0f;
}
}
@@ -120,13 +125,15 @@ 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;
@@ -147,7 +154,8 @@ 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;
@@ -175,7 +183,8 @@ 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);
@@ -197,7 +206,8 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st
int i;
i = start + 1;
- while (i <= end) {
+ while (i <= end)
+ {
float *vec0;
float *vec1;
@@ -208,8 +218,10 @@ 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;
@@ -248,7 +260,8 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st
return i - 1; /* restart at lower bound */
}
- else {
+ else
+ {
i++;
same = 0; // Reset same
}
@@ -273,14 +286,16 @@ 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");
@@ -288,7 +303,8 @@ 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 77b035024a9..f554b7b1c50 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -119,8 +119,10 @@ 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++;
}
}
@@ -132,9 +134,12 @@ 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--;
@@ -170,19 +175,23 @@ 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);
}
@@ -190,21 +199,26 @@ 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);
}
@@ -260,16 +274,19 @@ 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);
@@ -279,7 +296,8 @@ 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);
}
@@ -391,10 +409,12 @@ 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);
@@ -416,7 +436,8 @@ 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);
}
@@ -428,22 +449,28 @@ 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++;
}
@@ -497,7 +524,8 @@ 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");
@@ -510,7 +538,8 @@ 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);
@@ -543,7 +572,8 @@ 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);
}
@@ -551,32 +581,40 @@ 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
* */
@@ -587,18 +625,22 @@ 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
* */
@@ -630,7 +672,8 @@ 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);
@@ -656,14 +699,16 @@ 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;
@@ -672,38 +717,45 @@ 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;
}
}
@@ -726,34 +778,43 @@ 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;
}
}
@@ -770,8 +831,10 @@ 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
* */
@@ -786,19 +849,24 @@ 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;
}
@@ -812,18 +880,23 @@ 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;
}
@@ -838,42 +911,52 @@ 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;
@@ -887,17 +970,22 @@ 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;
@@ -910,25 +998,31 @@ 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;
@@ -937,7 +1031,8 @@ 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)
+ {
}
}
}
@@ -951,18 +1046,21 @@ 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);
@@ -981,18 +1079,24 @@ 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;
}
@@ -1008,29 +1112,36 @@ 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);
@@ -1038,44 +1149,57 @@ 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);
@@ -1088,25 +1212,31 @@ 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);
@@ -1119,15 +1249,19 @@ 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);
@@ -1135,14 +1269,17 @@ 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);
@@ -1161,25 +1298,32 @@ 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);
}
@@ -1187,28 +1331,34 @@ 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);
}
@@ -1219,11 +1369,13 @@ 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;
}
}
@@ -1231,26 +1383,32 @@ 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;
}
}
@@ -1262,7 +1420,8 @@ 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)
@@ -1276,7 +1435,8 @@ 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
@@ -1305,14 +1465,17 @@ 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);
}
@@ -1325,11 +1488,13 @@ 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);
}
@@ -1344,15 +1509,18 @@ 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");
}
}
@@ -1368,10 +1536,12 @@ 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;
@@ -1381,7 +1551,8 @@ 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);
}
}
@@ -1400,7 +1571,8 @@ 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");
}
@@ -1416,10 +1588,12 @@ 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;
@@ -1429,7 +1603,8 @@ 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);
}
}
@@ -1448,7 +1623,8 @@ 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");
}
@@ -1545,7 +1721,8 @@ 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
@@ -1560,14 +1737,17 @@ 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;
}
@@ -1585,11 +1765,14 @@ 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);
}
}
@@ -1617,7 +1800,8 @@ 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);
@@ -1654,30 +1838,38 @@ 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);
}
}
@@ -1698,7 +1890,8 @@ 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++;
}
@@ -1708,23 +1901,29 @@ 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;
}
@@ -1737,7 +1936,8 @@ 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);
}
@@ -1748,7 +1948,8 @@ 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");
@@ -1764,14 +1965,17 @@ 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);
@@ -1787,40 +1991,48 @@ 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;
}
@@ -1850,7 +2062,8 @@ 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);
@@ -1876,7 +2089,8 @@ 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);
@@ -1894,10 +2108,12 @@ 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];
@@ -1906,7 +2122,8 @@ 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];
@@ -1914,7 +2131,8 @@ 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;
@@ -1922,7 +2140,8 @@ 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;
}
@@ -1930,19 +2149,22 @@ 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;
}
@@ -1956,12 +2178,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;
}
}
@@ -1987,32 +2209,38 @@ 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");
@@ -2027,7 +2255,8 @@ 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;
}
@@ -2061,17 +2290,20 @@ 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);
}
@@ -2095,11 +2327,13 @@ 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;
}
@@ -2110,7 +2344,8 @@ 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);
@@ -2130,12 +2365,14 @@ 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;
@@ -2143,13 +2380,15 @@ 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);
}
@@ -2190,23 +2429,29 @@ 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);
}
}
@@ -2229,7 +2474,8 @@ 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;
@@ -2242,13 +2488,16 @@ 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;
@@ -2258,12 +2507,15 @@ 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);
}
}
@@ -2279,7 +2531,8 @@ 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;
@@ -2310,7 +2563,8 @@ 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;
@@ -2339,7 +2593,8 @@ 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)
@@ -2364,17 +2619,20 @@ 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");
@@ -2393,10 +2651,12 @@ 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);
@@ -2413,7 +2673,8 @@ 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;
@@ -2426,13 +2687,16 @@ 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);
}
}
@@ -2451,8 +2715,10 @@ 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);
}
}
@@ -2496,21 +2762,25 @@ 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";
}
@@ -2524,7 +2794,8 @@ 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 */
}
@@ -2533,7 +2804,8 @@ int RIG_nbJoints(RigGraph *rg)
static void BIF_freeRetarget(void)
{
- if (GLOBAL_RIGG) {
+ if (GLOBAL_RIGG)
+ {
RIG_freeRigGraph((BGraph*)GLOBAL_RIGG);
GLOBAL_RIGG = NULL;
}
@@ -2555,10 +2827,11 @@ 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;
@@ -2637,7 +2910,8 @@ 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;
@@ -2656,7 +2930,8 @@ 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);
@@ -2669,7 +2944,8 @@ 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 4c7ab833e69..81b020a4cf9 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -162,21 +162,25 @@ 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;
}
}
@@ -189,7 +193,8 @@ 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);
}
@@ -201,7 +206,8 @@ 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));
@@ -217,15 +223,18 @@ 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;
}
@@ -240,17 +249,21 @@ 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;
@@ -267,10 +280,12 @@ 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;
}
}
@@ -282,13 +297,15 @@ 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 "";
}
@@ -297,17 +314,20 @@ 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;
}
@@ -316,13 +336,16 @@ 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;
@@ -334,35 +357,44 @@ 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");
}
}
@@ -396,7 +428,8 @@ 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);
@@ -440,7 +473,8 @@ 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);
}
@@ -467,7 +501,8 @@ 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;
}
@@ -487,7 +522,8 @@ 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;
}
@@ -508,15 +544,18 @@ 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);
}
@@ -524,37 +563,44 @@ 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);
}
@@ -581,7 +627,8 @@ 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();
@@ -607,32 +654,41 @@ 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);
}
@@ -650,8 +706,10 @@ 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;
@@ -659,11 +717,13 @@ 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;
}
}
@@ -741,60 +801,75 @@ 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;
}
}
@@ -808,15 +883,18 @@ 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;
@@ -830,15 +908,18 @@ 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;
}
@@ -867,7 +948,8 @@ 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);
}
@@ -895,7 +977,8 @@ 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;
}
@@ -913,7 +996,8 @@ 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];
@@ -938,7 +1022,8 @@ 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);
}
@@ -980,7 +1065,8 @@ 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;
@@ -995,16 +1081,20 @@ 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;
@@ -1013,34 +1103,42 @@ 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;
@@ -1049,7 +1147,8 @@ 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;
@@ -1057,7 +1156,8 @@ 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;
@@ -1068,7 +1168,8 @@ 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];
@@ -1078,16 +1179,20 @@ 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;
}
@@ -1098,7 +1203,8 @@ 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);
@@ -1121,7 +1227,8 @@ 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;
@@ -1135,15 +1242,18 @@ 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);
@@ -1162,15 +1272,18 @@ 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);
}
}
@@ -1179,16 +1292,19 @@ 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);
}
}
@@ -1218,13 +1334,15 @@ 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;
@@ -1240,12 +1358,14 @@ 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;
@@ -1289,7 +1409,8 @@ 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);
}
@@ -1304,7 +1425,8 @@ 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);
}
@@ -1318,7 +1440,8 @@ 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);
}
@@ -1330,7 +1453,8 @@ 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);
}
@@ -1342,10 +1466,12 @@ 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;
}
}
@@ -1369,36 +1495,45 @@ 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);
@@ -1413,12 +1548,14 @@ 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;
}
@@ -1436,12 +1573,16 @@ 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
@@ -1459,7 +1600,8 @@ 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;
@@ -1468,7 +1610,8 @@ 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];
@@ -1477,7 +1620,8 @@ 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;
@@ -1503,18 +1647,24 @@ 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;
}
}
@@ -1533,11 +1683,13 @@ 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;
@@ -1545,7 +1697,8 @@ 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];
@@ -1554,7 +1707,8 @@ 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];
@@ -1605,13 +1759,15 @@ 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;
@@ -1626,7 +1782,8 @@ 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;
}
@@ -1637,7 +1794,8 @@ 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;
@@ -1651,7 +1809,8 @@ 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;
@@ -1660,7 +1819,8 @@ 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;
}
}
@@ -1675,7 +1835,8 @@ 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];
@@ -1687,12 +1848,14 @@ 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);
}
@@ -1702,12 +1865,15 @@ 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;
}
@@ -1715,7 +1881,8 @@ 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;
}
}
@@ -1732,13 +1899,16 @@ 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;
@@ -1757,7 +1927,8 @@ 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;
@@ -1766,7 +1937,8 @@ 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;
}
}
@@ -1778,9 +1950,11 @@ 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);
@@ -1791,7 +1965,8 @@ 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;
@@ -1801,21 +1976,26 @@ 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 */
}
}
@@ -1835,18 +2015,22 @@ 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;
}
}
@@ -1859,28 +2043,34 @@ 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;
}
@@ -1897,9 +2087,11 @@ 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 */
@@ -1910,7 +2102,8 @@ 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;
@@ -1949,8 +2142,10 @@ 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;
}
@@ -1978,7 +2173,8 @@ 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) {
@@ -1989,15 +2185,18 @@ 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;
}
@@ -2033,41 +2232,50 @@ 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);
@@ -2076,7 +2284,8 @@ 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;
@@ -2136,7 +2345,8 @@ 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);
}
@@ -2146,16 +2356,20 @@ 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
@@ -2175,7 +2389,8 @@ 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);
@@ -2190,7 +2405,8 @@ 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);
@@ -2212,16 +2428,19 @@ 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;
}
@@ -2232,9 +2451,11 @@ 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);
}
}
@@ -2243,7 +2464,8 @@ 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);
}
@@ -2256,7 +2478,8 @@ 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));
}
@@ -2264,9 +2487,11 @@ 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);
@@ -2277,9 +2502,11 @@ 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);
@@ -2308,10 +2535,12 @@ 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;
@@ -2325,10 +2554,12 @@ 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;
@@ -2340,7 +2571,8 @@ 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));
}
@@ -2350,7 +2582,8 @@ 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;
@@ -2361,8 +2594,10 @@ 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;
}
@@ -2373,7 +2608,8 @@ 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));
@@ -2441,7 +2677,8 @@ 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;
@@ -2460,8 +2697,10 @@ 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);
@@ -2469,11 +2708,13 @@ 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);
}
@@ -2509,7 +2750,8 @@ 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);
@@ -2533,7 +2775,8 @@ int ED_operator_sketch_mode_active_stroke(bContext *C)
{
return 1;
}
- else {
+ else
+ {
return 0;
}
}
@@ -2550,7 +2793,8 @@ static int ED_operator_sketch_mode_gesture(bContext *C)
{
return 1;
}
- else {
+ else
+ {
return 0;
}
}
@@ -2567,7 +2811,8 @@ int ED_operator_sketch_full_mode(bContext *C)
{
return 1;
}
- else {
+ else
+ {
return 0;
}
}
@@ -2583,7 +2828,8 @@ int ED_operator_sketch_mode(const bContext *C)
{
return 1;
}
- else {
+ else
+ {
return 0;
}
}
diff --git a/source/blender/editors/armature/poseUtils.c b/source/blender/editors/armature/poseUtils.c
index 88d219137f7..1a9ff73e5dc 100644
--- a/source/blender/editors/armature/poseUtils.c
+++ b/source/blender/editors/armature/poseUtils.c
@@ -131,7 +131,8 @@ void poseAnim_mapping_get (bContext *C, ListBase *pfLinks, Object *ob, bAction *
/* 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;
@@ -140,7 +141,8 @@ 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;
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index ea2b28380e0..2799d7994bc 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -897,12 +897,10 @@ 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)
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index f54cdb330e3..0ad4b23d8f4 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -197,26 +197,57 @@ void ED_pose_recalculate_paths(Scene *scene, Object *ob)
BLI_freelistN(&targets);
}
+/* show popup to determine settings */
+static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *evt)
+{
+ Object *ob = object_pose_armature_get(CTX_data_active_object(C));
+
+ if (ELEM(NULL, ob, ob->pose))
+ return OPERATOR_CANCELLED;
+
+ /* set default settings from existing/stored settings */
+ {
+ bAnimVizSettings *avs = &ob->pose->avs;
+ PointerRNA avs_ptr;
+
+ RNA_int_set(op->ptr, "start_frame", avs->path_sf);
+ RNA_int_set(op->ptr, "end_frame", avs->path_ef);
+
+ RNA_pointer_create(NULL, &RNA_AnimVizMotionPaths, avs, &avs_ptr);
+ RNA_enum_set(op->ptr, "bake_location", RNA_enum_get(&avs_ptr, "bake_location"));
+ }
+
+ /* show popup dialog to allow editing of range... */
+ // FIXME: hardcoded dimensions here are just arbitrary
+ return WM_operator_props_dialog_popup(C, op, 200, 200);
+}
+
/* 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 pose_calculate_paths_exec (bContext *C, wmOperator *op)
+static int pose_calculate_paths_exec(bContext *C, wmOperator *op)
{
- ScrArea *sa= CTX_wm_area(C);
+ Object *ob = object_pose_armature_get(CTX_data_active_object(C));
Scene *scene= CTX_data_scene(C);
- Object *ob;
- /* since this call may also be used from the buttons window, we need to check for where to get the object */
- if (sa->spacetype == SPACE_BUTS)
- ob= ED_object_context(C);
- else
- ob= object_pose_armature_get(CTX_data_active_object(C));
-
if (ELEM(NULL, ob, ob->pose))
return OPERATOR_CANCELLED;
+ /* grab baking settings from operator settings */
+ {
+ bAnimVizSettings *avs = &ob->pose->avs;
+ PointerRNA avs_ptr;
+
+ avs->path_sf = RNA_int_get(op->ptr, "start_frame");
+ avs->path_ef = RNA_int_get(op->ptr, "end_frame");
+
+ RNA_pointer_create(NULL, &RNA_AnimVizMotionPaths, avs, &avs_ptr);
+ RNA_enum_set(&avs_ptr, "bake_location", RNA_enum_get(op->ptr, "bake_location"));
+ }
+
/* 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);
}
@@ -227,7 +258,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *op)
ED_pose_recalculate_paths(scene, ob);
/* notifiers for updates */
- WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
return OPERATOR_FINISHED;
}
@@ -240,11 +271,22 @@ void POSE_OT_paths_calculate (wmOperatorType *ot)
ot->description = "Calculate paths for the selected bones";
/* api callbacks */
+ ot->invoke = pose_calculate_paths_invoke;
ot->exec = pose_calculate_paths_exec;
ot->poll = ED_operator_posemode;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* properties */
+ RNA_def_int(ot->srna, "start_frame", 1, MINAFRAME, MAXFRAME, "Start",
+ "First frame to calculate bone paths on", MINFRAME, MAXFRAME/2.0);
+ RNA_def_int(ot->srna, "end_frame", 250, MINAFRAME, MAXFRAME, "End",
+ "Last frame to calculate bone paths on", MINFRAME, MAXFRAME/2.0);
+
+ RNA_def_enum(ot->srna, "bake_location", motionpath_bake_location_items, 0,
+ "Bake Location",
+ "Which point on the bones is used when calculating paths");
}
/* --------- */
@@ -278,14 +320,7 @@ static void ED_pose_clear_paths(Object *ob)
/* operator callback for this */
static int pose_clear_paths_exec (bContext *C, wmOperator *UNUSED(op))
{
- ScrArea *sa= CTX_wm_area(C);
- Object *ob;
-
- /* since this call may also be used from the buttons window, we need to check for where to get the object */
- if (sa->spacetype == SPACE_BUTS)
- ob= ED_object_context(C);
- else
- ob= object_pose_armature_get(CTX_data_active_object(C));
+ Object *ob = object_pose_armature_get(CTX_data_active_object(C));
/* only continue if there's an object */
if (ELEM(NULL, ob, ob->pose))
@@ -295,7 +330,7 @@ static int pose_clear_paths_exec (bContext *C, wmOperator *UNUSED(op))
ED_pose_clear_paths(ob);
/* notifiers for updates */
- WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob);
+ WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
return OPERATOR_FINISHED;
}
@@ -323,7 +358,8 @@ 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);
@@ -385,7 +421,8 @@ 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) {
@@ -502,7 +539,8 @@ 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;
@@ -518,7 +556,8 @@ 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]) {
@@ -547,7 +586,8 @@ 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;
@@ -561,7 +601,8 @@ 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;
@@ -591,7 +632,8 @@ 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;
}
@@ -1395,7 +1437,8 @@ 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;
}
@@ -1448,7 +1491,8 @@ 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;
@@ -1650,7 +1694,8 @@ 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)
@@ -1754,7 +1799,8 @@ 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);
@@ -1800,7 +1846,8 @@ 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);
@@ -1849,7 +1896,8 @@ 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;
@@ -2032,7 +2080,8 @@ 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 */
@@ -2065,7 +2114,8 @@ 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);
@@ -2105,7 +2155,8 @@ 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 */
@@ -2135,7 +2186,8 @@ 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);
@@ -2177,7 +2229,8 @@ 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 */
diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c
index eebdeafcea9..546bcb1f40f 100644
--- a/source/blender/editors/armature/reeb.c
+++ b/source/blender/editors/armature/reeb.c
@@ -41,6 +41,7 @@
#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"
@@ -80,23 +81,15 @@ static ReebGraph *FILTERED_RG = NULL;
#define DEBUG_REEB
#define DEBUG_REEB_NODE
-/* place-holders! */
-typedef struct EditEdge {
- void *fake;
-} EditEdge;
-
-typedef struct EditFace {
- void *fake;
-} EditFace;
-/* end place-holders! */
-
-typedef struct VertexData {
+typedef struct VertexData
+{
float w; /* weight */
int i; /* index */
ReebNode *n;
} VertexData;
-typedef struct EdgeIndex {
+typedef struct EdgeIndex
+{
EditEdge **edges;
int *offset;
} EdgeIndex;
@@ -190,14 +183,16 @@ 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;
@@ -207,7 +202,8 @@ 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);
}
@@ -233,7 +229,8 @@ 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);
}
}
@@ -321,7 +318,8 @@ ReebNode *BIF_NodeFromIndex(ReebArc *arc, ReebNode *node)
ReebNode *BIF_lowestLevelNode(ReebNode *node)
{
- while (node->link_down) {
+ while (node->link_down)
+ {
node = node->link_down;
}
@@ -409,7 +407,8 @@ 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;
}
@@ -485,12 +484,15 @@ 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);
@@ -510,17 +512,22 @@ 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);
}
}
@@ -532,20 +539,25 @@ 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));
}
@@ -556,7 +568,8 @@ 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
@@ -567,7 +580,8 @@ 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);
}
@@ -578,8 +592,10 @@ 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");
}
}
@@ -590,11 +606,14 @@ 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);
@@ -628,11 +647,13 @@ 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);
}
@@ -640,16 +661,19 @@ 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++;
}
@@ -669,7 +693,8 @@ 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];
@@ -689,16 +714,20 @@ 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)
@@ -706,13 +735,15 @@ 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;
@@ -721,10 +752,12 @@ static void resizeArcBuckets(ReebArc *arc)
int newOffset = 0;
int len;
- if (oldStart < newStart) {
+ if (oldStart < newStart)
+ {
oldOffset = newStart - oldStart;
}
- else {
+ else
+ {
newOffset = oldStart - newStart;
}
@@ -733,7 +766,8 @@ static void resizeArcBuckets(ReebArc *arc)
memcpy(arc->buckets + newOffset, oldBuckets + oldOffset, len * sizeof(EmbedBucket));
}
- if (oldBuckets != NULL) {
+ if (oldBuckets != NULL)
+ {
MEM_freeN(oldBuckets);
}
}
@@ -743,8 +777,10 @@ 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;
}
}
@@ -757,7 +793,8 @@ 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);
@@ -773,11 +810,14 @@ 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;
@@ -786,11 +826,14 @@ 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;
@@ -798,7 +841,8 @@ static void fillArcEmptyBuckets(ReebArc *arc)
}
}
- if (missing) {
+ if (missing)
+ {
end_p = arc->tail->p;
end_index = arc->bcount - 1;
@@ -815,7 +859,8 @@ 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 */
}
@@ -836,16 +881,19 @@ 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");
@@ -856,11 +904,13 @@ 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);
}
}
@@ -870,7 +920,8 @@ 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);
}
}
@@ -890,7 +941,8 @@ 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);
@@ -905,7 +957,8 @@ 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);
}
}
@@ -922,7 +975,8 @@ 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];
@@ -945,7 +999,8 @@ 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;
@@ -958,16 +1013,19 @@ 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 */
@@ -979,7 +1037,8 @@ 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];
@@ -1002,7 +1061,8 @@ 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;
@@ -1015,16 +1075,19 @@ 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);
@@ -1059,7 +1122,8 @@ 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;
@@ -1072,16 +1136,19 @@ 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 */
@@ -1108,7 +1175,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;
@@ -1423,13 +1490,16 @@ 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;
}
}
@@ -1438,10 +1508,13 @@ 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);
@@ -1451,38 +1524,47 @@ 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;
@@ -1505,10 +1587,12 @@ 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;
@@ -1539,14 +1623,12 @@ 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;
@@ -1568,25 +1650,26 @@ 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
@@ -1602,7 +1685,8 @@ 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
@@ -1629,10 +1713,13 @@ 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);
@@ -1761,7 +1848,8 @@ 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;
@@ -1769,33 +1857,39 @@ 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);
@@ -1826,24 +1920,29 @@ 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);
}
@@ -1864,7 +1963,8 @@ 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);
}
@@ -1879,10 +1979,12 @@ static int compareVerts( const void* a, const void* b )
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;
}
@@ -1899,21 +2001,26 @@ 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);
@@ -1937,7 +2044,8 @@ void REEB_exportGraph(ReebGraph *rg, int count)
char filename[128];
FILE *f;
- if (count == -1) {
+ if (count == -1)
+ {
strcpy(filename, "test.txt");
}
else {
@@ -1945,13 +2053,15 @@ 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]);
}
@@ -1972,10 +2082,12 @@ 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);
}
}
@@ -1986,51 +2098,63 @@ 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;
}
@@ -2052,11 +2176,13 @@ 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;
}
@@ -2085,42 +2211,51 @@ 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);
}
- 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;
}
@@ -2140,11 +2275,13 @@ 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;
}
@@ -2166,9 +2303,11 @@ 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);
@@ -2186,7 +2325,8 @@ 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);
@@ -2200,7 +2340,8 @@ 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);
@@ -2215,9 +2356,11 @@ 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);
@@ -2231,7 +2374,8 @@ 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);
@@ -2246,8 +2390,9 @@ int mergeArcs(ReebGraph *rg, ReebArc *a0, ReebArc *a1)
resizeArcBuckets(a0);
}
}
- else {
- /* Need something here (OR NOT) */
+ else
+ {
+ // Need something here (OR NOT)
}
return result;
@@ -2256,14 +2401,18 @@ 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);
}
}
@@ -2288,7 +2437,8 @@ 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;
@@ -2301,11 +2451,13 @@ 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;
}
@@ -2345,7 +2497,8 @@ 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;
@@ -2379,17 +2532,20 @@ 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;
@@ -2398,7 +2554,8 @@ 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;
@@ -2438,8 +2595,10 @@ 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++;
@@ -2447,8 +2606,10 @@ 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);
@@ -2457,13 +2618,15 @@ 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
@@ -2493,7 +2656,8 @@ 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));
}
@@ -2501,7 +2665,8 @@ 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);
}
@@ -2516,7 +2681,8 @@ 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]);
}
@@ -2579,7 +2745,8 @@ 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++;
}
@@ -2592,42 +2759,52 @@ 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;
}
}
@@ -2636,30 +2813,38 @@ 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);
}
@@ -2672,13 +2857,16 @@ 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;
}
@@ -2693,17 +2881,20 @@ 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++;
}
@@ -2725,19 +2916,23 @@ 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;
}
@@ -2750,13 +2945,16 @@ 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;
}
@@ -2785,8 +2983,10 @@ 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)]++;
@@ -2798,8 +2998,10 @@ 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;
@@ -2807,18 +3009,24 @@ 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;
}
@@ -2836,64 +3044,80 @@ 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);
@@ -2903,7 +3127,8 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
}
}
- if (selected_eve) {
+ if (selected_eve)
+ {
allDone = 0;
weightSetData(selected_eve, selected_weight + min_distance);
@@ -2912,8 +3137,10 @@ 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;
}
@@ -2946,11 +3173,13 @@ 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;
}
@@ -2964,12 +3193,14 @@ 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;
@@ -2987,12 +3218,14 @@ 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;
@@ -3002,7 +3235,8 @@ 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 */
}
}
@@ -3017,10 +3251,12 @@ 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;
}
@@ -3034,10 +3270,12 @@ 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;
}
@@ -3053,10 +3291,12 @@ 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;
}
@@ -3074,7 +3314,8 @@ 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)]);
}
@@ -3090,7 +3331,8 @@ 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)]);
}
@@ -3105,7 +3347,8 @@ 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)]);
}
@@ -3118,7 +3361,8 @@ 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)]);
}
@@ -3131,10 +3375,12 @@ 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;
}
}
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index e65b4280dc9..c19041b817e 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -132,7 +132,7 @@ static void set_actNurb(Object *obedit, Nurb *nu)
if (nu==NULL)
cu->actnu = -1;
else {
- ListBase *nurbs= BKE_curve_editNurbs_get(cu);
+ ListBase *nurbs= curve_editnurbs(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= BKE_curve_editNurbs_get(cu);
+ ListBase *nurbs= curve_editnurbs(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);
- BKE_nurb_handle_calc(&cur, prevp ? &prev : NULL, nextp ? &next : NULL, 0);
+ calchandleNurb(&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= BKE_nurbList_verts_count(&editnurb->nurbs);
+ int totvert= count_curveverts(&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= BKE_nurb_duplicate(nu);
+ newnu= duplicateNurb(nu);
BLI_addtail(&newnurb, newnu);
if (nu->type == CU_NURBS) {
- BKE_nurb_order_clamp_u(nu);
+ clamp_nurb_order_u(nu);
}
}
@@ -1220,7 +1220,7 @@ void load_editNurb(Object *obedit)
calc_shapeKeys(obedit);
ED_curve_updateAnimPaths(obedit->data);
- BKE_nurbList_free(&oldnurb);
+ freeNurblist(&oldnurb);
}
set_actNurb(obedit, NULL);
@@ -1247,8 +1247,8 @@ void make_editNurb(Object *obedit)
}
if (editnurb) {
- BKE_nurbList_free(&editnurb->nurbs);
- BKE_curve_editNurb_keyIndex_free(editnurb);
+ freeNurblist(&editnurb->nurbs);
+ free_curve_editNurb_keyIndex(editnurb);
editnurb->keyindex= NULL;
}
else {
@@ -1260,8 +1260,8 @@ void make_editNurb(Object *obedit)
cu->lastsel= NULL; /* for select row */
while (nu) {
- newnu= BKE_nurb_duplicate(nu);
- BKE_nurb_test2D(newnu); // after join, or any other creation of curve
+ newnu= duplicateNurb(nu);
+ test2DNurb(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;
- BKE_curve_editNurb_free(cu);
+ free_curve_editNurb(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= BKE_curve_copy(oldcu);
+ newcu= newob->data= copy_curve(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;
- BKE_nurbList_free(&newedit->nurbs);
- BKE_curve_editNurb_keyIndex_free(newedit);
+ freeNurblist(&newedit->nurbs);
+ free_curve_editNurb_keyIndex(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]
}
}
- BKE_nurb_test2D(nu);
+ test2DNurb(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);
- BKE_nurb_free(nu); nu=NULL;
+ freeNurb(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;
- BKE_nurb_order_clamp_v(nu);
+ clamp_nurb_order_v(nu);
- BKE_nurb_knot_calc_v(nu);
+ nurbs_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);
- BKE_nurb_order_clamp_u(nu);
+ clamp_nurb_order_u(nu);
if (nu->knotsv) MEM_freeN(nu->knotsv);
nu->knotsv= NULL;
}
else {
nu->pntsu= newu;
- BKE_nurb_order_clamp_u(nu);
+ clamp_nurb_order_u(nu);
}
- BKE_nurb_knot_calc_u(nu);
+ nurbs_knot_calc_u(nu);
}
}
}
@@ -1743,7 +1743,7 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
nu->pntsv= 2;
nu->orderv= 2;
- BKE_nurb_knot_calc_v(nu);
+ nurbs_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++;
- BKE_nurb_knot_calc_v(nu);
+ nurbs_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++;
- BKE_nurb_knot_calc_u(nu);
+ nurbs_knot_calc_u(nu);
}
}
}
@@ -1911,7 +1911,7 @@ static void adduplicateflagNurb(Object *obedit, short flag)
/* knots */
newnu->knotsu= NULL;
- BKE_nurb_knot_calc_u(newnu);
+ nurbs_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");
- BKE_nurb_order_clamp_u(newnu);
- BKE_nurb_order_clamp_v(newnu);
+ clamp_nurb_order_u(newnu);
+ clamp_nurb_order_v(newnu);
newnu->knotsu= newnu->knotsv= NULL;
@@ -1972,20 +1972,20 @@ static void adduplicateflagNurb(Object *obedit, short flag)
}
}
}
- if (BKE_nurb_check_valid_u(newnu)) {
+ if (check_valid_nurb_u(newnu)) {
if (nu->pntsu==newnu->pntsu && nu->knotsu) {
newnu->knotsu= MEM_dupallocN( nu->knotsu );
}
else {
- BKE_nurb_knot_calc_u(newnu);
+ nurbs_knot_calc_u(newnu);
}
}
- if (BKE_nurb_check_valid_v(newnu)) {
+ if (check_valid_nurb_v(newnu)) {
if (nu->pntsv==newnu->pntsv && nu->knotsv) {
newnu->knotsv= MEM_dupallocN( nu->knotsv );
}
else {
- BKE_nurb_knot_calc_v(newnu);
+ nurbs_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)) {
- BKE_nurb_direction_switch(nu);
+ switchdirectionNurb(nu);
keyData_switchDirectionNurb(cu, nu);
}
@@ -2174,7 +2174,7 @@ static int smooth_exec(bContext *C, wmOperator *UNUSED(op))
}
MEM_freeN(beztOrig);
if (change)
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(nu);
}
else if (nu->bp) {
bpOrig = MEM_dupallocN( nu->bp );
@@ -2893,7 +2893,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
nu->bezt= beztnew;
nu->pntsu+= amount;
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(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) {
- BKE_nurb_knot_calc_u(nu);
+ nurbs_knot_calc_u(nu);
}
}
} /* End of 'else if (nu->pntsv==1)' */
@@ -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;
- BKE_nurb_knot_calc_u(nu);
- BKE_nurb_knot_calc_v(nu);
+ nurbs_knot_calc_u(nu);
+ nurbs_knot_calc_v(nu);
} /* End of 'if (sel== nu->pntsu*nu->pntsv)' (subdivide entire NURB) */
else {
/* subdivide in v direction? */
@@ -3132,7 +3132,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
MEM_freeN(nu->bp);
nu->bp= bpnew;
nu->pntsv+= sel;
- BKE_nurb_knot_calc_v(nu);
+ nurbs_knot_calc_v(nu);
}
else {
/* or in u direction? */
@@ -3173,7 +3173,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
MEM_freeN(nu->bp);
nu->bp= bpnew;
nu->pntsu+= sel;
- BKE_nurb_knot_calc_u(nu); /* shift knots forward */
+ nurbs_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;
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(nu);
}
else if (type==CU_NURBS) {
nu->type = CU_NURBS;
nu->orderu= 4;
nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
- BKE_nurb_knot_calc_u(nu);
+ nurbs_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;
- BKE_nurb_knot_calc_u(nu);
+ nurbs_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);
- BKE_nurbList_handles_set(editnurb, RNA_enum_get(op->ptr, "type"));
+ sethandlesNurb(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);
@@ -3865,15 +3865,15 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
if (nu1->type == CU_NURBS) {
/* merge knots */
- BKE_nurb_knot_calc_u(nu1);
+ nurbs_knot_calc_u(nu1);
/* make knots, for merged curved for example */
- BKE_nurb_knot_calc_v(nu1);
+ nurbs_knot_calc_v(nu1);
}
MEM_freeN(temp);
BLI_remlink(editnurb, nu2);
- BKE_nurb_free(nu2);
+ freeNurb(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;
- BKE_nurb_direction_switch(nu);
+ switchdirectionNurb(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;
- BKE_nurb_direction_switch(nu);
+ switchdirectionNurb(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;
- BKE_nurb_direction_switch(nu);
+ switchdirectionNurb(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;
- BKE_nurb_direction_switch(nu);
+ switchdirectionNurb(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);
- BKE_nurb_free(nu2); nu2= NULL;
- BKE_nurb_handles_calc(nu1);
+ freeNurb(nu2); nu2= NULL;
+ calchandlesNurb(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) {
- BKE_nurb_knot_calc_u(nu1);
+ nurbs_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)
}
}
}
- BKE_nurb_free(nu2); nu2= NULL;
+ freeNurb(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;
- BKE_nurb_handles_calc(nu1);
+ calchandlesNurb(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;
- BKE_nurb_knot_calc_u(nu1);
+ nurbs_knot_calc_u(nu1);
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;
- BKE_nurb_knot_calc_v(nu);
+ nurbs_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;
- BKE_nurb_knot_calc_u(newnu);
+ nurbs_knot_calc_u(newnu);
ok= 1;
nu= newnu;
@@ -4538,7 +4538,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
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;
- BKE_nurb_handle_calc(bezt_recalc[1], bezt_recalc[0], bezt_recalc[2], 0);
+ calchandleNurb(bezt_recalc[1], bezt_recalc[0], bezt_recalc[2], 0);
bezt_recalc[1]->h1 = h1;
bezt_recalc[1]->h2 = h2;
}
@@ -4548,8 +4548,8 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
}
- if (newnu) BKE_nurb_handles_calc(newnu);
- else BKE_nurb_handles_calc(nu);
+ if (newnu) calchandlesNurb(newnu);
+ else calchandlesNurb(nu);
}
}
}
@@ -4617,14 +4617,14 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
if (!newnu) {
nu->pntsu++;
- BKE_nurb_knot_calc_u(nu);
+ nurbs_knot_calc_u(nu);
}
- else BKE_nurb_knot_calc_u(newnu);
+ else nurbs_knot_calc_u(newnu);
}
}
if (ok) {
- BKE_nurb_test2D(nu);
+ test2DNurb(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++;
}
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(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;
- BKE_nurb_knot_calc_u(nu); /* 1==u type is ignored for cyclic curves */
+ nurbs_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;
- BKE_nurb_knot_calc_u(nu); /* 1==u type is ignored for cyclic curves */
+ nurbs_knot_calc_u(nu); /* 1==u type is ignored for cyclic curves */
}
if (direction==1 && nu->pntsv>1) {
nu->flagv ^= CU_NURB_CYCLIC;
- BKE_nurb_knot_calc_v(nu); /* 2==v type is ignored for cyclic curves */
+ nurbs_knot_calc_v(nu); /* 2==v type is ignored for cyclic curves */
}
break;
}
@@ -5472,7 +5472,7 @@ static int point_on_nurb(Nurb *nu, void *point)
static Nurb *get_lastsel_nurb(Curve *cu)
{
- ListBase *nubase= BKE_curve_editNurbs_get(cu);
+ ListBase *nubase= curve_editnurbs(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);
- BKE_nurbList_free(nubase);
+ freeNurblist(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);
- BKE_nurb_free(nu); nu= NULL;
+ freeNurb(nu); nu= NULL;
}
}
}
@@ -5692,7 +5692,7 @@ static int delete_exec(bContext *C, wmOperator *op)
BLI_remlink(nubase, nu);
keyIndex_delNurb(editnurb, nu);
- BKE_nurb_free(nu); nu= NULL;
+ freeNurb(nu); nu= NULL;
}
}
}
@@ -5734,7 +5734,7 @@ static int delete_exec(bContext *C, wmOperator *op)
keyIndex_updateBezt(editnurb, nu->bezt, bezt1, nu->pntsu);
MEM_freeN(nu->bezt);
nu->bezt= bezt1;
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(nu);
}
}
else if (nu->pntsv==1) {
@@ -5770,8 +5770,8 @@ static int delete_exec(bContext *C, wmOperator *op)
}
#endif
}
- BKE_nurb_order_clamp_u(nu);
- BKE_nurb_knot_calc_u(nu);
+ clamp_nurb_order_u(nu);
+ nurbs_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;
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(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);
- BKE_nurb_free(nu); nu = NULL;
+ freeNurb(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);
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(nu);
}
else { /* add new curve */
@@ -5886,8 +5886,8 @@ static int delete_exec(bContext *C, wmOperator *op)
nu->pntsu= cut+1;
- BKE_nurb_handles_calc(nu);
- BKE_nurb_handles_calc(nu1);
+ calchandlesNurb(nu);
+ calchandlesNurb(nu1);
}
}
else if (bp1) {
@@ -5896,7 +5896,7 @@ static int delete_exec(bContext *C, wmOperator *op)
cu->actnu= -1;
BLI_remlink(nubase, nu);
- BKE_nurb_free(nu); nu= NULL;
+ freeNurb(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;
- BKE_nurb_order_clamp_u(nu);
- BKE_nurb_knot_calc_u(nu);
+ clamp_nurb_order_u(nu);
+ nurbs_knot_calc_u(nu);
- BKE_nurb_order_clamp_u(nu1);
- BKE_nurb_knot_calc_u(nu1);
+ clamp_nurb_order_u(nu1);
+ nurbs_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);
- BKE_nurbList_free(nubase);
+ freeNurblist(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= BKE_nurb_duplicate(nu);
+ newnu= duplicateNurb(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++;
}
- BKE_nurb_handles_calc(newnu);
+ calchandlesNurb(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]);
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(nu);
}
else {
@@ -6272,7 +6272,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
if (cutype==CU_NURBS) {
nu->knotsu= NULL; /* nurbs_knot_calc_u allocates */
- BKE_nurb_knot_calc_u(nu);
+ nurbs_knot_calc_u(nu);
}
}
@@ -6306,7 +6306,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
if (cutype==CU_NURBS) {
nu->knotsu= NULL; /* nurbs_knot_calc_u allocates */
- BKE_nurb_knot_calc_u(nu);
+ nurbs_knot_calc_u(nu);
}
break;
@@ -6347,7 +6347,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
for (a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
bezt->radius = bezt->weight = 1.0;
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(nu);
}
else if ( cutype==CU_NURBS ) { /* nurb */
nu->pntsu= 8;
@@ -6375,7 +6375,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bp++;
}
- BKE_nurb_knot_calc_u(nu);
+ nurbs_knot_calc_u(nu);
}
break;
case CU_PRIM_PATCH: /* 4x4 patch */
@@ -6407,8 +6407,8 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
}
}
- BKE_nurb_knot_calc_u(nu);
- BKE_nurb_knot_calc_v(nu);
+ nurbs_knot_calc_u(nu);
+ nurbs_knot_calc_v(nu);
}
break;
case CU_PRIM_TUBE: /* Cylinder */
@@ -6469,7 +6469,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
bp++;
}
nu->flagu= CU_NURB_BEZIER;
- BKE_nurb_knot_calc_u(nu);
+ nurbs_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]);
- BKE_nurb_knot_calc_v(nu);
+ nurbs_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;
- BKE_nurb_test2D(nu);
+ test2DNurb(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= BKE_curve_editNurbs_get(cu);
+ ListBase *editbase= curve_editnurbs(cu);
Nurb *nu, *newnu;
EditNurb *editnurb= cu->editnurb;
void *lastsel= NULL;
AnimData *ad= BKE_animdata_from_id(&cu->id);
- BKE_nurbList_free(editbase);
+ freeNurblist(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= BKE_nurb_duplicate(nu);
+ newnu= duplicateNurb(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= BKE_curve_editNurbs_get(cu);
+ ListBase *nubase= curve_editnurbs(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= BKE_nurb_duplicate(nu);
+ newnu= duplicateNurb(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;
- BKE_nurbList_free(&undoCurve->nubase);
+ freeNurblist(&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 cca5dd7a37b..1f1d1495276 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -520,17 +520,13 @@ 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++)
- {
- /* pass */
- }
-
- return cu->str[s] ? (s + 1) : 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);
}
static short prev_word(Curve *cu)
@@ -538,14 +534,9 @@ 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--)
- {
- /* pass */
- }
-
- return cu->str[s] ? (s + 1) : 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--);
+ if (cu->str[s]) return(s+1); else return(s);
}
static int kill_selection(Object *obedit, int ins) /* 1 == new character */
@@ -825,7 +816,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) {
@@ -1130,7 +1121,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;
@@ -1500,7 +1491,7 @@ void load_editText(Object *obedit)
void free_editText(Object *obedit)
{
- BKE_curve_editfont_free((Curve *)obedit->data);
+ BKE_free_editfont((Curve *)obedit->data);
}
/********************** set case operator *********************/
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 5f31a273d1a..d48cfaab63c 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -534,7 +534,7 @@ static void gp_stroke_to_bezier (bContext *C, bGPDlayer *gpl, bGPDstroke *gps, C
}
/* must calculate handles or else we crash */
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(nu);
/* add nurb to curve */
BLI_addtail(&cu->nurb, nu);
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 303ca89b168..c366de6fa43 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");
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 391286a2a88..a9affbcd342 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 r_color[3]);
+ void (*get_backdrop_color)(bAnimContext *ac, bAnimListElem *ale, float *color);
/* 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_curve.h b/source/blender/editors/include/ED_curve.h
index 73ff8e9304d..50e43c46de5 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 BKE_curve_editNurb_free (struct Curve *cu);
+void free_curve_editNurb (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 71d37d5c6ea..4c503a2687c 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, const float co[3], char mode);
+intptr_t mesh_octree_table(struct Object *ob, struct BMEditMesh *em, float *co, 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, const float limit[2]);
+struct UvVertMap *EDBM_uv_vert_map_create(struct BMEditMesh *em, int selected, int do_face_idx_array, float *limit);
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, const float co[3], int index);
+struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em, struct BMVert *eve, float *co, 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 r_min[3], float r_max[3]);
+int paintface_minmax(struct Object *ob, float *min, float *max);
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 f62befdaa31..f0fffb34b73 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -66,7 +66,6 @@ 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 2427ed1a333..3569c0e8243 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[2], float max[2]);
+int ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float *min, float *max);
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,8 +71,7 @@ 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,
- const float co[2], float r_uv[2]);
+int ED_uvedit_nearest_uv(struct Scene *scene, struct Object *obedit, struct Image *ima, float co[2], float 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 4b614085f8e..f886c01039e 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -269,6 +269,8 @@ 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_draw.c b/source/blender/editors/interface/interface_draw.c
index 91d3c890df3..d90d8286db9 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1469,8 +1469,11 @@ static ImBuf *scale_trackpreview_ibuf(ImBuf *ibuf, float track_pos[2], int width
ImBuf *scaleibuf;
const float scalex = ((float)ibuf->x - 2 * margin) / width;
const float scaley = ((float)ibuf->y - 2 * margin) / height;
- float off_x = (int)track_pos[0] - track_pos[0] + 0.5f;
- float off_y = (int)track_pos[1] - track_pos[1] + 0.5f;
+ /* NOTE: 1.0f = 0.5f for integer coordinate coorrection (center of pixel vs. left bottom corner of bixel)
+ * and 0.5f for centering image in preview (cross is draving at exact center of widget so image
+ * should be shifted by half of pixel for correct centering) - sergey */
+ float off_x = (int)track_pos[0] - track_pos[0] + 1.0f;
+ float off_y = (int)track_pos[1] - track_pos[1] + 1.0f;
int x, y;
scaleibuf = IMB_allocImBuf(width, height, 32, IB_rect);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 42005c0888c..a7ff1565c3d 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -781,8 +781,9 @@ 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;
@@ -1563,7 +1564,8 @@ 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 31bc9497ab5..67e295503c2 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -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);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index bafd85e9451..d0f760d16fb 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 9220491a60c..c903040a6b9 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 fe7a4e85418..c0c80bf215f 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1060,7 +1060,8 @@ 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;
@@ -2231,8 +2232,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];
- 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);
+ 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);
return 1;
}
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 2d222059fc1..9f4a351c66d 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1151,7 +1151,8 @@ 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 cfc9e11879e..294a39eddf8 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 r_min[3], float r_max[3])
+int paintface_minmax(Object *ob, float *min, float *max)
{
Mesh *me;
MPoly *mp;
MTexPoly *tf;
MLoop *ml;
MVert *mvert;
- int a, b, ok = FALSE;
+ int a, b, ok = 0;
float vec[3], bmat[3][3];
me = get_mesh(ob);
@@ -427,10 +427,10 @@ int paintface_minmax(Object *ob, float r_min[3], float r_max[3])
copy_v3_v3(vec, (mvert[ml->v].co));
mul_m3_v3(bmat, vec);
add_v3_v3v3(vec, vec, ob->obmat[3]);
- DO_MINMAX(vec, r_min, r_max);
+ DO_MINMAX(vec, min, max);
}
- ok = TRUE;
+ ok = 1;
}
return ok;
diff --git a/source/blender/editors/mesh/editmesh_bvh.c b/source/blender/editors/mesh/editmesh_bvh.c
index 6d740812f27..6155ad1be1c 100644
--- a/source/blender/editors/mesh/editmesh_bvh.c
+++ b/source/blender/editors/mesh/editmesh_bvh.c
@@ -239,8 +239,7 @@ static void raycallback(void *userdata, int index, const BVHTreeRay *ray, BVHTre
}
}
-BMFace *BMBVH_RayCast(BMBVHTree *tree, const float co[3], const float dir[3],
- float r_hitout[3], float r_cagehit[3])
+BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, float *cagehit)
{
BVHTreeRayHit hit;
@@ -251,9 +250,10 @@ BMFace *BMBVH_RayCast(BMBVHTree *tree, const float co[3], const float dir[3],
BLI_bvhtree_ray_cast(tree->tree, co, dir, 0.0f, &hit, raycallback, tree);
if (hit.dist != FLT_MAX && hit.index != -1) {
- if (r_hitout) {
+ if (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, const float co[3], const float dir[3],
v3 = tree->em->looptris[hit.index][2]->v;
for (i = 0; i < 3; i++) {
- r_hitout[i] = v1->co[i] + ((v2->co[i] - v1->co[i]) * tree->uv[0]) +
- ((v3->co[i] - v1->co[i]) * tree->uv[1]);
+ co[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(r_hitout, hit.co);
+ copy_v3_v3(hitout, hit.co);
}
- if (r_cagehit) {
- copy_v3_v3(r_cagehit, hit.co);
- }
+ if (cagehit)
+ copy_v3_v3(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 6512f054c1b..e2b45062e41 100644
--- a/source/blender/editors/mesh/editmesh_bvh.h
+++ b/source/blender/editors/mesh/editmesh_bvh.h
@@ -50,12 +50,13 @@ 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, const float co[3], const float dir[3],
- float r_hitout[3], float r_cagehit[3]);
+struct BMFace *BMBVH_RayCast(struct BMBVHTree *tree, float *co, float *dir, float *hitout, float *cagehit);
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 6f33fcd05b7..597939840e1 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, const float co[3], float *cageco)
+static KnifeVert *new_knife_vert(KnifeTool_OpData *kcd, float *co, float *cageco)
{
KnifeVert *kfv = BLI_mempool_calloc(kcd->kverts);
@@ -2684,6 +2684,7 @@ static void knifetool_finish(bContext *C, wmOperator *op)
knife_make_cuts(kcd);
#endif
+ EDBM_mesh_normals_update(kcd->em);
EDBM_update_generic(C, kcd->em, TRUE);
}
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index beb5345ca9b..bbede255d10 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_grow_items(edges, previewlines);
+ BLI_array_growitems(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_grow_items(edges, previewlines);
+ BLI_array_growitems(edges, previewlines);
for (i = 1; i <= previewlines; i++) {
if (!v[0][0] || !v[0][1] || !v[1][0] || !v[1][1])
@@ -314,7 +314,7 @@ static void ringsel_finish(bContext *C, wmOperator *op)
if (lcd->do_cut) {
BM_mesh_esubdivide(em->bm, BM_ELEM_SELECT,
- 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f,
cuts,
SUBDIV_SELECT_LOOPCUT, SUBD_PATH, 0, FALSE, 0);
diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c
index b74e8797d72..e755df1f076 100644
--- a/source/blender/editors/mesh/editmesh_rip.c
+++ b/source/blender/editors/mesh/editmesh_rip.c
@@ -56,8 +56,7 @@
#include "mesh_intern.h"
/* helper to find edge for edge_rip */
-static float edbm_rip_rip_edgedist(ARegion *ar, float mat[][4],
- const float co1[3], const float co2[2], const float mvalf[2])
+static float edbm_rip_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *co2, const float mvalf[2])
{
float vec1[3], vec2[3];
@@ -112,9 +111,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;
@@ -263,7 +262,7 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm)
uid_start = uid;
uid = uid_end + bm->totedge;
- BLI_array_grow_one(eloop_pairs);
+ BLI_array_growone(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 */
@@ -277,7 +276,7 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm)
}
/* null terminate */
- BLI_array_grow_one(eloop_pairs);
+ BLI_array_growone(eloop_pairs);
lp = &eloop_pairs[BLI_array_count(eloop_pairs) - 1];
lp->l_a = lp->l_b = NULL;
@@ -348,7 +347,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 32e70e798fe..05352938aba 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_grow_one(stack);
+ BLI_array_growone(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_grow_one(stack);
+ BLI_array_growone(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 a82f34a4649..3cbb099a0a9 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_grow_one(vtx_frame);
+ BLI_array_growone(vtx_frame);
copy_v3_v3(vtx_frame[idx], curr_vert->co);
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 7eae8b4d67e..30ae71bd8a6 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -87,6 +87,7 @@ static int edbm_subdivide_exec(bContext *C, wmOperator *op)
int cuts = RNA_int_get(op->ptr, "number_cuts");
float smooth = 0.292f * RNA_float_get(op->ptr, "smoothness");
float fractal = RNA_float_get(op->ptr, "fractal") / 2.5f;
+ float along_normal = RNA_float_get(op->ptr, "fractal_along_normal");
if (RNA_boolean_get(op->ptr, "quadtri") &&
RNA_enum_get(op->ptr, "quadcorner") == SUBD_STRAIGHT_CUT)
@@ -95,7 +96,7 @@ static int edbm_subdivide_exec(bContext *C, wmOperator *op)
}
BM_mesh_esubdivide(em->bm, BM_ELEM_SELECT,
- smooth, fractal,
+ smooth, fractal, along_normal,
cuts,
SUBDIV_SELECT_ORIG, RNA_enum_get(op->ptr, "quadcorner"),
RNA_boolean_get(op->ptr, "quadtri"), TRUE,
@@ -143,6 +144,7 @@ void MESH_OT_subdivide(wmOperatorType *ot)
"Quad Corner Type", "How to subdivide quad corners (anything other than Straight Cut will prevent ngons)");
RNA_def_float(ot->srna, "fractal", 0.0f, 0.0f, FLT_MAX, "Fractal", "Fractal randomness factor", 0.0f, 1000.0f);
+ RNA_def_float(ot->srna, "fractal_along_normal", 0.0f, 0.0f, 1.0f, "Along Normal", "Apply fractal displacement along normal only", 0.0f, 1.0f);
RNA_def_int(ot->srna, "seed", 0, 0, 10000, "Random Seed", "Seed for the random number generator", 0, 50);
}
@@ -612,7 +614,7 @@ static int edbm_extrude_faces_exec(bContext *C, wmOperator *op)
edbm_extrude_face_indiv(em, op, BM_ELEM_SELECT, nor);
- WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit);
+ EDBM_update_generic(C, em, TRUE);
return OPERATOR_FINISHED;
}
@@ -896,7 +898,7 @@ static EnumPropertyItem prop_mesh_delete_types[] = {
{0, "VERT", 0, "Vertices", ""},
{1, "EDGE", 0, "Edges", ""},
{2, "FACE", 0, "Faces", ""},
- {3, "EDGE_FACE", 0, "Edges & Faces", ""},
+ {3, "EDGE_FACE", 0, "Only Edges & Faces", ""},
{4, "ONLY_FACE", 0, "Only Faces", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -927,9 +929,7 @@ 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);
@@ -1023,7 +1023,8 @@ 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)]++;
}
}
@@ -3197,11 +3198,45 @@ static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
+ BMesh *bm = em->bm;
float angle_limit = RNA_float_get(op->ptr, "angle_limit");
+ char dissolve_flag;
+
+ if (em->selectmode == SCE_SELECT_FACE) {
+ /* flush selection to tags and untag edges/verts with partially selected faces */
+ BMIter iter;
+ BMIter liter;
+
+ BMElem *ele;
+ BMFace *f;
+ BMLoop *l;
+
+ BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) {
+ BM_elem_flag_set(ele, BM_ELEM_TAG, BM_elem_flag_test(ele, BM_ELEM_SELECT));
+ }
+ BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
+ BM_elem_flag_set(ele, BM_ELEM_TAG, BM_elem_flag_test(ele, BM_ELEM_SELECT));
+ }
+
+ BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+ if (!BM_elem_flag_test(f, BM_ELEM_SELECT)) {
+ BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+ BM_elem_flag_disable(l->v, BM_ELEM_TAG);
+ BM_elem_flag_disable(l->e, BM_ELEM_TAG);
+ }
+ }
+ }
+
+ dissolve_flag = BM_ELEM_TAG;
+ }
+ else {
+ dissolve_flag = BM_ELEM_SELECT;
+ }
+
if (!EDBM_op_callf(em, op,
"dissolve_limit edges=%he verts=%hv angle_limit=%f",
- BM_ELEM_SELECT, BM_ELEM_SELECT, angle_limit))
+ dissolve_flag, dissolve_flag, angle_limit))
{
return OPERATOR_CANCELLED;
}
@@ -3640,6 +3675,22 @@ 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;
@@ -3677,8 +3728,11 @@ static void xsortvert_flag(bContext *C, int flag)
}
}
/* printf("%d verts: %d to be sorted, %d unchanged…\n", totvert, sorted, unchanged);*/
- if (sorted == 0)
+ if (sorted == 0) {
+ MEM_freeN(sortblock);
+ MEM_freeN(unchangedblock);
return;
+ }
ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
mesh_foreachScreenVert(&vc, xsortvert_flag__doSetX, sortblock, V3D_CLIP_TEST_OFF);
@@ -3936,8 +3990,11 @@ static void hashvert_flag(BMEditMesh *em, int flag, unsigned int seed)
}
/* protected = totvert - randomized;*/
/* printf("%d verts: %d to be randomized, %d protected…\n", totvert, randomized, protected);*/
- if (randomized == 0)
+ if (randomized == 0) {
+ MEM_freeN(block);
+ MEM_freeN(randblock);
return;
+ }
/* Randomize non-protected vertices indices, and create an array mapping old idx to new
@@ -4265,4 +4322,3 @@ 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");
}
-
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 2ebeb9ca224..4ec3c22d1df 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, const float limit[2])
+UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, int do_face_idx_array, float *limit)
{
BMVert *ev;
BMFace *efa;
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 5aea6f8d1c3..fb9b012a31a 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -189,42 +189,6 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
}
}
-/* copies from active to 'index' */
-static void editmesh_face_copy_customdata(BMEditMesh *em, int type, int index)
-{
- BMesh *bm = em->bm;
- CustomData *pdata = &bm->pdata;
- BMIter iter;
- BMFace *efa;
- const int n = CustomData_get_active_layer(pdata, type);
-
- /* ensure all current elements follow new customdata layout */
- BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
- void *data = CustomData_bmesh_get_n(pdata, efa->head.data, type, n);
- CustomData_bmesh_set_n(pdata, efa->head.data, type, index, data);
- }
-}
-
-/* copies from active to 'index' */
-static void editmesh_loop_copy_customdata(BMEditMesh *em, int type, int index)
-{
- BMesh *bm = em->bm;
- CustomData *ldata = &bm->ldata;
- BMIter iter;
- BMIter liter;
- BMFace *efa;
- BMLoop *loop;
- const int n = CustomData_get_active_layer(ldata, type);
-
- /* ensure all current elements follow new customdata layout */
- BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
- BM_ITER_ELEM (loop, &liter, efa, BM_LOOPS_OF_FACE) {
- void *data = CustomData_bmesh_get_n(ldata, loop->head.data, type, n);
- CustomData_bmesh_set_n(ldata, loop->head.data, type, index, data);
- }
- }
-}
-
int ED_mesh_uv_loop_reset_ex(struct bContext *C, struct Mesh *me, const int layernum)
{
BMEditMesh *em = me->edit_btmesh;
@@ -360,7 +324,8 @@ int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_s
BM_data_layer_add_named(em->bm, &em->bm->pdata, CD_MTEXPOLY, name);
/* copy data from active UV */
if (layernum) {
- editmesh_face_copy_customdata(em, CD_MTEXPOLY, layernum);
+ const int layernum_dst = CustomData_get_active_layer(&em->bm->pdata, CD_MTEXPOLY);
+ BM_data_layer_copy(em->bm, &em->bm->pdata, CD_MTEXPOLY, layernum, layernum_dst);
}
if (active_set || layernum == 0) {
CustomData_set_layer_active(&em->bm->pdata, CD_MTEXPOLY, layernum);
@@ -370,7 +335,9 @@ int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_s
BM_data_layer_add_named(em->bm, &em->bm->ldata, CD_MLOOPUV, name);
/* copy data from active UV */
if (layernum) {
- editmesh_loop_copy_customdata(em, CD_MLOOPUV, layernum);
+ const int layernum_dst = CustomData_get_active_layer(&em->bm->ldata, CD_MLOOPUV);
+ BM_data_layer_copy(em->bm, &em->bm->ldata, CD_MLOOPUV, layernum, layernum_dst);
+
is_init = TRUE;
}
if (active_set || layernum == 0) {
@@ -457,7 +424,8 @@ int ED_mesh_color_add(bContext *C, Scene *UNUSED(scene), Object *UNUSED(ob), Mes
BM_data_layer_add_named(em->bm, &em->bm->ldata, CD_MLOOPCOL, name);
/* copy data from active vertex color layer */
if (layernum) {
- editmesh_loop_copy_customdata(em, CD_MLOOPCOL, layernum);
+ const int layernum_dst = CustomData_get_active_layer(&em->bm->ldata, CD_MLOOPCOL);
+ BM_data_layer_copy(em->bm, &em->bm->ldata, CD_MLOOPUV, layernum, layernum_dst);
}
if (active_set || layernum == 0) {
CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPCOL, layernum);
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index b6403f33bc9..70ae9704d3e 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 */
diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c
index 43cd89af3ac..e7dd903d847 100644
--- a/source/blender/editors/mesh/mesh_navmesh.c
+++ b/source/blender/editors/mesh/mesh_navmesh.c
@@ -316,6 +316,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
}
else {
obedit = base->object;
+ scene_deselect_all(scene);
scene_select_base(scene, base);
copy_v3_v3(obedit->loc, co);
copy_v3_v3(obedit->rot, rot);
@@ -430,7 +431,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/meshtools.c b/source/blender/editors/mesh/meshtools.c
index d8e9dea598c..7c02f26dbdc 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,7 +198,8 @@ 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;
@@ -298,7 +299,8 @@ 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;
@@ -567,7 +569,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) {
@@ -599,7 +601,8 @@ 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) {
@@ -638,7 +641,7 @@ typedef struct MocNode {
intptr_t index[MOC_NODE_RES];
} MocNode;
-static int mesh_octree_get_base_offs(const float co[3], const float offs[3], const float div[3])
+static int mesh_octree_get_base_offs(float *co, float *offs, float *div)
{
int vx, vy, vz;
@@ -733,7 +736,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, const float co[3])
+static intptr_t mesh_octree_find_index(MocNode **bt, MVert *mvert, float *co)
{
float *vec;
int a;
@@ -770,7 +773,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, const float co[3], char mode)
+intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode)
{
MocNode **bt;
@@ -917,7 +920,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, const float co[3])
+static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, float *co)
{
float vec[3];
intptr_t poinval;
@@ -925,10 +928,9 @@ static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, c
/* 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];
@@ -969,7 +971,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, const float co[3], int index)
+BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *eve, float *co, int index)
{
if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_TOPO) {
return editbmesh_get_x_mirror_vert_topo(ob, em, eve, index);
@@ -1014,7 +1016,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) {
- uv_poly_center(em, efa, cent);
+ poly_uv_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 1407d38ed0f..713009d2a19 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= BKE_metaball_element_add(mball, type);
+ ml= add_metaball_element(mball, type);
copy_v3_v3(&ml->x, mat[3]);
ml->flag |= SELECT;
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index fcce65c9326..96703d41214 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);
@@ -1100,40 +1100,40 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
if (dupli_gh)
BLI_ghash_insert(dupli_gh, dob, ob);
if (parent_gh)
- BLI_ghash_insert(parent_gh, BLI_ghashutil_pairalloc(dob->ob, dob->index), ob);
+ BLI_ghash_insert(parent_gh, BLI_ghashutil_pairalloc(dob->ob, SET_INT_IN_POINTER(dob->index)), ob);
}
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) {
- GHashPair *pair = BLI_ghashutil_pairalloc(ob_src_par, dob->index);
+ GHashPair *pair = BLI_ghashutil_pairalloc(ob_src_par, SET_INT_IN_POINTER(dob->index));
ob_dst_par = BLI_ghash_lookup(parent_gh, pair);
BLI_ghashutil_pairfree(pair);
}
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,16 +1227,15 @@ 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 */
@@ -1246,8 +1245,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));
}
@@ -1259,16 +1258,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;
@@ -1279,24 +1278,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) */
@@ -1306,8 +1305,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) {
@@ -1320,23 +1319,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;
@@ -1344,33 +1343,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);
@@ -1378,64 +1377,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 = BKE_curve_copy(ob->data);
+ newob->data= copy_curve(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);
@@ -1449,17 +1448,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 = BKE_curve_copy(ob->data);
+ newob->data= copy_curve(ob->data);
}
else {
- newob = ob;
+ newob= ob;
/* meshes doesn't use displist */
freedisplist(&newob->disp);
@@ -1468,13 +1467,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 = BKE_metaball_basis_find(scene, ob);
+ baseob= find_basis_mball(scene, ob);
if (ob != baseob) {
/* if motherball is converting it would be marked as done later */
@@ -1488,29 +1487,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 {
@@ -1523,10 +1522,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)) {
@@ -1546,11 +1545,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);
@@ -1568,16 +1567,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;
}
@@ -1596,7 +1595,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");
@@ -1615,28 +1614,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);
}
@@ -1648,11 +1647,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) {
@@ -1663,11 +1662,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);
@@ -1678,71 +1677,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 = BKE_curve_copy(obn->data);
- didit = 1;
+ obn->data= copy_curve(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 = BKE_curve_copy(obn->data);
- didit = 1;
+ obn->data= copy_curve(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 = BKE_curve_copy(obn->data);
- didit = 1;
+ obn->data= copy_curve(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 = BKE_metaball_copy(obn->data);
- didit = 1;
+ obn->data= copy_mball(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--;
}
@@ -1752,44 +1751,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;
+ 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--;
}
- 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--;
}
@@ -1806,13 +1805,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;
}
@@ -1821,13 +1820,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--;
}
@@ -1848,14 +1847,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);
@@ -1872,16 +1871,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 */
@@ -1892,7 +1891,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) {
@@ -1906,7 +1905,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;
}
@@ -1925,11 +1924,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);
}
@@ -1938,36 +1937,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);
@@ -1979,7 +1978,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;
}
@@ -1996,10 +1995,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");
}
@@ -2007,7 +2006,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;
@@ -2020,8 +2019,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");
@@ -2054,13 +2053,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;
@@ -2073,8 +2072,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");
@@ -2103,5 +2102,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 9e8381a72c6..1f012c6f0be 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 a865b1d015d..ec3567454df 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_r
/* 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_r
}
/* 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 ch
/* 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,25 +1145,26 @@ 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;
}
@@ -1183,21 +1184,22 @@ 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;
}
@@ -1218,7 +1220,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);
@@ -1229,7 +1231,8 @@ 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);
@@ -1240,9 +1243,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;
}
@@ -1259,17 +1262,18 @@ 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);
@@ -1279,10 +1283,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;
}
@@ -1299,7 +1303,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 *********************/
@@ -1307,25 +1311,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:
@@ -1334,37 +1338,38 @@ 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;
}
@@ -1375,22 +1380,23 @@ 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;
}
@@ -1402,17 +1408,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) {
@@ -1429,12 +1435,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 */
@@ -1444,16 +1450,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) {
@@ -1488,8 +1494,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)) {
@@ -1509,7 +1515,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);
@@ -1539,17 +1545,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;
}
@@ -1559,9 +1565,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");
@@ -1572,7 +1578,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);
}
@@ -1580,9 +1586,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");
@@ -1593,7 +1599,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);
}
@@ -1613,7 +1619,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", "");
@@ -1632,7 +1638,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", "");
@@ -1651,7 +1657,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", "");
@@ -1670,7 +1676,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", "");
@@ -1683,14 +1689,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)) {
@@ -1699,8 +1705,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");
@@ -1708,8 +1714,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)) {
@@ -1736,8 +1742,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);
@@ -1756,7 +1762,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");
@@ -1767,20 +1773,21 @@ 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;
@@ -1788,7 +1795,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;
}
@@ -1805,6 +1812,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 d5385d00c8a..e48c2eb6196 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,8 +109,7 @@ 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)
{
@@ -121,10 +120,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;
}
@@ -133,15 +132,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;
@@ -152,7 +151,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;
@@ -171,24 +170,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);
}
}
@@ -206,7 +205,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));
}
@@ -225,7 +224,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");
@@ -234,19 +233,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;
}
@@ -264,14 +263,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;
@@ -284,7 +283,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;
}
@@ -300,7 +299,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");
}
@@ -311,19 +310,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;
}
@@ -333,14 +332,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);
@@ -349,15 +348,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);
}
@@ -368,11 +367,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;
}
@@ -381,14 +380,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;
}
@@ -397,27 +396,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;
@@ -435,14 +434,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);
@@ -456,10 +455,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
@@ -473,50 +472,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");
@@ -530,7 +529,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);
@@ -568,18 +567,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)
@@ -605,7 +604,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)
@@ -613,53 +612,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);
}
}
@@ -674,7 +673,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)) {
@@ -693,12 +692,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;
}
}
}
@@ -707,49 +706,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) {
- BKE_metaball_tex_space_calc(to);
+ tex_space_mball(to);
}
else {
- BKE_curve_tex_space_calc(to->data);
+ tex_space_curve(to->data);
}
}
@@ -761,125 +760,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? */
@@ -890,43 +889,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) {
@@ -942,42 +941,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;
@@ -985,13 +984,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);
}
}
@@ -1004,13 +1003,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)
@@ -1029,8 +1028,8 @@ static void UNUSED_FUNCTION(copy_attr_menu) (Main * bmain, Scene * scene, View3D
"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");
@@ -1040,10 +1039,10 @@ static void UNUSED_FUNCTION(copy_attr_menu) (Main * bmain, Scene * scene, View3D
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");
}
@@ -1051,12 +1050,12 @@ static void UNUSED_FUNCTION(copy_attr_menu) (Main * bmain, Scene * scene, View3D
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);
}
@@ -1075,7 +1074,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;
}
@@ -1093,7 +1092,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;
}
/* ********************************************** */
@@ -1109,7 +1108,8 @@ 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);
@@ -1121,17 +1121,44 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene)
BLI_freelistN(&targets);
}
-/* 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
- */
+/* show popup to determine settings */
+static int object_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *evt)
+{
+ Object *ob = CTX_data_active_object(C);
+
+ if (ob == NULL)
+ return OPERATOR_CANCELLED;
+
+ /* set default settings from existing/stored settings */
+ {
+ bAnimVizSettings *avs = &ob->avs;
+
+ RNA_int_set(op->ptr, "start_frame", avs->path_sf);
+ RNA_int_set(op->ptr, "end_frame", avs->path_ef);
+ }
+
+ /* show popup dialog to allow editing of range... */
+ // FIXME: hardcoded dimensions here are just arbitrary
+ return WM_operator_props_dialog_popup(C, op, 200, 200);
+}
+
+/* Calculate/recalculate whole paths (avs.path_sf to avs.path_ef) */
static int object_calculate_paths_exec(bContext *C, wmOperator *op)
{
- Scene *scene = CTX_data_scene(C);
+ Scene *scene= CTX_data_scene(C);
+ int start = RNA_int_get(op->ptr, "start_frame");
+ int end = RNA_int_get(op->ptr, "end_frame");
/* 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 */
+ bAnimVizSettings *avs = &ob->avs;
+
+ /* grab baking settings from operator settings */
+ avs->path_sf = start;
+ avs->path_ef = end;
+
+ /* verify that the selected object has the appropriate settings */
animviz_verify_motionpaths(op->reports, scene, ob, NULL);
}
CTX_DATA_END;
@@ -1141,12 +1168,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";
@@ -1154,11 +1181,18 @@ void OBJECT_OT_paths_calculate(wmOperatorType *ot)
ot->description = "Calculate paths for the selected bones";
/* api callbacks */
+ ot->invoke = object_calculate_paths_invoke;
ot->exec = object_calculate_paths_exec;
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* properties */
+ RNA_def_int(ot->srna, "start_frame", 1, MINAFRAME, MAXFRAME, "Start",
+ "First frame to calculate object paths on", MINFRAME, MAXFRAME/2.0);
+ RNA_def_int(ot->srna, "end_frame", 250, MINAFRAME, MAXFRAME, "End",
+ "Last frame to calculate object paths on", MINFRAME, MAXFRAME/2.0);
}
/* --------- */
@@ -1167,11 +1201,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 +1213,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 +1236,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 +1246,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 +1295,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 +1310,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 +1325,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,32 +1378,30 @@ 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_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))
- {
+ 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))
RNA_enum_item_add(&item, &totitem, input);
- }
++input;
}
RNA_enum_item_end(&item, &totitem);
- *free = 1;
+ *free= 1;
return item;
}
@@ -1403,24 +1435,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;
}
}
@@ -1429,7 +1461,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");
@@ -1476,7 +1508,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", "");
@@ -1506,12 +1538,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);
@@ -1538,7 +1570,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");
@@ -1546,14 +1578,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);
@@ -1579,16 +1611,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", ""},
@@ -1599,40 +1631,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;
@@ -1640,14 +1672,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);
}
}
@@ -1669,17 +1701,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;
@@ -1698,16 +1730,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);
@@ -1724,16 +1756,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);
}
}
}
@@ -1756,14 +1788,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;
@@ -1783,7 +1815,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;
}
}
@@ -1804,5 +1836,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 702671d8d9b..3867b1e34cb 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 4ffc3e8c19f..f8476165134 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;
@@ -313,8 +313,11 @@ static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int *
em = me->edit_btmesh;
+ EDBM_mesh_normals_update(em);
+ BMEdit_RecalcTessellation(em);
+
/* 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 +330,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 +340,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 +371,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 +390,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 +417,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 +432,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 +440,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 +451,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,12 +481,13 @@ 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;
@@ -498,7 +502,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;
}
@@ -514,19 +518,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;
}
@@ -542,14 +546,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);
@@ -565,7 +569,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;
}
@@ -574,25 +578,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;
}
@@ -614,26 +618,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);
}
@@ -644,7 +648,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];
@@ -662,7 +666,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;
}
@@ -681,27 +685,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);
}
@@ -718,7 +722,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;
}
@@ -737,29 +741,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);
}
@@ -778,11 +782,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;
}
@@ -803,25 +807,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);
}
@@ -833,7 +837,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;
}
@@ -852,10 +856,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 ee9d776ea3b..b1738a960ce 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 648f530881a..4ba62541c60 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;
- }
- bp++;
+ 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;
}
- break;
+ bp++;
+ }
+ 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 f2d682cd0cb..445047ac321 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 = BKE_curve_vertexCos_get(cu, &cu->nurb, &numVerts);
+ vertexCos = curve_getVertexCos(cu, &cu->nurb, &numVerts);
mti->deformVerts(md, ob, NULL, vertexCos, numVerts, 0, 0);
- BK_curve_vertexCos_apply(cu, &cu->nurb, vertexCos);
+ curve_applyVertexCos(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,48 +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->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;
+ 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;
@@ -1405,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);
}
@@ -1427,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;
}
@@ -1452,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);
}
@@ -1476,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 {
@@ -1496,7 +1496,7 @@ typedef struct OceanBakeJob {
static void oceanbake_free(void *customdata)
{
- OceanBakeJob *oj = customdata;
+ OceanBakeJob *oj= customdata;
MEM_freeN(oj);
}
@@ -1515,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);
@@ -1560,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;
@@ -1572,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;
}
@@ -1580,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,
@@ -1614,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;
@@ -1622,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 */
@@ -1630,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);
@@ -1667,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 4cd18d91249..138cbad0a68 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -222,7 +222,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");
@@ -231,7 +231,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");
@@ -241,10 +241,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");
@@ -253,7 +253,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);
}
@@ -283,7 +283,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, */
@@ -302,7 +302,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");
@@ -321,13 +321,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);
@@ -342,13 +342,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);
@@ -366,7 +366,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);
@@ -377,23 +377,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 077ae2830a9..a666f04034b 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,31 +425,32 @@ 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 */
@@ -474,7 +475,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", "");
}
@@ -484,15 +485,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));
@@ -517,20 +518,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;
@@ -548,19 +549,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;
@@ -573,14 +574,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" */
@@ -589,7 +590,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 */
@@ -598,25 +599,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) {
@@ -636,7 +637,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)
@@ -647,7 +648,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);
@@ -658,7 +659,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;
}
}
@@ -667,13 +668,14 @@ 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;
@@ -686,8 +688,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;
}
@@ -695,22 +697,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);
@@ -739,7 +741,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", "");
}
@@ -748,13 +750,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");
@@ -762,14 +764,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 */
}
}
}
@@ -777,7 +779,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;
}
@@ -795,17 +797,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;
@@ -837,17 +839,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;
@@ -876,7 +878,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 ******************* */
@@ -890,24 +892,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);
}
@@ -919,7 +921,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;
}
@@ -938,7 +940,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", "");
}
@@ -954,23 +956,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)
@@ -983,13 +985,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) {
@@ -1004,13 +1006,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) {
@@ -1024,7 +1026,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;
}
@@ -1043,7 +1045,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", "");
@@ -1054,24 +1056,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);
}
@@ -1081,7 +1083,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");
}
@@ -1093,24 +1095,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; */
@@ -1120,11 +1122,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;
@@ -1132,8 +1134,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);
@@ -1153,7 +1155,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", "");
@@ -1164,18 +1166,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);
}
}
@@ -1184,10 +1186,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;
}
@@ -1202,11 +1204,12 @@ 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);
}
}
@@ -1229,14 +1232,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;
}
@@ -1254,53 +1257,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;
}
}
}
@@ -1310,7 +1313,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;
}
@@ -1330,22 +1333,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 */
@@ -1358,7 +1361,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", "");
@@ -1372,22 +1375,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--;
}
}
@@ -1397,7 +1400,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);
}
@@ -1410,9 +1413,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);
@@ -1423,18 +1426,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];
}
}
}
@@ -1451,73 +1454,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 = 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;
+ }
+ 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;
}
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;
}
}
@@ -1526,10 +1529,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);
}
}
@@ -1543,30 +1546,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;
}
}
}
@@ -1582,20 +1585,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;
}
}
@@ -1607,31 +1610,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) );
}
}
}
@@ -1648,26 +1651,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);
}
@@ -1697,11 +1700,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 */
@@ -1709,83 +1712,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);
}
@@ -1802,7 +1805,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", ""},
@@ -1819,7 +1822,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", "");
@@ -1827,10 +1830,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);
@@ -1856,7 +1859,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}};
@@ -1872,7 +1875,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", "");
@@ -1886,20 +1889,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;
}
@@ -1922,5 +1925,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 7a4db175ee4..388766f5fa3 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,7 +602,8 @@ 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;
@@ -627,42 +628,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;
}
@@ -682,7 +683,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");
@@ -696,24 +697,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;
}
@@ -731,7 +732,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");
@@ -749,7 +750,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;
@@ -758,27 +759,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:
+ 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);
- break;
- case SEL_INVERT:
- if (base->flag & SELECT) {
- ED_base_object_select(base, BA_DESELECT);
- }
- else {
- ED_base_object_select(base, BA_SELECT);
- }
- break;
+ }
+ 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;
}
@@ -796,7 +797,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);
}
@@ -813,7 +814,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;
}
@@ -821,13 +822,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;
}
@@ -845,7 +846,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");
}
@@ -853,20 +854,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);
@@ -880,7 +881,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;
}
@@ -898,7 +899,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");
}
@@ -911,24 +912,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;
}
@@ -946,7 +947,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 5d31bfff99a..79b1ca13c9e 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_get(ob->data));
+ key_to_curve(key->refkey, ob->data, BKE_curve_nurbs(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 e416bd5b762..55954790687 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,7 +227,8 @@ 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);
@@ -243,7 +244,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;
}
@@ -268,7 +269,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)
@@ -288,7 +289,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)
@@ -308,22 +309,23 @@ 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);
@@ -336,7 +338,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;
}
@@ -353,20 +355,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);
@@ -377,21 +379,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;
@@ -411,7 +413,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");
@@ -426,7 +428,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)
@@ -464,24 +466,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);
}
}
@@ -489,7 +491,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) {
@@ -503,7 +505,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;
@@ -511,20 +513,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;
}
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(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);
}
}
@@ -535,7 +537,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);
@@ -543,13 +545,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;
}
@@ -558,16 +560,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);
@@ -582,7 +584,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;
}
@@ -598,14 +600,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);
@@ -627,7 +629,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", "");
@@ -637,23 +639,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");
@@ -661,10 +663,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);
@@ -672,8 +674,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;
@@ -686,10 +688,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);
@@ -705,24 +707,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;
@@ -734,7 +736,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++;
}
@@ -753,7 +755,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;
}
}
}
@@ -761,11 +763,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);
@@ -773,25 +775,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) { BKE_curve_center_median(cu, cent); }
- else { BKE_curve_center_bounds(cu, cent); }
+ else if (around==V3D_CENTROID) { curve_center_median(cu, cent); }
+ else { 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);
- BKE_curve_translate(cu, cent_neg, 1);
+ 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) {
@@ -800,12 +802,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 {
@@ -813,21 +815,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) {
@@ -860,15 +862,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) {
@@ -887,28 +889,27 @@ 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);
@@ -920,22 +921,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;
@@ -968,7 +969,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 6d5e098770a..b5c34f1c750 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -84,9 +84,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)
@@ -94,7 +94,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;
}
@@ -144,18 +144,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;
}
}
@@ -163,14 +163,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 {
@@ -184,7 +184,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;
@@ -201,7 +201,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;
@@ -222,21 +222,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;
}
}
@@ -249,24 +249,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;
}
}
@@ -287,27 +287,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;
}
@@ -319,19 +319,19 @@ int ED_vgroup_copy_array(Object *ob, Object *ob_from)
int dvert_tot_from;
int dvert_tot;
int 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;
ED_vgroup_give_parray(ob_from->data, &dvert_array_from, &dvert_tot_from, FALSE);
ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, FALSE);
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);
@@ -386,13 +386,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 */
@@ -401,7 +401,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
@@ -409,27 +409,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 {
@@ -437,21 +437,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);
}
}
}
@@ -463,9 +463,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
@@ -475,7 +475,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
@@ -484,17 +484,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
@@ -503,10 +503,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 */
}
}
@@ -514,20 +514,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) {
@@ -536,11 +536,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];
@@ -548,7 +548,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;
}
@@ -559,7 +559,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;
@@ -569,8 +569,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 *********************/
@@ -578,7 +578,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)) {
@@ -586,7 +586,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;
@@ -595,7 +595,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);
}
@@ -603,7 +603,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 {
@@ -615,11 +615,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;
}
}
}
@@ -629,19 +629,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;
}
}
}
@@ -653,10 +653,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;
@@ -673,16 +673,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 */
@@ -698,9 +698,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;
@@ -751,7 +751,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;
@@ -778,12 +778,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. */
@@ -823,7 +823,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,
@@ -853,7 +853,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;
@@ -865,7 +865,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);
}
@@ -885,19 +885,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;
@@ -912,11 +912,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;
@@ -930,10 +930,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;
@@ -976,7 +976,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])) {
@@ -1009,7 +1009,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;
}
@@ -1025,13 +1025,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;
@@ -1043,9 +1043,8 @@ 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);
@@ -1065,10 +1064,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);
@@ -1085,7 +1084,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 */
@@ -1103,9 +1102,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;
@@ -1138,9 +1137,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;
@@ -1184,17 +1183,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;
@@ -1211,9 +1210,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)) {
@@ -1231,10 +1230,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) {
@@ -1254,8 +1253,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);
@@ -1304,14 +1303,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);
@@ -1385,9 +1384,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)) {
@@ -1405,11 +1404,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 */
}
}
@@ -1422,7 +1421,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;
@@ -1440,14 +1439,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);
@@ -1475,14 +1474,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);
}
@@ -1532,19 +1531,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);
@@ -1554,13 +1553,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) {
@@ -1574,13 +1573,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;
}
@@ -1604,29 +1603,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;
}
@@ -1638,7 +1637,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;
@@ -1651,27 +1650,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;
}
@@ -1701,40 +1700,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);
@@ -1743,9 +1742,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);
@@ -1754,10 +1753,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 */
@@ -1779,7 +1778,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;
}
@@ -1788,10 +1787,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;
@@ -1799,7 +1798,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);
@@ -1819,7 +1818,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);
@@ -1830,17 +1829,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 */
@@ -1853,7 +1852,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);
@@ -1861,32 +1860,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--;
}
@@ -1897,26 +1896,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;
}
}
}
@@ -1927,7 +1926,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;
}
@@ -1946,7 +1945,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;
@@ -1959,16 +1958,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;
}
}
@@ -1976,20 +1975,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;
@@ -2003,10 +2002,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;
}
}
}
@@ -2023,35 +2022,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;
}
}
}
@@ -2067,7 +2066,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);
}
}
@@ -2076,15 +2075,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;
@@ -2095,24 +2094,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;
}
@@ -2128,12 +2127,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);
@@ -2141,8 +2140,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;
}
@@ -2161,7 +2160,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");
@@ -2169,15 +2168,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;
}
@@ -2196,7 +2195,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");
@@ -2204,12 +2203,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;
@@ -2219,7 +2218,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;
}
@@ -2238,7 +2237,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");
@@ -2246,13 +2245,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;
}
@@ -2268,15 +2267,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;
}
@@ -2292,17 +2291,17 @@ 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;
}
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;
}
@@ -2318,21 +2317,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;
}
@@ -2348,7 +2347,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);
@@ -2356,13 +2355,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;
}
@@ -2378,19 +2377,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;
}
@@ -2406,7 +2405,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");
@@ -2414,16 +2413,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;
@@ -2436,8 +2435,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;
}
@@ -2448,14 +2447,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);
@@ -2466,7 +2465,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");
@@ -2486,21 +2485,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;
}
@@ -2516,7 +2515,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");
@@ -2533,8 +2532,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;
}
@@ -2543,7 +2542,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;
@@ -2580,7 +2579,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", "");
@@ -2591,18 +2590,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;
}
@@ -2619,7 +2618,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");
@@ -2630,16 +2629,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;
}
@@ -2650,14 +2649,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");
@@ -2668,21 +2667,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;
}
@@ -2704,19 +2703,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;
}
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;
@@ -2743,48 +2743,47 @@ 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 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;
}
@@ -2804,10 +2803,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;
}
@@ -2818,11 +2817,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;
}
@@ -2832,33 +2831,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);
}
@@ -2871,7 +2870,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);
@@ -2884,14 +2883,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);
@@ -2900,15 +2899,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;
@@ -2923,7 +2922,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);
@@ -2942,15 +2941,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) {
@@ -2978,7 +2977,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;
@@ -3001,7 +3000,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 c82e0459218..417cddb74fe 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -291,7 +291,8 @@ 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 131034848de..5f22165176b 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -45,9 +45,7 @@
#include "DNA_space_types.h"
#include "BLI_math.h"
-#include "BLI_lasso.h"
-#include "BLI_listbase.h"
-#include "BLI_string.h"
+#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
#include "BLI_kdtree.h"
#include "BLI_rand.h"
@@ -215,7 +213,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;
@@ -477,12 +475,10 @@ static int key_inside_rect(PEData *data, const float co[3])
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;
}
@@ -1637,9 +1633,7 @@ 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 (BLI_lasso_is_point_inside(mcords,moves,vertco[0],vertco[1], IS_CLIPPED) &&
- key_test_depth(&data, co))
- {
+ if ((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
if (select && !(key->flag & PEK_SELECT)) {
key->flag |= PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
@@ -1657,9 +1651,7 @@ 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 (BLI_lasso_is_point_inside(mcords,moves,vertco[0],vertco[1], IS_CLIPPED) &&
- key_test_depth(&data, co))
- {
+ if ((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
if (select && !(key->flag & PEK_SELECT)) {
key->flag |= PEK_SELECT;
point->flag |= PEP_EDIT_RECALC;
@@ -3495,7 +3487,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];
@@ -3671,7 +3663,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;
@@ -3712,7 +3704,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
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index c0d3e505873..20fa4c5753f 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -594,7 +594,8 @@ 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);
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index f9737b02a01..695e7ed0e7f 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -146,6 +146,13 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
BLI_assert((oglrender->sizex == ibuf->x) && (oglrender->sizey == ibuf->y));
if (ibuf->rect_float == NULL) {
+ /* internally sequencer working in sRGB space and stores both bytes and float
+ * buffers in sRGB space, but if byte->float onversion doesn't happen in sequencer
+ * (e.g. when adding image sequence/movie into sequencer) there'll be only
+ * byte buffer and profile will still indicate sRGB->linear space conversion is needed
+ * here we're ensure there'll be no conversion happen and float buffer would store
+ * linear frame (sergey) */
+ ibuf->profile = IB_PROFILE_NONE;
IMB_float_from_rect(ibuf);
}
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index b648dac6343..6722ac5e686 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 = BKE_curve_editNurbs_get((Curve *)ob->data);
+ ListBase *nurbs = curve_editnurbs((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 = BKE_curve_editNurbs_get((Curve *)ob->data);
+ ListBase *nurbs = curve_editnurbs((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 2a561a6bc6c..bed17048ea1 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -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);
@@ -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;
@@ -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;
@@ -1813,63 +1813,3 @@ 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 5b73645abde..5ba0e86e0c1 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -825,7 +825,7 @@ int bglPointHack(void)
void bglVertex3fv(const float vec[3])
{
- switch (curmode) {
+ switch(curmode) {
case GL_POINTS:
if (pointhack) {
glRasterPos3fv(vec);
@@ -838,7 +838,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 +851,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,15 +882,11 @@ 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 512cd404273..cafa4527c20 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 3777547fa90..e427e1e21cf 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");
@@ -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 553a9a335d7..5d4710accad 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -377,9 +377,7 @@ 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? */
@@ -568,9 +566,7 @@ 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 ac327b56fb9..55cf827fea6 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_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 9fe941253f6..fb640346a99 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..c062d47a374 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -198,8 +198,8 @@ static void do_shared_vertex_tesscol(Mesh *me)
{
/* if no mcol: do not do */
/* if tface: only the involved faces, otherwise all */
+ const int use_face_sel = (me->editflag & ME_EDIT_PAINT_MASK);
MFace *mface;
- MTFace *tface;
int a;
short *scolmain, *scol;
char *mcol;
@@ -208,11 +208,10 @@ static void do_shared_vertex_tesscol(Mesh *me)
scolmain = MEM_callocN(4 * sizeof(short) * me->totvert, "colmain");
- tface = me->mtface;
mface = me->mface;
mcol = (char *)me->mcol;
for (a = me->totface; a > 0; a--, mface++, mcol += 16) {
- if ((tface && tface->mode & TF_SHAREDCOL) || (me->editflag & ME_EDIT_PAINT_MASK) == 0) {
+ if ((use_face_sel == FALSE) || (mface->flag & ME_FACE_SEL)) {
scol = scolmain + 4 * mface->v1;
scol[0]++; scol[1] += mcol[1]; scol[2] += mcol[2]; scol[3] += mcol[3];
scol = scolmain + 4 * mface->v2;
@@ -224,7 +223,6 @@ static void do_shared_vertex_tesscol(Mesh *me)
scol[0]++; scol[1] += mcol[13]; scol[2] += mcol[14]; scol[3] += mcol[15];
}
}
- if (tface) tface++;
}
a = me->totvert;
@@ -237,12 +235,11 @@ static void do_shared_vertex_tesscol(Mesh *me)
}
scol += 4;
}
-
- tface = me->mtface;
+
mface = me->mface;
mcol = (char *)me->mcol;
for (a = me->totface; a > 0; a--, mface++, mcol += 16) {
- if ((tface && tface->mode & TF_SHAREDCOL) || (me->editflag & ME_EDIT_PAINT_MASK) == 0) {
+ if ((use_face_sel == FALSE)|| (mface->flag & ME_FACE_SEL)) {
scol = scolmain + 4 * mface->v1;
mcol[1] = scol[1]; mcol[2] = scol[2]; mcol[3] = scol[3];
scol = scolmain + 4 * mface->v2;
@@ -254,7 +251,6 @@ static void do_shared_vertex_tesscol(Mesh *me)
mcol[13] = scol[1]; mcol[14] = scol[2]; mcol[15] = scol[3];
}
}
- if (tface) tface++;
}
MEM_freeN(scolmain);
@@ -262,12 +258,12 @@ static void do_shared_vertex_tesscol(Mesh *me)
void do_shared_vertexcol(Mesh *me, int do_tessface)
{
+ const int use_face_sel = (me->editflag & ME_EDIT_PAINT_MASK);
MLoop *ml = me->mloop;
MLoopCol *lcol = me->mloopcol;
- MTexPoly *mtp = me->mtpoly;
- MPoly *mp = me->mpoly;
- float (*scol)[5];
- int i, has_shared = 0;
+ MPoly *mp;
+ float (*scol)[4];
+ int i, j, has_shared = 0;
/* if no mloopcol: do not do */
/* if mtexpoly: only the involved faces, otherwise all */
@@ -276,42 +272,37 @@ void do_shared_vertexcol(Mesh *me, int do_tessface)
scol = MEM_callocN(sizeof(float) * me->totvert * 5, "scol");
- for (i = 0; i < me->totloop; i++, ml++, lcol++) {
- if (i >= mp->loopstart + mp->totloop) {
- mp++;
- if (mtp) mtp++;
+ for (i = 0, mp = me->mpoly; i < me->totpoly; i++, mp++) {
+ if ((use_face_sel == FALSE) || (mp->flag & ME_FACE_SEL)) {
+ ml = me->mloop + mp->loopstart;
+ lcol = me->mloopcol + mp->loopstart;
+ for (j = 0; j < mp->totloop; j++, ml++, lcol++) {
+ scol[ml->v][0] += lcol->r;
+ scol[ml->v][1] += lcol->g;
+ scol[ml->v][2] += lcol->b;
+ scol[ml->v][3] += 1.0f;
+ has_shared = 1;
+ }
}
-
- if (!(mtp && (mtp->mode & TF_SHAREDCOL)) && (me->editflag & ME_EDIT_PAINT_MASK) != 0)
- continue;
-
- scol[ml->v][0] += lcol->r;
- scol[ml->v][1] += lcol->g;
- scol[ml->v][2] += lcol->b;
- scol[ml->v][3] += lcol->a;
- scol[ml->v][4] += 1.0;
- has_shared = 1;
}
-
+
if (has_shared) {
for (i = 0; i < me->totvert; i++) {
- if (!scol[i][4]) continue;
-
- scol[i][0] /= scol[i][4];
- scol[i][1] /= scol[i][4];
- scol[i][2] /= scol[i][4];
- scol[i][3] /= scol[i][4];
+ if (scol[i][3] != 0.0f) {
+ mul_v3_fl(scol[i], 1.0f / scol[i][3]);
+ }
}
-
- ml = me->mloop;
- lcol = me->mloopcol;
- for (i = 0; i < me->totloop; i++, ml++, lcol++) {
- if (!scol[ml->v][4]) continue;
- lcol->r = scol[ml->v][0];
- lcol->g = scol[ml->v][1];
- lcol->b = scol[ml->v][2];
- lcol->a = scol[ml->v][3];
+ for (i = 0, mp = me->mpoly; i < me->totpoly; i++, mp++) {
+ if ((use_face_sel == FALSE) || (mp->flag & ME_FACE_SEL)) {
+ ml = me->mloop + mp->loopstart;
+ lcol = me->mloopcol + mp->loopstart;
+ for (j = 0; j < mp->totloop; j++, ml++, lcol++) {
+ lcol->r = scol[ml->v][0];
+ lcol->g = scol[ml->v][1];
+ lcol->b = scol[ml->v][2];
+ }
+ }
}
}
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 8d2dfc8dbfa..157be337823 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[3], const float val[3])
+static void sculpt_clip(Sculpt *sd, SculptSession *ss, float *co, const float val[3])
{
int i;
@@ -2817,10 +2817,8 @@ 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;
}
}
}
@@ -2930,11 +2928,8 @@ 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 c08ed2e85b9..89a786d02a9 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -237,9 +237,7 @@ 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 73dfde8fd6f..0ee985a5869 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;
@@ -443,7 +443,8 @@ 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);
@@ -465,7 +466,8 @@ 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;
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index c1875eb3a9a..9d0dab7d34e 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 20d5257a62f..b698ec03668 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 2385bfd75b7..fcc5b488ca9 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 b2a58041832..f1f4fb37b6e 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_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 2f9956fc143..bf8976035a8 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -1380,12 +1380,7 @@ 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_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c
index b569469d304..f8c81c2944a 100644
--- a/source/blender/editors/space_clip/clip_graph_ops.c
+++ b/source/blender/editors/space_clip/clip_graph_ops.c
@@ -82,7 +82,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;
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index c7033b0db99..7e1bbc254e9 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_movieclip_file_add(str);
+ clip = BKE_add_movieclip_file(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/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 4de790bc00c..228c716e3b6 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -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);
@@ -808,7 +808,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);
@@ -896,7 +896,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 +941,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 f4454394ca3..35986fa2700 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -92,25 +92,6 @@ static int space_clip_frame_poll(bContext *C)
return FALSE;
}
-static int space_clip_size_poll(bContext *C)
-{
- SpaceClip *sc = CTX_wm_space_clip(C);
-
- if (sc) {
- MovieClip *clip = ED_space_clip(sc);
-
- if (clip) {
- int width, height;
-
- BKE_movieclip_get_size(clip, &sc->user, &width, &height);
-
- return width > 0 && height > 0;
- }
- }
-
- return FALSE;
-}
-
/********************** add marker operator *********************/
static void add_marker(SpaceClip *sc, float x, float y)
@@ -175,7 +156,7 @@ void CLIP_OT_add_marker(wmOperatorType *ot)
/* api callbacks */
ot->invoke = add_marker_invoke;
ot->exec = add_marker_exec;
- ot->poll = space_clip_size_poll;
+ ot->poll = space_clip_frame_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -545,7 +526,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:
@@ -662,7 +643,7 @@ void CLIP_OT_slide_marker(wmOperatorType *ot)
ot->idname = "CLIP_OT_slide_marker";
/* api callbacks */
- ot->poll = space_clip_size_poll;
+ ot->poll = space_clip_frame_poll;
ot->invoke = slide_marker_invoke;
ot->modal = slide_marker_modal;
@@ -1219,7 +1200,7 @@ void CLIP_OT_select_grouped(wmOperatorType *ot)
/* api callbacks */
ot->exec = select_groped_exec;
- ot->poll = space_clip_size_poll;
+ ot->poll = space_clip_frame_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -2035,7 +2016,7 @@ static Object *get_orientation_object(bContext *C)
static int set_orientation_poll(bContext *C)
{
- if (space_clip_size_poll(C)) {
+ if (space_clip_frame_poll(C)) {
Scene *scene = CTX_data_scene(C);
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip(sc);
@@ -2645,7 +2626,7 @@ void CLIP_OT_set_scale(wmOperatorType *ot)
static int set_solution_scale_poll(bContext *C)
{
- if (space_clip_size_poll(C)) {
+ if (space_clip_frame_poll(C)) {
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip(sc);
MovieTracking *tracking = &clip->tracking;
@@ -2993,7 +2974,7 @@ void CLIP_OT_frame_jump(wmOperatorType *ot)
/* api callbacks */
ot->exec = frame_jump_exec;
- ot->poll = ED_space_clip_poll;
+ ot->poll = space_clip_frame_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -3050,7 +3031,7 @@ void CLIP_OT_join_tracks(wmOperatorType *ot)
/* api callbacks */
ot->exec = join_tracks_exec;
- ot->poll = space_clip_size_poll;
+ ot->poll = space_clip_frame_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 36b38661463..193fa2d2c65 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;
@@ -417,7 +417,8 @@ 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);
@@ -489,7 +490,8 @@ 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);
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index aa1ab823ee1..7d1981a5a3b 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -911,7 +911,8 @@ 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;
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index a05eba2daeb..45a271cc7e9 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -520,7 +520,7 @@ static void filelist_read_dir(struct FileList* filelist);
struct FileList* filelist_new(short type)
{
FileList* p = MEM_callocN( sizeof(FileList), "filelist" );
- switch (type) {
+ 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;
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index b17ca5ee319..31695ddd776 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -447,7 +447,8 @@ 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 a4da1975c56..48449ac8870 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,7 +268,8 @@ 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;
}
@@ -328,7 +329,8 @@ 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];
@@ -387,7 +389,8 @@ 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,
@@ -412,7 +415,8 @@ 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;
@@ -436,7 +440,8 @@ 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,
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index e166914b36f..0cf15c22efa 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.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:
@@ -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 8bc2eda7e33..4d2fe2cd568 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 d435b78b65c..fc84cfc46a2 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -720,8 +720,8 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View
correct_bezpart(v1, v2, v3, v4);
- 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);
+ 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);
for (fp= data; resol; resol--, fp+= 3)
glVertex2fv(fp);
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 6214201a87d..e485e4e4b3c 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 */
@@ -552,7 +553,7 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
*/
float *col= fcu->color;
- switch (fcu->array_index) {
+ switch(fcu->array_index) {
case 0:
col[0]= 1.0f; col[1]= 0.0f; col[2]= 0.0f;
break;
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 793e5712c8c..29bd5f5117d 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -334,6 +334,65 @@ 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)
{
@@ -722,7 +781,7 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
/* draw the image or grid */
if (ibuf == NULL)
- ED_region_grid_draw(ar, zoomx, zoomy);
+ draw_image_grid(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 d9f3ffafb14..2c688990a8f 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -190,14 +190,13 @@ int space_image_main_area_poll(bContext *C)
return 0;
}
-/* For IMAGE_OT_curves_point_set to avoid sampling when in uv smooth mode or editmode */
+/* For IMAGE_OT_curves_point_set to avoid sampling when in uv smooth mode */
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;
- if (sima && !toolsettings->uvsculpt && !scene->obedit)
+ ToolSettings *toolsettings = CTX_data_scene(C)->toolsettings;
+ if (sima && !toolsettings->uvsculpt)
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 447028b8bef..08aa69fe499 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -205,9 +205,7 @@ 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 2ef8f6c306c..1c2f43f67a4 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 = BKE_curve_editNurbs_get(cu);
+ ListBase *nurbs = curve_editnurbs(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 22df7432ecb..dcead6c01db 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,7 +119,8 @@ 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_window.c b/source/blender/editors/space_logic/logic_window.c
index 9f5ae19d92c..f7c69c80067 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,10 +551,13 @@ 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;
@@ -564,7 +567,8 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
break;
}
- while (sound) {
+ while (sound)
+ {
if (nr==sa->sndnr)
break;
nr++;
@@ -723,7 +727,8 @@ 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"
@@ -940,7 +945,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;
@@ -1156,7 +1161,8 @@ 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;
@@ -1341,12 +1347,14 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
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) {
+ 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) {
+ 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,
@@ -1393,7 +1401,8 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
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) {
+ 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");
}
@@ -1480,7 +1489,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) {
+ 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)");
@@ -1600,7 +1610,8 @@ 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,
@@ -1716,7 +1727,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;
@@ -1858,12 +1869,14 @@ 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;
}
@@ -1891,7 +1904,8 @@ 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, "");
@@ -1907,7 +1921,8 @@ 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, "");
@@ -1933,7 +1948,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
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);
@@ -2808,7 +2824,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 );
- 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");
@@ -3742,7 +3759,8 @@ 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:
@@ -3817,7 +3835,8 @@ 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);
@@ -3915,7 +3934,8 @@ 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);
@@ -3968,7 +3988,8 @@ 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);
@@ -4142,7 +4163,8 @@ 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:
diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c
index 93105c39f39..82175f83d39 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 a133d370d99..de42e4a783d 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/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 27c48d2232f..4dc3aef7d2c 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 91ece361aac..50850856086 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -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);
}
@@ -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,50 +2227,45 @@ 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 ************* */
@@ -2310,7 +2310,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:
@@ -2499,8 +2499,8 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa
else {
/* always do all three, to prevent data hanging around */
- 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);
+ 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);
return 1;
}
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index f38e3e0d272..f5ab3185aae 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -243,8 +243,37 @@ static bNode *editnode_get_active(bNodeTree *ntree)
return nodeGetActive(ntree);
}
-void snode_dag_update(bContext *UNUSED(C), SpaceNode *snode)
+static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup)
{
+ bNode *node;
+
+ if (ntree == lookup)
+ return 1;
+
+ for (node=ntree->nodes.first; node; node=node->next)
+ if (node->type == NODE_GROUP && node->id)
+ if (has_nodetree((bNodeTree*)node->id, lookup))
+ return 1;
+
+ return 0;
+}
+
+static void snode_dag_update_group(void *calldata, ID *owner_id, bNodeTree *ntree)
+{
+ if (has_nodetree(ntree, calldata))
+ DAG_id_tag_update(owner_id, 0);
+}
+
+void snode_dag_update(bContext *C, SpaceNode *snode)
+{
+ Main *bmain = CTX_data_main(C);
+
+ /* for groups, update all ID's using this */
+ if (snode->edittree!=snode->nodetree) {
+ bNodeTreeType *tti= ntreeGetType(snode->edittree->type);
+ tti->foreach_nodetree(bmain, snode->edittree, snode_dag_update_group);
+ }
+
DAG_id_tag_update(snode->id, 0);
}
@@ -284,7 +313,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;
@@ -585,21 +614,6 @@ static void snode_update(SpaceNode *snode, bNode *node)
nodeUpdateID(snode->nodetree, gnode->id);
}
-static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup)
-{
- bNode *node;
-
- if (ntree == lookup)
- return 1;
-
- for (node=ntree->nodes.first; node; node=node->next)
- if (node->type == NODE_GROUP && node->id)
- if (has_nodetree((bNodeTree*)node->id, lookup))
- return 1;
-
- return 0;
-}
-
void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
{
int was_active_texture = (node->flag & NODE_ACTIVE_TEXTURE);
@@ -1458,7 +1472,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);
@@ -2412,7 +2426,8 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
/* when linking to group outputs, update the socket type */
/* XXX this should all be part of a generic update system */
if (!link->tonode) {
- link->tosock->type = link->fromsock->type;
+ if(link->tosock->type != link->fromsock->type)
+ nodeSocketSetType(link->tosock, link->fromsock->type);
}
}
else if (outside_group_rect(snode) && (link->tonode || link->fromnode)) {
@@ -2651,7 +2666,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_ops.c b/source/blender/editors/space_node/node_ops.c
index e1493b5b1a5..25940787b60 100644
--- a/source/blender/editors/space_node/node_ops.c
+++ b/source/blender/editors/space_node/node_ops.c
@@ -130,6 +130,11 @@ void ED_operatormacros_node(void)
ot = WM_operatortype_append_macro("NODE_OT_move_detach_links", "Detach", OPTYPE_UNDO|OPTYPE_REGISTER);
ot->description = "Move a node to detach links";
WM_operatortype_macro_define(ot, "NODE_OT_links_detach");
+ WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+
+ ot = WM_operatortype_append_macro("NODE_OT_move_detach_links_release", "Detach", OPTYPE_UNDO|OPTYPE_REGISTER);
+ ot->description = "Move a node to detach links";
+ WM_operatortype_macro_define(ot, "NODE_OT_links_detach");
mot = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_boolean_set(mot->ptr, "release_confirm", TRUE);
}
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index 13e85c7f74d..049886b1d66 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -220,10 +220,8 @@ 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);
@@ -297,14 +295,11 @@ 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 3540c20e515..fca9927b0f5 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 7b2bbf3e285..779475943dd 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -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;
@@ -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,7 +776,7 @@ 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;
@@ -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:
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 5515ec45269..c06576e48a6 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -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 13e86209f3a..5c527face83 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;
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index c2a3affa1b6..ed050b7f93d 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 09d974fe4b8..bb91c177295 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);
@@ -411,7 +411,10 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
if (seq_load.flag & SEQ_LOAD_REPLACE_SEL)
deselect_all_seq(scene);
- tot_files = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
+ if (RNA_struct_property_is_set(op->ptr, "files"))
+ tot_files = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
+ else
+ tot_files = 0;
if (tot_files) {
/* multiple files */
@@ -420,7 +423,8 @@ 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);
@@ -594,7 +598,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 5431156de45..cd0c8779c39 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -206,12 +206,14 @@ 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];
}
@@ -221,12 +223,14 @@ 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];
}
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index d2b1cccfefc..bd306f2d646 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -87,6 +87,7 @@ 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"},
@@ -201,7 +202,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);
@@ -461,7 +462,8 @@ void deselect_all_seq(Scene *scene)
if (ed == NULL) return;
- SEQP_BEGIN (ed, seq) {
+ SEQP_BEGIN(ed, seq)
+ {
seq->flag &= ~SEQ_ALLSEL;
}
SEQ_END
@@ -844,7 +846,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);
@@ -870,7 +872,8 @@ 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) {
@@ -897,7 +900,8 @@ 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;
@@ -932,7 +936,8 @@ 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);
@@ -1477,7 +1482,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;
@@ -3010,7 +3015,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_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index f326052ea60..2447ca6cfbe 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/text_draw.c b/source/blender/editors/space_text/text_draw.c
index ffb686b6810..84f960ecf2a 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -130,7 +130,8 @@ 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_time/space_time.c b/source/blender/editors/space_time/space_time.c
index 674dd670cf7..5e56dfa728e 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,7 +357,8 @@ 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);
@@ -508,7 +509,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);
@@ -548,7 +549,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 6c683eba085..e9bf9345b5c 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/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index f5f3b4c3f16..524b66c852c 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -179,7 +179,7 @@ static DMDrawOption draw_mesh_face_select__drawFaceOptsInv(void *userData, int i
return DM_DRAW_OPTION_SKIP;
}
-static void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm)
+void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm)
{
drawMeshFaceSelect_userData data;
@@ -593,20 +593,6 @@ static DMDrawOption draw_em_tf_mapped__set_draw(void *userData, int index)
}
}
-static DMDrawOption wpaint__setSolidDrawOptions_material(void *userData, int index)
-{
- Mesh *me = (Mesh *)userData;
-
- if (me->mat && me->mpoly) {
- Material *ma = me->mat[me->mpoly[index].mat_nr];
- if (ma && (ma->game.flag & GEMAT_INVISIBLE)) {
- return DM_DRAW_OPTION_SKIP;
- }
- }
-
- return DM_DRAW_OPTION_NORMAL;
-}
-
/* when face select is on, use face hidden flag */
static DMDrawOption wpaint__setSolidDrawOptions_facemask(void *userData, int index)
{
@@ -946,6 +932,10 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
draw_mesh_textured_old(scene, v3d, rv3d, ob, dm, draw_flags);
return;
}
+ else if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
+ draw_mesh_paint(rv3d, ob, dm, draw_flags);
+ return;
+ }
/* set opengl state for negative scale & color */
if (ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
@@ -953,12 +943,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
glEnable(GL_LIGHTING);
- if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
- /* weight paint mode exception */
- dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_material,
- GPU_enable_material, NULL, ob->data, DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
- }
- else {
+ {
Mesh *me = ob->data;
TexMatCallback data = {scene, ob, me, dm};
int (*set_face_cb)(void *, int);
@@ -1015,3 +1000,53 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
draw_mesh_face_select(rv3d, ob->data, dm);
}
+/* Vertex Paint and Weight Paint */
+
+void draw_mesh_paint(RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags)
+{
+ DMSetDrawOptions facemask = NULL;
+ Mesh *me = ob->data;
+
+ /* hide faces in face select mode */
+ if (draw_flags & DRAW_FACE_SELECT)
+ facemask = wpaint__setSolidDrawOptions_facemask;
+
+ if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
+ /* enforce default material settings */
+ GPU_enable_material(0, NULL);
+
+ /* but set default spec */
+ glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
+ glEnable(GL_COLOR_MATERIAL); /* according manpages needed */
+ glColor3ub(120, 120, 120);
+ glDisable(GL_COLOR_MATERIAL);
+
+ /* diffuse */
+ glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
+ glEnable(GL_LIGHTING);
+ glEnable(GL_COLOR_MATERIAL);
+
+ dm->drawMappedFaces(dm, facemask, GPU_enable_material, NULL, me,
+ DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
+
+ glDisable(GL_COLOR_MATERIAL);
+ glDisable(GL_LIGHTING);
+
+ GPU_disable_material();
+ }
+ else if (ob->mode & OB_MODE_VERTEX_PAINT) {
+ if (me->mloopcol)
+ dm->drawMappedFaces(dm, facemask, GPU_enable_material, NULL, me,
+ DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
+ else {
+ glColor3f(1.0f, 1.0f, 1.0f);
+ dm->drawMappedFaces(dm, facemask, GPU_enable_material, NULL, me,
+ DM_DRAW_ALWAYS_SMOOTH);
+ }
+ }
+
+ /* draw face selection on top */
+ if (draw_flags & DRAW_FACE_SELECT)
+ draw_mesh_face_select(rv3d, me, dm);
+}
+
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 3f431585fc9..2b58b627447 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -163,7 +163,10 @@ typedef struct drawDMFacesSel_userData {
typedef struct drawDMNormal_userData {
BMEditMesh *em;
+ int uniform_scale;
float normalsize;
+ float tmat[3][3];
+ float imat[3][3];
} drawDMNormal_userData;
typedef struct bbsObmodeMeshVerts_userData {
@@ -2213,7 +2216,7 @@ void nurbs_foreachScreenVert(
short s[2] = {IS_CLIPPED, 0};
Nurb *nu;
int i;
- ListBase *nurbs = BKE_curve_editNurbs_get(cu);
+ ListBase *nurbs = curve_editnurbs(cu);
ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
@@ -2268,25 +2271,56 @@ void nurbs_foreachScreenVert(
* logic!!!
*/
+static void calcDrawDMNormalScale(Object *ob, drawDMNormal_userData *data)
+{
+ float obmat[3][3];
+
+ copy_m3_m4(obmat, ob->obmat);
+
+ data->uniform_scale = is_uniform_scaled_m3(obmat);
+
+ if (!data->uniform_scale) {
+ /* inverted matrix */
+ invert_m3_m3(data->imat, obmat);
+
+ /* transposed inverted matrix */
+ copy_m3_m3(data->tmat, data->imat);
+ transpose_m3(data->tmat);
+ }
+}
+
static void draw_dm_face_normals__mapFunc(void *userData, int index, const float cent[3], const float no[3])
{
drawDMNormal_userData *data = userData;
BMFace *efa = EDBM_face_at_index(data->em, index);
+ float n[3];
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
+ if (!data->uniform_scale) {
+ mul_v3_m3v3(n, data->tmat, (float *) no);
+ normalize_v3(n);
+ mul_m3_v3(data->imat, n);
+ }
+ else {
+ copy_v3_v3(n, no);
+ }
+
glVertex3fv(cent);
- glVertex3f(cent[0] + no[0] * data->normalsize,
- cent[1] + no[1] * data->normalsize,
- cent[2] + no[2] * data->normalsize);
+ glVertex3f(cent[0] + n[0] * data->normalsize,
+ cent[1] + n[1] * data->normalsize,
+ cent[2] + n[2] * data->normalsize);
}
}
-static void draw_dm_face_normals(BMEditMesh *em, Scene *scene, DerivedMesh *dm)
+
+static void draw_dm_face_normals(BMEditMesh *em, Scene *scene, Object *ob, DerivedMesh *dm)
{
drawDMNormal_userData data;
data.em = em;
data.normalsize = scene->toolsettings->normalsize;
+ calcDrawDMNormalScale(ob, &data);
+
glBegin(GL_LINES);
dm->foreachMappedFaceCenter(dm, draw_dm_face_normals__mapFunc, &data);
glEnd();
@@ -2316,27 +2350,42 @@ static void draw_dm_vert_normals__mapFunc(void *userData, int index, const float
BMVert *eve = EDBM_vert_at_index(data->em, index);
if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
- glVertex3fv(co);
+ float no[3], n[3];
if (no_f) {
- glVertex3f(co[0] + no_f[0] * data->normalsize,
- co[1] + no_f[1] * data->normalsize,
- co[2] + no_f[2] * data->normalsize);
+ copy_v3_v3(no, no_f);
}
else {
- glVertex3f(co[0] + no_s[0] * (data->normalsize / 32767.0f),
- co[1] + no_s[1] * (data->normalsize / 32767.0f),
- co[2] + no_s[2] * (data->normalsize / 32767.0f));
+ no[0] = no_s[0] / 32767.0f;
+ no[1] = no_s[1] / 32767.0f;
+ no[2] = no_s[2] / 32767.0f;
}
+
+ if (!data->uniform_scale) {
+ mul_v3_m3v3(n, data->tmat, (float *) no);
+ normalize_v3(n);
+ mul_m3_v3(data->imat, n);
+ }
+ else {
+ copy_v3_v3(n, no);
+ }
+
+ glVertex3fv(co);
+ glVertex3f(co[0] + n[0] * data->normalsize,
+ co[1] + n[1] * data->normalsize,
+ co[2] + n[2] * data->normalsize);
}
}
-static void draw_dm_vert_normals(BMEditMesh *em, Scene *scene, DerivedMesh *dm)
+
+static void draw_dm_vert_normals(BMEditMesh *em, Scene *scene, Object *ob, DerivedMesh *dm)
{
drawDMNormal_userData data;
data.em = em;
data.normalsize = scene->toolsettings->normalsize;
+ calcDrawDMNormalScale(ob, &data);
+
glBegin(GL_LINES);
dm->foreachMappedVert(dm, draw_dm_vert_normals__mapFunc, &data);
glEnd();
@@ -2852,9 +2901,10 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
#define DRAW_EM_MEASURE_STATS_FACEAREA() \
if (BM_elem_flag_test(f, BM_ELEM_SELECT)) { \
- mul_v3_fl(vmid, 1.0 / n); \
+ mul_v3_fl(vmid, 1.0f / (float)n); \
if (unit->system) \
- bUnit_AsString(numstr, sizeof(numstr), area * unit->scale_length, \
+ bUnit_AsString(numstr, sizeof(numstr), \
+ (double)(area * unit->scale_length), \
3, unit->system, B_UNIT_LENGTH, do_split, FALSE); \
else \
BLI_snprintf(numstr, sizeof(numstr), conv_float, area); \
@@ -3166,11 +3216,11 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
if (me->drawflag & ME_DRAWNORMALS) {
UI_ThemeColor(TH_NORMAL);
- draw_dm_face_normals(em, scene, cageDM);
+ draw_dm_face_normals(em, scene, ob, cageDM);
}
if (me->drawflag & ME_DRAW_VNORMALS) {
UI_ThemeColor(TH_VNORMAL);
- draw_dm_vert_normals(em, scene, cageDM);
+ draw_dm_vert_normals(em, scene, ob, cageDM);
}
if ( (me->drawflag & (ME_DRAWEXTRA_EDGELEN | ME_DRAWEXTRA_FACEAREA | ME_DRAWEXTRA_FACEANG)) &&
@@ -3269,7 +3319,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
else if (dt == OB_WIRE || totface == 0) {
draw_wire = OBDRAW_WIRE_ON; /* draw wire only, no depth buffer stuff */
}
- else if ( (draw_flags & DRAW_FACE_SELECT || (is_obact && ob->mode & OB_MODE_TEXTURE_PAINT)) ||
+ else if ( ((is_obact && ob->mode & OB_MODE_TEXTURE_PAINT)) ||
check_object_draw_texture(scene, v3d, dt))
{
if ( (v3d->flag & V3D_SELECT_OUTLINE) &&
@@ -3424,39 +3474,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
}
}
else if (dt == OB_PAINT) {
- if (is_obact) {
- if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
- /* enforce default material settings */
- GPU_enable_material(0, NULL);
-
- /* but set default spec */
- glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
- glEnable(GL_COLOR_MATERIAL); /* according manpages needed */
- glColor3ub(120, 120, 120);
- glDisable(GL_COLOR_MATERIAL);
- /* diffuse */
- glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
- glEnable(GL_LIGHTING);
- glEnable(GL_COLOR_MATERIAL);
-
- dm->drawMappedFaces(dm, NULL, GPU_enable_material, NULL, me->mpoly,
- DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
- glDisable(GL_COLOR_MATERIAL);
- glDisable(GL_LIGHTING);
-
- GPU_disable_material();
- }
- else if (ob->mode & OB_MODE_VERTEX_PAINT) {
- if (me->mloopcol)
- dm->drawMappedFaces(dm, NULL, GPU_enable_material, NULL, NULL,
- DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
- else {
- glColor3f(1.0f, 1.0f, 1.0f);
- dm->drawMappedFaces(dm, NULL, GPU_enable_material, NULL, NULL,
- DM_DRAW_ALWAYS_SMOOTH);
- }
- }
- }
+ draw_mesh_paint(rv3d, ob, dm, draw_flags);
}
/* set default draw color back for wire or for draw-extra later on */
@@ -3963,7 +3981,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
break;
case OB_MBALL:
- if (BKE_metaball_is_basis(ob)) {
+ if (is_basis_mball(ob)) {
lb = &ob->disp;
if (lb->first == NULL) makeDispListMBall(scene, ob);
if (lb->first == NULL) return 1;
@@ -6140,7 +6158,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 (BKE_metaball_is_basis(ob)) {
+ if (is_basis_mball(ob)) {
bb = ob->bb;
if (bb == NULL) {
makeDispListMBall(scene, ob);
@@ -6231,7 +6249,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
}
}
else if (ob->type == OB_MBALL) {
- if (BKE_metaball_is_basis(ob)) {
+ if (is_basis_mball(ob)) {
if ((base->flag & OB_FROMDUPLI) == 0)
drawDispListwire(&ob->disp);
}
@@ -6291,7 +6309,7 @@ static void drawWireExtra(Scene *scene, RegionView3D *rv3d, Object *ob)
}
}
else if (ob->type == OB_MBALL) {
- if (BKE_metaball_is_basis(ob)) {
+ if (is_basis_mball(ob)) {
drawDispListwire(&ob->disp);
}
}
@@ -6526,8 +6544,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
zbufoff = 1;
dt = OB_SOLID;
}
- else if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT))
+
+ if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
dt = OB_PAINT;
+ }
glEnable(GL_DEPTH_TEST);
}
@@ -6670,7 +6690,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
cu = ob->data;
if (cu->editnurb) {
- ListBase *nurbs = BKE_curve_editNurbs_get(cu);
+ ListBase *nurbs = curve_editnurbs(cu);
drawnurb(scene, v3d, rv3d, base, nurbs->first, dt);
}
else if (dt == OB_BOUNDBOX) {
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 6d810d9103c..c3ff00e3c82 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 = BKE_curve_editNurbs_get(cu);
+ ListBase *nurbs = curve_editnurbs(cu);
StructRNA *seltype = NULL;
void *selp = NULL;
@@ -509,7 +509,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BPoint *bp;
BezTriple *bezt;
int a;
- ListBase *nurbs = BKE_curve_editNurbs_get(cu);
+ ListBase *nurbs = curve_editnurbs(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++;
}
}
- BKE_nurb_test2D(nu);
- BKE_nurb_handles_test(nu); /* test for bezier too */
+ test2DNurb(nu);
+ testhandlesNurb(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 2f66fdf8cd4..6f637afd293 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -700,12 +700,11 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
fac = fac * fac;
interp_v3_v3v3(xaxis, xaxis, m_inv[0], fac);
}
- else {
+ else
+#endif
+ {
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. */
@@ -1555,9 +1554,7 @@ 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 c4309980b18..ab4eca2e303 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 (ob->type == OB_ARMATURE) {
+ 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->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_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 168775deae2..66b8ceb7a85 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -130,6 +130,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in
/* drawmesh.c */
void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, struct DerivedMesh *dm, int faceselect);
+void draw_mesh_paint(RegionView3D *rv3d, struct Object *ob, struct DerivedMesh *dm, int faceselect);
/* view3d_draw.c */
void view3d_main_area_draw(const struct bContext *C, struct ARegion *ar);
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index e1bbc0e1545..ac9c32816dd 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -48,12 +48,9 @@
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
-#include "BLI_lasso.h"
-#include "BLI_rect.h"
+#include "BLI_blenlib.h"
#include "BLI_rand.h"
#include "BLI_linklist.h"
-#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BLI_utildefines.h"
/* vertex box select */
@@ -322,6 +319,79 @@ 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
@@ -342,7 +412,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 (BLI_lasso_is_edge_inside(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1], IS_CLIPPED)) {
+ if (lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) {
if (select) pchan->bone->flag |= BONE_SELECTED;
else pchan->bone->flag &= ~BONE_SELECTED;
}
@@ -371,7 +441,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 (BLI_lasso_is_point_inside(mcords, moves, base->sx, base->sy, IS_CLIPPED)) {
+ if (lasso_inside(mcords, moves, base->sx, base->sy)) {
if (select) ED_base_object_select(base, BA_SELECT);
else ED_base_object_select(base, BA_DESELECT);
@@ -384,13 +454,26 @@ 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) &&
- BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED))
- {
+ if (BLI_in_rcti(data->rect, x, y) && lasso_inside(data->mcords, data->moves, x, y)) {
BM_vert_select_set(data->vc->em->bm, eve, data->select);
}
}
@@ -401,15 +484,14 @@ 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) &&
- 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))
- {
+ lasso_inside(data->mcords, data->moves, x0, y0) &&
+ lasso_inside(data->mcords, data->moves, x1, y1)) {
BM_edge_select_set(data->vc->em->bm, eed, data->select);
data->done = 1;
}
}
else {
- if (BLI_lasso_is_edge_inside(data->mcords, data->moves, x0, y0, x1, y1, IS_CLIPPED)) {
+ if (lasso_inside_edge(data->mcords, data->moves, x0, y0, x1, y1)) {
BM_edge_select_set(data->vc->em->bm, eed, data->select);
}
}
@@ -419,9 +501,7 @@ static void do_lasso_select_mesh__doSelectFace(void *userData, BMFace *efa, int
{
LassoSelectUserData *data = userData;
- if (BLI_in_rcti(data->rect, x, y) &&
- BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED))
- {
+ if (BLI_in_rcti(data->rect, x, y) && lasso_inside(data->mcords, data->moves, x, y)) {
BM_face_select_set(data->vc->em->bm, efa, data->select);
}
}
@@ -433,7 +513,7 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves,
rcti rect;
int bbsel;
- BLI_lasso_boundbox(&rect, mcords, moves);
+ lasso_select_boundbox(&rect, mcords, moves);
/* set editmesh */
vc->em = BMEdit_FromObject(vc->obedit);
@@ -487,13 +567,73 @@ 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 (BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED)) {
+ if (lasso_inside(data->mcords, data->moves, x, y)) {
if (bp) {
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
if (bp == cu->lastsel && !(bp->f1 & 1)) cu->lastsel = NULL;
@@ -541,7 +681,7 @@ static void do_lasso_select_lattice__doSelect(void *userData, BPoint *bp, int x,
{
LassoSelectUserData *data = userData;
- if (BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED)) {
+ if (lasso_inside(data->mcords, data->moves, x, y)) {
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
}
}
@@ -582,22 +722,20 @@ static void do_lasso_select_armature(ViewContext *vc, int mcords[][2], short mov
project_short(vc->ar, vec, sco2);
didpoint = 0;
- if (BLI_lasso_is_point_inside(mcords, moves, sco1[0], sco1[1], IS_CLIPPED)) {
+ if (lasso_inside(mcords, moves, sco1[0], sco1[1])) {
if (select) ebone->flag |= BONE_ROOTSEL;
else ebone->flag &= ~BONE_ROOTSEL;
didpoint = 1;
change = TRUE;
}
- if (BLI_lasso_is_point_inside(mcords, moves, sco2[0], sco2[1], IS_CLIPPED)) {
+ if (lasso_inside(mcords, moves, sco2[0], sco2[1])) {
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 &&
- BLI_lasso_is_edge_inside(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1], IS_CLIPPED))
- {
+ if (didpoint == 0 && lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) {
if (select) ebone->flag |= BONE_TIPSEL | BONE_ROOTSEL | BONE_SELECTED;
else ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
change = TRUE;
@@ -633,7 +771,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 (BLI_lasso_is_point_inside(mcords, moves, sco[0], sco[1], IS_CLIPPED)) {
+ if (lasso_inside(mcords, moves, sco[0], sco[1])) {
if (select) ml->flag |= SELECT;
else ml->flag &= ~SELECT;
}
@@ -712,7 +850,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 */
- BLI_lasso_boundbox(&rect, mcords, moves);
+ lasso_select_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);
@@ -735,7 +873,7 @@ static void do_lasso_select_paintface(ViewContext *vc, int mcords[][2], short mo
bm_vertoffs = me->totpoly + 1; /* max index array */
- BLI_lasso_boundbox(&rect, mcords, moves);
+ lasso_select_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);
@@ -755,7 +893,7 @@ static void do_lasso_select_node(int mcords[][2], short moves, short select)
short node_cent[2];
float node_centf[2];
- BLI_lasso_boundbox(&rect, mcords, moves);
+ lasso_select_boundbox(&rect, mcords, moves);
/* store selection in temp test flag */
for (node = snode->edittree->nodes.first; node; node = node->next) {
@@ -764,7 +902,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]) && BLI_lasso_is_point_inside(mcords, moves, node_cent[0], node_cent[1])) {
+ if (BLI_in_rcti(&rect, node_cent[0], node_cent[1]) && lasso_inside(mcords, moves, node_cent[0], node_cent[1])) {
if (select) {
node->flag |= SELECT;
}
@@ -830,7 +968,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);
@@ -975,7 +1113,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;
@@ -984,7 +1122,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);
@@ -1051,7 +1189,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 */
@@ -1829,7 +1967,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 988d0a00601..1c1fa4c7fac 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 = BKE_curve_editNurbs_get(cu);
+ ListBase *nurbs = curve_editnurbs(cu);
Nurb *nu = nurbs->first;
while (nu) {
@@ -141,8 +141,8 @@ static void special_transvert_update(Object *obedit)
}
}
- BKE_nurb_test2D(nu);
- BKE_nurb_handles_test(nu); /* test for bezier too */
+ test2DNurb(nu);
+ testhandlesNurb(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 = BKE_curve_editNurbs_get(cu);
+ ListBase *nurbs = curve_editnurbs(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 233719033c7..9a0d5e0dd85 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -298,7 +298,8 @@ void removeAspectRatio(TransInfo *t, float *vec)
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);
@@ -414,7 +415,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 ) {
@@ -585,7 +586,8 @@ 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;
@@ -800,7 +802,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;
@@ -1086,9 +1088,11 @@ 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;
}
}
@@ -1152,7 +1156,8 @@ typedef enum {
} ArrowDirection;
static void drawArrow(ArrowDirection d, short offset, short length, short size)
{
- switch (d) {
+ switch(d)
+ {
case LEFT:
offset = -offset;
length = -length;
@@ -1186,7 +1191,8 @@ 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:
@@ -1217,7 +1223,8 @@ 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) {
+ 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);
@@ -1238,7 +1245,8 @@ 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];
@@ -1259,7 +1267,8 @@ 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);
@@ -1408,23 +1417,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;
@@ -1432,14 +1441,12 @@ 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;
}
@@ -1453,31 +1460,34 @@ 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
* */
@@ -1488,7 +1498,8 @@ 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;
}
@@ -1516,7 +1527,8 @@ 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;
}
@@ -1528,7 +1540,8 @@ 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) {
@@ -1537,15 +1550,18 @@ 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);
@@ -1576,12 +1592,15 @@ 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) ||
@@ -1712,14 +1731,16 @@ 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)) {
@@ -1735,19 +1756,22 @@ 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]) {
@@ -1773,7 +1797,8 @@ 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()
@@ -1786,11 +1811,13 @@ 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;
@@ -1815,9 +1842,11 @@ 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);
@@ -2068,7 +2097,8 @@ 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
@@ -2241,7 +2271,8 @@ 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);
}
}
@@ -2293,7 +2324,8 @@ 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;
@@ -2433,9 +2465,11 @@ 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;
}
@@ -2569,7 +2603,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;
@@ -2721,7 +2755,8 @@ 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 {
@@ -2739,7 +2774,8 @@ 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);
}
@@ -2972,7 +3008,8 @@ 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
@@ -3056,7 +3093,8 @@ 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);
@@ -3402,7 +3440,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;
@@ -3861,7 +3899,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) {
@@ -4357,7 +4395,7 @@ static int createSlideVerts(TransInfo *t)
BMVert *v, *v2, *first;
BMLoop *l, *l1, *l2;
TransDataSlideVert *sv_array;
- BMBVHTree *btree = BMBVH_NewBVH(em, 0, NULL, NULL);
+ BMBVHTree *btree = BMBVH_NewBVH(em, BMBVH_RESPECT_HIDDEN, NULL, NULL);
SmallHash table;
SlideData *sld = MEM_callocN(sizeof(*sld), "sld");
View3D *v3d = t->sa ? t->sa->spacedata.first : NULL;
@@ -5205,7 +5243,8 @@ 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)
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index ebded7b0a6e..18e9c1a47b8 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -76,7 +76,8 @@ 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) {
@@ -477,7 +478,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]);
@@ -524,7 +525,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]);
@@ -603,7 +604,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;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 00c8e0a1d34..062f88f8837 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -127,7 +127,8 @@ 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--;
@@ -137,7 +138,8 @@ static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, Tra
tail--;
}
- if (head != tail) {
+ if (head != tail)
+ {
*head = *tail;
head++;
}
@@ -151,7 +153,8 @@ static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, Tra
head++;
}
- if (head != tail) {
+ if (head != tail)
+ {
*tail = *head;
tail--;
}
@@ -532,11 +535,13 @@ 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;
}
@@ -1438,7 +1443,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= BKE_curve_editNurbs_get(cu);
+ nurbs= curve_editnurbs(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++) {
@@ -1588,7 +1593,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 */
- BKE_nurb_handles_test(nu);
+ testhandlesNurb(nu);
}
}
else {
@@ -2702,7 +2707,8 @@ 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;
@@ -2733,7 +2739,8 @@ 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;
@@ -3986,7 +3993,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.
@@ -4440,7 +4447,8 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
}
/* set active flag */
- if (ob == OBACT) {
+ if (ob == OBACT)
+ {
td->flag |= TD_ACTIVE;
}
}
@@ -4492,7 +4500,8 @@ 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;
@@ -4525,8 +4534,10 @@ 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;
}
@@ -4543,7 +4554,8 @@ 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)) {
@@ -4604,7 +4616,8 @@ 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;
@@ -5057,7 +5070,8 @@ 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);
@@ -5106,7 +5120,8 @@ 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);
@@ -5132,7 +5147,8 @@ 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');
@@ -5282,14 +5298,16 @@ 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;
@@ -5297,7 +5315,8 @@ 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;
}
@@ -5314,7 +5333,8 @@ static void createTransObject(bContext *C, TransInfo *t)
}
CTX_DATA_END;
- if (propmode) {
+ if (propmode)
+ {
Scene *scene = t->scene;
View3D *v3d = t->view;
Base *base;
@@ -5323,8 +5343,7 @@ 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;
@@ -5395,7 +5414,7 @@ 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
}
@@ -5730,13 +5749,10 @@ 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;
- BKE_movieclip_get_size(clip, &sc->user, &width, &height);
-
- if (!clip || width == 0 || height == 0)
+ if (!clip || !BKE_movieclip_has_frame(clip, &sc->user))
return;
if (!ELEM(t->mode, TFM_RESIZE, TFM_TRANSLATION))
@@ -6016,10 +6032,12 @@ 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 217e0d36fce..b500398dd76 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -111,7 +111,8 @@
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);
@@ -255,7 +256,8 @@ 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;
}
}
@@ -673,7 +675,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= BKE_curve_editNurbs_get(cu);
+ ListBase *nurbs= curve_editnurbs(cu);
Nurb *nu= nurbs->first;
if (t->state != TRANS_CANCEL) {
@@ -685,15 +687,15 @@ static void recalcData_view3d(TransInfo *t)
if (t->state == TRANS_CANCEL) {
while (nu) {
- BKE_nurb_handles_calc(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
+ calchandlesNurb(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
nu= nu->next;
}
}
else {
/* Normal updating */
while (nu) {
- BKE_nurb_test2D(nu);
- BKE_nurb_handles_calc(nu);
+ test2DNurb(nu);
+ calchandlesNurb(nu);
nu= nu->next;
}
}
@@ -773,17 +775,21 @@ 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);
@@ -909,7 +915,8 @@ 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();
@@ -977,7 +984,8 @@ 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;
}
@@ -1035,7 +1043,8 @@ 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;
@@ -1051,12 +1060,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;
}
}
@@ -1115,8 +1124,10 @@ 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;
}
}
@@ -1126,31 +1137,35 @@ 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 {
@@ -1171,8 +1186,7 @@ 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");
}
@@ -1182,13 +1196,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");
}
@@ -1196,12 +1210,14 @@ 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;
}
@@ -1266,7 +1282,8 @@ void postTrans (bContext *C, TransInfo *t)
}
}
- if (t->mouse.data) {
+ if (t->mouse.data)
+ {
MEM_freeN(t->mouse.data);
}
}
@@ -1423,7 +1440,8 @@ 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++;
}
@@ -1475,7 +1493,7 @@ void calculateCenterBound(TransInfo *t)
void calculateCenter(TransInfo *t)
{
- switch (t->around) {
+ switch(t->around) {
case V3D_CENTER:
calculateCenterBound(t);
break;
@@ -1524,7 +1542,8 @@ 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) {
@@ -1564,7 +1583,8 @@ 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);
}
@@ -1605,8 +1625,11 @@ 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,
@@ -1633,7 +1656,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;
@@ -1661,7 +1684,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 467e3dc600e..bd3fb20f77f 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -313,7 +313,8 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
}
#endif
- switch (mode) {
+ switch(mode)
+ {
case INPUT_VECTOR:
mi->apply = InputVector;
t->helpline = HLP_NONE;
@@ -390,7 +391,8 @@ 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 f8a982c6b71..5b70b25c894 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -389,7 +389,7 @@ int calc_manipulator_stats(const bContext *C)
Nurb *nu;
BezTriple *bezt;
BPoint *bp;
- ListBase *nurbs= BKE_curve_editNurbs_get(cu);
+ ListBase *nurbs= curve_editnurbs(cu);
nu= nurbs->first;
while (nu) {
@@ -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 */
@@ -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) {
@@ -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;
@@ -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 b9ae3180591..0c8ef20c9d0 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -317,19 +317,23 @@ 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");
}
@@ -372,7 +376,8 @@ 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 */
}
@@ -395,7 +400,8 @@ 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;
}
@@ -417,7 +423,8 @@ 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;
}
@@ -438,7 +445,8 @@ 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 */
@@ -447,7 +455,8 @@ 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");
@@ -456,18 +465,21 @@ 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);
@@ -485,12 +497,14 @@ 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");
}
@@ -813,7 +827,8 @@ 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);
}
@@ -838,13 +853,15 @@ 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);
@@ -926,7 +943,6 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
kmi = WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_A, KM_ANY, 0, 0);
RNA_boolean_set(kmi->ptr, "release_confirm", TRUE);
kmi = WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0);
- RNA_boolean_set(kmi->ptr, "release_confirm", TRUE);
WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
@@ -936,7 +952,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
WM_keymap_add_item(keymap, "NODE_OT_move_detach_links", DKEY, KM_PRESS, KM_ALT, 0);
/* XXX release_confirm is set in the macro operator definition */
- WM_keymap_add_item(keymap, "NODE_OT_move_detach_links", EVT_TWEAK_A, KM_ANY, KM_ALT, 0);
+ WM_keymap_add_item(keymap, "NODE_OT_move_detach_links_release", EVT_TWEAK_A, KM_ANY, KM_ALT, 0);
WM_keymap_add_item(keymap, "NODE_OT_move_detach_links", EVT_TWEAK_S, KM_ANY, KM_ALT, 0);
break;
case SPACE_SEQ:
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index db974626b14..0f929003e8f 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -176,7 +176,8 @@ 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");
@@ -492,7 +493,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");
@@ -580,7 +581,8 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
BM_editselection_normal(&ese, normal);
BM_editselection_plane(&ese, plane);
- switch (ese.htype) {
+ switch (ese.htype)
+ {
case BM_VERT:
result = ORIENTATION_VERT;
break;
@@ -715,14 +717,15 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
Nurb *nu;
BezTriple *bezt;
int a;
- ListBase *nurbs= BKE_curve_editNurbs_get(cu);
+ ListBase *nurbs= curve_editnurbs(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]);
@@ -883,7 +886,8 @@ 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 0a5613bca22..7bdd3ddc069 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -140,7 +140,8 @@ 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);
@@ -183,7 +184,8 @@ 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);
@@ -238,14 +240,16 @@ 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);
}
@@ -255,7 +259,8 @@ 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];
@@ -278,7 +283,8 @@ 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);
}
@@ -290,7 +296,8 @@ 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);
// }
@@ -313,7 +320,8 @@ 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);
@@ -323,13 +331,15 @@ 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);
}
}
@@ -358,8 +368,10 @@ 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;
}
}
@@ -427,31 +439,38 @@ 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");
}
}
@@ -479,7 +498,8 @@ 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;
@@ -495,7 +515,8 @@ static void setSnappingCallback(TransInfo *t)
}
- switch (t->mode) {
+ switch (t->mode)
+ {
case TFM_TRANSLATION:
t->tsnap.applySnap = ApplySnapTranslation;
t->tsnap.distance = TranslationBetween;
@@ -745,7 +766,8 @@ 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];
@@ -755,7 +777,8 @@ 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;
@@ -776,8 +799,10 @@ 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;
@@ -785,10 +810,13 @@ 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;
}
@@ -796,7 +824,8 @@ 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 */
}
}
@@ -810,8 +839,9 @@ 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;
@@ -826,7 +856,8 @@ 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;
@@ -847,7 +878,8 @@ 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);
}
@@ -867,7 +899,8 @@ 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;
@@ -884,8 +917,9 @@ 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;
@@ -898,20 +932,24 @@ 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)) {
@@ -933,7 +971,8 @@ 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;
@@ -941,7 +980,8 @@ 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);
}
@@ -959,17 +999,21 @@ 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++) {
@@ -997,7 +1041,8 @@ 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;
@@ -1020,7 +1065,8 @@ 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;
@@ -1066,7 +1112,8 @@ 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;
@@ -1098,7 +1145,8 @@ 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;
@@ -1119,7 +1167,8 @@ 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];
@@ -1138,7 +1187,8 @@ 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;
@@ -1149,7 +1199,8 @@ 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);
@@ -1176,7 +1227,8 @@ 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];
@@ -1191,13 +1243,15 @@ 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);
@@ -1226,14 +1280,16 @@ 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);
@@ -1257,7 +1313,8 @@ 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);
@@ -1309,7 +1366,8 @@ 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
@@ -1325,7 +1383,8 @@ 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);
@@ -1350,7 +1409,8 @@ 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);
}
@@ -1361,7 +1421,8 @@ 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];
}
@@ -1375,7 +1436,8 @@ 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) {
@@ -1394,24 +1456,28 @@ 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
@@ -1424,7 +1490,8 @@ 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);
}
@@ -1449,19 +1516,22 @@ 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;
@@ -1475,7 +1545,8 @@ 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);
}
@@ -1486,7 +1557,8 @@ 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];
}
@@ -1508,13 +1580,16 @@ 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;
@@ -1598,7 +1673,8 @@ 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);
@@ -1650,7 +1726,8 @@ 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) {
@@ -1804,7 +1881,8 @@ 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 5430a9a1c90..4b03c846f3e 100644
--- a/source/blender/editors/util/crazyspace.c
+++ b/source/blender/editors/util/crazyspace.c
@@ -187,6 +187,75 @@ 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 1f1d5a0c0c0..c037508687b 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -207,7 +207,8 @@ 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 cd88614f8fe..a43d549cba1 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 (OB_TYPE_SUPPORT_EDITMODE(obedit->type)) {
+ if (ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)) {
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 (OB_TYPE_SUPPORT_EDITMODE(obedit->type)) {
+ if (ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)) {
return undo_editmode_valid(undoname);
}
}
@@ -413,11 +413,9 @@ void ED_undo_operator_repeat_cb_evt(bContext *C, void *arg_op, int UNUSED(arg_ev
/* ************************** */
-enum {
- UNDOSYSTEM_GLOBAL = 1,
- UNDOSYSTEM_EDITMODE = 2,
- UNDOSYSTEM_PARTICLE = 3
-};
+#define UNDOSYSTEM_GLOBAL 1
+#define UNDOSYSTEM_EDITMODE 2
+#define UNDOSYSTEM_PARTICLE 3
static int get_undo_system(bContext *C)
{
@@ -425,9 +423,8 @@ static int get_undo_system(bContext *C)
/* find out which undo system */
if (obedit) {
- if (OB_TYPE_SUPPORT_EDITMODE(obedit->type)) {
+ if (ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE))
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 fb7e2254e45..e772ff5a87a 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_grow_items(tf_uv, efa->len);
- BLI_array_grow_items(tf_uvorig, efa->len);
+ BLI_array_growitems(tf_uv, efa->len);
+ BLI_array_growitems(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++;
}
- uv_poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len);
+ 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 += uv_poly_area(tf_uv, efa->len);
+ totuvarea += poly_uv_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_grow_items(tf_uv, efa->len);
- BLI_array_grow_items(tf_uvorig, efa->len);
+ BLI_array_growitems(tf_uv, efa->len);
+ BLI_array_growitems(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++;
}
- uv_poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len);
+ poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len);
//uvarea = tf_area(tf, efa->v4!=0) / totuvarea;
- uvarea = uv_poly_area(tf_uv, efa->len) / totuvarea;
+ uvarea = poly_uv_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_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);
+ 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);
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);
}
- uv_poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, nverts);
+ 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)) {
- uv_poly_center(em, efa, cent);
+ poly_uv_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)) {
- uv_poly_center(em, efa, cent);
+ poly_uv_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 d258d271833..fdcb5db1911 100644
--- a/source/blender/editors/uvedit/uvedit_intern.h
+++ b/source/blender/editors/uvedit/uvedit_intern.h
@@ -54,9 +54,14 @@ struct BMVert;
int uvedit_face_visible_nolocal(struct Scene *scene, struct BMFace *efa);
/* geometric utilities */
-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]);
+
+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]);
/* find nearest */
@@ -69,10 +74,8 @@ 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,
- 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);
+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);
/* utility tool functions */
@@ -117,3 +120,4 @@ 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 a30274c0f2c..db3c994cfa0 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -47,7 +47,6 @@
#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"
@@ -523,23 +522,44 @@ void uvedit_live_unwrap_update(SpaceImage *sima, Scene *scene, Object *obedit)
}
/*********************** geometric utilities ***********************/
-void uv_poly_center(BMEditMesh *em, BMFace *f, float r_cent[2])
+void poly_uv_center(BMEditMesh *em, BMFace *f, float cent[2])
{
BMLoop *l;
MLoopUV *luv;
BMIter liter;
- zero_v2(r_cent);
+ zero_v2(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(r_cent, luv->uv);
+ add_v2_v2(cent, luv->uv);
}
- mul_v2_fl(r_cent, 1.0f / (float)f->len);
+ mul_v2_fl(cent, 1.0f / (float)f->len);
}
-float uv_poly_area(float uv[][2], int 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)
{
//BMESH_TODO: make this not suck
//maybe use scanfill? I dunno.
@@ -552,7 +572,7 @@ float uv_poly_area(float uv[][2], int len)
return 1.0;
}
-void uv_poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len)
+void poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len)
{
int i;
for (i = 0; i < len; i++) {
@@ -561,7 +581,7 @@ void uv_poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float as
}
}
-int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float r_min[2], float r_max[2])
+int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float *min, float *max)
{
BMEditMesh *em = BMEdit_FromObject(obedit);
BMFace *efa;
@@ -571,7 +591,7 @@ int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float r_min[2], f
MLoopUV *luv;
int sel;
- INIT_MINMAX2(r_min, r_max);
+ INIT_MINMAX2(min, max);
sel = 0;
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
@@ -582,7 +602,7 @@ int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float r_min[2], f
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, r_min, r_max);
+ DO_MINMAX2(luv->uv, min, max);
sel = 1;
}
}
@@ -643,7 +663,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, const float co[2], NearestHit *hit)
+void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, float co[2], NearestHit *hit)
{
MTexPoly *tf;
BMFace *efa;
@@ -690,11 +710,13 @@ void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, const float
}
}
-static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, const float co[2], NearestHit *hit)
+static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, float co[2], NearestHit *hit)
{
MTexPoly *tf;
BMFace *efa;
- BMIter iter;
+ BMLoop *l;
+ BMIter iter, liter;
+ MLoopUV *luv;
float mindist, dist, cent[2];
mindist = 1e10f;
@@ -709,9 +731,16 @@ static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, const
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);
- uv_poly_center(em, efa, cent);
+ add_v2_v2(cent, luv->uv);
+ }
+ cent[0] /= efa->len;
+ cent[1] /= efa->len;
dist = fabs(co[0] - cent[0]) + fabs(co[1] - cent[1]);
if (dist < mindist) {
@@ -723,12 +752,12 @@ static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, const
}
static int nearest_uv_between(BMEditMesh *em, BMFace *efa, int UNUSED(nverts), int id,
- const float co[2], const float uv[2])
+ float co[2], float uv[2])
{
BMLoop *l;
MLoopUV *luv;
BMIter iter;
- float m[3], v1[3], v2[3], c1, c2, *uv1, /* *uv2, */ /* UNUSED */ *uv3;
+ float m[3], v1[3], v2[3], c1, c2, *uv1 = NULL, /* *uv2, */ /* UNUSED */ *uv3 = NULL;
int id1, id2, i;
id1 = (id + efa->len - 1) % efa->len;
@@ -769,7 +798,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 const co[2], const float penalty[2], NearestHit *hit)
+ float co[2], float penalty[2], NearestHit *hit)
{
BMFace *efa;
BMLoop *l;
@@ -827,7 +856,7 @@ void uv_find_nearest_vert(Scene *scene, Image *ima, BMEditMesh *em,
}
}
-int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, const float co[2], float r_uv[2])
+int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, float co[2], float uv[2])
{
BMEditMesh *em = BMEdit_FromObject(obedit);
BMFace *efa;
@@ -836,10 +865,11 @@ int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, const float c
MTexPoly *tf;
MLoopUV *luv;
float mindist, dist;
- int found = FALSE;
+ int found = 0;
mindist = 1e10f;
- copy_v2_v2(r_uv, co);
+ uv[0] = co[0];
+ uv[1] = co[1];
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
@@ -853,8 +883,9 @@ int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, const float c
if (dist <= mindist) {
mindist = dist;
- copy_v2_v2(r_uv, luv->uv);
- found = TRUE;
+ uv[0] = luv->uv[0];
+ uv[1] = luv->uv[1];
+ found = 1;
}
}
}
@@ -1074,7 +1105,7 @@ static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit
/*********************** linked select ***********************/
-static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, const float limit[2], NearestHit *hit, int extend)
+static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, float limit[2], NearestHit *hit, int extend)
{
BMFace *efa;
BMLoop *l;
@@ -1685,11 +1716,11 @@ static int sticky_select(float *limit, int hitv[4], int v, float *hituv[4], floa
return 0;
}
-static int mouse_select(bContext *C, const float co[2], int extend, int loop)
+static int mouse_select(bContext *C, float co[2], int extend, int loop)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
- ToolSettings *ts = scene->toolsettings;
+ ToolSettings *ts = CTX_data_tool_settings(C);
Object *obedit = CTX_data_edit_object(C);
Image *ima = CTX_data_edit_image(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1756,8 +1787,8 @@ static int mouse_select(bContext *C, const float co[2], int extend, int loop)
}
/* mark 1 vertex as being hit */
- BLI_array_grow_items(hitv, hit.efa->len);
- BLI_array_grow_items(hituv, hit.efa->len);
+ BLI_array_growitems(hitv, hit.efa->len);
+ BLI_array_growitems(hituv, hit.efa->len);
for (i = 0; i < hit.efa->len; i++) {
hitv[i] = 0xFFFFFFFF;
}
@@ -1777,8 +1808,8 @@ static int mouse_select(bContext *C, const float co[2], int extend, int loop)
}
/* mark 2 edge vertices as being hit */
- BLI_array_grow_items(hitv, hit.efa->len);
- BLI_array_grow_items(hituv, hit.efa->len);
+ BLI_array_growitems(hitv, hit.efa->len);
+ BLI_array_growitems(hituv, hit.efa->len);
fill_vn_i(hitv, hit.efa->len, 0xFFFFFFFF);
hitv[hit.lindex] = hit.vert1;
@@ -1802,8 +1833,8 @@ static int mouse_select(bContext *C, const float co[2], int extend, int loop)
/* mark all face vertices as being hit */
- BLI_array_grow_items(hitv, hit.efa->len);
- BLI_array_grow_items(hituv, hit.efa->len);
+ BLI_array_growitems(hitv, hit.efa->len);
+ BLI_array_growitems(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);
@@ -2091,7 +2122,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 = scene->toolsettings;
+ ToolSettings *ts = CTX_data_tool_settings(C);
Object *obedit = CTX_data_edit_object(C);
Image *ima = CTX_data_edit_image(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -2193,7 +2224,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 = scene->toolsettings;
+ ToolSettings *ts = CTX_data_tool_settings(C);
Object *obedit = CTX_data_edit_object(C);
Image *ima = CTX_data_edit_image(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -2279,7 +2310,7 @@ static void uv_select_sync_flush(ToolSettings *ts, BMEditMesh *em, const short s
*
* De-selects faces that have been tagged on efa->tmp.l. */
-static void uv_faces_do_sticky(SpaceImage *sima, Scene *scene, Object *obedit, short select)
+static void uv_faces_do_sticky(bContext *C, 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).
@@ -2287,7 +2318,7 @@ static void uv_faces_do_sticky(SpaceImage *sima, Scene *scene, Object *obedit, s
* This only needs to be done when the Mesh is not used for
* selection (so for sticky modes, vertex or location based). */
- ToolSettings *ts = scene->toolsettings;
+ ToolSettings *ts = CTX_data_tool_settings(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
BMFace *efa;
BMLoop *l;
@@ -2408,7 +2439,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 = scene->toolsettings;
+ ToolSettings *ts = CTX_data_tool_settings(C);
Object *obedit = CTX_data_edit_object(C);
Image *ima = CTX_data_edit_image(C);
ARegion *ar = CTX_wm_region(C);
@@ -2457,7 +2488,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)) {
- uv_poly_center(em, efa, cent);
+ poly_uv_center(em, efa, cent);
if (BLI_in_rctf(&rectf, cent[0], cent[1])) {
BM_elem_flag_enable(efa, BM_ELEM_TAG);
change = 1;
@@ -2467,7 +2498,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(sima, scene, obedit, select);
+ uv_faces_do_sticky(C, sima, scene, obedit, select);
}
else {
/* other selection modes */
@@ -2502,9 +2533,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
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);
- }
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
}
@@ -2563,7 +2592,6 @@ 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);
@@ -2601,11 +2629,9 @@ static int circle_select_exec(bContext *C, wmOperator *op)
}
if (change) {
- uv_select_sync_flush(ts, em, select);
+ 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);
- }
+ WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
}
return OPERATOR_FINISHED;
@@ -2635,129 +2661,9 @@ 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[2], float w, float h)
+static void snap_uv_to_pixel(float *uvco, float w, float h)
{
uvco[0] = ((float)((int)((uvco[0] * w) + 0.5f))) / w;
uvco[1] = ((float)((int)((uvco[1] * h) + 0.5f))) / h;
@@ -3122,9 +3028,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;
@@ -3237,9 +3143,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);
- ToolSettings *ts = scene->toolsettings;
+ /*Scene *scene = CTX_data_scene(C);*/ /*UNUSED*/
BMEditMesh *em = BMEdit_FromObject(obedit);
BMFace *efa;
BMLoop *l;
@@ -3665,7 +3571,6 @@ 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);
@@ -3726,11 +3631,6 @@ 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 e1b2d87c4f2..97b4e8f3905 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);
@@ -1178,13 +1178,13 @@ static int stitch_init(bContext *C, wmOperator *op)
}
else {
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- i = 0;
- BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+ BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
if (uvedit_uv_select_test(em, scene, l)) {
UvElement *element = ED_uv_element_get(state->element_map, efa, l);
- stitch_select_uv(element, state, 1);
+ if (element) {
+ stitch_select_uv(element, state, 1);
+ }
}
- i++;
}
}
}
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 2a9d472c204..dbdd63a5fef 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -1142,6 +1142,7 @@ void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel)
param_lscm_solve(handle);
param_lscm_end(handle);
+ param_average(handle);
param_pack(handle, scene->toolsettings->uvcalc_margin);
param_flush(handle);
@@ -1176,7 +1177,8 @@ static int unwrap_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_INFO, "Object scale is not 1.0. Unwrap will operate on a non-scaled version of the mesh.");
/* remember last method for live unwrap */
- scene->toolsettings->unwrapper = method;
+ if(RNA_struct_property_is_set(op->ptr, "method"))
+ scene->toolsettings->unwrapper = method;
scene->toolsettings->uv_subsurf_level = subsurf_level;
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 980aed64ed9..1dee327a066 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -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 4113344760b..fc3878e2532 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -710,10 +710,8 @@ 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);
@@ -1036,10 +1034,8 @@ 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 c830971dcbd..7f941901f32 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -441,11 +441,9 @@ 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 ||
@@ -1087,7 +1085,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
GMS.gob = ob;
GMS.gscene = scene;
GMS.totmat= ob->totcol+1; /* materials start from 1, default material is 0 */
- GMS.glay= v3d->lay;
+ GMS.glay= (v3d->localvd)? v3d->localvd->lay: v3d->lay; /* keep lamps visible in local view */
GMS.gviewmat= rv3d->viewmat;
GMS.gviewinv= rv3d->viewinv;
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index 83d9619f217..6c30c95f355 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -171,16 +171,14 @@ 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
@@ -238,7 +236,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 e14e4dce405..ef7e775ce9f 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -397,7 +397,8 @@ 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:
@@ -534,7 +535,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;
@@ -587,7 +588,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;
@@ -806,7 +807,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;
@@ -857,7 +858,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;
@@ -1604,7 +1605,7 @@ GPULamp *GPU_lamp_from_blender(Scene *scene, Object *ob, Object *par)
la = ob->data;
gpu_lamp_from_blender(scene, ob, par, la, lamp);
- if (la->type==LA_SPOT && (la->mode & LA_SHAD_BUF)) {
+ if ((la->type==LA_SPOT && (la->mode & LA_SHAD_BUF)) || (la->type==LA_SUN && (la->mode & LA_SHAD_RAY))) {
/* opengl */
lamp->fb = GPU_framebuffer_create();
if (!lamp->fb) {
@@ -1766,7 +1767,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;
@@ -1787,7 +1788,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;
@@ -1846,7 +1847,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 76dacd4a10d..2ac99e2eee2 100644
--- a/source/blender/gpu/intern/gpu_shader_material.glsl
+++ b/source/blender/gpu/intern/gpu_shader_material.glsl
@@ -2041,13 +2041,12 @@ void node_geometry(vec3 I, vec3 N, mat4 toworld,
backfacing = 0.0;
}
-void node_tex_coord(vec3 I, vec3 N, mat4 viewinvmat, mat4 obinvmat,
+void node_tex_coord(vec3 I, vec3 N, mat4 toworld,
vec3 attr_orco, vec3 attr_uv,
- out vec3 generated, out vec3 normal, out vec3 uv, out vec3 object,
+ out vec3 generated, 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 6a6db7eadbb..a6d962a7bb9 100644
--- a/source/blender/gpu/intern/gpu_shader_material.glsl.c
+++ b/source/blender/gpu/intern/gpu_shader_material.glsl.c
@@ -1,1487 +1,1484 @@
/* DataToC output of file <gpu_shader_material_glsl> */
-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,
+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,
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,
+ 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,
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, 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,
+ 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,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,
+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,
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,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,
+ 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, 46,114,103, 98, 32, 61, 32,109, 97,120, 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,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,100,111,100,103,101, 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,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, 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,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,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,
+ 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, 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,
+ 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,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,
+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,
+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,
+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,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,
+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,
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, 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, 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,
+ 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,
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,
+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,
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, 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,
+ 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,
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,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,
+ 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,
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/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp
index a288f330224..ccfe2eaa862 100644
--- a/source/blender/ikplugin/intern/itasc_plugin.cpp
+++ b/source/blender/ikplugin/intern/itasc_plugin.cpp
@@ -502,7 +502,8 @@ static void GetEulerXYZ(const KDL::Rotation& R, double& X,double& Y,double& Z)
static void GetJointRotation(KDL::Rotation& boneRot, int type, double* rot)
{
- switch (type & ~IK_TRANSY) {
+ switch (type & ~IK_TRANSY)
+ {
default:
// fixed bone, no joint
break;
@@ -824,7 +825,8 @@ 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:
@@ -879,21 +881,15 @@ 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;
@@ -925,7 +921,8 @@ 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;
@@ -1168,7 +1165,8 @@ 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)) {
@@ -1514,7 +1512,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);
@@ -1612,12 +1610,10 @@ 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 d0d141a8ef8..0c8f932db6a 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -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/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp
index 42bec5874ca..42ef799cf3e 100644
--- a/source/blender/imbuf/intern/dds/ColorBlock.cpp
+++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp
@@ -93,10 +93,12 @@ 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;
@@ -116,10 +118,12 @@ 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);
@@ -144,7 +148,8 @@ 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);
@@ -159,8 +164,10 @@ 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;
}
}
@@ -236,7 +243,8 @@ 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 3966135ea32..e2874652f02 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 308ea810f03..3c5cb34812c 100644
--- a/source/blender/imbuf/intern/dds/PixelFormat.h
+++ b/source/blender/imbuf/intern/dds/PixelFormat.h
@@ -66,14 +66,17 @@
// 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);
}
@@ -82,20 +85,21 @@
// 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/jpeg.c b/source/blender/imbuf/intern/jpeg.c
index 87e56bffb41..3f3ebc5872d 100644
--- a/source/blender/imbuf/intern/jpeg.c
+++ b/source/blender/imbuf/intern/jpeg.c
@@ -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 44b7472b910..ff3a816f478 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -117,7 +117,8 @@ 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;
@@ -161,7 +162,8 @@ 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;
@@ -234,10 +236,12 @@ 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];
@@ -250,10 +254,12 @@ 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;
@@ -263,10 +269,12 @@ 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);
@@ -356,7 +364,8 @@ 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;
@@ -734,7 +743,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--;
@@ -904,7 +913,8 @@ 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);
}
@@ -915,7 +925,8 @@ 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);
@@ -975,7 +986,8 @@ 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 {
@@ -986,8 +998,10 @@ 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) {
@@ -1018,7 +1032,8 @@ 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);
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index 513fcb9b6dc..74e1a4084c2 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -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 66acd952ac0..524f96b72af 100644
--- a/source/blender/imbuf/intern/radiance_hdr.c
+++ b/source/blender/imbuf/intern/radiance_hdr.c
@@ -192,11 +192,8 @@ 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/targa.c b/source/blender/imbuf/intern/targa.c
index 0ed9b99d0ee..7aceb695d00 100644
--- a/source/blender/imbuf/intern/targa.c
+++ b/source/blender/imbuf/intern/targa.c
@@ -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;
@@ -617,7 +617,7 @@ 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:
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index 9aeed8002e1..5d64e1b2aec 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -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;
@@ -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;
diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c
index 08b2e608c8e..ff87c22170d 100644
--- a/source/blender/imbuf/intern/tiff.c
+++ b/source/blender/imbuf/intern/tiff.c
@@ -320,8 +320,8 @@ static void scanline_contig_16bit(float *rectf, unsigned short *sbuf, int scanli
int i;
for (i=0; i < scanline_w; i++) {
rectf[i*4 + 0] = sbuf[i*spp + 0] / 65535.0;
- rectf[i*4 + 1] = sbuf[i*spp + 1] / 65535.0;
- rectf[i*4 + 2] = sbuf[i*spp + 2] / 65535.0;
+ rectf[i*4 + 1] = (spp>=3)? sbuf[i*spp + 1] / 65535.0: sbuf[i*spp + 0] / 65535.0;
+ rectf[i*4 + 2] = (spp>=3)? sbuf[i*spp + 2] / 65535.0: sbuf[i*spp + 0] / 65535.0;
rectf[i*4 + 3] = (spp==4)?(sbuf[i*spp + 3] / 65535.0):1.0;
}
}
@@ -331,8 +331,8 @@ static void scanline_contig_32bit(float *rectf, float *fbuf, int scanline_w, int
int i;
for (i=0; i < scanline_w; i++) {
rectf[i*4 + 0] = fbuf[i*spp + 0];
- rectf[i*4 + 1] = fbuf[i*spp + 1];
- rectf[i*4 + 2] = fbuf[i*spp + 2];
+ rectf[i*4 + 1] = (spp>=3)? fbuf[i*spp + 1]: fbuf[i*spp + 0];
+ rectf[i*4 + 2] = (spp>=3)? fbuf[i*spp + 2]: fbuf[i*spp + 0];
rectf[i*4 + 3] = (spp==4)?fbuf[i*spp + 3]:1.0f;
}
}
@@ -440,6 +440,8 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
if (bitspersample == 32) {
if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */
fill_vn_fl(fbuf, ibuf->x, 1.0f);
+ else if (chan >= spp) /* for grayscale, duplicate first channel into G and B */
+ success |= TIFFReadScanline(image, fbuf, row, 0);
else
success |= TIFFReadScanline(image, fbuf, row, chan);
scanline_separate_32bit(tmpibuf->rect_float+ib_offset, fbuf, ibuf->x, chan);
@@ -448,6 +450,8 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
else if (bitspersample == 16) {
if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */
fill_vn_ushort(sbuf, ibuf->x, 65535);
+ else if (chan >= spp) /* for grayscale, duplicate first channel into G and B */
+ success |= TIFFReadScanline(image, fbuf, row, 0);
else
success |= TIFFReadScanline(image, sbuf, row, chan);
scanline_separate_16bit(tmpibuf->rect_float+ib_offset, sbuf, ibuf->x, chan);
@@ -777,22 +781,17 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
if (pixels16) {
/* convert from float source */
- float rgb[3];
+ float rgb[4];
if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
linearrgb_to_srgb_v3_v3(rgb, &fromf[from_i]);
else
copy_v3_v3(rgb, &fromf[from_i]);
- to16[to_i+0] = FTOUSHORT(rgb[0]);
- to16[to_i+1] = FTOUSHORT(rgb[1]);
- to16[to_i+2] = FTOUSHORT(rgb[2]);
- to_i += 3; from_i+=3;
-
- if (samplesperpixel == 4) {
- to16[to_i+3] = FTOUSHORT(fromf[from_i+3]);
- /*to_i++; from_i++;*/ /*unused, set on each loop */
- }
+ rgb[3] = fromf[from_i+3];
+
+ for (i = 0; i < samplesperpixel; i++, to_i++)
+ to16[to_i] = FTOUSHORT(rgb[i]);
}
else {
for (i = 0; i < samplesperpixel; i++, to_i++, from_i++)
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index 9e819e56da5..4694b52d672 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -40,6 +40,7 @@
#endif
#include "BLI_blenlib.h"
+#include "BLI_fileops.h"
#include "DNA_userdef_types.h"
#include "BKE_global.h"
@@ -250,7 +251,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,10 +259,7 @@ 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");
@@ -342,14 +340,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 (BLI_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 (BLI_stat(name, &st) == -1) return(0);
if (((st.st_mode) & S_IFMT) != S_IFREG) return(0);
if (ismovie(name)) return (ANIM_MOVIE);
@@ -359,6 +357,8 @@ int imb_get_anim_type(const char * name)
# ifdef WITH_FFMPEG
if (isffmpeg(name)) return (ANIM_FFMPEG);
# endif
+
+
if (isavi(name)) return (ANIM_AVI);
#endif
#ifdef WITH_REDCODE
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 05a96ef2f35..86a2bb60cc9 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -319,12 +319,8 @@ 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_EDITMODE(_type) \
- (ELEM7(_type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE))
+#define OB_TYPE_SUPPORT_MATERIAL(_type) ((_type) >= OB_MESH && (_type) <= OB_MBALL)
+#define OB_TYPE_SUPPORT_VGROUP(_type) (ELEM(_type, OB_MESH, OB_LATTICE))
/* 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 83688e30643..d2df799bc94 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -176,16 +176,14 @@ 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_exclude; /* not used by internal, exclude */
+ unsigned int lay; /* scene->lay itself has priority over this */
+ unsigned int lay_zmask; /* has to be after lay, this is for Z-masking */
int layflag;
+ int pad;
+
int passflag; /* pass_xor has to be after passflag */
int pass_xor;
-
- int samples;
- int pad;
} SceneRenderLayer;
/* srl->layflag */
diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h
index 3e20b353856..4758bfadf70 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -56,11 +56,6 @@
#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;
@@ -115,8 +110,6 @@ typedef struct SmokeDomainSettings {
/* flags */
#define MOD_SMOKE_FLOW_ABSOLUTE (1<<1) /*old style emission*/
#define MOD_SMOKE_FLOW_INITVELOCITY (1<<2) /* passes particles speed to the smoke */
-#define MOD_SMOKE_FLOW_INIT (1 << 3) /* is the flow object already initialized? */
-
typedef struct SmokeFlowSettings {
struct SmokeModifierData *smd; /* for fast RNA access */
@@ -142,16 +135,15 @@ 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; // UNUSED
- int *tridivs;
+ float *vel;
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_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h
index 2f099ed59f5..9c0f63028c1 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 motion_flag; /* flags describes motion type */
+ short pod;
/* ** 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, pad2;
+ /* ** which camera intrinsics to refine. uses on the REFINE_* flags */
+ short refine_camera_intrinsics, pad23;
/* ** tool settings ** */
@@ -243,11 +243,6 @@ 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/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index 41c04ca0899..ef7a2746d37 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -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:
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index f9572e1313a..f67fff460f1 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -889,7 +889,8 @@ void dna_write(FILE *file, void *pntr, int size)
data = (char *) pntr;
- for (i = 0 ; i < size ; i++) {
+ for (i = 0 ; i < size ; i++)
+ {
fprintf(file, "%d,", data[i]);
linelength++;
if (linelength >= MAX_DNA_LINE_LENGTH) {
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index afa6a6e9608..1b8772ffbcd 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -70,6 +70,8 @@ extern EnumPropertyItem fmodifier_type_items[];
extern EnumPropertyItem nla_mode_extend_items[];
extern EnumPropertyItem nla_mode_blend_items[];
+extern EnumPropertyItem motionpath_bake_location_items[];
+
extern EnumPropertyItem event_value_items[];
extern EnumPropertyItem event_type_items[];
extern EnumPropertyItem operator_return_items[];
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index ca29dcd341d..e083a690fba 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -1359,10 +1359,8 @@ 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);
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 18edcf1344f..3200b271718 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,13 +3122,12 @@ 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 */
@@ -4499,7 +4498,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)
@@ -4542,7 +4541,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_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index e8eed526a7c..e564c03df14 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -1451,6 +1451,22 @@ 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_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 94ea79099c2..06352fd727c 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -837,7 +837,7 @@ void rna_def_animdata(BlenderRNA *brna)
/* Active Action */
prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
/* this flag as well as the dynamic test must be defined for this to be editable... */
- RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_REFCOUNT);
RNA_def_property_pointer_funcs(prop, NULL, "rna_AnimData_action_set", NULL, "rna_Action_id_poll");
RNA_def_property_editable_func(prop, "rna_AnimData_action_editable");
RNA_def_property_ui_text(prop, "Action", "Active Action for this datablock");
diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c
index f7065307d87..167eb23c023 100644
--- a/source/blender/makesrna/intern/rna_animviz.c
+++ b/source/blender/makesrna/intern/rna_animviz.c
@@ -39,6 +39,14 @@
#include "WM_types.h"
+/* Which part of bone(s) get baked */
+// TODO: icons?
+EnumPropertyItem motionpath_bake_location_items[] = {
+ {MOTIONPATH_BAKE_HEADS, "HEADS", 0, "Heads", "Calculate bone paths from heads"},
+ {0, "TAILS", 0, "Tails", "Calculate bone paths from tails"},
+ //{MOTIONPATH_BAKE_CENTERS, "CENTROID", 0, "Centers", "Calculate bone paths from center of mass"},
+ {0, NULL, 0, NULL, NULL}};
+
#ifdef RNA_RUNTIME
static PointerRNA rna_AnimViz_onion_skinning_get(PointerRNA *ptr)
@@ -241,10 +249,6 @@ static void rna_def_animviz_paths(BlenderRNA *brna)
"Display Paths of poses within a fixed number of frames around the current frame"},
{MOTIONPATH_TYPE_RANGE, "RANGE", 0, "In Range", "Display Paths of poses within specified range"},
{0, NULL, 0, NULL, NULL}};
- static const EnumPropertyItem prop_location_items[] = {
- {MOTIONPATH_BAKE_HEADS, "HEADS", 0, "Heads", "Calculate bone paths from heads"},
- {0, "TAILS", 0, "Tails", "Calculate bone paths from tails"},
- {0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "AnimVizMotionPaths", NULL);
RNA_def_struct_sdna(srna, "bAnimVizSettings");
@@ -260,7 +264,7 @@ static void rna_def_animviz_paths(BlenderRNA *brna)
prop = RNA_def_property(srna, "bake_location", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "path_bakeflag");
- RNA_def_property_enum_items(prop, prop_location_items);
+ RNA_def_property_enum_items(prop, motionpath_bake_location_items);
RNA_def_property_ui_text(prop, "Bake Location", "When calculating Bone Paths, use Head or Tips");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 6d67f0c00dd..7a712b7da8a 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -562,7 +562,7 @@ static void rna_def_constraint_python(BlenderRNA *brna)
prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Script", "The text object that contains the Python script");
- RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_REFCOUNT);
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop = RNA_def_property(srna, "use_targets", PROP_BOOLEAN, PROP_NONE);
@@ -1097,7 +1097,7 @@ static void rna_def_constraint_action(BlenderRNA *brna)
prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "act");
RNA_def_property_ui_text(prop, "Action", "The constraining action");
- RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_REFCOUNT);
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index 86a2d6c9a46..97cf73ab998 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_get */
+#include "ED_curve.h" /* for BKE_curve_nurbs */
/* 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_get(cu);
+ ListBase *nurbs = BKE_curve_nurbs(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 = BKE_curve_type_get(cu);
+ short obtype = curve_type(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)
- BKE_curve_tex_space_calc(cu);
+ tex_space_curve(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)
- BKE_curve_tex_space_calc(cu);
+ tex_space_curve(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)
- BKE_curve_tex_space_calc(cu);
+ tex_space_curve(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;
- BKE_curve_curve_dimension_update(cu);
+ update_curve_dimension(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)
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(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_get(cu);
+ ListBase *nurbs = BKE_curve_nurbs(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_get(cu);
+ ListBase *nurbs = BKE_curve_nurbs(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) {
- BKE_nurb_handles_calc(nu);
+ calchandlesNurb(nu);
}
else {
- BKE_nurb_knot_calc_u(nu);
+ nurbs_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;
- BKE_nurb_knot_calc_v(nu);
+ nurbs_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;
- BKE_nurb_order_clamp_u(nu);
- BKE_nurb_knot_calc_u(nu);
+ clamp_nurb_order_u(nu);
+ nurbs_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;
- BKE_nurb_order_clamp_v(nu);
- BKE_nurb_knot_calc_v(nu);
+ clamp_nurb_order_v(nu);
+ nurbs_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 {
- BKE_nurb_points_add(nu, number);
+ addNurbPoints(nu, number);
/* update */
- BKE_nurb_knot_calc_u(nu);
+ nurbs_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 {
- BKE_nurb_bezierPoints_add(nu, number);
+ addNurbPointsBezier(nu, number);
/* update */
- BKE_nurb_knot_calc_u(nu);
+ nurbs_knot_calc_u(nu);
rna_Curve_update_data_id(NULL, NULL, id);
}
@@ -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_get(cu), nu);
+ BLI_addtail(BKE_curve_nurbs(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_get(cu);
+ ListBase *nurbs = BKE_curve_nurbs(cu);
found = BLI_remlink_safe(nurbs, nu);
@@ -596,7 +596,7 @@ static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, Nurb *nu)
return;
}
- BKE_nurb_free(nu);
+ freeNurb(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_get(cu);
+ ListBase *nurbs = BKE_curve_nurbs(cu);
- BKE_nurbList_free(nurbs);
+ freeNurblist(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_get(cu);
+ ListBase *nurbs = BKE_curve_nurbs(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_get(cu);
+ ListBase *nubase = BKE_curve_nurbs(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_get(cu);
+ ListBase *nubase = BKE_curve_nurbs(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_get(cu), NULL);
+ rna_iterator_listbase_begin(iter, BKE_curve_nurbs(cu), NULL);
}
#else
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 122e42e29e7..bf5f51374fa 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -482,10 +482,12 @@ 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_main.c b/source/blender/makesrna/intern/rna_main.c
index cb4eea5c25b..e616a632147 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -347,7 +347,8 @@ 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 63006af7c72..10a45fbb94d 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 = BKE_curve_type_get((struct Curve *)data);
+ type = curve_type((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 = BKE_curve_add(name, type);
+ Curve *cu = add_curve(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 = BKE_metaball_add(name);
+ MetaBall *mb = add_mball(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_movieclip_file_add(filepath);
+ clip = BKE_add_movieclip_file(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)
{
- BKE_movieclip_unlink(bmain, clip);
+ unlink_movieclip(bmain, clip);
free_libblock(&bmain->movieclip, clip);
/* XXX python now has invalid pointer? */
}
diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c
index f7ef0c5c89a..e8ea19a5c5b 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)
- BKE_metaball_properties_copy(scene, ob);
+ copy_mball_properties(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 = BKE_metaball_element_add(mb, type);
+ MetaElem *ml = add_metaball_element(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..e5d502a4e58 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -282,6 +282,7 @@ static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr)
part->sta = 1.0f;
part->end = 250.0f;
part->ren_as = PART_DRAW_NOT;
+ part->flag |= PART_UNBORN;
part->draw_as = PART_DRAW_DOT;
BLI_strncpy(psys->name, "SmokeParticles", sizeof(psys->name));
psys->recalc |= (PSYS_RECALC_RESET|PSYS_RECALC_PHYS);
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index 8d262c58f9b..7ad13b8a6d1 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -459,7 +459,7 @@ static void rna_def_nlastrip(BlenderRNA *brna)
prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "act");
RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Action_id_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_REFCOUNT);
RNA_def_property_editable_func(prop, "rna_NlaStrip_action_editable");
RNA_def_property_ui_text(prop, "Action", "Action referenced by this strip");
RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index a101bcaec12..38b12604d5e 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;
@@ -709,7 +742,8 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports,
ret = nodeAddLink(ntree, fromnode, fromsock, tonode, tosock);
if (ret) {
- nodeUpdate(ntree, tonode);
+ if (tonode)
+ nodeUpdate(ntree, tonode);
ntreeUpdateTree(ntree);
@@ -1891,14 +1925,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 +1967,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 +2117,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 140e874eb78..183d0e37c36 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)
- BKE_curve_type_test(ob);
+ test_curve_type(ob);
else if (ob->type == OB_ARMATURE)
armature_rebuild_pose(ob, ob->data);
}
@@ -383,8 +383,11 @@ static void rna_Object_parent_set(PointerRNA *ptr, PointerRNA value)
{
Object *ob = (Object*)ptr->data;
Object *par = (Object*)value.data;
-
- ED_object_parent(ob, par, ob->partype, ob->parsubstr);
+
+ /* NOTE: this dummy check here prevents this method causing weird runtime errors on mingw 4.6.2 */
+ if (ob) {
+ ED_object_parent(ob, par, ob->partype, ob->parsubstr);
+ }
}
static void rna_Object_parent_type_set(PointerRNA *ptr, int value)
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 0ac6dcbc518..fb383b1256b 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 = BKE_curve_copy( (Curve *) ob->data );
+ copycu = tmpobj->data = copy_curve( (Curve *) ob->data );
/* temporarily set edit so we get updates from edit mode, but
* also because for text datablocks copying it while in edit
@@ -124,7 +124,7 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
case OB_MBALL: {
/* metaballs don't have modifiers, so just convert to mesh */
- Object *basis_ob = BKE_metaball_basis_find(sce, ob);
+ Object *basis_ob = find_basis_mball(sce, ob);
/* todo, re-generatre for render-res */
/* metaball_polygonize(scene, ob) */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 359b1e4ee00..eeb31eecd95 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1077,8 +1077,11 @@ static void rna_RenderSettings_color_management_update(Main *bmain, Scene *UNUSE
bNode *node;
if (ntree && scene->use_nodes) {
- /* XXX images are freed here, stop render and preview threads, until Image is threadsafe */
- WM_jobs_stop_all(bmain->wm.first);
+ /* images are freed here, stop render and preview threads, until
+ * Image is threadsafe. when we are changing this propery from a
+ * python script in the render thread, don't stop own thread */
+ if(BLI_thread_is_main())
+ WM_jobs_stop_all(bmain->wm.first);
for (node = ntree->nodes.first; node; node = node->next) {
if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_IMAGE)) {
@@ -1905,19 +1908,6 @@ 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);
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 7fecbb83fa5..c94d420da8a 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -414,6 +414,8 @@ 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:
@@ -1586,6 +1588,25 @@ 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;
@@ -1827,6 +1848,7 @@ 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 b1fed62f87b..69d76c0e342 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -16,7 +16,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Daniel Genrich
- * Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -337,25 +336,12 @@ 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_texture.c b/source/blender/makesrna/intern/rna_texture.c
index c314e9be0ba..fab80997d08 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -134,6 +134,8 @@ 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:
@@ -1300,6 +1302,17 @@ 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;
@@ -2000,6 +2013,7 @@ 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_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index 85adf524717..c3a46c39643 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -607,12 +607,6 @@ 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 44ece727912..635dfb48b27 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); /* Only used in Properties Editor and 3D View - Thomas */
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); /* should this be optional? - Campbell */
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 2e56d1a2a4d..ae236da6952 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1769,6 +1769,12 @@ 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);
@@ -3367,6 +3373,15 @@ 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 0eb4ef1c5c9..8c4b7917cb8 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -665,15 +665,13 @@ 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 c11d6fc50af..e4e89db403d 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_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index 8ad5b72204b..15940112527 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -423,11 +423,8 @@ 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) {
@@ -524,11 +521,8 @@ 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 4c5ce184c22..b3faf6c140a 100644
--- a/source/blender/modifiers/intern/MOD_collision.c
+++ b/source/blender/modifiers/intern/MOD_collision.c
@@ -71,7 +71,8 @@ static void freeData(ModifierData *md)
{
CollisionModifierData *collmd = (CollisionModifierData*) md;
- if (collmd) {
+ if (collmd)
+ {
if (collmd->bvhtree)
BLI_bvhtree_free(collmd->bvhtree);
if (collmd->x)
@@ -119,12 +120,14 @@ 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;
@@ -138,17 +141,20 @@ static void deformVerts(ModifierData *md, Object *ob,
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 );
}
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 70294588fd4..293a8a8c686 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 11542dc4c1a..a1dc69918c2 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -679,7 +679,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
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 +711,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
break;
}
- switch (*fs) {
+ switch(*fs) {
case 3:
case 6:
case 9:
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c
index 8d3b1871c51..fe0cb2e650f 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c
@@ -66,7 +66,8 @@
void fluidsim_init(FluidsimModifierData *fluidmd)
{
#ifdef WITH_MOD_FLUID
- if (fluidmd) {
+ if (fluidmd)
+ {
FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings");
fluidmd->fss = fss;
@@ -183,7 +184,8 @@ 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;
}
@@ -214,13 +216,15 @@ 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;
}
@@ -236,7 +240,8 @@ 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);
@@ -244,7 +249,8 @@ 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);
@@ -252,7 +258,8 @@ 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);
}
@@ -272,7 +279,8 @@ 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);
@@ -382,7 +390,8 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *
if (fss->meshVelocities)
MEM_freeN(fss->meshVelocities);
- if (len < 7) {
+ if (len<7)
+ {
return;
}
@@ -400,21 +409,25 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *
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) {
+ if (wri != totvert)
+ {
MEM_freeN(fss->meshVelocities);
fss->meshVelocities = NULL;
return;
}
- for (i=0; i<totvert;i++) {
- for (j=0; j<3; j++) {
+ for (i=0; i<totvert;i++)
+ {
+ for (j=0; j<3; j++)
+ {
gzread(gzf, &wrf, sizeof( wrf ));
velarray[i].vel[j] = wrf;
}
@@ -470,7 +483,8 @@ 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
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index b115e5bb244..d8fbb6f468f 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(const float co_1[3], const float co_2[3], const float falloff_squared, float fac)
+static float hook_falloff(float *co_1, float *co_2, 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 b667fc4bd29..da4a489838f 100644
--- a/source/blender/modifiers/intern/MOD_mask.c
+++ b/source/blender/modifiers/intern/MOD_mask.c
@@ -195,7 +195,8 @@ 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;
@@ -228,7 +229,8 @@ 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 */
@@ -243,7 +245,8 @@ 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 */
@@ -274,7 +277,8 @@ 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);
@@ -286,7 +290,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
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;
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c
index 1284d5a6769..09924b5b0a4 100644
--- a/source/blender/modifiers/intern/MOD_mirror.c
+++ b/source/blender/modifiers/intern/MOD_mirror.c
@@ -113,7 +113,7 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
float mtx[4][4];
int i, j;
int a, totshape;
- int *vtargetmap, *vtmap_a = NULL, *vtmap_b = NULL;
+ int *vtargetmap = NULL, *vtmap_a = NULL, *vtmap_b = NULL;
/* mtx is the mirror transformation */
unit_m4(mtx);
@@ -223,10 +223,11 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
MLoop *ml2;
int e;
- /* reverse the loop */
- for (j = 0; j < mp->totloop; j++) {
- DM_copy_loop_data(result, result, mp->loopstart + j, mp->loopstart + maxLoops + mp->totloop - j - 1, 1);
- }
+ /* reverse the loop, but we keep the first vertex in the face the same,
+ * to ensure that quads are split the same way as on the other side */
+ DM_copy_loop_data(result, result, mp->loopstart, mp->loopstart + maxLoops, 1);
+ for (j = 1; j < mp->totloop; j++)
+ DM_copy_loop_data(result, result, mp->loopstart + j, mp->loopstart + maxLoops + mp->totloop - j, 1);
ml2 = ml + mp->loopstart + maxLoops;
e = ml2[0].e;
diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c
index 56b6493eda6..d408e5a3bee 100644
--- a/source/blender/modifiers/intern/MOD_remesh.c
+++ b/source/blender/modifiers/intern/MOD_remesh.c
@@ -103,10 +103,8 @@ 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;
@@ -166,7 +164,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 60eed4abcb1..ae21d3d66ad 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 5ac52a97315..6c1325b0bde 100644
--- a/source/blender/modifiers/intern/MOD_simpledeform.c
+++ b/source/blender/modifiers/intern/MOD_simpledeform.c
@@ -185,7 +185,8 @@ 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]);
@@ -205,7 +206,8 @@ 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;
@@ -214,7 +216,8 @@ 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_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index d3e54651eea..5f9bce9ec36 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -447,8 +447,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* same as EM_solidify() in editmesh_lib.c */
float *vert_angles= MEM_callocN(sizeof(float) * numVerts * 2, "mod_solid_pair"); /* 2 in 1 */
float *vert_accum= vert_angles + numVerts;
- float *face_angles = NULL;
- BLI_array_staticdeclare(face_angles, 16); /* BM_NGON_STACK_SIZE */
int j, vidx;
face_nors = CustomData_get_layer(&dm->polyData, CD_NORMAL);
@@ -469,27 +467,28 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
mesh_calc_poly_normal(mp, &mloop[mp->loopstart], mvert, face_nors[i]);
/* just added, calc the normal */
- BLI_array_empty(face_angles);
for (j=0, ml=mloop+mp->loopstart; j<mp->totloop; j++, ml++) {
MLoop *ml_prev = ME_POLY_LOOP_PREV(mloop, mp, j);
MLoop *ml_next = ME_POLY_LOOP_NEXT(mloop, mp, j);
- float e1[3], e2[3], angle;
-
+ float e1[3], e2[3];
+ float angle;
+
+ /* TODO - we could speed this up by _not_ normalizing both verts each time
+ * and always re-usingthe last vector. */
sub_v3_v3v3(e1, mvert[ml_next->v].co, mvert[ml->v].co);
sub_v3_v3v3(e2, mvert[ml_prev->v].co, mvert[ml->v].co);
- angle = M_PI - angle_normalized_v3v3(e1, e2);
- BLI_array_append(face_angles, angle);
- }
-
- for (j=0, ml=mloop+mp->loopstart; j<mp->totloop; j++, ml++) {
+
+ angle = (float)M_PI - angle_v3v3(e1, e2);
+ if (angle < FLT_EPSILON) {
+ angle = FLT_EPSILON;
+ }
+
vidx = ml->v;
- vert_accum[vidx] += face_angles[j];
- vert_angles[vidx]+= shell_angle_to_dist(angle_normalized_v3v3(vert_nors[vidx], face_nors[i])) * face_angles[j];
+ vert_accum[vidx]+= angle;
+ vert_angles[vidx]+= shell_angle_to_dist(angle_normalized_v3v3(vert_nors[vidx], face_nors[i])) * angle;
}
}
-
- BLI_array_free(face_angles);
/* vertex group support */
if (dvert) {
diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c
index be1ceeee317..ebd95992090 100644
--- a/source/blender/modifiers/intern/MOD_subsurf.c
+++ b/source/blender/modifiers/intern/MOD_subsurf.c
@@ -51,7 +51,7 @@
static void initData(ModifierData *md)
{
- SubsurfModifierData *smd = (SubsurfModifierData*) md;
+ SubsurfModifierData *smd = (SubsurfModifierData *) md;
smd->levels = 1;
smd->renderLevels = 2;
@@ -60,8 +60,8 @@ static void initData(ModifierData *md)
static void copyData(ModifierData *md, ModifierData *target)
{
- SubsurfModifierData *smd = (SubsurfModifierData*) md;
- SubsurfModifierData *tsmd = (SubsurfModifierData*) target;
+ SubsurfModifierData *smd = (SubsurfModifierData *) md;
+ SubsurfModifierData *tsmd = (SubsurfModifierData *) target;
tsmd->flags = smd->flags;
tsmd->levels = smd->levels;
@@ -71,7 +71,7 @@ static void copyData(ModifierData *md, ModifierData *target)
static void freeData(ModifierData *md)
{
- SubsurfModifierData *smd = (SubsurfModifierData*) md;
+ SubsurfModifierData *smd = (SubsurfModifierData *) md;
if (smd->mCache) {
ccgSubSurf_free(smd->mCache);
@@ -83,41 +83,41 @@ static void freeData(ModifierData *md)
static int isDisabled(ModifierData *md, int useRenderParams)
{
- SubsurfModifierData *smd = (SubsurfModifierData*) md;
- int levels= (useRenderParams)? smd->renderLevels: smd->levels;
+ SubsurfModifierData *smd = (SubsurfModifierData *) md;
+ int levels = (useRenderParams) ? smd->renderLevels : smd->levels;
return get_render_subsurf_level(&md->scene->r, levels) == 0;
}
static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
- DerivedMesh *derivedData,
- int useRenderParams,
- int isFinalCalc)
+ DerivedMesh *derivedData,
+ int useRenderParams,
+ int isFinalCalc)
{
- SubsurfModifierData *smd = (SubsurfModifierData*) md;
+ SubsurfModifierData *smd = (SubsurfModifierData *) md;
DerivedMesh *result;
result = subsurf_make_derived_from_derived(derivedData, smd,
- useRenderParams, NULL, isFinalCalc, 0, (ob->flag & OB_MODE_EDIT));
+ useRenderParams, NULL, isFinalCalc, 0, (ob->flag & OB_MODE_EDIT));
if (useRenderParams || !isFinalCalc) {
- DerivedMesh *cddm= CDDM_copy(result);
+ DerivedMesh *cddm = CDDM_copy(result);
result->release(result);
- result= cddm;
+ result = cddm;
}
return result;
}
static DerivedMesh *applyModifierEM(ModifierData *md, Object *UNUSED(ob),
- struct BMEditMesh *UNUSED(editData),
- DerivedMesh *derivedData)
+ struct BMEditMesh *UNUSED(editData),
+ DerivedMesh *derivedData)
{
- SubsurfModifierData *smd = (SubsurfModifierData*) md;
+ SubsurfModifierData *smd = (SubsurfModifierData *) md;
DerivedMesh *result;
result = subsurf_make_derived_from_derived(derivedData, smd, 0,
- NULL, 0, 1, 1);
+ NULL, 0, 1, 1);
return result;
}
@@ -128,11 +128,11 @@ ModifierTypeInfo modifierType_Subsurf = {
/* structName */ "SubsurfModifierData",
/* structSize */ sizeof(SubsurfModifierData),
/* type */ eModifierTypeType_Constructive,
- /* flags */ eModifierTypeFlag_AcceptsMesh
- | eModifierTypeFlag_SupportsMapping
- | eModifierTypeFlag_SupportsEditmode
- | eModifierTypeFlag_EnableInEditmode
- | eModifierTypeFlag_AcceptsCVs,
+ /* flags */ eModifierTypeFlag_AcceptsMesh |
+ eModifierTypeFlag_SupportsMapping |
+ eModifierTypeFlag_SupportsEditmode |
+ eModifierTypeFlag_EnableInEditmode |
+ eModifierTypeFlag_AcceptsCVs,
/* copyData */ copyData,
/* deformVerts */ NULL,
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index c0a4b319a18..e134ff9dcca 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;
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c
index 926a674462c..dd89ad59abd 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -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 5fa3090cd87..78e76e27c02 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 1f886812ab7..5ce435a7ca5 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -69,9 +69,7 @@ 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) {
@@ -79,7 +77,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;
@@ -159,7 +157,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/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c
index b8961870043..0ef27ed992e 100644
--- a/source/blender/modifiers/intern/MOD_weightvgedit.c
+++ b/source/blender/modifiers/intern/MOD_weightvgedit.c
@@ -211,7 +211,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
dvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MDEFORMVERT, numVerts);
/* If no vertices were ever added to an object's vgroup, dvert might be NULL. */
- if (!dvert)
+ if (!dvert) {
/* If this modifier is not allowed to add vertices, just return. */
if (!do_add)
return dm;
@@ -221,6 +221,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
/* Ultimate security check. */
if (!dvert)
return dm;
+ }
/* Get org weights, assuming 0.0 for vertices not in given vgroup. */
org_w = MEM_mallocN(sizeof(float) * numVerts, "WeightVGEdit Modifier, org_w");
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c
index b7bbc717981..adcabc23efb 100644
--- a/source/blender/modifiers/intern/MOD_weightvgmix.c
+++ b/source/blender/modifiers/intern/MOD_weightvgmix.c
@@ -258,7 +258,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
dvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MDEFORMVERT, numVerts);
/* If no vertices were ever added to an object's vgroup, dvert might be NULL. */
- if (!dvert)
+ if (!dvert) {
/* If not affecting all vertices, just return. */
if (wmd->mix_set != MOD_WVG_SET_ALL)
return dm;
@@ -268,7 +268,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
/* Ultimate security check. */
if (!dvert)
return dm;
-
+ }
/* Find out which vertices to work on. */
tidx = MEM_mallocN(sizeof(int) * numVerts, "WeightVGMix Modifier, tidx");
tdw1 = MEM_mallocN(sizeof(MDeformWeight*) * numVerts, "WeightVGMix Modifier, tdw1");
diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c
index 8012057b393..ab3a363e703 100644
--- a/source/blender/nodes/composite/node_composite_util.c
+++ b/source/blender/nodes/composite/node_composite_util.c
@@ -884,9 +884,8 @@ 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--;
}
@@ -1109,7 +1108,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];
@@ -1119,7 +1118,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];
@@ -1128,7 +1127,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;
@@ -1143,7 +1142,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];
diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
index b3690b5d20f..132b1659fa5 100644
--- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
@@ -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,7 +79,7 @@ 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]);
break;
@@ -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..571720e5d3a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.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): 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"
@@ -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,8 +77,8 @@ 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;
+ // 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,13 +107,9 @@ 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);
angle2=c->t2; /* t2 is radians. */
@@ -121,6 +117,9 @@ static void do_chroma_key(bNode *node, float *out, float *in)
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_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
index 0153a2bce34..46d7c620aa8 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
@@ -206,10 +206,12 @@ 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)) {
@@ -241,7 +243,8 @@ 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)) {
@@ -273,7 +276,8 @@ 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_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_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_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c
index d6cb54eb944..6d470467cb0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_filter.c
+++ b/source/blender/nodes/composite/nodes/node_composite_filter.c
@@ -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_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c
index 62179cfa471..6a156c390a7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -442,14 +442,11 @@ 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 32b07582140..ec6d2006296 100644
--- a/source/blender/nodes/composite/nodes/node_composite_levels.c
+++ b/source/blender/nodes/composite/nodes/node_composite_levels.c
@@ -64,7 +64,7 @@ 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]);
value[0]=value[0]*255; /* scale to 0-255 range */
@@ -122,7 +122,8 @@ 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]);
@@ -173,7 +174,8 @@ 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]);
diff --git a/source/blender/nodes/composite/nodes/node_composite_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c
index 4c9d1a66fb0..8362df1b691 100644
--- a/source/blender/nodes/composite/nodes/node_composite_math.c
+++ b/source/blender/nodes/composite/nodes/node_composite_math.c
@@ -46,7 +46,8 @@ 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 2f017b52676..dd2c169fe9a 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 = TRUE;
+ rect= MEM_dupallocN(rect);
+ alloc= 1;
}
- 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 f6ffc783b08..d9f0da9b8aa 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 = TRUE;
+ stackbuf->rect= obuf->rect_float;
+ stackbuf->malloc= 1;
- 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 8268977658d..6952817248d 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_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
index 6eff3dcd95b..b12f08bb13d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
@@ -91,7 +91,8 @@ 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;
@@ -116,7 +117,8 @@ 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;
@@ -238,7 +240,8 @@ 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;
@@ -267,7 +270,8 @@ 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_stabilize2d.c b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
index e5d8fe16d51..0eac85c4030 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_transform.c b/source/blender/nodes/composite/nodes/node_composite_transform.c
index 2c2a352017a..a610d8a66c4 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, TRUE);
+ CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1);
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..6e61dc483b4 100644
--- a/source/blender/nodes/intern/node_common.c
+++ b/source/blender/nodes/intern/node_common.c
@@ -551,7 +551,8 @@ static bNodeSocket *group_verify_socket(bNodeTree *ntree, ListBase *lb, int in_o
sock->groupsock = gsock;
BLI_strncpy(sock->name, gsock->name, sizeof(sock->name));
- sock->type= gsock->type;
+ if(gsock->type != sock->type)
+ nodeSocketSetType(sock, gsock->type);
/* XXX hack: group socket input/output roles are inverted internally,
* need to change the limit value when making actual node sockets from them.
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index 9a9a27603dc..90c62bc47ac 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_common.c b/source/blender/nodes/shader/nodes/node_shader_common.c
index f75cecfe83b..df369482a2e 100644
--- a/source/blender/nodes/shader/nodes/node_shader_common.c
+++ b/source/blender/nodes/shader/nodes/node_shader_common.c
@@ -73,6 +73,9 @@ static void *group_initexec(bNode *node)
bNodeTree *ngroup= (bNodeTree*)node->id;
bNodeTreeExec *exec;
+ if (!ngroup)
+ return NULL;
+
/* initialize the internal node tree execution */
exec = ntreeShaderBeginExecTree(ngroup, 0);
@@ -121,6 +124,9 @@ static void group_execute(void *data, int thread, struct bNode *node, void *node
bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
bNodeThreadStack *nts;
+ if (!exec)
+ return;
+
/* XXX same behavior as trunk: all nodes inside group are executed.
* it's stupid, but just makes it work. compo redesign will do this better.
*/
diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c
index db2b57ab51b..44df496f5d6 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/texture/nodes/node_texture_common.c b/source/blender/nodes/texture/nodes/node_texture_common.c
index 9a66ecb5ffb..1eaf9b2b0fe 100644
--- a/source/blender/nodes/texture/nodes/node_texture_common.c
+++ b/source/blender/nodes/texture/nodes/node_texture_common.c
@@ -58,6 +58,9 @@ static void *group_initexec(bNode *node)
bNodeTree *ngroup= (bNodeTree*)node->id;
void *exec;
+ if (!ngroup)
+ return NULL;
+
/* initialize the internal node tree execution */
exec = ntreeTexBeginExecTree(ngroup, 0);
@@ -107,6 +110,9 @@ static void group_execute(void *data, int thread, struct bNode *node, void *node
bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
bNodeThreadStack *nts;
+ if (!exec)
+ return;
+
/* XXX same behavior as trunk: all nodes inside group are executed.
* it's stupid, but just makes it work. compo redesign will do this better.
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c
index 54c9645fac3..29d154df884 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_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c
index 19ba0e88639..2b899fde593 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/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index 6a02d8e4a25..f25222c89da 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -124,7 +124,7 @@ static PyObject *bpy_bmlayeraccess_collection_get(BPy_BMLayerAccess *self, void
PyDoc_STRVAR(bpy_bmlayercollection_active_doc,
-"This meshes vert sequence (read-only).\n\n:type: :class:`BMVertSeq`"
+"The active layer of this type (read-only).\n\n:type: :class:`BMLayerItem`"
);
static PyObject *bpy_bmlayercollection_active_get(BPy_BMLayerItem *self, void *UNUSED(flag))
{
@@ -145,6 +145,17 @@ static PyObject *bpy_bmlayercollection_active_get(BPy_BMLayerItem *self, void *U
}
}
+
+PyDoc_STRVAR(bpy_bmlayercollection_is_singleton_doc,
+"This meshes vert sequence (read-only).\n\n:type: :class:`BMVertSeq`"
+);
+static PyObject *bpy_bmlayercollection_is_singleton_get(BPy_BMLayerItem *self, void *UNUSED(flag))
+{
+ BPY_BM_CHECK_OBJ(self);
+
+ return PyBool_FromLong(CustomData_layertype_is_singleton(self->type));
+}
+
PyDoc_STRVAR(bpy_bmlayercollection_name_doc,
"The layers unique name (read-only).\n\n:type: string"
);
@@ -211,7 +222,8 @@ static PyGetSetDef bpy_bmlayeraccess_loop_getseters[] = {
static PyGetSetDef bpy_bmlayercollection_getseters[] = {
/* BMESH_TODO, make writeable */
- {(char *)"active", (getter)bpy_bmlayercollection_active_get, (setter)NULL, (char *)bpy_bmlayercollection_active_doc, NULL},
+ {(char *)"active", (getter)bpy_bmlayercollection_active_get, (setter)NULL, (char *)bpy_bmlayercollection_active_doc, NULL},
+ {(char *)"is_singleton", (getter)bpy_bmlayercollection_is_singleton_get, (setter)NULL, (char *)bpy_bmlayercollection_is_singleton_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
@@ -230,6 +242,87 @@ static PyGetSetDef bpy_bmlayeritem_getseters[] = {
/* BMLayerCollection
* ----------------- */
+PyDoc_STRVAR(bpy_bmlayeritem_copy_from_doc,
+".. method:: copy_from(other)\n"
+"\n"
+" Return a copy of the layer\n"
+"\n"
+" :arg other: Another layer to copy from.\n"
+" :arg other: :class:`BMLayerItem`\n"
+);
+static PyObject *bpy_bmlayeritem_copy_from(BPy_BMLayerItem *self, BPy_BMLayerItem *value)
+{
+ CustomData *data;
+
+ if (!BPy_BMLayerItem_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "layer.copy_from(x): expected BMLayerItem, not '%.200s'",
+ Py_TYPE(value)->tp_name);
+ return NULL;
+ }
+
+ BPY_BM_CHECK_OBJ(self);
+ BPY_BM_CHECK_OBJ(value);
+
+ if (self->bm != value->bm) {
+ PyErr_SetString(PyExc_ValueError,
+ "layer.copy_from(): layer is from another mesh");
+ return NULL;
+ }
+
+ else if ((self->htype != value->htype) ||
+ (self->type != value->type) ||
+ (self->index != value->index))
+ {
+ PyErr_SetString(PyExc_ValueError,
+ "layer.copy_from(other): layer type mismatch");
+ }
+
+ data = bpy_bm_customdata_get(self->bm, self->htype);
+
+ if ((bpy_bmlayeritem_get(self) == NULL) ||
+ (bpy_bmlayeritem_get(value) == NULL))
+ {
+ return NULL;
+ }
+
+ BM_data_layer_copy(self->bm, data, self->type, value->index, self->index);
+
+ Py_RETURN_NONE;
+}
+
+/* similar to new(), but no name arg. */
+PyDoc_STRVAR(bpy_bmlayercollection_verify_doc,
+".. method:: verify()\n"
+"\n"
+" Create a new layer or return an existing active layer\n"
+"\n"
+" :return: The newly verified layer.\n"
+" :rtype: :class:`BMLayerItem`\n"
+);
+static PyObject *bpy_bmlayercollection_verify(BPy_BMLayerCollection *self)
+{
+ int index;
+ CustomData *data;
+
+ BPY_BM_CHECK_OBJ(self);
+
+ data = bpy_bm_customdata_get(self->bm, self->htype);
+
+ index = CustomData_get_layer_index(data, self->type);
+
+ if (index == -1) {
+ BM_data_layer_add(self->bm, data, self->type);
+ index = 0;
+ }
+ else {
+ index = CustomData_get_active_layer_index(data, self->type) - index; /* make relative */
+ }
+
+ BLI_assert(index >= 0);
+
+ return BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index);
+}
PyDoc_STRVAR(bpy_bmlayercollection_new_doc,
".. method:: new(name)\n"
@@ -255,6 +348,14 @@ static PyObject *bpy_bmlayercollection_new(BPy_BMLayerCollection *self, PyObject
data = bpy_bm_customdata_get(self->bm, self->htype);
+ if (CustomData_layertype_is_singleton(self->type) &&
+ CustomData_has_layer(data, self->type))
+ {
+ PyErr_SetString(PyExc_ValueError,
+ "layers.new(): is a singleton, use verify() instead");
+ return NULL;
+ }
+
if (name) {
BM_data_layer_add_named(self->bm, data, self->type, name);
}
@@ -451,7 +552,13 @@ static PyObject *bpy_bmlayercollection_get(BPy_BMLayerCollection *self, PyObject
return Py_INCREF(def), def;
}
+static struct PyMethodDef bpy_bmlayeritem_methods[] = {
+ {"copy_from", (PyCFunction)bpy_bmlayeritem_copy_from, METH_O, bpy_bmlayeritem_copy_from_doc},
+ {NULL, NULL, 0, NULL}
+};
+
static struct PyMethodDef bpy_bmelemseq_methods[] = {
+ {"verify", (PyCFunction)bpy_bmlayercollection_verify, METH_NOARGS, bpy_bmlayercollection_verify_doc},
{"new", (PyCFunction)bpy_bmlayercollection_new, METH_VARARGS, bpy_bmlayercollection_new_doc},
{"remove", (PyCFunction)bpy_bmlayercollection_remove, METH_O, bpy_bmlayercollection_remove_doc},
@@ -462,8 +569,6 @@ static struct PyMethodDef bpy_bmelemseq_methods[] = {
{NULL, NULL, 0, NULL}
};
-
-
/* Sequences
* ========= */
@@ -763,6 +868,7 @@ void BPy_BM_init_types_customdata(void)
// BPy_BMLayerAccess_Type.tp_methods = bpy_bmeditselseq_methods;
BPy_BMLayerCollection_Type.tp_methods = bpy_bmelemseq_methods;
+ BPy_BMLayerItem_Type.tp_methods = bpy_bmlayeritem_methods;
BPy_BMLayerCollection_Type.tp_as_sequence = &bpy_bmlayercollection_as_sequence;
@@ -883,8 +989,7 @@ PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer)
}
case CD_MTEXPOLY:
{
- ret = Py_NotImplemented; /* TODO */
- Py_INCREF(ret);
+ ret = BPy_BMTexPoly_CreatePyObject(value);
break;
}
case CD_MLOOPUV:
@@ -977,8 +1082,7 @@ int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObj
}
case CD_MTEXPOLY:
{
- PyErr_SetString(PyExc_AttributeError, "readonly"); /* could make this writeable later */
- ret = -1;
+ ret = BPy_BMTexPoly_AssignPyObject(value, py_value);
break;
}
case CD_MLOOPUV:
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index 9972ff288b2..aa78dc64f6b 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -34,15 +34,107 @@
#include "../mathutils/mathutils.h"
+#include "DNA_object_types.h"
#include "DNA_meshdata_types.h"
#include "BLI_utildefines.h"
#include "BLI_math_vector.h"
#include "BKE_deform.h"
+#include "BKE_library.h"
#include "bmesh_py_types_meshdata.h"
+
+/* Mesh BMTexPoly
+ * ************** */
+
+#define BPy_BMTexPoly_Check(v) (Py_TYPE(v) == &BPy_BMTexPoly_Type)
+
+typedef struct BPy_BMTexPoly {
+ PyObject_VAR_HEAD
+ MTexPoly *data;
+} BPy_BMTexPoly;
+
+extern PyObject *pyrna_id_CreatePyObject(ID *id);
+extern int pyrna_id_FromPyObject(PyObject *obj, ID **id);
+
+PyDoc_STRVAR(bpy_bmtexpoly_image_doc,
+"Image or None.\n\n:type: :class:`bpy.types.Image`"
+);
+static PyObject *bpy_bmtexpoly_image_get(BPy_BMTexPoly *self, void *UNUSED(closure))
+{
+ return pyrna_id_CreatePyObject((ID *)self->data->tpage);
+}
+
+static int bpy_bmtexpoly_image_set(BPy_BMTexPoly *self, PyObject *value, void *UNUSED(closure))
+{
+ ID *id;
+
+ if (value == Py_None) {
+ id = NULL;
+ }
+ else if (pyrna_id_FromPyObject(value, &id) && id && GS(id->name) == ID_IM) {
+ /* pass */
+ }
+ else {
+ PyErr_Format(PyExc_KeyError, "BMTexPoly.image = x"
+ "expected an image or None, not '%.200s'",
+ Py_TYPE(value)->tp_name);
+ return -1;
+ }
+
+ id_lib_extern(id);
+ self->data->tpage = (struct Image *)id;
+
+ return 0;
+}
+
+static PyGetSetDef bpy_bmtexpoly_getseters[] = {
+ /* attributes match rna_def_mtpoly */
+ {(char *)"image", (getter)bpy_bmtexpoly_image_get, (setter)bpy_bmtexpoly_image_set, (char *)bpy_bmtexpoly_image_doc, NULL},
+
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+PyTypeObject BPy_BMTexPoly_Type = {{{0}}}; /* bm.loops.layers.uv.active */
+
+static void bm_init_types_bmtexpoly(void)
+{
+ BPy_BMTexPoly_Type.tp_basicsize = sizeof(BPy_BMTexPoly);
+
+ BPy_BMTexPoly_Type.tp_name = "BMTexPoly";
+
+ BPy_BMTexPoly_Type.tp_doc = NULL; // todo
+
+ BPy_BMTexPoly_Type.tp_getset = bpy_bmtexpoly_getseters;
+
+ BPy_BMTexPoly_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+
+ PyType_Ready(&BPy_BMTexPoly_Type);
+}
+
+int BPy_BMTexPoly_AssignPyObject(struct MTexPoly *mtpoly, PyObject *value)
+{
+ if (UNLIKELY(!BPy_BMTexPoly_Check(value))) {
+ PyErr_Format(PyExc_TypeError, "expected BMTexPoly, not a %.200s", Py_TYPE(value)->tp_name);
+ return -1;
+ }
+ else {
+ *((MTexPoly *)mtpoly) = *(((BPy_BMTexPoly *)value)->data);
+ return 0;
+ }
+}
+
+PyObject *BPy_BMTexPoly_CreatePyObject(struct MTexPoly *mtpoly)
+{
+ BPy_BMTexPoly *self = PyObject_New(BPy_BMTexPoly, &BPy_BMTexPoly_Type);
+ self->data = mtpoly;
+ return (PyObject *)self;
+}
+
+/* --- End Mesh BMTexPoly --- */
+
/* Mesh Loop UV
* ************ */
@@ -596,6 +688,7 @@ PyObject *BPy_BMDeformVert_CreatePyObject(struct MDeformVert *dvert)
/* call to init all types */
void BPy_BM_init_types_meshdata(void)
{
+ bm_init_types_bmtexpoly();
bm_init_types_bmloopuv();
bm_init_types_bmloopcol();
bm_init_types_bmdvert();
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.h b/source/blender/python/bmesh/bmesh_py_types_meshdata.h
index 4636f800ed3..c9e8dce97a0 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.h
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.h
@@ -40,10 +40,17 @@ typedef struct BPy_BMGenericMeshData {
void *data;
} BPy_BMGenericMeshData;
+struct MTexPoly;
struct MLoopUV;
struct MLoopCol;
struct MDeformVert;
+int BPy_BMTexPoly_AssignPyObject(struct MTexPoly *mloopuv, PyObject *value);
+PyObject *BPy_BMTexPoly_CreatePyObject(struct MTexPoly *mloopuv);
+
+int BPy_BMLoopUV_AssignPyObject(struct MLoopUV *data, PyObject *value);
+PyObject *BPy_BMLoopUV_CreatePyObject(struct MLoopUV *data);
+
int BPy_BMLoopUV_AssignPyObject(struct MLoopUV *data, PyObject *value);
PyObject *BPy_BMLoopUV_CreatePyObject(struct MLoopUV *data);
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index 4d0c05f6582..dbb25eb854b 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -1071,8 +1071,8 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
else {
MEM_freeN(items);
PyErr_SetString(PyExc_TypeError,
- "EnumProperty(...): expected an tuple containing "
- "(identifier, name description) and optionally a "
+ "EnumProperty(...): expected a tuple containing "
+ "(identifier, name, description) and optionally a "
"unique number");
return NULL;
}
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 7c8f28d0979..47134cda7b2 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);
@@ -6246,6 +6246,31 @@ PyObject *pyrna_prop_CreatePyObject(PointerRNA *ptr, PropertyRNA *prop)
return (PyObject *)pyrna;
}
+/* utility func to be used by external modules, *sneaky!* */
+PyObject *pyrna_id_CreatePyObject(ID *id)
+{
+ if (id) {
+ PointerRNA ptr;
+ RNA_id_pointer_create(id, &ptr);
+ return pyrna_struct_CreatePyObject(&ptr);
+ }
+ else {
+ Py_RETURN_NONE;
+ }
+}
+
+int pyrna_id_FromPyObject(PyObject *obj, ID **id)
+{
+ if (BPy_StructRNA_Check(obj) && (RNA_struct_is_ID(((BPy_StructRNA *)obj)->ptr.type))) {
+ *id = ((BPy_StructRNA *)obj)->ptr.id.data;
+ return TRUE;
+ }
+ else {
+ *id = NULL;
+ return FALSE;
+ }
+}
+
void BPY_rna_init(void)
{
#ifdef USE_MATHUTILS // register mathutils callbacks, ok to run more then once.
@@ -6401,7 +6426,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 +7214,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 +7242,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 +7502,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 543574e5136..b94c2e21139 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++) {
- BKE_curve_forward_diff_bezier(k1[i], h1[i], h2[i], k2[i], coord_array + i, resolu - 1, sizeof(float) * dims);
+ 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_import.c b/source/blender/quicktime/apple/quicktime_import.c
index 197c8cebca3..a1f35935877 100644
--- a/source/blender/quicktime/apple/quicktime_import.c
+++ b/source/blender/quicktime/apple/quicktime_import.c
@@ -195,19 +195,16 @@ 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);
@@ -585,16 +582,13 @@ 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 2a3c8e60638..315995475e9 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, lay_exclude;
+ unsigned int lay, lay_zmask;
int layflag, passflag, pass_xor;
struct Material *mat_override;
diff --git a/source/blender/render/intern/include/strand.h b/source/blender/render/intern/include/strand.h
index 5094b646807..7482b4d10ee 100644
--- a/source/blender/render/intern/include/strand.h
+++ b/source/blender/render/intern/include/strand.h
@@ -101,7 +101,7 @@ void free_strand_surface(struct Render *re);
struct StrandShadeCache *strand_shade_cache_create(void);
void strand_shade_cache_free(struct StrandShadeCache *cache);
void strand_shade_segment(struct Render *re, struct StrandShadeCache *cache, struct StrandSegment *sseg, struct ShadeSample *ssamp, float t, float s, int addpassflag);
-void strand_shade_unref(struct StrandShadeCache *cache, struct StrandVert *svert);
+void strand_shade_unref(struct StrandShadeCache *cache, struct ObjectInstanceRen *obi, struct StrandVert *svert);
#endif
diff --git a/source/blender/render/intern/raytrace/bvh.h b/source/blender/render/intern/raytrace/bvh.h
index 946b64e98e5..ac86a65ff0b 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;
@@ -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,10 +149,12 @@ 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)) {
+ if(is_leaf(node))
+ {
RE_rayobject_merge_bb( (RayObject*)node, min, max);
}
- else {
+ else
+ {
DO_MIN(node->bb , min);
DO_MAX(node->bb+3, max);
}
@@ -171,22 +173,26 @@ 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;
@@ -206,9 +212,11 @@ static int bvh_node_stack_raycast_simd(Node *root, Isect *isec)
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);
@@ -216,16 +224,19 @@ 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];
@@ -275,33 +286,41 @@ 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;
}
}
}
@@ -319,41 +338,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;
}
}
}
@@ -366,22 +385,28 @@ void bvh_dfs_make_hint(Node *node, LCTSHint *hint, int reserve_space, HintObject
{
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;
}
}
diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp
index a2773ba218d..989946166d1 100644
--- a/source/blender/render/intern/raytrace/rayobject.cpp
+++ b/source/blender/render/intern/raytrace/rayobject.cpp
@@ -60,11 +60,13 @@ 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;
}
@@ -75,7 +77,8 @@ 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);
@@ -127,7 +130,7 @@ MALWAYS_INLINE int vlr_check_intersect_solid(Isect *UNUSED(is), ObjectInstanceRe
MALWAYS_INLINE int vlr_check_bake(Isect *is, ObjectInstanceRen* obi, VlakRen *UNUSED(vlr))
{
- return (obi->obr->ob != is->userdata);
+ return (obi->obr->ob != is->userdata) && (obi->obr->ob->flag & SELECT);
}
/* Ray Triangle/Quad Intersection */
@@ -292,11 +295,13 @@ 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)
@@ -317,25 +322,27 @@ 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;
}
}
@@ -368,7 +375,8 @@ 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;
@@ -380,10 +388,12 @@ 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;
@@ -395,7 +405,8 @@ 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
@@ -409,10 +420,12 @@ 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;
@@ -420,7 +433,8 @@ 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);
}
@@ -452,10 +466,12 @@ 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);
}
@@ -469,7 +485,8 @@ 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);
@@ -477,7 +494,8 @@ 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);
@@ -487,7 +505,8 @@ 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);
}
@@ -499,10 +518,12 @@ 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);
}
@@ -522,7 +543,8 @@ 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 d0036fd8556..165b62cfbe4 100644
--- a/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
@@ -102,7 +102,8 @@ 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)
diff --git a/source/blender/render/intern/raytrace/rayobject_hint.h b/source/blender/render/intern/raytrace/rayobject_hint.h
index 37d9edb035d..3689aa8ac17 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 ce88bac1587..2e803ce0fd3 100644
--- a/source/blender/render/intern/raytrace/rayobject_instance.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_instance.cpp
@@ -99,7 +99,8 @@ 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;
}
@@ -116,7 +117,8 @@ 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;
@@ -130,10 +132,12 @@ 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];
@@ -161,7 +165,8 @@ 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];
@@ -197,7 +202,8 @@ 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 eef2fcc51c9..ea1d5c2573c 100644
--- a/source/blender/render/intern/raytrace/rayobject_octree.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_octree.cpp
@@ -305,7 +305,7 @@ static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short
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);
@@ -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;
@@ -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++;
@@ -658,7 +658,8 @@ 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]);
}
@@ -682,41 +683,42 @@ 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;
}
}
@@ -1001,7 +1003,7 @@ 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) {
diff --git a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
index 2d0abba9a75..2edf1593e99 100644
--- a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
@@ -71,7 +71,8 @@ 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;
diff --git a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
index ad74159fd3b..54901db8bdd 100644
--- a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
@@ -74,7 +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++) {
+ 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];
}
@@ -123,7 +124,8 @@ 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]++;
}
@@ -156,7 +158,8 @@ static void object_sort(Item *begin, Item *end, int axis)
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 );
}
@@ -172,11 +175,13 @@ 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;
}
@@ -186,7 +191,8 @@ 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);
}
@@ -331,25 +337,30 @@ 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]);
@@ -371,7 +382,8 @@ 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;
@@ -389,8 +401,9 @@ 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);
- // this makes sure the tree built is the same whatever is the order of the sorting axis
- if ( hcost < bcost || (hcost == bcost && axis < baxis)) {
+ if ( hcost < bcost
+ || (hcost == bcost && axis < baxis)) //this makes sure the tree built is the same whatever is the order of the sorting axis
+ {
bcost = hcost;
baxis = axis;
boffset = i;
@@ -410,11 +423,13 @@ 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;
@@ -485,13 +500,15 @@ 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 cbec02ab798..4c2099eb1e3 100644
--- a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
@@ -79,10 +79,12 @@ 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;
@@ -98,12 +100,14 @@ void bvh_done<SVBVHTree>(SVBVHTree *obj)
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);
- 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;
diff --git a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
index 26a99794362..e82623f1da9 100644
--- a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
@@ -87,9 +87,11 @@ void bvh_done<VBVHTree>(VBVHTree *obj)
BLI_memarena_use_malloc(arena1);
//Build and optimize the tree
- if (1) {
+ if (1)
+ {
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);
return;
}
@@ -106,7 +108,8 @@ void bvh_done<VBVHTree>(VBVHTree *obj)
else
obj->root = NULL;
}
- else {
+ else
+ {
/*
TODO
MemArena *arena2 = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "vbvh arena2");
@@ -156,7 +159,8 @@ 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);
diff --git a/source/blender/render/intern/raytrace/reorganize.h b/source/blender/render/intern/raytrace/reorganize.h
index 1930e5bb32b..68b2b22ecdd 100644
--- a/source/blender/render/intern/raytrace/reorganize.h
+++ b/source/blender/render/intern/raytrace/reorganize.h
@@ -66,15 +66,17 @@ void reorganize_find_fittest_parent(Node *tree, Node *node, std::pair<float,Node
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)
+ for(Node *child = parent->child; child; child = child->sibling)
q.push(child);
}
}
@@ -87,23 +89,28 @@ 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; ) {
+ 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 );
- if (best.second == node) {
+ if(best.second == node)
+ {
//Already inside the fitnest BB
prev = &(*prev)->sibling;
}
- else {
+ else
+ {
Node *tmp = *prev;
*prev = (*prev)->sibling;
@@ -116,7 +123,8 @@ void reorganize(Node *root)
}
}
- if (node != root) {
+ if(node != root)
+ {
}
}
}
@@ -129,24 +137,29 @@ 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;
}
}
@@ -158,16 +171,18 @@ 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;
@@ -177,14 +192,15 @@ 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);
}
@@ -194,27 +210,30 @@ 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)
+ for(Node *child = parent->child; RE_rayobject_isAligned(child) && child; child = child->sibling)
pushup_simd<Node,SSize>(child);
}
@@ -229,17 +248,19 @@ 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;
@@ -265,17 +286,18 @@ 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);
}
@@ -325,27 +347,32 @@ 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);
@@ -354,7 +381,7 @@ struct OVBVHNode
}
//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();
}
}
@@ -388,7 +415,8 @@ 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++;
@@ -399,35 +427,36 @@ 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];
}
@@ -439,22 +468,26 @@ 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);
}
@@ -462,13 +495,16 @@ 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;
}
@@ -476,22 +512,24 @@ 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 a4044db8208..e0e96781f36 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,39 +116,40 @@ 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;
}
}
@@ -159,20 +160,25 @@ 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]);
@@ -182,9 +188,10 @@ 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);
}
}
}
@@ -211,19 +218,17 @@ 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));
- }
}
}
@@ -243,12 +248,14 @@ 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];
@@ -267,25 +274,26 @@ 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;
@@ -293,17 +301,20 @@ 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 f916dd412f7..1c84cd23510 100644
--- a/source/blender/render/intern/raytrace/vbvh.h
+++ b/source/blender/render/intern/raytrace/vbvh.h
@@ -57,14 +57,17 @@ 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
@@ -83,9 +86,10 @@ 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;
}
@@ -96,7 +100,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;
@@ -114,7 +118,7 @@ struct BuildBinaryVBVH
void test_break()
{
- if (RE_rayobjectcontrol_test_break(control))
+ if(RE_rayobjectcontrol_test_break(control))
throw "Stop";
}
@@ -156,17 +160,19 @@ 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();
@@ -177,7 +183,8 @@ 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);
@@ -217,7 +224,7 @@ struct Reorganize_VBVH
VBVHNode *transform(OldNode *old)
{
- if (is_leaf(old))
+ if(is_leaf(old))
return (VBVHNode*)old;
VBVHNode *node = create_node();
@@ -230,7 +237,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 7fe1fab1681..66ed0bd85a9 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -908,10 +908,10 @@ static float *get_object_orco(Render *re, Object *ob)
if (!orco) {
if (ELEM(ob->type, OB_CURVE, OB_FONT)) {
- orco = BKE_curve_make_orco(re->scene, ob);
+ orco = make_orco_curve(re->scene, ob);
}
else if (ob->type==OB_SURF) {
- orco = BKE_curve_surf_make_orco(ob);
+ orco = make_orco_surf(ob);
}
if (orco)
@@ -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;
@@ -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!=BKE_metaball_basis_find(re->scene, ob))
+ if (ob!=find_basis_mball(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= BKE_metaball_make_orco(ob, &dispbase);
+ orco= make_orco_mball(ob, &dispbase);
set_object_orco(re, ob, orco);
}
}
@@ -2630,7 +2630,8 @@ 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));
@@ -2642,7 +2643,8 @@ 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));
@@ -3484,7 +3486,8 @@ 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);
@@ -3760,7 +3763,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;
@@ -4725,7 +4728,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!=BKE_metaball_basis_find(re->scene, ob))
+ if (ob->type == OB_MBALL && ob!=find_basis_mball(re->scene, ob))
return 0;
if (nolamps && (ob->type==OB_LAMP))
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index 3e82bec7e52..f7f592c9407 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/pipeline.c b/source/blender/render/intern/source/pipeline.c
index a4a244daf43..0398204e62b 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -1803,6 +1803,28 @@ static int check_valid_camera(Scene *scene, Object *camera_override)
return 1;
}
+static int node_tree_has_composite_output(bNodeTree *ntree)
+{
+ bNode *node;
+
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (node->type == CMP_NODE_COMPOSITE) {
+ return TRUE;
+ }
+ else if (node->type == NODE_GROUP) {
+ if (node_tree_has_composite_output((bNodeTree *)node->id))
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+static int check_composite_output(Scene *scene)
+{
+ return node_tree_has_composite_output(scene->nodetree);
+}
+
int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *reports)
{
SceneRenderLayer *srl;
@@ -1837,19 +1859,12 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
if (scene->r.scemode & R_DOCOMP) {
if (scene->use_nodes) {
- bNodeTree *ntree= scene->nodetree;
- bNode *node;
-
- if (ntree==NULL) {
+ if (!scene->nodetree) {
BKE_report(reports, RPT_ERROR, "No Nodetree in Scene");
return 0;
}
- for (node= ntree->nodes.first; node; node= node->next)
- if (node->type==CMP_NODE_COMPOSITE)
- break;
-
- if (node==NULL) {
+ if (!check_composite_output(scene)) {
BKE_report(reports, RPT_ERROR, "No Render Output Node in Scene");
return 0;
}
diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c
index 54474891810..5d4f9db9a02 100644
--- a/source/blender/render/intern/source/pointdensity.c
+++ b/source/blender/render/intern/source/pointdensity.c
@@ -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 bb08911a1eb..0c735c18c57 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -87,7 +87,8 @@ static int test_break(void *data)
static void RE_rayobject_config_control(RayObject *r, Render *re)
{
- if (RE_rayobject_isRayAPI(r)) {
+ if (RE_rayobject_isRayAPI(r))
+ {
r = RE_rayobject_align( r );
r->control.data = re;
r->control.test_break = test_break;
@@ -98,7 +99,8 @@ 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__
@@ -109,7 +111,8 @@ 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;
}
@@ -145,30 +148,37 @@ 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;
}
@@ -222,7 +232,8 @@ 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;
@@ -230,7 +241,8 @@ 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++;
@@ -248,9 +260,11 @@ 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 ) );
vlakprimitive++;
@@ -272,7 +286,8 @@ 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 );
}
@@ -284,13 +299,16 @@ 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;
@@ -311,7 +329,8 @@ 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++;
@@ -320,7 +339,8 @@ 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++;
@@ -328,7 +348,8 @@ static void makeraytree_single(Render *re)
}
}
- if (faces + special == 0) {
+ if (faces + special == 0)
+ {
re->raytree = RE_rayobject_empty_create();
return;
}
@@ -336,7 +357,8 @@ 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 {
@@ -344,7 +366,8 @@ 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;
@@ -361,11 +384,13 @@ static void makeraytree_single(Render *re)
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)) {
@@ -375,7 +400,8 @@ static void makeraytree_single(Render *re)
}
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);
@@ -391,7 +417,8 @@ 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);
@@ -425,7 +452,8 @@ void makeraytree(Render *re)
//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++) {
+ for (i=0; i<3; i++)
+ {
min[i] += 0.01f;
max[i] += 0.01f;
sub[i] = max[i]-min[i];
@@ -978,10 +1006,12 @@ 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];
@@ -1035,7 +1065,8 @@ 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);
@@ -1346,7 +1377,8 @@ 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;
@@ -1447,7 +1479,8 @@ 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;
@@ -2234,7 +2267,8 @@ 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);
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c
index 162fc160915..37d6479e7bc 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -458,7 +458,6 @@ 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 4c49d2cc7fe..fedbce89058 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -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;
@@ -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 */
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index c0267a3b44d..f5e36125299 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;
diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c
index f3b6bfb80ea..6a0c8e3526f 100644
--- a/source/blender/render/intern/source/renderdatabase.c
+++ b/source/blender/render/intern/source/renderdatabase.c
@@ -871,7 +871,8 @@ 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);
@@ -1273,7 +1274,8 @@ 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/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index e74041c9006..cf688982eda 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -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,7 +1158,8 @@ 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/strand.c b/source/blender/render/intern/source/strand.c
index ea6b099996d..e8fcbe4ef5a 100644
--- a/source/blender/render/intern/source/strand.c
+++ b/source/blender/render/intern/source/strand.c
@@ -323,13 +323,18 @@ struct StrandShadeCache {
MemArena *memarena;
};
+typedef struct StrandCacheEntry {
+ GHashPair pair;
+ ShadeResult shr;
+} StrandCacheEntry;
+
StrandShadeCache *strand_shade_cache_create(void)
{
StrandShadeCache *cache;
cache= MEM_callocN(sizeof(StrandShadeCache), "StrandShadeCache");
- cache->resulthash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "strand_shade_cache_create1 gh");
- cache->refcounthash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "strand_shade_cache_create2 gh");
+ cache->resulthash= BLI_ghash_new(BLI_ghashutil_pairhash, BLI_ghashutil_paircmp, "strand_shade_cache_create1 gh");
+ cache->refcounthash= BLI_ghash_new(BLI_ghashutil_pairhash, BLI_ghashutil_paircmp, "strand_shade_cache_create2 gh");
cache->memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "strand shade cache arena");
return cache;
@@ -338,39 +343,47 @@ StrandShadeCache *strand_shade_cache_create(void)
void strand_shade_cache_free(StrandShadeCache *cache)
{
BLI_ghash_free(cache->refcounthash, NULL, NULL);
- BLI_ghash_free(cache->resulthash, NULL, (GHashValFreeFP)MEM_freeN);
+ BLI_ghash_free(cache->resulthash, (GHashKeyFreeFP)MEM_freeN, NULL);
BLI_memarena_free(cache->memarena);
MEM_freeN(cache);
}
+static GHashPair strand_shade_hash_pair(ObjectInstanceRen *obi, StrandVert *svert)
+{
+ GHashPair pair = {obi, svert};
+ return pair;
+}
+
static void strand_shade_get(Render *re, StrandShadeCache *cache, ShadeSample *ssamp, StrandSegment *sseg, StrandVert *svert)
{
- ShadeResult *hashshr;
+ StrandCacheEntry *entry;
StrandPoint p;
int *refcount;
+ GHashPair pair = strand_shade_hash_pair(sseg->obi, svert);
- hashshr= BLI_ghash_lookup(cache->resulthash, svert);
- refcount= BLI_ghash_lookup(cache->refcounthash, svert);
+ entry= BLI_ghash_lookup(cache->resulthash, &pair);
+ refcount= BLI_ghash_lookup(cache->refcounthash, &pair);
- if (!hashshr) {
+ if (!entry) {
/* not shaded yet, shade and insert into hash */
p.t= (sseg->v[1] == svert)? 0.0f: 1.0f;
strand_eval_point(sseg, &p);
strand_shade_point(re, ssamp, sseg, svert, &p);
- hashshr= MEM_callocN(sizeof(ShadeResult), "HashShadeResult");
- *hashshr= ssamp->shr[0];
- BLI_ghash_insert(cache->resulthash, svert, hashshr);
+ entry= MEM_callocN(sizeof(StrandCacheEntry), "StrandCacheEntry");
+ entry->pair = pair;
+ entry->shr = ssamp->shr[0];
+ BLI_ghash_insert(cache->resulthash, entry, entry);
}
else
/* already shaded, just copy previous result from hash */
- ssamp->shr[0]= *hashshr;
+ ssamp->shr[0]= entry->shr;
/* lower reference count and remove if not needed anymore by any samples */
(*refcount)--;
if (*refcount == 0) {
- BLI_ghash_remove(cache->resulthash, svert, NULL, (GHashValFreeFP)MEM_freeN);
- BLI_ghash_remove(cache->refcounthash, svert, NULL, NULL);
+ BLI_ghash_remove(cache->resulthash, &pair, (GHashKeyFreeFP)MEM_freeN, NULL);
+ BLI_ghash_remove(cache->refcounthash, &pair, NULL, NULL);
}
}
@@ -388,34 +401,39 @@ void strand_shade_segment(Render *re, StrandShadeCache *cache, StrandSegment *ss
/* apply alpha along width */
if (sseg->buffer->widthfade != 0.0f) {
- s = 1.0f - pow(fabs(s), sseg->buffer->widthfade);
+ s = 1.0f - powf(fabsf(s), sseg->buffer->widthfade);
strand_apply_shaderesult_alpha(ssamp->shr, s);
}
}
-void strand_shade_unref(StrandShadeCache *cache, StrandVert *svert)
+void strand_shade_unref(StrandShadeCache *cache, ObjectInstanceRen *obi, StrandVert *svert)
{
+ GHashPair pair = strand_shade_hash_pair(obi, svert);
int *refcount;
/* lower reference count and remove if not needed anymore by any samples */
- refcount= BLI_ghash_lookup(cache->refcounthash, svert);
+ refcount= BLI_ghash_lookup(cache->refcounthash, &pair);
(*refcount)--;
if (*refcount == 0) {
- BLI_ghash_remove(cache->resulthash, svert, NULL, (GHashValFreeFP)MEM_freeN);
- BLI_ghash_remove(cache->refcounthash, svert, NULL, NULL);
+ BLI_ghash_remove(cache->resulthash, &pair, (GHashKeyFreeFP)MEM_freeN, NULL);
+ BLI_ghash_remove(cache->refcounthash, &pair, NULL, NULL);
}
}
-static void strand_shade_refcount(StrandShadeCache *cache, StrandVert *svert)
+static void strand_shade_refcount(StrandShadeCache *cache, StrandSegment *sseg, StrandVert *svert)
{
- int *refcount= BLI_ghash_lookup(cache->refcounthash, svert);
+ GHashPair pair = strand_shade_hash_pair(sseg->obi, svert);
+ GHashPair *key;
+ int *refcount= BLI_ghash_lookup(cache->refcounthash, &pair);
if (!refcount) {
+ key= BLI_memarena_alloc(cache->memarena, sizeof(GHashPair));
+ *key = pair;
refcount= BLI_memarena_alloc(cache->memarena, sizeof(int));
*refcount= 1;
- BLI_ghash_insert(cache->refcounthash, svert, refcount);
+ BLI_ghash_insert(cache->refcounthash, key, refcount);
}
else
(*refcount)++;
@@ -580,8 +598,8 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float
}
if (cache) {
- strand_shade_refcount(cache, sseg->v[1]);
- strand_shade_refcount(cache, sseg->v[2]);
+ strand_shade_refcount(cache, sseg, sseg->v[1]);
+ strand_shade_refcount(cache, sseg, sseg->v[2]);
}
spart->totapixbuf[offset]++;
}
diff --git a/source/blender/render/intern/source/sunsky.c b/source/blender/render/intern/source/sunsky.c
index 8aabfbfed09..8097628e575 100644
--- a/source/blender/render/intern/source/sunsky.c
+++ b/source/blender/render/intern/source/sunsky.c
@@ -338,7 +338,8 @@ static void ComputeAttenuatedSunlight(float theta, int turbidity, float fTau[3])
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)));
@@ -392,7 +393,8 @@ 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];
}
diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c
index 1f5ada9b113..8b059d4a564 100644
--- a/source/blender/render/intern/source/volume_precache.c
+++ b/source/blender/render/intern/source/volume_precache.c
@@ -334,10 +334,14 @@ 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++) {
+ 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);
@@ -380,11 +384,15 @@ 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++) {
+ 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
@@ -440,9 +448,12 @@ 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++) {
+ 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
diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c
index 0f72a4bd40f..fa0326e2c97 100644
--- a/source/blender/render/intern/source/volumetric.c
+++ b/source/blender/render/intern/source/volumetric.c
@@ -559,7 +559,8 @@ 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;
diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c
index 817e51f2020..1f49b654ef8 100644
--- a/source/blender/render/intern/source/voxeldata.c
+++ b/source/blender/render/intern/source/voxeldata.c
@@ -171,7 +171,8 @@ 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++;
@@ -181,8 +182,10 @@ 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;
@@ -246,7 +249,8 @@ 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;
}
@@ -267,7 +271,8 @@ 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;
}
@@ -328,7 +333,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;
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index 06fc323e8d7..9836382b0fa 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -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)
@@ -3748,8 +3748,8 @@ static void unref_strand_samples(StrandShadeCache *cache, ZTranspRow *row, int t
strand= RE_findOrAddStrand(obr, row[totface].p-1);
svert= strand->vert + row[totface].segment;
- strand_shade_unref(cache, svert);
- strand_shade_unref(cache, svert+1);
+ strand_shade_unref(cache, obi, svert);
+ strand_shade_unref(cache, obi, svert+1);
}
}
}
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 78ad364b8e8..ae02ff33950 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -691,7 +691,8 @@ 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;
@@ -760,7 +761,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 58c2c649163..0c95ccea5d7 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_metaball_cubeTable_free();
+ BKE_freecubetable();
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 cd7a8a93975..48002029e56 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -103,9 +103,7 @@ 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 7fbdce097a9..aae2560aa14 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -84,6 +84,7 @@
#include "ED_screen.h"
#include "ED_util.h"
+#include "ED_object.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -589,7 +590,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 +623,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 +1797,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);
}
@@ -2129,7 +2130,12 @@ static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED
{
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
char filepath[FILE_MAX];
- BLI_strncpy(filepath, G.main->name, sizeof(filepath));
+
+ if (G.main->name[0] == 0)
+ BLI_strncpy(filepath, "untitled", sizeof(filepath));
+ else
+ BLI_strncpy(filepath, G.main->name, sizeof(filepath));
+
BLI_replace_extension(filepath, sizeof(filepath), ".dae");
RNA_string_set(op->ptr, "filepath", filepath);
}
@@ -2153,6 +2159,10 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", filename);
selected = RNA_boolean_get(op->ptr, "selected");
second_life = RNA_boolean_get(op->ptr, "second_life");
+
+ /* get editmode results */
+ ED_object_exit_editmode(C, 0); /* 0 = does not exit editmode */
+
if (collada_export(CTX_data_scene(C), filename, selected, second_life)) {
return OPERATOR_FINISHED;
}
@@ -2774,7 +2784,8 @@ 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);
@@ -3199,12 +3210,9 @@ 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))
@@ -3227,9 +3235,7 @@ 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..f3485d8ac60 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -499,6 +499,8 @@ float BPY_driver_exec(struct ChannelDriver *driver, const float evaltime) {retur
void BPY_DECREF(void *pyob_ptr) {}
void BPY_pyconstraint_exec(struct bPythonConstraint *con, struct bConstraintOb *cob, struct ListBase *targets) {}
void macro_wrapper(struct wmOperatorType *ot, void *userdata) {}
+int pyrna_id_FromPyObject(struct PyObject *obj, struct ID **id){ return 0; }
+struct PyObject *pyrna_id_CreatePyObject(struct ID *id) {return NULL; }
/* intern/dualcon */
struct DualConMesh;
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 13daeec87be..d663b4facbf 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -1101,7 +1101,7 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
#ifdef WITH_FFMPEG
BLI_argsAdd(ba, 1, NULL, "--debug-ffmpeg", "\n\tEnable debug messages from FFmpeg library", debug_mode_generic, (void *)G_DEBUG_FFMPEG);
#endif
- BLI_argsAdd(ba, 1, NULL, "--debug-python", "\n\tEnable debug messages for python", debug_mode_generic, (void *)G_DEBUG_FFMPEG);
+ BLI_argsAdd(ba, 1, NULL, "--debug-python", "\n\tEnable debug messages for python", debug_mode_generic, (void *)G_DEBUG_PYTHON);
BLI_argsAdd(ba, 1, NULL, "--debug-events", "\n\tEnable debug messages for the event system", debug_mode_generic, (void *)G_DEBUG_EVENTS);
BLI_argsAdd(ba, 1, NULL, "--debug-wm", "\n\tEnable debug messages for the window manager", debug_mode_generic, (void *)G_DEBUG_WM);
BLI_argsAdd(ba, 1, NULL, "--debug-all", "\n\tEnable all debug messages (excludes libmv)", debug_mode_generic, (void *)G_DEBUG_ALL);
diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp
index eccfefedd4d..f4224b9e255 100644
--- a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp
@@ -88,6 +88,12 @@ void GPC_Canvas::Resize(int width, int height)
{
m_width = width;
m_height = height;
+
+ // initialize area so that it's available for game logic on frame 1 (ImageViewport)
+ m_displayarea.m_x1 = 0;
+ m_displayarea.m_y1 = 0;
+ m_displayarea.m_x2 = width;
+ m_displayarea.m_y2 = height;
}
void GPC_Canvas::EndFrame()
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);
}